- 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:
@@ -5,8 +5,8 @@
|
||||
|
||||
MTGGamePhase* MTGGamePhase::instance = 0;
|
||||
|
||||
MTGGamePhase::MTGGamePhase(int id) :
|
||||
ActionElement(id)
|
||||
MTGGamePhase::MTGGamePhase(GameObserver* g, int id) :
|
||||
ActionElement(id), observer(g)
|
||||
{
|
||||
animation = 0;
|
||||
currentState = -1;
|
||||
@@ -18,7 +18,7 @@ MTGGamePhase::MTGGamePhase(int id) :
|
||||
void MTGGamePhase::Update(float dt)
|
||||
{
|
||||
|
||||
int newState = GameObserver::GetInstance()->getCurrentGamePhase();
|
||||
int newState = observer->getCurrentGamePhase();
|
||||
if (newState != currentState)
|
||||
{
|
||||
activeState = ACTIVE;
|
||||
@@ -41,13 +41,12 @@ void MTGGamePhase::Update(float dt)
|
||||
|
||||
bool MTGGamePhase::NextGamePhase()
|
||||
{
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
if (activeState == INACTIVE)
|
||||
{
|
||||
if (game->currentActionPlayer == game->currentlyActing())
|
||||
if (observer->currentActionPlayer == observer->currentlyActing())
|
||||
{
|
||||
activeState = ACTIVE;
|
||||
game->userRequestNextGamePhase();
|
||||
observer->userRequestNextGamePhase();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user