]> git.localhorst.tv Git - l2e.git/commitdiff
added missing spell flags
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 10 Sep 2012 20:59:01 +0000 (22:59 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 10 Sep 2012 20:59:01 +0000 (22:59 +0200)
src/common/Spell.cpp
src/common/Spell.h

index 8f8784a761ed83840f9ee6c8ad77729ca6302a68..4fce398bdaf16e534c702736b1d12d101f0362f9 100644 (file)
@@ -15,7 +15,7 @@ using loader::TypeDescription;
 namespace common {
 
 Spell::Spell()
-: name(""), value(0), cost(0), usability(0) {
+: name(""), value(0), cost(0), status(false), battle(false) {
 
 }
 
@@ -23,7 +23,7 @@ Spell::Spell()
 void Spell::CreateTypeDescription() {
        Spell s;
 
-       // TODO: flags
+       int boolId(TypeDescription::GetTypeId("Boolean"));
        int numberId(TypeDescription::GetTypeId("Number"));
        int stringId(TypeDescription::GetTypeId("String"));
        int targetsId(TypeDescription::GetTypeId("TargetingMode"));
@@ -35,6 +35,8 @@ void Spell::CreateTypeDescription() {
        td.AddField("name", FieldDescription(((char *)&s.name) - ((char *)&s), stringId, true));
        td.AddField("cost", FieldDescription(((char *)&s.cost) - ((char *)&s), numberId, false));
        td.AddField("targets", FieldDescription(((char *)&s.targetingMode) - ((char *)&s), targetsId, false));
+       td.AddField("status", FieldDescription(((char *)&s.status) - ((char *)&s), boolId, false));
+       td.AddField("battle", FieldDescription(((char *)&s.battle) - ((char *)&s), boolId, false));
 }
 
 void Spell::Construct(void *data) {
index eb8fa02928605b2e84b2aa37084fbdc994a43405..d9601260a007e84ae482c5ffeedcf35d8ad2c99a 100644 (file)
@@ -23,8 +23,8 @@ public:
        Uint16 Value() const { return value; }
        Uint8 Cost() const { return cost; }
 
-       bool CanUseOnStatusScreen() const { return usability & USABILITY_STATUS; }
-       bool CanUseInBattle() const { return usability & USABILITY_BATTLE; }
+       bool CanUseOnStatusScreen() const { return status; }
+       bool CanUseInBattle() const { return battle; }
 
        TargetingMode &GetTargetingMode() { return targetingMode; }
        const TargetingMode &GetTargetingMode() const { return targetingMode; }
@@ -36,33 +36,23 @@ public:
 public:
        void SetName(const char *n) { name = n; }
        void SetCost(Uint8 c) { cost = c; }
-       void SetUsableInBattle() { usability |= USABILITY_BATTLE; }
+       void SetUsableInBattle() { battle = true; }
 
        static void CreateTypeDescription();
        static void Construct(void *);
 
-private:
-       enum Usability {
-               // USABILITY_UNUSED = 1,
-               // USABILITY_UNUSED = 2,
-               // USABILITY_UNUSED = 4,
-               // USABILITY_UNUSED = 8,
-               // USABILITY_UNUSED = 16,
-               // USABILITY_UNUSED = 32,
-               USABILITY_STATUS = 64,
-               USABILITY_BATTLE = 128,
-       };
-
 private:
        const char *name;
 
        int value;
 
        int cost;
-       Uint8 usability;
        TargetingMode targetingMode;
        HeroGroup usableBy;
 
+       bool status;
+       bool battle;
+
 };
 
 }