[Scummvm-git-logs] scummvm master -> e6de89d2441b6c60139195449b5f056a7407fbff

dreammaster dreammaster at scummvm.org
Sat Feb 17 23:55:03 CET 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e6de89d244 XEEN: Fix crash after searching beds


Commit: e6de89d2441b6c60139195449b5f056a7407fbff
    https://github.com/scummvm/scummvm/commit/e6de89d2441b6c60139195449b5f056a7407fbff
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-02-17T17:55:04-05:00

Commit Message:
XEEN: Fix crash after searching beds

Changed paths:
    engines/xeen/interface.cpp
    engines/xeen/party.cpp


diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 508874a..0e29ffa 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 7e89cf1..dc70bc2 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:





More information about the Scummvm-git-logs mailing list