merge the new developmentbranch into the test branch #39

Closed
j23f0712 wants to merge 431 commits from development2 into dev/test
Showing only changes of commit 4440341f79 - Show all commits

View File

@@ -2,7 +2,6 @@
import pp.mdga.game.Color;
import pp.mdga.game.Player;
import pp.mdga.game.PlayerData;
import pp.mdga.message.client.*;
import pp.mdga.message.server.*;
import pp.mdga.server.ServerGameLogic;
@@ -48,8 +47,8 @@ public void exit() {
* This method will be used to initialize the game and all necessary objects.
*/
public void initializeGame() {
for (Map.Entry<Integer, Player> entry : this.logic.getGame().getPlayers().entrySet()) {
this.logic.getGame().getBoard().addPlayerData(entry.getValue().getColor(), new PlayerData(entry.getValue().getColor()));
for (var player : this.logic.getGame().getPlayers().values()) {
player.initialize();
}
}
@@ -122,11 +121,6 @@ public void received(LobbyReadyMessage msg, int from) {
}
this.logic.getGame().getPlayerById(from).setReady(true);
this.logic.getServerSender().broadcast(new UpdateReadyMessage(from, true));
if (this.logic.getGame().areAllReady()) {
this.initializeGame();
this.logic.getServerSender().broadcast(new ServerStartGameMessage(this.logic.getGame().getBoard()));
this.logic.setCurrentState(this.logic.getGameState());
}
}
/**
@@ -151,9 +145,9 @@ public void received(LobbyNotReadyMessage msg, int from) {
*/
@Override
public void received(StartGameMessage msg, int from) {
if (msg.isForceStartGame() || this.logic.getGame().areAllReady()) {
if (this.logic.getGame().areAllReady()) {
this.initializeGame();
this.logic.getServerSender().broadcast(new ServerStartGameMessage(this.logic.getGame().getBoard()));
this.logic.getServerSender().broadcast(new ServerStartGameMessage(this.logic.getGame().getPlayersAsList(), this.logic.getGame().getBoard()));
this.logic.setCurrentState(this.logic.getGameState());
}
}