Skip to content

Commit fd2843e

Browse files
committed
Fix bug introduced in 09ea0be
Changelog: Fix kicking of non-hosts who didn't have default color values. Only change colors if you are the host on the setup screen. Fixes ticket:2329
1 parent 99ec8a0 commit fd2843e

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

Diff for: lib/netplay/netplay.c

+14-5
Original file line numberDiff line numberDiff line change
@@ -1512,11 +1512,7 @@ void NET_InitPlayers()
15121512
{
15131513
NET_InitPlayer(i, true);
15141514
}
1515-
// Now switch player color of the host to what they normally use for SP games
1516-
if ( getPlayerColour(NET_HOST_ONLY) != war_GetSPcolor())
1517-
{
1518-
changeColour(NET_HOST_ONLY, war_GetSPcolor());
1519-
}
1515+
15201516
NetPlay.hostPlayer = NET_HOST_ONLY; // right now, host starts always at index zero
15211517
NetPlay.playercount = 0;
15221518
NetPlay.pMapFileHandle = NULL;
@@ -1557,6 +1553,8 @@ static void NETSendPlayerInfoTo(uint32_t index, unsigned to)
15571553
void NETSendAllPlayerInfoTo(unsigned int to)
15581554
{
15591555
static uint32_t indices[MAX_PLAYERS] = {0, 1, 2, 3, 4, 5, 6, 7};
1556+
ASSERT_OR_RETURN( , NetPlay.isHost == true, "Invalid call for non-host");
1557+
15601558
NETSendNPlayerInfoTo(indices, ARRAY_SIZE(indices), to);
15611559
}
15621560

@@ -3702,6 +3700,11 @@ BOOL NEThostGame(const char* SessionName, const char* PlayerName,
37023700
NetPlay.players[0].connection = -1;
37033701
NetPlay.playercount = 1;
37043702
debug(LOG_NET, "Hosting but no comms");
3703+
// Now switch player color of the host to what they normally use for SP games
3704+
if ( getPlayerColour(NET_HOST_ONLY) != war_GetSPcolor())
3705+
{
3706+
changeColour(NET_HOST_ONLY, war_GetSPcolor());
3707+
}
37053708
return true;
37063709
}
37073710

@@ -3771,6 +3774,12 @@ BOOL NEThostGame(const char* SessionName, const char* PlayerName,
37713774

37723775
MultiPlayerJoin(selectedPlayer);
37733776

3777+
// Now switch player color of the host to what they normally use for SP games
3778+
if ( getPlayerColour(NET_HOST_ONLY) != war_GetSPcolor())
3779+
{
3780+
changeColour(NET_HOST_ONLY, war_GetSPcolor());
3781+
}
3782+
37743783
allow_joining = true;
37753784

37763785
NETregisterServer(0);

Diff for: src/multiint.c

-5
Original file line numberDiff line numberDiff line change
@@ -3348,11 +3348,6 @@ BOOL startMultiOptions(BOOL bReenter)
33483348
game.skDiff[i] = (DIFF_SLIDER_STOPS / 2); // reset AI (turn it on again)
33493349
setPlayerColour(i,i); //reset all colors as well
33503350
}
3351-
// Now switch player color of the host to what they normally use
3352-
if (getPlayerColour(NET_HOST_ONLY) != war_GetSPcolor())
3353-
{
3354-
changeColour(NET_HOST_ONLY, war_GetSPcolor());
3355-
}
33563351

33573352
if(!NetPlay.bComms) // force skirmish if no comms.
33583353
{

0 commit comments

Comments
 (0)