@@ -1552,9 +1552,9 @@ BOOL recvTeamRequest()
15521552{
15531553 UBYTE player , team ;
15541554
1555- if (!NetPlay .isHost ) // only host should act
1555+ if (!NetPlay .isHost || ! bHosted ) // Only host should act, and only if the game hasn't started yet.
15561556 {
1557- ASSERT (false , "Host only routine detected for client!" );
1557+ ASSERT (NetPlay . isHost , "Host only routine detected for client!" );
15581558 return true;
15591559 }
15601560
@@ -1608,9 +1608,9 @@ BOOL recvReadyRequest()
16081608 UBYTE player ;
16091609 BOOL bReady ;
16101610
1611- if (!NetPlay .isHost ) // only host should act
1611+ if (!NetPlay .isHost || ! bHosted ) // Only host should act, and only if the game hasn't started yet.
16121612 {
1613- ASSERT (false , "Host only routine detected for client!" );
1613+ ASSERT (NetPlay . isHost , "Host only routine detected for client!" );
16141614 return true;
16151615 }
16161616
@@ -1754,9 +1754,9 @@ BOOL recvColourRequest()
17541754{
17551755 UBYTE player , col ;
17561756
1757- if (!NetPlay .isHost ) // only host should act
1757+ if (!NetPlay .isHost || ! bHosted ) // Only host should act, and only if the game hasn't started yet.
17581758 {
1759- ASSERT (false , "Host only routine detected for client!" );
1759+ ASSERT (NetPlay . isHost , "Host only routine detected for client!" );
17601760 return true;
17611761 }
17621762
@@ -1787,9 +1787,9 @@ BOOL recvPositionRequest()
17871787{
17881788 UBYTE player , position ;
17891789
1790- if (!NetPlay .isHost ) // only host should act
1790+ if (!NetPlay .isHost || ! bHosted ) // Only host should act, and only if the game hasn't started yet.
17911791 {
1792- ASSERT (false , "Host only routine detected for client!" );
1792+ ASSERT (NetPlay . isHost , "Host only routine detected for client!" );
17931793 return true;
17941794 }
17951795
@@ -2833,6 +2833,11 @@ static void processMultiopWidgets(UDWORD id)
28332833/* Start a multiplayer or skirmish game */
28342834void startMultiplayerGame (void )
28352835{
2836+ if (!bHosted )
2837+ {
2838+ debug (LOG_ERROR , "Multiple start requests received when we already started." );
2839+ return ;
2840+ }
28362841 decideWRF (); // set up swrf & game.map
28372842 bMultiPlayer = true;
28382843 bMultiMessages = true;
@@ -2992,14 +2997,12 @@ void frontendMultiMessages(void)
29922997 break ;
29932998
29942999 case NET_READY_REQUEST :
2995- if (NetPlay .isHost )
3000+ recvReadyRequest ();
3001+
3002+ // If hosting and game not yet started, try to start the game if everyone is ready.
3003+ if (NetPlay .isHost && bHosted && multiplayPlayersReady (false))
29963004 {
2997- recvReadyRequest ();
2998- if (multiplayPlayersReady (false))
2999- {
3000- // if hosting try to start the game if everyone is ready
3001- startMultiplayerGame ();
3002- }
3005+ startMultiplayerGame ();
30033006 }
30043007 break ;
30053008
0 commit comments