diff options
author | Paul Gilbert | 2018-04-05 19:48:15 -0400 |
---|---|---|
committer | Paul Gilbert | 2018-04-05 19:48:15 -0400 |
commit | a54850cae0e84089a07188f3ef264a0ab3c412c8 (patch) | |
tree | e71200a1e68891169fa2335312927430c589aff4 /engines/xeen | |
parent | 37dbd365e2cb40699a065b416db3b1cd638f63b8 (diff) | |
download | scummvm-rg350-a54850cae0e84089a07188f3ef264a0ab3c412c8.tar.gz scummvm-rg350-a54850cae0e84089a07188f3ef264a0ab3c412c8.tar.bz2 scummvm-rg350-a54850cae0e84089a07188f3ef264a0ab3c412c8.zip |
XEEN: Fix getting multiple Northern Sphinx keys
Diffstat (limited to 'engines/xeen')
-rw-r--r-- | engines/xeen/party.cpp | 16 | ||||
-rw-r--r-- | engines/xeen/scripts.cpp | 10 |
2 files changed, 13 insertions, 13 deletions
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index 78e7a3a200..8852b51ca2 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 05b03e3a46..202bbd0a82 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -711,7 +711,7 @@ bool Scripts::cmdTakeOrGive(ParamsIterator ¶ms) { 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 ¶ms) { // fall through case 21: case 66: - if (param2) { + if (flag) { switch (mode2) { case 82: mode1 = 0; @@ -732,7 +732,7 @@ bool Scripts::cmdTakeOrGive(ParamsIterator ¶ms) { case 100: case 101: case 106: - if (param2) + if (flag) continue; // Break out of character loop @@ -748,7 +748,7 @@ bool Scripts::cmdTakeOrGive(ParamsIterator ¶ms) { case 100: case 101: case 106: - if (param2) { + if (flag) { _lineNum = -1; return false; } @@ -770,7 +770,7 @@ bool Scripts::cmdTakeOrGive(ParamsIterator ¶ms) { case 100: case 101: case 106: - if (param2) + if (flag) continue; // Break out of character loop |