Server now closes correctly when host is leaving

This commit is contained in:
Hanno Fleischer
2024-12-16 12:08:18 +01:00
parent 61ea4c3276
commit ab4c7159f3
3 changed files with 3 additions and 3 deletions

View File

@@ -204,7 +204,7 @@ public void enter(MdgaState state) {
switch (state) {
case MAIN:
view = mainView;
clientGameLogic.clear();
clientGameLogic = new ClientGameLogic(networkConnection);
break;
case LOBBY:
view = lobbyView;

View File

@@ -285,6 +285,7 @@ public void handleDisconnect(int id) {
public void exit() {
LOGGER.log(Level.INFO, "Requesting server shutdown"); //NON-NLS
running = false;
pendingMessages.add(new ReceivedMessage(new AnimationEndMessage(), -1));
}
/**

View File

@@ -50,9 +50,8 @@ public void exit() {
*/
@Override
public void selectLeave() {
parent.setState(parent.getStartDialog());
logic.addNotification(new StartDialogNotification());
logic.send(new LeaveGameMessage());
logic.addNotification(new StartDialogNotification());
}
/**