diff --git a/projects/mtg/include/ActionElement.h b/projects/mtg/include/ActionElement.h index 7be2a33b8..bdd7007fe 100644 --- a/projects/mtg/include/ActionElement.h +++ b/projects/mtg/include/ActionElement.h @@ -9,10 +9,6 @@ #include #include "MTGDefinitions.h" -#define INACTIVE 0 -#define ACTION_REQUESTED 1 -#define ACTIVE 2 - class MTGCardInstance; class ManaCost; class Targetable; @@ -22,31 +18,33 @@ class WEvent; class ActionElement: public JGuiObject { protected: - int activeState; + enum Activity{ + Inactive, + ActionRequested, + Active + }; + + Activity activity; TargetChooser * tc; public: GamePhase currentPhase; GamePhase newPhase; int modal; int waitingForAnswer; - int getActivity(); - virtual void Update(float){}; - virtual void Render(){}; + virtual void Update(float){} + virtual void Render(){} virtual int testDestroy() { return 0; } - ; virtual int destroy() { return 0; } - ; virtual bool CheckUserInput(JButton) { return false; } - ; ActionElement(int id); ActionElement(const ActionElement& copyFromMe); TargetChooser * getActionTc(){return tc;} @@ -62,27 +60,22 @@ public: { return 0; } - ; virtual int stillInUse(MTGCardInstance *) { return 0; } - ; virtual int receiveEvent(WEvent *) { return 0; } - ; virtual int reactToClick(MTGCardInstance *) { return 0; } - ; virtual const char * getMenuText() { return "Ability"; } - ; virtual ActionElement * clone() const = 0; }; diff --git a/projects/mtg/src/ActionElement.cpp b/projects/mtg/src/ActionElement.cpp index abf685513..f5956fe2e 100644 --- a/projects/mtg/src/ActionElement.cpp +++ b/projects/mtg/src/ActionElement.cpp @@ -8,7 +8,7 @@ ActionElement::ActionElement(int id) : JGuiObject(id) { - activeState = INACTIVE; + activity = Inactive; modal = 0; waitingForAnswer = 0; currentPhase = MTG_PHASE_INVALID; @@ -18,7 +18,7 @@ ActionElement::ActionElement(int id) : ActionElement::ActionElement(const ActionElement& a): JGuiObject(a) { - activeState = a.activeState; + activity = a.activity; tc = a.tc ? a.tc->clone() : NULL; currentPhase = a.currentPhase; newPhase = a.newPhase; @@ -31,12 +31,6 @@ ActionElement::~ActionElement() SAFE_DELETE(tc); } -int ActionElement::getActivity() -{ - - return activeState; -} - int ActionElement::isReactingToTargetClick(Targetable * object) { if (MTGCardInstance * cObject = dynamic_cast(object)) diff --git a/projects/mtg/src/MTGGamePhase.cpp b/projects/mtg/src/MTGGamePhase.cpp index 4c93439e3..e88ae621d 100644 --- a/projects/mtg/src/MTGGamePhase.cpp +++ b/projects/mtg/src/MTGGamePhase.cpp @@ -17,7 +17,7 @@ void MTGGamePhase::Update(float) int newState = observer->getCurrentGamePhase(); if (newState != currentState) { - activeState = ACTIVE; + activity = Active; animation = 4; currentState = newState; } @@ -28,18 +28,18 @@ void MTGGamePhase::Update(float) } else { - activeState = INACTIVE; + activity = Inactive; animation = 0; } } bool MTGGamePhase::NextGamePhase() { - if (activeState == INACTIVE) + if (activity == Inactive) { if (observer->currentActionPlayer == observer->currentlyActing()) { - activeState = ACTIVE; + activity = Active; observer->userRequestNextGamePhase(); return true; }