From a467e669b2d775388fd10d7ee420b977e23c72a5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 Apr 2018 22:42:43 -0400 Subject: XEEN: Fix subtraction of Megacredits paying for castle improvements --- engines/xeen/party.cpp | 71 +++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 35 deletions(-) (limited to 'engines') diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index d92a4952cc..1d00632a18 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -915,45 +915,46 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int case 20: _gameFlags[files._ccNum][takeVal] = false; break; - case 21: { - bool found = false; - for (int idx = 0; idx < 9; ++idx) { - if (takeVal < 35) { - if (ps._weapons[idx]._id == takeVal) { - ps._weapons[idx].clear(); - ps._weapons.sort(); - found = true; - break; - } - } else if (takeVal < 49) { - if (ps._armor[idx]._id == (takeVal - 35)) { - ps._armor[idx].clear(); - ps._armor.sort(); - found = true; - break; - } - } else if (takeVal < 60) { - if (ps._accessories[idx]._id == (takeVal - 49)) { - ps._accessories[idx].clear(); - ps._accessories.sort(); - found = true; - break; - } - } else if (takeVal < 82) { - if (ps._misc[idx]._material == ((int)takeVal - 60)) { - ps._misc[idx].clear(); - ps._misc.sort(); - found = true; - break; + case 21: + if (takeVal >= 82) { + _questItems[takeVal - 82]--; + } else { + bool found = false; + for (int idx = 0; idx < 9; ++idx) { + if (takeVal < 35) { + if (ps._weapons[idx]._id == takeVal) { + ps._weapons[idx].clear(); + ps._weapons.sort(); + found = true; + break; + } + } else if (takeVal < 49) { + if (ps._armor[idx]._id == (takeVal - 35)) { + ps._armor[idx].clear(); + ps._armor.sort(); + found = true; + break; + } + } else if (takeVal < 60) { + if (ps._accessories[idx]._id == (takeVal - 49)) { + ps._accessories[idx].clear(); + ps._accessories.sort(); + found = true; + break; + } + } else { + if (ps._misc[idx]._material == ((int)takeVal - 60)) { + ps._misc[idx].clear(); + ps._misc.sort(); + found = true; + break; + } } - } else { - _questItems[takeVal - 82]--; } + if (!found) + return true; } - if (!found) - return true; break; - } case 25: changeTime(takeVal); break; -- cgit v1.2.3