- cleaned up lobby message processing
This commit is contained in:
parent
2e99f69ef1
commit
a2f013c51a
|
@ -433,15 +433,22 @@ void ClientInterface::updateLobby() {
|
|||
break;
|
||||
|
||||
case nmtLaunch:
|
||||
case nmtBroadCastSetup:
|
||||
{
|
||||
NetworkMessageLaunch networkMessageLaunch;
|
||||
|
||||
if(receiveMessage(&networkMessageLaunch)) {
|
||||
if(networkMessageLaunch.getMessageType() == nmtLaunch) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got nmtLaunch\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
else if(networkMessageLaunch.getMessageType() == nmtBroadCastSetup) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got nmtBroadCastSetup\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
else {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got networkMessageLaunch.getMessageType() = %d\n",__FILE__,__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
||||
|
||||
char szBuf[1024]="";
|
||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] Invalid networkMessageLaunch.getMessageType() = %d",__FILE__,__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
||||
throw runtime_error(szBuf);
|
||||
}
|
||||
|
||||
networkMessageLaunch.buildGameSettings(&gameSettings);
|
||||
|
@ -462,37 +469,11 @@ void ClientInterface::updateLobby() {
|
|||
if(networkMessageLaunch.getMessageType() == nmtLaunch) {
|
||||
launchGame= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case nmtBroadCastSetup:
|
||||
{
|
||||
NetworkMessageLaunch networkMessageLaunch;
|
||||
|
||||
if(receiveMessage(&networkMessageLaunch))
|
||||
{
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got NetworkMessageLaunch\n",__FILE__,__FUNCTION__);
|
||||
|
||||
networkMessageLaunch.buildGameSettings(&gameSettings);
|
||||
|
||||
//replace server player by network
|
||||
for(int i= 0; i<gameSettings.getFactionCount(); ++i)
|
||||
{
|
||||
//replace by network
|
||||
if(gameSettings.getFactionControl(i)==ctHuman)
|
||||
{
|
||||
gameSettings.setFactionControl(i, ctNetwork);
|
||||
}
|
||||
|
||||
//set the faction index
|
||||
if(gameSettings.getStartLocationIndex(i)==playerIndex)
|
||||
{
|
||||
gameSettings.setThisFactionIndex(i);
|
||||
}
|
||||
}
|
||||
else if(networkMessageLaunch.getMessageType() == nmtBroadCastSetup) {
|
||||
gameSettingsReceived=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case nmtPlayerIndexMessage:
|
||||
{
|
||||
|
|
|
@ -783,6 +783,18 @@ bool ServerInterface::shouldDiscardNetworkMessage(NetworkMessageType networkMess
|
|||
|
||||
ChatMsgInfo msg(netMsg.getText().c_str(),netMsg.getSender().c_str(),netMsg.getTeamIndex());
|
||||
this->addChatInfo(msg);
|
||||
|
||||
string newChatText = msg.chatText.c_str();
|
||||
string newChatSender = msg.chatSender.c_str();
|
||||
int newChatTeamIndex = msg.chatTeamIndex;
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 about to broadcast nmtText chatText [%s] chatSender [%s] chatTeamIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatSender.c_str(),newChatTeamIndex);
|
||||
|
||||
NetworkMessageText networkMessageText(newChatText.c_str(),newChatSender.c_str(),newChatTeamIndex);
|
||||
broadcastMessage(&networkMessageText, connectionSlot->getPlayerIndex());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] after broadcast nmtText chatText [%s] chatSender [%s] chatTeamIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatSender.c_str(),newChatTeamIndex);
|
||||
|
||||
}
|
||||
break;
|
||||
case nmtSynchNetworkGameData:
|
||||
|
|
Loading…
Reference in New Issue