Refactor of the parser. The goal is to reduce maintenance cost, by refactoring some of the most frequent "copy/paste" we have in there. This removes roughly 500 lines, going from 4850 to 4350 lines. I'm getting closer to my goal of getting this file back to 4000 lines :)

Crossing fingers I didn't break anything major. The test suite passes, though I expect some edge case bugs to appear. Apologies in advance, I think this change is worth it.
This commit is contained in:
wagic.the.homebrew
2011-05-01 15:53:13 +00:00
parent 14c56f0510
commit e100bd826c
4 changed files with 504 additions and 971 deletions
+7 -13
View File
@@ -1149,10 +1149,10 @@ public:
//remove from combat
class ACombatRemovel: public ActivatedAbility
class ACombatRemoval: public ActivatedAbility
{
public:
ACombatRemovel(int _id, MTGCardInstance * card, Targetable * _target) :
ACombatRemoval(int _id, MTGCardInstance * card, Targetable * _target) :
ActivatedAbility(_id, card)
{
target = _target;
@@ -1173,9 +1173,9 @@ public:
return "Remove From Combat";
}
ACombatRemovel * clone() const
ACombatRemoval * clone() const
{
ACombatRemovel * a = NEW ACombatRemovel(*this);
ACombatRemoval * a = NEW ACombatRemoval(*this);
a->isClone = 1;
return a;
}
@@ -2529,12 +2529,6 @@ public:
class ATokenCreator: public ActivatedAbility
{
public:
enum
{
ATOKEN_WHO_CONTROLLER = 0,
ATOKEN_WHO_OPPONENT = 1,
ATOKEN_WHO_TARGETCONTROLLER = 2
};
list<int> abilities;
list<int> types;
list<int> colors;
@@ -2695,13 +2689,13 @@ ATOKEN_WHO_TARGETCONTROLLER = 2
{
switch(who)
{
case ATokenCreator::ATOKEN_WHO_CONTROLLER:
case TargetChooser::CONTROLLER:
tokenReciever = source->controller();
break;
case ATokenCreator::ATOKEN_WHO_OPPONENT:
case TargetChooser::OPPONENT:
tokenReciever = source->controller()->opponent();
break;
case ATokenCreator::ATOKEN_WHO_TARGETCONTROLLER:
case TargetChooser::TARGET_CONTROLLER:
if(target)
{
tokenReciever = ((MTGCardInstance*)target)->controller();