some (possible) bugs are fixed when starting but not all. Discussion needed .

This commit is contained in:
Titus Tscharntke
2010-05-04 00:05:10 +00:00
parent 0dd135fc12
commit 73be43d6ad
3 changed files with 17 additions and 7 deletions

View File

@@ -328,8 +328,11 @@ void ConnectionSlot::update(bool checkForNewClients)
} }
break; break;
} }
case nmtReady:
{
// its simply ignored here. Probably we are starting a game
break;
}
default: default:
{ {
//throw runtime_error("Unexpected message in connection slot: " + intToStr(networkMessageType)); //throw runtime_error("Unexpected message in connection slot: " + intToStr(networkMessageType));

View File

@@ -419,8 +419,8 @@ public:
// ===================================================== // =====================================================
// class SwitchSetupRequest // class SwitchSetupRequest
// //
// Message sent from the server to the client // Message sent from the client to the server
// when the client connects and vice versa // to switch its settings
// ===================================================== // =====================================================
class SwitchSetupRequest: public NetworkMessage{ class SwitchSetupRequest: public NetworkMessage{
@@ -453,10 +453,10 @@ public:
}; };
// ===================================================== // =====================================================
// class SwitchSetupRequest // class PlayerIndexMessage
// //
// Message sent from the server to the client // Message sent from the server to the clients
// when the client connects and vice versa // to tell them about a slot change ( caused by another client )
// ===================================================== // =====================================================
class PlayerIndexMessage: public NetworkMessage{ class PlayerIndexMessage: public NetworkMessage{

View File

@@ -308,6 +308,13 @@ void ServerInterface::waitUntilReady(Checksum* checksum){
NetworkMessageType networkMessageType= connectionSlot->getNextMessageType(true); NetworkMessageType networkMessageType= connectionSlot->getNextMessageType(true);
NetworkMessageReady networkMessageReady; NetworkMessageReady networkMessageReady;
// consume old messages from the setup
while(networkMessageType == nmtSwitchSetupRequest)
{
SwitchSetupRequest switchSetupRequest;
connectionSlot->receiveMessage(&switchSetupRequest);
networkMessageType= connectionSlot->getNextMessageType(true);
}
if(networkMessageType == nmtReady && if(networkMessageType == nmtReady &&
connectionSlot->receiveMessage(&networkMessageReady)) connectionSlot->receiveMessage(&networkMessageReady))
{ {