[Scummvm-git-logs] scummvm master -> 79f448651dc7efd1232a6d6f3dbb2bebe8705e79

dreammaster dreammaster at scummvm.org
Sun Nov 19 00:16:15 CET 2017


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:
79f448651d XEEN: Fix number of spells per class array & constant


Commit: 79f448651dc7efd1232a6d6f3dbb2bebe8705e79
    https://github.com/scummvm/scummvm/commit/79f448651dc7efd1232a6d6f3dbb2bebe8705e79
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-11-18T18:16:11-05:00

Commit Message:
XEEN: Fix number of spells per class array & constant

Changed paths:
    engines/xeen/character.cpp
    engines/xeen/character.h
    engines/xeen/dialogs_spells.cpp
    engines/xeen/spells.h


diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index 3827fa8..def830e 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 903d8fa..24c54de 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 f5dfe65..1a347af 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 a05e81c..a333ea2 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,





More information about the Scummvm-git-logs mailing list