Merge remote-tracking branch 'origin/master'

This commit is contained in:
Jonas 2022-04-08 11:11:14 +02:00
commit 3c94bd5324
2 changed files with 12 additions and 3 deletions

View File

@ -90,6 +90,11 @@ public class VoteHandler {
passengers[ghostPosition] = g; passengers[ghostPosition] = g;
passengers[ghostPosition].send( passengers[ghostPosition].send(
"You are now a ghost!"); // TODO: ServerGameInfoHandler might deal with this one "You are now a ghost!"); // TODO: ServerGameInfoHandler might deal with this one
// set hasVoted to false for all passengers for future votings
for (Passenger passenger : passengers) {
passenger.setHasVoted(false);
}
} }
/** /**
@ -100,7 +105,7 @@ public class VoteHandler {
* *
* @param passengers: train passengers * @param passengers: train passengers
*/ */
public void humanVote(Passenger[] passengers) { public void humanVote(Passenger[] passengers, Game game) {
// array to collect votes for all players during voting, i.e. votes for player 1 are saved in // array to collect votes for all players during voting, i.e. votes for player 1 are saved in
// votesForPlayers[0] // votesForPlayers[0]
@ -176,5 +181,9 @@ public class VoteHandler {
} }
} }
} }
// set hasVoted to false for all passengers for future votings
for (Passenger passenger : passengers) {
passenger.setHasVoted(false);
}
} }
} }

View File

@ -71,9 +71,9 @@ public class Passenger {
// changes this passenger's status from human to ghost // changes this passenger's status from human to ghost
isGhost = true; isGhost = true;
} }
public void setHasVoted() { public void setHasVoted(boolean voted) {
// used to signal that this passenger voted during a voting // used to signal that this passenger voted during a voting
hasVoted = true; hasVoted = voted;
} }
public int getPosition() { public int getPosition() {