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

@@ -12,10 +12,12 @@ int PhaseRing::phaseStrToInt(string s)
if (s.compare("draw") == 0) return Constants::MTG_PHASE_DRAW;
if (s.compare("firstmain") == 0) return Constants::MTG_PHASE_FIRSTMAIN;
if (s.compare("combatbegin") == 0) return Constants::MTG_PHASE_COMBATBEGIN;
if (s.compare("combatbegins") == 0) return Constants::MTG_PHASE_COMBATBEGIN;
if (s.compare("combatattackers") == 0) return Constants::MTG_PHASE_COMBATATTACKERS;
if (s.compare("combatblockers") == 0) return Constants::MTG_PHASE_COMBATBLOCKERS;
if (s.compare("combatdamage") == 0) return Constants::MTG_PHASE_COMBATDAMAGE;
if (s.compare("combatend") == 0) return Constants::MTG_PHASE_COMBATEND;
if (s.compare("combatends") == 0) return Constants::MTG_PHASE_COMBATEND;
if (s.compare("secondmain") == 0) return Constants::MTG_PHASE_SECONDMAIN;
if (s.compare("endofturn") == 0) return Constants::MTG_PHASE_ENDOFTURN;
if (s.compare("cleanup") == 0) return Constants::MTG_PHASE_CLEANUP;