Further semantic organization: Moved getGameInfo out of AllZone, into FModel.

getGameInfo returns a GameSummary object, so it has been renamed to getGameSummary.
This commit is contained in:
Doublestrike
2012-01-22 08:18:35 +00:00
parent 617e0833cb
commit 332fc9c41f
6 changed files with 15 additions and 21 deletions

View File

@@ -27,7 +27,6 @@ import forge.card.cardfactory.PreloadingCardFactory;
import forge.card.replacement.ReplacementHandler; import forge.card.replacement.ReplacementHandler;
import forge.card.trigger.TriggerHandler; import forge.card.trigger.TriggerHandler;
import forge.deck.DeckManager; import forge.deck.DeckManager;
import forge.game.GameSummary;
import forge.game.limited.CardRatings; import forge.game.limited.CardRatings;
import forge.gui.input.InputControl; import forge.gui.input.InputControl;
import forge.model.FGameState; import forge.model.FGameState;
@@ -427,18 +426,6 @@ public final class AllZone {
return null; return null;
} }
/**
* <p>
* getGameInfo.
* </p>
*
* @return a {@link forge.game.GameSummary} object.
* @since 1.0.15
*/
public static GameSummary getGameInfo() {
return Singletons.getModel().getGameState().getGameInfo();
}
/** /**
* <p> * <p>
* getTriggerHandler. * getTriggerHandler.

View File

@@ -753,7 +753,7 @@ public class GameAction {
*/ */
public final boolean checkEndGameState() { public final boolean checkEndGameState() {
// Win / Lose // Win / Lose
final GameSummary game = AllZone.getGameInfo(); final GameSummary game = Singletons.getModel().getGameSummary();
boolean humanWins = false; boolean humanWins = false;
boolean computerWins = false; boolean computerWins = false;
final Player computer = AllZone.getComputerPlayer(); final Player computer = AllZone.getComputerPlayer();

View File

@@ -65,7 +65,7 @@ public class PhaseUtil {
final Player turn = AllZone.getPhaseHandler().getPlayerTurn(); final Player turn = AllZone.getPhaseHandler().getPlayerTurn();
AllZone.getPhaseHandler().turnReset(); AllZone.getPhaseHandler().turnReset();
AllZone.getGameInfo().notifyNextTurn(); Singletons.getModel().getGameSummary().notifyNextTurn();
AllZone.getCombat().reset(); AllZone.getCombat().reset();
AllZone.getCombat().setAttackingPlayer(turn); AllZone.getCombat().setAttackingPlayer(turn);

View File

@@ -32,6 +32,7 @@ import forge.PhaseHandler;
import forge.PhaseUtil; import forge.PhaseUtil;
import forge.Player; import forge.Player;
import forge.PlayerZone; import forge.PlayerZone;
import forge.Singletons;
import forge.card.abilityfactory.AbilityFactory; import forge.card.abilityfactory.AbilityFactory;
import forge.card.spellability.SpellAbility; import forge.card.spellability.SpellAbility;
import forge.game.GamePlayerRating; import forge.game.GamePlayerRating;
@@ -99,7 +100,7 @@ public class InputMulligan extends Input {
@Override @Override
public final void selectButtonCancel() { public final void selectButtonCancel() {
final Player humanPlayer = AllZone.getHumanPlayer(); final Player humanPlayer = AllZone.getHumanPlayer();
final GamePlayerRating humanRating = AllZone.getGameInfo().getPlayerRating(humanPlayer.getName()); final GamePlayerRating humanRating = Singletons.getModel().getGameSummary().getPlayerRating(humanPlayer.getName());
final int newHand = this.doMulligan(humanPlayer, humanRating); final int newHand = this.doMulligan(humanPlayer, humanRating);
@@ -122,7 +123,7 @@ public class InputMulligan extends Input {
final void end() { final void end() {
// Computer mulligan // Computer mulligan
final Player aiPlayer = AllZone.getComputerPlayer(); final Player aiPlayer = AllZone.getComputerPlayer();
final GamePlayerRating aiRating = AllZone.getGameInfo().getPlayerRating(aiPlayer.getName()); final GamePlayerRating aiRating = Singletons.getModel().getGameSummary().getPlayerRating(aiPlayer.getName());
boolean aiTakesMulligan = true; boolean aiTakesMulligan = true;
// Computer mulligans if there are no cards with converted mana cost of // Computer mulligans if there are no cards with converted mana cost of

View File

@@ -68,7 +68,7 @@ public class FGameState {
private PlayerZone stackZone = new DefaultPlayerZone(Constant.Zone.Stack, null); private PlayerZone stackZone = new DefaultPlayerZone(Constant.Zone.Stack, null);
private long timestamp = 0; private long timestamp = 0;
private GameSummary gameInfo; private GameSummary gameSummary;
/** /**
* Constructor. * Constructor.
@@ -384,15 +384,15 @@ public class FGameState {
* *
* @return the game info * @return the game info
*/ */
public final GameSummary getGameInfo() { public final GameSummary getGameSummary() {
return this.gameInfo; return this.gameSummary;
} }
/** /**
* Call this each time you start a new game, ok?. * Call this each time you start a new game, ok?.
*/ */
public final void newGameCleanup() { public final void newGameCleanup() {
this.gameInfo = new GameSummary(this.humanPlayer.getName(), this.computerPlayer.getName()); this.gameSummary = new GameSummary(this.humanPlayer.getName(), this.computerPlayer.getName());
this.getHumanPlayer().reset(); this.getHumanPlayer().reset();
this.getComputerPlayer().reset(); this.getComputerPlayer().reset();

View File

@@ -34,6 +34,7 @@ import forge.Constant;
import forge.ConstantStringArrayList; import forge.ConstantStringArrayList;
import forge.FileUtil; import forge.FileUtil;
import forge.HttpUtil; import forge.HttpUtil;
import forge.game.GameSummary;
import forge.gui.input.InputControl; import forge.gui.input.InputControl;
import forge.properties.ForgePreferences; import forge.properties.ForgePreferences;
import forge.properties.ForgeProps; import forge.properties.ForgeProps;
@@ -297,6 +298,11 @@ public class FModel {
return this.gameState; return this.gameState;
} }
/** @return {@link forge.game.GameSummary} */
public final GameSummary getGameSummary() {
return this.gameState.getGameSummary();
}
/** /**
* Create and return a new game state. * Create and return a new game state.
* *