Files
wagic/projects/mtg/src/ActionElement.cpp
Tobias Loose 146872797b ActionElement.h: Replace defines, remove superfluous ";"
Defines do not follow scope rules, but enums do. Enum classes
even utilize strong type checking (but i am not sure about compiler
support for c++11 on all target platforms).
2013-11-17 16:08:29 +01:00

47 lines
1.0 KiB
C++

#include "PrecompiledHeader.h"
#include "ActionElement.h"
#include "MTGCardInstance.h"
#include "Targetable.h"
#include "TargetChooser.h"
ActionElement::ActionElement(int id) :
JGuiObject(id)
{
activity = Inactive;
modal = 0;
waitingForAnswer = 0;
currentPhase = MTG_PHASE_INVALID;
newPhase = MTG_PHASE_INVALID;
tc = NULL;
}
ActionElement::ActionElement(const ActionElement& a): JGuiObject(a)
{
activity = a.activity;
tc = a.tc ? a.tc->clone() : NULL;
currentPhase = a.currentPhase;
newPhase = a.newPhase;
modal = a.modal;
waitingForAnswer = a.waitingForAnswer;
}
ActionElement::~ActionElement()
{
SAFE_DELETE(tc);
}
int ActionElement::isReactingToTargetClick(Targetable * object)
{
if (MTGCardInstance * cObject = dynamic_cast<MTGCardInstance *>(object))
return isReactingToClick(cObject);
return 0;
}
int ActionElement::reactToTargetClick(Targetable * object)
{
if (MTGCardInstance * cObject = dynamic_cast<MTGCardInstance *>(object))
return reactToClick(cObject);
return 0;
}