mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Fikser noen bugs i programmeringstimeren
This commit is contained in:
parent
b02e665e86
commit
89f2a4545e
@ -123,6 +123,7 @@ public class CardChoiceScreen extends InteractiveScreen implements Screen {
|
|||||||
*/
|
*/
|
||||||
private void confirmCards(Boolean requestPowerDown) {
|
private void confirmCards(Boolean requestPowerDown) {
|
||||||
if (chosenCards.size() == maxCards) {
|
if (chosenCards.size() == maxCards) {
|
||||||
|
roboRallyWrapper.shouldHurry = false;
|
||||||
List<ProgrammingCard> newProgram = getChosenAndLockedCards();
|
List<ProgrammingCard> newProgram = getChosenAndLockedCards();
|
||||||
//Save the program to get locked cards later
|
//Save the program to get locked cards later
|
||||||
roboRallyWrapper.roboRallyGame.setProgram(newProgram);
|
roboRallyWrapper.roboRallyGame.setProgram(newProgram);
|
||||||
|
@ -56,7 +56,6 @@ public class LoadingScreen extends AbstractScreen {
|
|||||||
}
|
}
|
||||||
return "Loading...";
|
return "Loading...";
|
||||||
}
|
}
|
||||||
System.out.println(roboRallyWrapper.roboRallyGame.getGameState());
|
|
||||||
switch (roboRallyWrapper.roboRallyGame.getGameState()) {
|
switch (roboRallyWrapper.roboRallyGame.getGameState()) {
|
||||||
case WAITING_FOR_OTHER_PLAYERS_PROGRAMS:
|
case WAITING_FOR_OTHER_PLAYERS_PROGRAMS:
|
||||||
return "Waiting for other players to finish programming...";
|
return "Waiting for other players to finish programming...";
|
||||||
@ -71,7 +70,6 @@ public class LoadingScreen extends AbstractScreen {
|
|||||||
default:
|
default:
|
||||||
return "Waiting for something...";
|
return "Waiting for something...";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +17,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This listener handles all sending and responses for the server
|
* This listener handles all sending and responses for the server
|
||||||
@ -172,11 +171,10 @@ class RoboRallyServerListener extends Listener {
|
|||||||
programs = new HashMap<>();
|
programs = new HashMap<>();
|
||||||
} else {
|
} else {
|
||||||
List<Connection> notReceivedFrom = playersNotYetReceivedFrom(programs);
|
List<Connection> notReceivedFrom = playersNotYetReceivedFrom(programs);
|
||||||
if (notReceivedFrom.size() != 1) {
|
if (notReceivedFrom.size() == 1) {
|
||||||
return;
|
Connection hurryUp = notReceivedFrom.get(0);
|
||||||
|
hurryUp.sendTCP(new HurryResponse());
|
||||||
}
|
}
|
||||||
Connection hurryUp = notReceivedFrom.get(0);
|
|
||||||
hurryUp.sendTCP(new HurryResponse());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +186,7 @@ class RoboRallyServerListener extends Listener {
|
|||||||
* @return True if information has been received by all alive players
|
* @return True if information has been received by all alive players
|
||||||
*/
|
*/
|
||||||
private <K> boolean receivedDataFromAllConnections(Map<Connection, K> data) {
|
private <K> boolean receivedDataFromAllConnections(Map<Connection, K> data) {
|
||||||
Set<Connection> connections = clients.keySet();
|
List<Connection> connections = new ArrayList<>(clients.keySet());
|
||||||
connections.removeAll(deadPlayers);
|
connections.removeAll(deadPlayers);
|
||||||
return data.keySet().containsAll(connections);
|
return data.keySet().containsAll(connections);
|
||||||
}
|
}
|
||||||
@ -201,10 +199,10 @@ class RoboRallyServerListener extends Listener {
|
|||||||
* @return All active connections for which the map has no data
|
* @return All active connections for which the map has no data
|
||||||
*/
|
*/
|
||||||
private <K> List<Connection> playersNotYetReceivedFrom(Map<Connection, K> data) {
|
private <K> List<Connection> playersNotYetReceivedFrom(Map<Connection, K> data) {
|
||||||
Set<Connection> connections = clients.keySet();
|
List<Connection> connections = new ArrayList<>(clients.keySet());
|
||||||
connections.removeAll(deadPlayers);
|
connections.removeAll(deadPlayers);
|
||||||
connections.removeAll(data.keySet());
|
connections.removeAll(data.keySet());
|
||||||
return new ArrayList<>(connections);
|
return connections;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user