diff options
-rw-r--r-- | engines/xeen/character.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/character.h | 3 | ||||
-rw-r--r-- | engines/xeen/dialogs_spells.cpp | 4 | ||||
-rw-r--r-- | engines/xeen/spells.h | 2 |
4 files changed, 5 insertions, 6 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp index 3827fa84d1..def830e2a1 100644 --- a/engines/xeen/character.cpp +++ b/engines/xeen/character.cpp @@ -759,7 +759,7 @@ void Character::synchronize(Common::Serializer &s) { } // Synchronize spell list - for (int i = 0; i < MAX_SPELLS_PER_CLASS - 1; ++i) + for (int i = 0; i < MAX_SPELLS_PER_CLASS; ++i) s.syncAsByte(_spells[i]); s.syncAsByte(_lloydMap); s.syncAsByte(_lloydPosition.x); diff --git a/engines/xeen/character.h b/engines/xeen/character.h index 903d8faabc..24c54deffe 100644 --- a/engines/xeen/character.h +++ b/engines/xeen/character.h @@ -33,6 +33,7 @@ namespace Xeen { #define INV_ITEMS_TOTAL 9 +#define MAX_SPELLS_PER_CLASS 39 enum BonusFlags { ITEMFLAG_BONUS_MASK = 0xBF, ITEMFLAG_CURSED = 0x40, ITEMFLAG_BROKEN = 0x80 @@ -287,7 +288,7 @@ public: int _tempAge; int _skills[18]; bool _awards[128]; - int _spells[39]; + int _spells[MAX_SPELLS_PER_CLASS]; int _lloydMap; Common::Point _lloydPosition; bool _hasSpells; diff --git a/engines/xeen/dialogs_spells.cpp b/engines/xeen/dialogs_spells.cpp index f5dfe65b00..1a347aff8e 100644 --- a/engines/xeen/dialogs_spells.cpp +++ b/engines/xeen/dialogs_spells.cpp @@ -345,7 +345,7 @@ const char *SpellsDialog::setSpellText(Character *c, int isCasting) { if (party._mazeId == 49 || party._mazeId == 37) { for (uint spellId = 0; spellId < 76; ++spellId) { int idx = 0; - while (idx < MAX_SPELLS_PER_CLASS && Res.SPELLS_ALLOWED[category][idx] == spellId) + while (idx < MAX_SPELLS_PER_CLASS && Res.SPELLS_ALLOWED[category][idx] != spellId) ++idx; // Handling if the spell is appropriate for the character's class @@ -416,7 +416,7 @@ const char *SpellsDialog::setSpellText(Character *c, int isCasting) { if (c->getMaxSP() == 0) { return Res.NOT_A_SPELL_CASTER; } else { - for (int spellIndex = 0; spellIndex < (MAX_SPELLS_PER_CLASS - 1); ++spellIndex) { + for (int spellIndex = 0; spellIndex < MAX_SPELLS_PER_CLASS; ++spellIndex) { if (c->_spells[spellIndex]) { int spellId = Res.SPELLS_ALLOWED[category][spellIndex]; int gemCost = Res.SPELL_GEM_COST[spellId]; diff --git a/engines/xeen/spells.h b/engines/xeen/spells.h index a05e81c56d..a333ea2f5f 100644 --- a/engines/xeen/spells.h +++ b/engines/xeen/spells.h @@ -31,8 +31,6 @@ namespace Xeen { class XeenEngine; class Character; -#define MAX_SPELLS_PER_CLASS 40 - enum MagicSpell { MS_AcidSpray = 0, MS_Awaken = 1, MS_BeastMaster = 2, MS_Bless = 3, MS_Clairvoyance = 4, MS_ColdRay = 5, MS_CreateFood = 6, |