From 35433e55b852b72a251a9a8e016548dbb56a4560 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 2 Jul 2013 17:02:03 +0200 Subject: [PATCH] Show match time value in table view. --- Mage.Common/src/mage/view/TableView.java | 2 +- Mage/src/mage/game/Table.java | 12 ++++++++---- Mage/src/mage/game/match/MatchOptions.java | 5 +++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Mage.Common/src/mage/view/TableView.java b/Mage.Common/src/mage/view/TableView.java index 778005e43d..6888788e03 100644 --- a/Mage.Common/src/mage/view/TableView.java +++ b/Mage.Common/src/mage/view/TableView.java @@ -91,7 +91,7 @@ public class TableView implements Serializable { this.controllerName += sb.toString(); this.deckType = table.getDeckType(); if (table.getMatch().getGames().isEmpty()) { - this.additionalInfo = ""; + this.additionalInfo = new StringBuilder("Timer: ").append(table.getMatch().getOptions().getMatchTimeLimit().toString()).toString(); } else { this.additionalInfo = sbScore.toString(); } diff --git a/Mage/src/mage/game/Table.java b/Mage/src/mage/game/Table.java index 6713c36b30..e0274b3e18 100644 --- a/Mage/src/mage/game/Table.java +++ b/Mage/src/mage/game/Table.java @@ -149,15 +149,17 @@ public class Table implements Serializable { throw new GameException("Seat is occupied."); } seat.setPlayer(player); - if (isReady()) + if (isReady()) { state = TableState.STARTING; + } return seat.getPlayer().getId(); } private boolean isReady() { for (int i = 0; i < numSeats; i++ ) { - if (seats[i].getPlayer() == null) + if (seats[i].getPlayer() == null) { return false; + } } return true; } @@ -172,8 +174,9 @@ public class Table implements Serializable { public Seat getNextAvailableSeat(String playerType) { for (int i = 0; i < numSeats; i++ ) { - if (seats[i].getPlayer() == null && seats[i].getPlayerType().equals(playerType)) + if (seats[i].getPlayer() == null && seats[i].getPlayerType().equals(playerType)) { return seats[i]; + } } return null; } @@ -183,8 +186,9 @@ public class Table implements Serializable { Player player = seats[i].getPlayer(); if (player != null && player.getId().equals(playerId)) { seats[i].setPlayer(null); - if (state == TableState.STARTING) + if (state == TableState.STARTING) { state = TableState.WAITING; + } break; } } diff --git a/Mage/src/mage/game/match/MatchOptions.java b/Mage/src/mage/game/match/MatchOptions.java index b54e3adabb..89381cf9ea 100644 --- a/Mage/src/mage/game/match/MatchOptions.java +++ b/Mage/src/mage/game/match/MatchOptions.java @@ -131,6 +131,11 @@ public class MatchOptions implements Serializable { return matchTimeLimit.getTimeLimit(); } + + public MatchTimeLimit getMatchTimeLimit() { + return this.matchTimeLimit; + } + public void setMatchTimeLimit(MatchTimeLimit matchTimeLimit) { this.matchTimeLimit = matchTimeLimit; }