[Scummvm-git-logs] scummvm master -> f30e96f18eafc9c6cb7f19a3325de3aa3252fea0
dreammaster
dreammaster at scummvm.org
Mon Mar 19 03:30:43 CET 2018
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f30e96f18e XEEN: Fix crash on Cast Spell dialog for non-spell casters
Commit: f30e96f18eafc9c6cb7f19a3325de3aa3252fea0
https://github.com/scummvm/scummvm/commit/f30e96f18eafc9c6cb7f19a3325de3aa3252fea0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-03-18T22:30:30-04:00
Commit Message:
XEEN: Fix crash on Cast Spell dialog for non-spell casters
Changed paths:
engines/xeen/dialogs/dialogs_spells.cpp
diff --git a/engines/xeen/dialogs/dialogs_spells.cpp b/engines/xeen/dialogs/dialogs_spells.cpp
index c11a9cf..60c30e6 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());
More information about the Scummvm-git-logs
mailing list