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

dreammaster dreammaster at scummvm.org
Fri Apr 6 01:48:17 CEST 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:
a54850cae0 XEEN: Fix getting multiple Northern Sphinx keys


Commit: a54850cae0e84089a07188f3ef264a0ab3c412c8
    https://github.com/scummvm/scummvm/commit/a54850cae0e84089a07188f3ef264a0ab3c412c8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-04-05T19:48:15-04:00

Commit Message:
XEEN: Fix getting multiple Northern Sphinx keys

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


diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 78e7a3a..8852b51 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -1178,29 +1178,29 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int
 			_questItems[giveVal - 82]++;
 		}
 		if (giveVal < 35 || giveVal >= 82) {
-			for (idx = 0; idx < 10 && _treasure._weapons[idx]._id; ++idx);
-			if (idx < 10) {
+			for (idx = 0; idx < MAX_TREASURE_ITEMS && !_treasure._weapons[idx].empty(); ++idx);
+			if (idx < MAX_TREASURE_ITEMS) {
 				_treasure._weapons[idx]._id = giveVal;
 				_treasure._hasItems = true;
 				return false;
 			}
 		} else if (giveVal < 49) {
-			for (idx = 0; idx < 10 && _treasure._armor[idx]._id; ++idx);
-			if (idx < 10) {
+			for (idx = 0; idx < MAX_TREASURE_ITEMS && !_treasure._armor[idx].empty(); ++idx);
+			if (idx < MAX_TREASURE_ITEMS) {
 				_treasure._armor[idx]._id = giveVal - 35;
 				_treasure._hasItems = true;
 				return false;
 			}
 		} else if (giveVal < 60) {
-			for (idx = 0; idx < 10 && _treasure._accessories[idx]._id; ++idx);
-			if (idx < 10) {
+			for (idx = 0; idx < MAX_TREASURE_ITEMS && !_treasure._accessories[idx].empty(); ++idx);
+			if (idx < MAX_TREASURE_ITEMS) {
 				_treasure._accessories[idx]._id = giveVal - 49;
 				_treasure._hasItems = true;
 				return false;
 			}
 		} else {
-			for (idx = 0; idx < 10 && _treasure._misc[idx]._material; ++idx);
-			if (idx < 10) {
+			for (idx = 0; idx < MAX_TREASURE_ITEMS && _treasure._misc[idx]._material; ++idx);
+			if (idx < MAX_TREASURE_ITEMS) {
 				_treasure._accessories[idx]._material = giveVal - 60;
 				_treasure._hasItems = true;
 				return false;
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index 05b03e3..202bbd0 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -711,7 +711,7 @@ bool Scripts::cmdTakeOrGive(ParamsIterator &params) {
 		if (_charIndex == 0 || _charIndex == 8) {
 			for (uint idx = 0; idx < party._activeParty.size(); ++idx) {
 				if (_charIndex == 0 || (_charIndex == 8 && (int)idx != combat._combatTarget)) {
-					party.giveTake(mode1, val1, mode2, val2, idx);
+					bool flag = party.giveTake(mode1, val1, mode2, val2, idx);
 
 					switch (mode1) {
 					case 8:
@@ -719,7 +719,7 @@ bool Scripts::cmdTakeOrGive(ParamsIterator &params) {
 						// fall through
 					case 21:
 					case 66:
-						if (param2) {
+						if (flag) {
 							switch (mode2) {
 							case 82:
 								mode1 = 0;
@@ -732,7 +732,7 @@ bool Scripts::cmdTakeOrGive(ParamsIterator &params) {
 							case 100:
 							case 101:
 							case 106:
-								if (param2)
+								if (flag)
 									continue;
 
 								// Break out of character loop
@@ -748,7 +748,7 @@ bool Scripts::cmdTakeOrGive(ParamsIterator &params) {
 					case 100:
 					case 101:
 					case 106:
-						if (param2) {
+						if (flag) {
 							_lineNum = -1;
 							return false;
 						}
@@ -770,7 +770,7 @@ bool Scripts::cmdTakeOrGive(ParamsIterator &params) {
 						case 100:
 						case 101:
 						case 106:
-							if (param2)
+							if (flag)
 								continue;
 
 							// Break out of character loop





More information about the Scummvm-git-logs mailing list