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;
}
case nmtReady:
{
// its simply ignored here. Probably we are starting a game
break;
}
default:
{
//throw runtime_error("Unexpected message in connection slot: " + intToStr(networkMessageType));

View File

@ -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{

View File

@ -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))
{