aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-04-08 13:55:21 -0400
committerPaul Gilbert2018-04-08 13:55:21 -0400
commit315b88e1bf6d93060ae7b35d22c6c31498f766f1 (patch)
tree870fa7b6cb3957ab4a3bb67a4c483ca99a175c3f
parent264f5f779969ecdcbba21db0b992f1ef473a6fcd (diff)
downloadscummvm-rg350-315b88e1bf6d93060ae7b35d22c6c31498f766f1.tar.gz
scummvm-rg350-315b88e1bf6d93060ae7b35d22c6c31498f766f1.tar.bz2
scummvm-rg350-315b88e1bf6d93060ae7b35d22c6c31498f766f1.zip
XEEN: Fix buying spells in Dark Side
-rw-r--r--engines/xeen/dialogs/dialogs_spells.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/engines/xeen/dialogs/dialogs_spells.cpp b/engines/xeen/dialogs/dialogs_spells.cpp
index 0b6312c8d5..e59fbdef9c 100644
--- a/engines/xeen/dialogs/dialogs_spells.cpp
+++ b/engines/xeen/dialogs/dialogs_spells.cpp
@@ -305,9 +305,10 @@ const char *SpellsDialog::setSpellText(Character *c, int mode) {
spellId < Res.DARK_SPELL_RANGES[groupIndex][1]; ++spellId) {
int idx = 0;
while (idx <= SPELLS_PER_CLASS && Res.SPELLS_ALLOWED[category][idx] ==
- Res.DARK_SPELL_OFFSETS[category][spellId]);
+ Res.DARK_SPELL_OFFSETS[category][spellId])
+ ++idx;
- if (idx <= SPELLS_PER_CLASS) {
+ if (idx < SPELLS_PER_CLASS) {
if (!c->_spells[idx] || (mode & 0x80)) {
int cost = spells.calcSpellCost(Res.SPELLS_ALLOWED[category][idx], expenseFactor);
_spells.push_back(SpellEntry(Common::String::format("\x3l%s\x3r\x9""000%u",
@@ -319,11 +320,11 @@ const char *SpellsDialog::setSpellText(Character *c, int mode) {
} else {
for (int spellId = 0; spellId < 20; ++spellId) {
int idx = 0;
- while (Res.CLOUDS_GUILD_SPELLS[party._mazeId - 28][spellId] !=
- (int)Res.SPELLS_ALLOWED[category][idx] && idx <= SPELLS_PER_CLASS)
+ while (idx < SPELLS_PER_CLASS && Res.CLOUDS_GUILD_SPELLS[party._mazeId - 28][spellId] !=
+ (int)Res.SPELLS_ALLOWED[category][idx])
++idx;
- if (idx <= SPELLS_PER_CLASS) {
+ if (idx < SPELLS_PER_CLASS) {
if (!c->_spells[idx] || (mode & 0x80)) {
int cost = spells.calcSpellCost(Res.SPELLS_ALLOWED[category][idx], expenseFactor);
_spells.push_back(SpellEntry(Common::String::format("\x3l%s\x3r\x9""000%u",