Skip to content

Commit

Permalink
Fix bug introduced in 09ea0be
Browse files Browse the repository at this point in the history
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
  • Loading branch information
buginator committed Nov 20, 2010
1 parent 99ec8a0 commit fd2843e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
19 changes: 14 additions & 5 deletions lib/netplay/netplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1512,11 +1512,7 @@ void NET_InitPlayers()
{
NET_InitPlayer(i, true);
}
// Now switch player color of the host to what they normally use for SP games
if ( getPlayerColour(NET_HOST_ONLY) != war_GetSPcolor())
{
changeColour(NET_HOST_ONLY, war_GetSPcolor());
}

NetPlay.hostPlayer = NET_HOST_ONLY; // right now, host starts always at index zero
NetPlay.playercount = 0;
NetPlay.pMapFileHandle = NULL;
Expand Down Expand Up @@ -1557,6 +1553,8 @@ static void NETSendPlayerInfoTo(uint32_t index, unsigned to)
void NETSendAllPlayerInfoTo(unsigned int to)
{
static uint32_t indices[MAX_PLAYERS] = {0, 1, 2, 3, 4, 5, 6, 7};
ASSERT_OR_RETURN( , NetPlay.isHost == true, "Invalid call for non-host");

NETSendNPlayerInfoTo(indices, ARRAY_SIZE(indices), to);
}

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

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

MultiPlayerJoin(selectedPlayer);

// Now switch player color of the host to what they normally use for SP games
if ( getPlayerColour(NET_HOST_ONLY) != war_GetSPcolor())
{
changeColour(NET_HOST_ONLY, war_GetSPcolor());
}

allow_joining = true;

NETregisterServer(0);
Expand Down
5 changes: 0 additions & 5 deletions src/multiint.c
Original file line number Diff line number Diff line change
Expand Up @@ -3348,11 +3348,6 @@ BOOL startMultiOptions(BOOL bReenter)
game.skDiff[i] = (DIFF_SLIDER_STOPS / 2); // reset AI (turn it on again)
setPlayerColour(i,i); //reset all colors as well
}
// Now switch player color of the host to what they normally use
if (getPlayerColour(NET_HOST_ONLY) != war_GetSPcolor())
{
changeColour(NET_HOST_ONLY, war_GetSPcolor());
}

if(!NetPlay.bComms) // force skirmish if no comms.
{
Expand Down

0 comments on commit fd2843e

Please sign in to comment.