aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/dialogs/dialogs_spells.cpp6
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());