- reworked the testsuite and the rules (storyflow) to use the same game deserialization code, moved that code to the players and zone classes

- removed every references to the gameobserver singleton. This object can now be instantiated several times as it's needed for minmax. To be able to do that, I mostly added a reference to a gameobserver from any targetable object (cards, players, spells) and abilities.
This commit is contained in:
Xawotihs
2011-10-01 13:30:30 +00:00
parent d6db0c4f63
commit 9adb9d625d
86 changed files with 1902 additions and 1961 deletions

View File

@@ -7,8 +7,8 @@
#include "MTGGameZones.h"
#include "GameObserver.h"
CardDisplay::CardDisplay() :
mId(0), game(GameObserver::GetInstance())
CardDisplay::CardDisplay(GameObserver* game) :
mId(0), PlayGuiObjectController(game)
{
tc = NULL;
listener = NULL;
@@ -21,7 +21,7 @@ CardDisplay::CardDisplay() :
CardDisplay::CardDisplay(int id, GameObserver* game, int _x, int _y, JGuiListener * _listener, TargetChooser * _tc,
int _nb_displayed_items) :
mId(id), game(game), x(_x), y(_y)
mId(id), PlayGuiObjectController(game), x(_x), y(_y)
{
tc = _tc;
listener = _listener;
@@ -119,7 +119,7 @@ bool CardDisplay::CheckUserInput(JButton key)
}
else
{
if (game) game->ButtonPressed(cardg);
if (observer) observer->ButtonPressed(cardg);
return true;
}
}
@@ -260,7 +260,7 @@ void CardDisplay::Render()
CardGui * cardg = ((CardGui *) mObjects[mCurr]);
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220);
int drawMode = DrawMode::kNormal;
if (game)
if (observer)
{
pos.actY = 150;
if (x < (CardGui::BigWidth / 2)) pos.actX = SCREEN_WIDTH - 10 - CardGui::BigWidth / 2;