Pass on admin state if the admin leaves the network game, so that someone else can start the game.

This commit is contained in:
lotodore
2007-10-03 13:36:47 +00:00
parent 8385b2e28d
commit 076d44b0ae
19 changed files with 239 additions and 49 deletions
+17 -8
View File
@@ -401,14 +401,6 @@ AbstractClientStateReceiving::Process(ClientThread &client)
client.GetCallback().SignalNetClientRemovedFromGame(removedData.removeReason);
client.SetState(ClientStateWaitJoin::Instance());
}
else if (tmpPacket->ToNetPacketError())
{
// Server reported an error.
NetPacketError::Data errorData;
tmpPacket->ToNetPacketError()->GetData(errorData);
// Show the error.
throw ClientException(errorData.errorCode, 0);
}
else if (tmpPacket->ToNetPacketChatText())
{
// Chat message - display it in the GUI.
@@ -428,6 +420,15 @@ AbstractClientStateReceiving::Process(ClientThread &client)
// Signal to GUI and remove from data list.
client.RemovePlayerData(playerLeftData.playerId);
}
else if (tmpPacket->ToNetPacketGameAdminChanged())
{
// New admin for the game.
NetPacketGameAdminChanged::Data adminChangedData;
tmpPacket->ToNetPacketGameAdminChanged()->GetData(adminChangedData);
// Set new game admin and signal to GUI.
client.SetNewGameAdmin(adminChangedData.playerId);
}
else if (tmpPacket->ToNetPacketGameListNew())
{
// A new game was created on the server.
@@ -478,6 +479,14 @@ AbstractClientStateReceiving::Process(ClientThread &client)
tmpPacket->ToNetPacketGameListPlayerLeft()->GetData(playerLeftData);
client.ModifyGameInfoRemovePlayer(playerLeftData.gameId, playerLeftData.playerId);
}
else if (tmpPacket->ToNetPacketError())
{
// Server reported an error.
NetPacketError::Data errorData;
tmpPacket->ToNetPacketError()->GetData(errorData);
// Show the error.
throw ClientException(errorData.errorCode, 0);
}
else
retVal = InternalProcess(client, tmpPacket);
}