forked from mirrors/0ad
Fixed 3+ player games. The problem was the FinalizeSlots method in GameAttributes, which confused player and slot IDs by deleting nonexistent slots/players from the array. Since this doesn't seem particularly useful (and is even undesirable for scenarios where some players *want* to be the last slot and to leave others empty), I commented it out rather than having the code incur the extra complexity of supporting renumberings.
This was SVN commit r6228.
This commit is contained in:
@@ -355,9 +355,11 @@ bool CNetClient::OnAuthenticate( void* pContext, CFsmEvent* pEvent )
|
||||
CAuthenticateResultMessage* pMessage =( CAuthenticateResultMessage* )pEvent->GetParamRef();
|
||||
if ( !pMessage ) return true;
|
||||
|
||||
LOG(CLogger::Error, LOG_CAT_NET, "CNetClient::OnAuthenticate(): Authentication result: %s", pMessage->m_Message.c_str() );
|
||||
LOG(CLogger::Error, LOG_CAT_NET, "CNetClient::OnAuthenticate(): Authentication result: %ls", pMessage->m_Message.c_str() );
|
||||
|
||||
pSession->SetID( pMessage->m_SessionID );
|
||||
|
||||
LOG(CLogger::Error, LOG_CAT_NET, "CNetClient::OnAuthenticate(): My session ID is %d", pMessage->m_SessionID);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -415,8 +417,9 @@ bool CNetClient::OnPreGame( void* pContext, CFsmEvent* pEvent )
|
||||
|
||||
// FIXME Validate slot id to prevent us from going boom
|
||||
CPlayerSlot* pSlot = pClient->m_pGameAttributes->GetSlot( pMessage->m_SlotID );
|
||||
if ( pSlot == pClient->m_pLocalPlayerSlot )
|
||||
if ( pSlot == pClient->m_pLocalPlayerSlot ) {
|
||||
pClient->m_pLocalPlayerSlot = NULL;
|
||||
}
|
||||
|
||||
switch ( pMessage->m_Assignment )
|
||||
{
|
||||
@@ -426,8 +429,8 @@ bool CNetClient::OnPreGame( void* pContext, CFsmEvent* pEvent )
|
||||
if ( pSession->GetID() == pMessage->m_SessionID )
|
||||
{
|
||||
pClient->m_pLocalPlayerSlot = pSlot;
|
||||
pSlot->AssignToSessionID( pMessage->m_SessionID );
|
||||
}
|
||||
pSlot->AssignToSessionID( pMessage->m_SessionID );
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user