- adding tests for issue 489 and issue 491
- check for null pointers in Credits.cpp
- Test suite can now select tokens by their name
- Fixed Dragon Broodmothere's token name
Also moved some static value definitions used in the drawing code from the class header to a private namespace in the cpp file, as they don't need to be seen by any clients of the class.
Some of the things refactored to the base class:
- isPaymentSet()
- canPay()
- Render()
- setSource()
- setPayment()
- the target instance
- duplicated constructor initialization crap
I'm not interested in pointing fingers as to how the code got this way, but I'll ask that everyone who's altered this code in one fashion or another to carefully diff this change and understand what I refactored. This code is a poster child for neglect & what happens when people start blindly copy & pasting code instead of paying attention to the commonality between code paths. If you see the same lines of code happening over & over, and you're about to make yet another copy, please stop yourself & think about how you can refactor the code to be in a single shared function (or, more explicitly, a shared base member function when possible).
If you don't understand what I mean by a shared base member function, then I would suggest at the very least reading up on this topic:
http://www.cplusplus.com/doc/tutorial/inheritance/
(And, after all that, if you're still unsure how to proceed, ping someone else for advice!)
CODE: SELECT ALL
#if defined (WIN32) || defined (LINUX)
char buf[4096], *p = buf;
sprintf(buf, "Some debug message showing variables %i and %i\n", variableA, variableB);
OutputDebugString(buf);
#endif
new paradigm:
CODE: SELECT ALL
DebugTrace("Some debug message showing variables " << variableA <<" and " << variableB);
No more dealing with formatting sprintf crap, just stream out variables. Also, DebugTrace washes out in release automatically. (TODO, need to sweep through the rest of the app to apply the changes to all the cases where OutputDebugString() is being called)
2) added two traces to follow adding/resolving things on the stack;
3) changed the uninformative "stack object" string that was the default for base class interrupts to use typeinfo(*this).name() so that you can actually see the derived class in the trace output. Here's a sample of what my trace output looks like now:
Action added to stack: Devoted Hero
Resolving Action on stack: Devoted Hero
Action added to stack: class NextGamePhase
Resolving Action on stack: class NextGamePhase
Action added to stack: class NextGamePhase
Resolving Action on stack: class NextGamePhase
Action added to stack: class StackAbility
Resolving Action on stack: class StackAbility
Action added to stack: class DrawAction
Resolving Action on stack: class DrawAction
4) replaced some hardcoded 0 / -1 values with their proper enums.
modified player status to recognize that test suite has been activated. This is to allow deactivation of "phase skip automation" game setting during test suite.
TODO: fix "Phase Skip Automation" such that if turned on the test suite does not break. This fix should be considered temporary
- fix for issue 467 (simultaneous triggers + "trigger" keyword)
- MootPoint's patch for some string parsing
- some random int/float compilation warning fixes
- Attempt at solving issue 247 (missing background image for trophy room). I think I attempted that a while ago and it caused some crashes, so let's revert this change if this happens
- {z} cost becomes l2e (Library To Exile)
- {q} cost becomes s2l (Send to Library) <- from any place to Library
- subtypes leyline, controllsershroud, playershroud become ability keywords
- support for tinyCrops see http://wololo.net/forum/viewtopic.php?f=15&t=2197
- card images can now be named after the card's name (ex: sets/10E/Ancestor's Chosen.jpg , or sets/10E/10E.zip:Ancestor's Chosen.jpg)
- yet another attempt at fixing tokens in the shop