From 1c99fe49568ab5e57e7c6576b5bc4fb17f38998e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Thu, 14 Jun 2012 14:24:22 +0200 Subject: [PATCH] time variable names corrected from "Last" to "Left" --- src/de/ctdo/crashtest/game/IStatemachine.java | 2 +- src/de/ctdo/crashtest/game/Statemachine.java | 16 ++++++++-------- src/de/ctdo/crashtest/game/TheGame.java | 18 +++++++++--------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/de/ctdo/crashtest/game/IStatemachine.java b/src/de/ctdo/crashtest/game/IStatemachine.java index a2cd765..83b0d75 100644 --- a/src/de/ctdo/crashtest/game/IStatemachine.java +++ b/src/de/ctdo/crashtest/game/IStatemachine.java @@ -7,7 +7,7 @@ public interface IStatemachine { void setNewState(Statemachine.state newState); int getStateChangeCounter(); void handleInput(char input); - int getTimerSecondsLast(); + int getTimerSecondsLeft(); int getTimerSeconds(); void startTimer(int seconds); void stopTimer(); diff --git a/src/de/ctdo/crashtest/game/Statemachine.java b/src/de/ctdo/crashtest/game/Statemachine.java index a92c7f8..51a6c4f 100644 --- a/src/de/ctdo/crashtest/game/Statemachine.java +++ b/src/de/ctdo/crashtest/game/Statemachine.java @@ -37,7 +37,7 @@ public class Statemachine implements IStatemachine { private long lastHandleInput; private int stateChangeCounter; private state currentState; - private int timertSecondsLast; + private int timertSecondsLeft; private int timertSeconds; public Statemachine() { @@ -91,8 +91,8 @@ public class Statemachine implements IStatemachine { } @Override - public int getTimerSecondsLast() { - return timertSecondsLast / 10; + public int getTimerSecondsLeft() { + return timertSecondsLeft / 10; } @Override @@ -102,7 +102,7 @@ public class Statemachine implements IStatemachine { @Override public void startTimer(int seconds) { - timertSecondsLast = seconds*10; + timertSecondsLeft = seconds*10; timertSeconds = seconds*10; scheduleTimer(); } @@ -110,7 +110,7 @@ public class Statemachine implements IStatemachine { @Override public void stopTimer() { if(timer != null) timer.cancel(); - timertSecondsLast = 0; + timertSecondsLeft = 0; timertSeconds = 0; } @@ -135,7 +135,7 @@ public class Statemachine implements IStatemachine { private void onTimerTick() { for(StatemachineListener listener: statemachineListenerList) { - listener.timerTick(timertSecondsLast); + listener.timerTick(timertSecondsLeft); } } @@ -225,11 +225,11 @@ public class Statemachine implements IStatemachine { TimerTask timerTask = new TimerTask() { @Override public void run() { - timertSecondsLast--; + timertSecondsLeft--; onTimerTick(); - if(timertSecondsLast <= 0) { + if(timertSecondsLeft <= 0) { if(timer != null) timer.cancel(); } } diff --git a/src/de/ctdo/crashtest/game/TheGame.java b/src/de/ctdo/crashtest/game/TheGame.java index 3f9a583..43f4009 100644 --- a/src/de/ctdo/crashtest/game/TheGame.java +++ b/src/de/ctdo/crashtest/game/TheGame.java @@ -149,9 +149,9 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent // spieler haben 8 Minuten, wenn sie es in weniger als 4 minuten schaffen // gibts +1, in weniger als 2 minuten gibts +2 - if(machine.getTimerSecondsLast() >= 6*60 ) { + if(machine.getTimerSecondsLeft() >= 6*60 ) { rate(2, "table game faster than 2 minutes"); - } else if(machine.getTimerSecondsLast() > 4*60) { + } else if(machine.getTimerSecondsLeft() > 4*60) { rate(1, "table game faster than 4 minutes"); } if(machine.getStateChangeCounter() > 100) { @@ -193,9 +193,9 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent // spieler haben 7 Minuten, wenn sie es in weniger als 4 minuten schaffen // gibts +1, in weniger als 2 minuten gibts +2 - if(machine.getTimerSecondsLast() >= 5*60 ) { + if(machine.getTimerSecondsLeft() >= 5*60 ) { rate(2, "r0kets faster than 2 minutes"); - } else if(machine.getTimerSecondsLast() > 3*60) { + } else if(machine.getTimerSecondsLeft() > 3*60) { rate(1, "r0kets faster than 4 minutes"); } @@ -417,16 +417,16 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent private void sayScore() { ircClient.say("stateChangeCounter: " + machine.getStateChangeCounter()); - int secondsLast = machine.getTimerSecondsLast(); + int secondsLeft = machine.getTimerSecondsLeft(); int seconds = machine.getTimerSeconds(); - int secondsLeft = seconds - secondsLast; + int secondsUsed = seconds - secondsLeft; int mins = seconds / 60; - int minsLast = secondsLast / 60; + int minsUsed = secondsUsed / 60; int minsLeft = secondsLeft / 60; - ircClient.say(String.format("time: %d:%02d last: %d:%02d left: %d:%02d", - mins, seconds % 60, minsLast, secondsLast % 60, minsLeft, secondsLeft % 60)); + ircClient.say(String.format("time: %d:%02d used: %d:%02d left: %d:%02d", + mins, seconds % 60, minsUsed, secondsUsed % 60, minsLeft, secondsLeft % 60)); ircClient.say("gamerRating: " + gamerRating); }