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

View File

@@ -470,7 +470,9 @@ private:
TriggeredAbility * parseTrigger(string s, string magicText, int id, Spell * spell, MTGCardInstance *card, Targetable * target);
MTGAbility * getAlternateCost( string s, int id, Spell *spell, MTGCardInstance *card );
MTGAbility * getManaReduxAbility(string s, int id, Spell *spell, MTGCardInstance *card, MTGCardInstance *target);
TargetChooser * parseSimpleTC(string s, string starter, MTGCardInstance *card, bool forceNoTarget = true);
TargetChooser * parseSimpleTC(const std::string& s, const std::string& starter, MTGCardInstance *card, bool forceNoTarget = true);
std::vector<std::string>& parseBetween(const std::string& s, string start, string stop, bool stopRequired, std::vector<std::string>& elems);
std::vector<std::string> parseBetween(const std::string& s, string start, string stop, bool stopRequired = true);
public:
int parseRestriction(string s);