A quick way to obtain game instead of Singletons.getModel().

There was such lines in a recent commit
Aside from the fact that two parts of condition on a first glance look a bit excessive, I just want to note that player instances now hold reference to a game object. That is the game that player is involved in.
So if you have a reference to player and have to recieve its game, you don't need to get the game from sinletons... just invoke player.getGame(). That is a bit shorter and removes reference to that singletons, incompatible with multiple games in one application (when we build the server).
Same is true when you need game given an abiliy or card - derive player from there and you know what to do next.
- Code: Select all
if (this.isOpponentTurn() && Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(activator)) {
return false;
Aside from the fact that two parts of condition on a first glance look a bit excessive, I just want to note that player instances now hold reference to a game object. That is the game that player is involved in.
So if you have a reference to player and have to recieve its game, you don't need to get the game from sinletons... just invoke player.getGame(). That is a bit shorter and removes reference to that singletons, incompatible with multiple games in one application (when we build the server).
Same is true when you need game given an abiliy or card - derive player from there and you know what to do next.