From 315b88e1bf6d93060ae7b35d22c6c31498f766f1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 8 Apr 2018 13:55:21 -0400 Subject: XEEN: Fix buying spells in Dark Side --- engines/xeen/dialogs/dialogs_spells.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'engines') 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", -- cgit v1.2.3