@@ -1558,9 +1558,9 @@ BOOL recvTeamRequest()
1558
1558
{
1559
1559
UBYTE player , team ;
1560
1560
1561
- if (!NetPlay .isHost ) // only host should act
1561
+ if (!NetPlay .isHost || ! bHosted ) // Only host should act, and only if the game hasn't started yet.
1562
1562
{
1563
- ASSERT (false , "Host only routine detected for client!" );
1563
+ ASSERT (NetPlay . isHost , "Host only routine detected for client!" );
1564
1564
return true;
1565
1565
}
1566
1566
@@ -1614,9 +1614,9 @@ BOOL recvReadyRequest()
1614
1614
UBYTE player ;
1615
1615
BOOL bReady ;
1616
1616
1617
- if (!NetPlay .isHost ) // only host should act
1617
+ if (!NetPlay .isHost || ! bHosted ) // Only host should act, and only if the game hasn't started yet.
1618
1618
{
1619
- ASSERT (false , "Host only routine detected for client!" );
1619
+ ASSERT (NetPlay . isHost , "Host only routine detected for client!" );
1620
1620
return true;
1621
1621
}
1622
1622
@@ -1760,9 +1760,9 @@ BOOL recvColourRequest()
1760
1760
{
1761
1761
UBYTE player , col ;
1762
1762
1763
- if (!NetPlay .isHost ) // only host should act
1763
+ if (!NetPlay .isHost || ! bHosted ) // Only host should act, and only if the game hasn't started yet.
1764
1764
{
1765
- ASSERT (false , "Host only routine detected for client!" );
1765
+ ASSERT (NetPlay . isHost , "Host only routine detected for client!" );
1766
1766
return true;
1767
1767
}
1768
1768
@@ -1793,9 +1793,9 @@ BOOL recvPositionRequest()
1793
1793
{
1794
1794
UBYTE player , position ;
1795
1795
1796
- if (!NetPlay .isHost ) // only host should act
1796
+ if (!NetPlay .isHost || ! bHosted ) // Only host should act, and only if the game hasn't started yet.
1797
1797
{
1798
- ASSERT (false , "Host only routine detected for client!" );
1798
+ ASSERT (NetPlay . isHost , "Host only routine detected for client!" );
1799
1799
return true;
1800
1800
}
1801
1801
@@ -2820,6 +2820,11 @@ static void processMultiopWidgets(UDWORD id)
2820
2820
/* Start a multiplayer or skirmish game */
2821
2821
void startMultiplayerGame (void )
2822
2822
{
2823
+ if (!bHosted )
2824
+ {
2825
+ debug (LOG_ERROR , "Multiple start requests received when we already started." );
2826
+ return ;
2827
+ }
2823
2828
decideWRF (); // set up swrf & game.map
2824
2829
bMultiPlayer = true;
2825
2830
bMultiMessages = true;
@@ -2975,14 +2980,12 @@ void frontendMultiMessages(void)
2975
2980
break ;
2976
2981
2977
2982
case NET_READY_REQUEST :
2978
- if (NetPlay .isHost )
2983
+ recvReadyRequest ();
2984
+
2985
+ // If hosting and game not yet started, try to start the game if everyone is ready.
2986
+ if (NetPlay .isHost && bHosted && multiplayPlayersReady (false))
2979
2987
{
2980
- recvReadyRequest ();
2981
- if (multiplayPlayersReady (false))
2982
- {
2983
- // if hosting try to start the game if everyone is ready
2984
- startMultiplayerGame ();
2985
- }
2988
+ startMultiplayerGame ();
2986
2989
}
2987
2990
break ;
2988
2991
0 commit comments