XEEN: Fix number of spells per class array & constant

This commit is contained in:
Paul Gilbert 2017-11-18 18:16:11 -05:00
parent 9f465b4062
commit 79f448651d
4 changed files with 5 additions and 6 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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];

View File

@ -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,