time variable names corrected from "Last" to "Left"

This commit is contained in:
Lucas Pleß 2012-06-14 14:24:22 +02:00
parent 58a8028bd5
commit 1c99fe4956
3 changed files with 18 additions and 18 deletions

View File

@ -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();

View File

@ -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();
}
}

View File

@ -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);
}