diff options
author | Paul Gilbert | 2018-02-17 17:55:04 -0500 |
---|---|---|
committer | Paul Gilbert | 2018-02-17 17:55:04 -0500 |
commit | e6de89d2441b6c60139195449b5f056a7407fbff (patch) | |
tree | 3d7b99e3e7c3ff17ef6966d2db2dcdbc5a64d81b | |
parent | 6b003386f54eccc0f60111e3518086a0310c763a (diff) | |
download | scummvm-rg350-e6de89d2441b6c60139195449b5f056a7407fbff.tar.gz scummvm-rg350-e6de89d2441b6c60139195449b5f056a7407fbff.tar.bz2 scummvm-rg350-e6de89d2441b6c60139195449b5f056a7407fbff.zip |
XEEN: Fix crash after searching beds
-rw-r--r-- | engines/xeen/interface.cpp | 19 | ||||
-rw-r--r-- | engines/xeen/party.cpp | 10 |
2 files changed, 14 insertions, 15 deletions
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index 508874a8f6..0e29ffa069 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -61,11 +61,12 @@ void PartyDrawer::drawParty(bool updateFlag) { // Handle drawing the party faces uint partyCount = inCombat ? combat._combatParty.size() : party._activeParty.size(); for (uint idx = 0; idx < partyCount; ++idx) { - Character &ps = inCombat ? *combat._combatParty[idx] : party._activeParty[idx]; - Condition charCondition = ps.worstCondition(); + Character &c = inCombat ? *combat._combatParty[idx] : party._activeParty[idx]; + Condition charCondition = c.worstCondition(); int charFrame = Res.FACE_CONDITION_FRAMES[charCondition]; - SpriteResource *sprites = (charFrame > 4) ? &_dseFace : ps._faceSprites; + SpriteResource *sprites = (charFrame > 4) ? &_dseFace : c._faceSprites; + assert(sprites); if (charFrame > 4) charFrame -= 5; @@ -73,18 +74,18 @@ void PartyDrawer::drawParty(bool updateFlag) { } for (uint idx = 0; idx < partyCount; ++idx) { - Character &ps = inCombat ? *combat._combatParty[idx] : party._activeParty[idx]; + Character &c = inCombat ? *combat._combatParty[idx] : party._activeParty[idx]; // Draw the Hp bar - int maxHp = ps.getMaxHP(); + int maxHp = c.getMaxHP(); int frame; - if (ps._currentHp < 1) + if (c._currentHp < 1) frame = 4; - else if (ps._currentHp > maxHp) + else if (c._currentHp > maxHp) frame = 3; - else if (ps._currentHp == maxHp) + else if (c._currentHp == maxHp) frame = 0; - else if (ps._currentHp < (maxHp / 4)) + else if (c._currentHp < (maxHp / 4)) frame = 2; else frame = 1; diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index 7e89cf170a..dc70bc2089 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -1396,10 +1396,9 @@ bool Party::giveExt(int mode1, uint val1, int mode2, uint val2, int mode3, uint FileManager &files = *g_vm->_files; Interface &intf = *g_vm->_interface; Map &map = *g_vm->_map; - Party &party = *g_vm->_party; Scripts &scripts = *g_vm->_scripts; Sound &sound = *g_vm->_sound; - Character &c = party._activeParty[charId]; + Character &c = _itemsCharacter; if (intf._objNumber && !scripts._animCounter) { MazeObject &obj = map._mobData._objects[intf._objNumber - 1]; @@ -1451,15 +1450,14 @@ bool Party::giveExt(int mode1, uint val1, int mode2, uint val2, int mode3, uint switch (mode) { case 34: - party._treasure._gold += val; + _treasure._gold += val; break; case 35: - party._treasure._gems += val; + _treasure._gems += val; break; case 66: - c = _itemsCharacter; c.clear(); if (giveTake(0, 0, mode, val, charId)) @@ -1475,7 +1473,7 @@ bool Party::giveExt(int mode1, uint val1, int mode2, uint val2, int mode3, uint break; case 106: - party._food += g_vm->getRandomNumber(1, val); + _food += g_vm->getRandomNumber(1, val); break; case 67: |