Fix clients and/or host crashing due to the last client clicking ready too many times. Based on patch by Buggy.
Throw in a few checks for changing player position or team, too. Closes ticket:2346. Changelog: Fixed crash for all players when the last player clicks "Ready" too many times.master
parent
3ede70143e
commit
1699da10cf
|
@ -1525,7 +1525,7 @@ BOOL recvTeamRequest(NETQUEUE queue)
|
||||||
{
|
{
|
||||||
UBYTE player, team;
|
UBYTE player, team;
|
||||||
|
|
||||||
if(!NetPlay.isHost) // only host should act
|
if (!NetPlay.isHost || !bHosted) // Only host should act, and only if the game hasn't started yet.
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1572,7 +1572,7 @@ BOOL recvReadyRequest(NETQUEUE queue)
|
||||||
UBYTE player;
|
UBYTE player;
|
||||||
BOOL bReady;
|
BOOL bReady;
|
||||||
|
|
||||||
if(!NetPlay.isHost) // only host should act
|
if (!NetPlay.isHost || !bHosted) // Only host should act, and only if the game hasn't started yet.
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1709,7 +1709,7 @@ BOOL recvColourRequest(NETQUEUE queue)
|
||||||
{
|
{
|
||||||
UBYTE player, col;
|
UBYTE player, col;
|
||||||
|
|
||||||
if(!NetPlay.isHost) // only host should act
|
if (!NetPlay.isHost || !bHosted) // Only host should act, and only if the game hasn't started yet.
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1735,7 +1735,7 @@ BOOL recvPositionRequest(NETQUEUE queue)
|
||||||
{
|
{
|
||||||
UBYTE player, position;
|
UBYTE player, position;
|
||||||
|
|
||||||
if(!NetPlay.isHost) // only host should act
|
if (!NetPlay.isHost || !bHosted) // Only host should act, and only if the game hasn't started yet.
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2754,6 +2754,11 @@ static void processMultiopWidgets(UDWORD id)
|
||||||
/* Start a multiplayer or skirmish game */
|
/* Start a multiplayer or skirmish game */
|
||||||
void startMultiplayerGame(void)
|
void startMultiplayerGame(void)
|
||||||
{
|
{
|
||||||
|
if (!bHosted)
|
||||||
|
{
|
||||||
|
debug(LOG_ERROR, "Multiple start requests received when we already started.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
decideWRF(); // set up swrf & game.map
|
decideWRF(); // set up swrf & game.map
|
||||||
bMultiPlayer = true;
|
bMultiPlayer = true;
|
||||||
bMultiMessages = true;
|
bMultiMessages = true;
|
||||||
|
@ -2896,8 +2901,8 @@ void frontendMultiMessages(void)
|
||||||
case NET_READY_REQUEST:
|
case NET_READY_REQUEST:
|
||||||
recvReadyRequest(queue);
|
recvReadyRequest(queue);
|
||||||
|
|
||||||
// if hosting try to start the game if everyone is ready
|
// If hosting and game not yet started, try to start the game if everyone is ready.
|
||||||
if(NetPlay.isHost && multiplayPlayersReady(false))
|
if (NetPlay.isHost && bHosted && multiplayPlayersReady(false))
|
||||||
{
|
{
|
||||||
startMultiplayerGame();
|
startMultiplayerGame();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue