( ie task list was being updated, set information being evaluated, etc )
put a guard around the endgame stat update process to only update when non-testsuite games are played.
Issue: 488
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!)
"It's currently unclear for me why several instances of the same hgeparticlesystem with the same .psi file are created..."
The GameApp::Create() call was initializing an array of particles, but it wasn't actually stashing them in the psi cache. The MenuItems also create the particles, but these are stashed correctly in the cache at that point. So, I simply removed the unused particle array loading code since it wasn't actually caching anything correctly & therefore simply adding redundant reading of the same particle files.
http://www.wololo.net/forum/viewtopic.php?f=21&t=1430&start=40#p13465
Seems to work from my testing so far. If this is the preferred route, we should probably sweep through & track down all the other cards that use the token counter hack, as that method used to work in 0.12.1 and broke some time after that.
(Somebody please sanity check this for me, as this is my first foray in messing with card rules.)
previously:
[card name] ([set name]) *d
would fail because when the parser when looking for the card name, it would use
[[card name] ]
and not
[[card name]]
since the card lookup is case insensitive but not whitespace insensitive the lookup would fail.
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.