Bläddra i källkod

Hide some spell mechnaics details

AlexVinS 10 år sedan
förälder
incheckning
46f99db8d7

+ 0 - 7
lib/spells/CSpellHandler.cpp

@@ -71,13 +71,6 @@ namespace SpellConfig
 	};
 }
 
-BattleSpellCastParameters::BattleSpellCastParameters(const BattleInfo* cb)
-	: spellLvl(0), destination(BattleHex::INVALID), casterSide(0),casterColor(PlayerColor::CANNOT_DETERMINE),casterHero(nullptr), secHero(nullptr),
-	usedSpellPower(0),mode(ECastingMode::HERO_CASTING), casterStack(nullptr), selectedStack(nullptr), cb(cb)
-{
-
-}
-
 ///CSpell::LevelInfo
 CSpell::LevelInfo::LevelInfo()
 	:description(""),cost(0),power(0),AIValue(0),smartTarget(true), clearTarget(false), clearAffected(false), range("0")

+ 3 - 39
lib/spells/CSpellHandler.h

@@ -30,6 +30,9 @@ struct BattleSpellCast;
 class CGameInfoCallback;
 class CRandomGenerator;
 class CMap;
+struct AdventureSpellCastParameters;
+struct BattleSpellCastParameters;
+class SpellCastEnvironment;
 
 struct SpellSchoolInfo
 {
@@ -41,45 +44,6 @@ struct SpellSchoolInfo
 	Bonus::BonusType knoledgeBonus;
 };
 
-///callback to be provided by server
-class DLL_LINKAGE SpellCastEnvironment
-{
-public:
-	virtual ~SpellCastEnvironment(){};
-	virtual void sendAndApply(CPackForClient * info) const = 0;
-
-	virtual CRandomGenerator & getRandomGenerator() const = 0;
-	virtual void complain(const std::string & problem) const = 0;
-
-	virtual const CMap * getMap() const = 0;
-	virtual const CGameInfoCallback * getCb() const = 0;
-
-	virtual bool moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, PlayerColor asker = PlayerColor::NEUTRAL) const =0;	//TODO: remove
-};
-
-///helper struct
-struct DLL_LINKAGE BattleSpellCastParameters
-{
-public:
-	BattleSpellCastParameters(const BattleInfo * cb);
-	int spellLvl;
-	BattleHex destination;
-	ui8 casterSide;
-	PlayerColor casterColor;
-	const CGHeroInstance * casterHero; //deprecated
-	const CGHeroInstance * secHero;
-	int usedSpellPower;
-	ECastingMode::ECastingMode mode;
-	const CStack * casterStack;
-	const CStack * selectedStack;
-	const BattleInfo * cb;
-};
-
-struct DLL_LINKAGE AdventureSpellCastParameters
-{
-	const CGHeroInstance * caster;
-	int3 pos;
-};
 
 enum class VerticalPosition : ui8{TOP, CENTER, BOTTOM};
 

+ 8 - 0
lib/spells/ISpellMechanics.cpp

@@ -17,6 +17,14 @@
 #include "BattleSpellMechanics.h"
 #include "CreatureSpellMechanics.h"
 
+BattleSpellCastParameters::BattleSpellCastParameters(const BattleInfo* cb)
+	: spellLvl(0), destination(BattleHex::INVALID), casterSide(0),casterColor(PlayerColor::CANNOT_DETERMINE),casterHero(nullptr), secHero(nullptr),
+	usedSpellPower(0),mode(ECastingMode::HERO_CASTING), casterStack(nullptr), selectedStack(nullptr), cb(cb)
+{
+
+}
+
+
 ///ISpellMechanics
 ISpellMechanics::ISpellMechanics(CSpell * s):
 	owner(s)

+ 40 - 0
lib/spells/ISpellMechanics.h

@@ -15,6 +15,46 @@
 #include "../BattleState.h"
 #include "../NetPacks.h"
 
+///callback to be provided by server
+class DLL_LINKAGE SpellCastEnvironment
+{
+public:
+	virtual ~SpellCastEnvironment(){};
+	virtual void sendAndApply(CPackForClient * info) const = 0;
+
+	virtual CRandomGenerator & getRandomGenerator() const = 0;
+	virtual void complain(const std::string & problem) const = 0;
+
+	virtual const CMap * getMap() const = 0;
+	virtual const CGameInfoCallback * getCb() const = 0;
+
+	virtual bool moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, PlayerColor asker = PlayerColor::NEUTRAL) const =0;	//TODO: remove
+};
+
+///helper struct
+struct DLL_LINKAGE BattleSpellCastParameters
+{
+public:
+	BattleSpellCastParameters(const BattleInfo * cb);
+	int spellLvl;
+	BattleHex destination;
+	ui8 casterSide;
+	PlayerColor casterColor;
+	const CGHeroInstance * casterHero; //deprecated
+	const CGHeroInstance * secHero;
+	int usedSpellPower;
+	ECastingMode::ECastingMode mode;
+	const CStack * casterStack;
+	const CStack * selectedStack;
+	const BattleInfo * cb;
+};
+
+struct DLL_LINKAGE AdventureSpellCastParameters
+{
+	const CGHeroInstance * caster;
+	int3 pos;
+};
+
 class DLL_LINKAGE ISpellMechanics
 {
 public:

+ 1 - 0
server/CGameHandler.cpp

@@ -10,6 +10,7 @@
 #include "../lib/CBuildingHandler.h"
 #include "../lib/CHeroHandler.h"
 #include "../lib/spells/CSpellHandler.h"
+#include "../lib/spells/ISpellMechanics.h"
 #include "../lib/CGeneralTextHandler.h"
 #include "../lib/CTownHandler.h"
 #include "../lib/CCreatureHandler.h"