Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/ch/unibas/dmi/dbis/cs108/gamelogic/VoteHandler.java
This commit is contained in:
Seraina 2022-04-08 11:12:07 +02:00
commit d83248d89f
2 changed files with 13 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,8 @@ public class VoteHandler {
* *
* @param passengers: train passengers * @param passengers: train passengers
*/ */
public static void humanVote(Passenger[] passengers) { public static 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,6 +182,10 @@ public class VoteHandler {
} }
} }
} }
// set hasVoted to false for all passengers for future votings
for (Passenger passenger : passengers) {
passenger.setHasVoted(false);
}
} }
static void print(Passenger[] array) { static void print(Passenger[] array) {

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 void setIsOg() { public void setIsOg() {