diff --git a/source/glest_game/network/connection_slot.cpp b/source/glest_game/network/connection_slot.cpp index 41fdc661e..d029bda7a 100644 --- a/source/glest_game/network/connection_slot.cpp +++ b/source/glest_game/network/connection_slot.cpp @@ -328,8 +328,11 @@ void ConnectionSlot::update(bool checkForNewClients) } break; } - - + case nmtReady: + { + // its simply ignored here. Probably we are starting a game + break; + } default: { //throw runtime_error("Unexpected message in connection slot: " + intToStr(networkMessageType)); diff --git a/source/glest_game/network/network_message.h b/source/glest_game/network/network_message.h index 187909014..0ce9981de 100644 --- a/source/glest_game/network/network_message.h +++ b/source/glest_game/network/network_message.h @@ -419,8 +419,8 @@ public: // ===================================================== // class SwitchSetupRequest // -// Message sent from the server to the client -// when the client connects and vice versa +// Message sent from the client to the server +// to switch its settings // ===================================================== class SwitchSetupRequest: public NetworkMessage{ @@ -453,10 +453,10 @@ public: }; // ===================================================== -// class SwitchSetupRequest +// class PlayerIndexMessage // -// Message sent from the server to the client -// when the client connects and vice versa +// Message sent from the server to the clients +// to tell them about a slot change ( caused by another client ) // ===================================================== class PlayerIndexMessage: public NetworkMessage{ diff --git a/source/glest_game/network/server_interface.cpp b/source/glest_game/network/server_interface.cpp index d94aa4dff..0b8dcde5a 100644 --- a/source/glest_game/network/server_interface.cpp +++ b/source/glest_game/network/server_interface.cpp @@ -308,6 +308,13 @@ void ServerInterface::waitUntilReady(Checksum* checksum){ NetworkMessageType networkMessageType= connectionSlot->getNextMessageType(true); NetworkMessageReady networkMessageReady; + // consume old messages from the setup + while(networkMessageType == nmtSwitchSetupRequest) + { + SwitchSetupRequest switchSetupRequest; + connectionSlot->receiveMessage(&switchSetupRequest); + networkMessageType= connectionSlot->getNextMessageType(true); + } if(networkMessageType == nmtReady && connectionSlot->receiveMessage(&networkMessageReady)) {