diff options
author | Paul Gilbert | 2018-03-18 22:30:30 -0400 |
---|---|---|
committer | Paul Gilbert | 2018-03-18 22:30:30 -0400 |
commit | f30e96f18eafc9c6cb7f19a3325de3aa3252fea0 (patch) | |
tree | f00c2bcf67ec6d0d4c9cbc1aa2bcb286cfa5cd96 /engines | |
parent | afeeb76076da0d6ed1d166aa520fc6c7b9c6a644 (diff) | |
download | scummvm-rg350-f30e96f18eafc9c6cb7f19a3325de3aa3252fea0.tar.gz scummvm-rg350-f30e96f18eafc9c6cb7f19a3325de3aa3252fea0.tar.bz2 scummvm-rg350-f30e96f18eafc9c6cb7f19a3325de3aa3252fea0.zip |
XEEN: Fix crash on Cast Spell dialog for non-spell casters
Diffstat (limited to 'engines')
-rw-r--r-- | engines/xeen/dialogs/dialogs_spells.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/engines/xeen/dialogs/dialogs_spells.cpp b/engines/xeen/dialogs/dialogs_spells.cpp index c11a9cfc0a..60c30e6813 100644 --- a/engines/xeen/dialogs/dialogs_spells.cpp +++ b/engines/xeen/dialogs/dialogs_spells.cpp @@ -143,7 +143,7 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int } else { SpellsCategory category = c->getSpellsCategory(); int spellIndex = (c->_currentSpell == -1) ? SPELLS_PER_CLASS - 1 : c->_currentSpell; - int spellId = Res.SPELLS_ALLOWED[category][spellIndex]; + int spellId = (category == SPELLCAT_INVALID) ? NO_SPELL : Res.SPELLS_ALLOWED[category][spellIndex]; windows[10].writeString(Common::String::format(Res.CAST_SPELL_DETAILS, c->_name.c_str(), spells._spellNames[spellId].c_str(), @@ -441,9 +441,9 @@ int CastSpell::execute(Character *&c) { do { if (redrawFlag) { SpellsCategory category = c->getSpellsCategory(); - assert(category != SPELLCAT_INVALID); + int spellIndex = c->_currentSpell != -1 ? c->_currentSpell : 39; - spellId = Res.SPELLS_ALLOWED[category][spellIndex]; + spellId = (category == SPELLCAT_INVALID) ? NO_SPELL : Res.SPELLS_ALLOWED[category][spellIndex]; int gemCost = Res.SPELL_GEM_COST[spellId]; int spCost = spells.calcSpellPoints(spellId, c->getCurrentLevel()); |