Skip to content

Commit

Permalink
Fix bug introduced in 09ea0be Changelog: Fix kicking of non-hosts who…
Browse files Browse the repository at this point in the history
… didn't have default color values.

Only change colors if you are the host on the setup screen.
Fixes ticket:2329
(cherry picked from commit fd2843e)

Conflicts:

	lib/netplay/netplay.c
  • Loading branch information
buginator committed Dec 7, 2010
1 parent 0049223 commit 00c92cb
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
Expand Up @@ -298,11 +298,7 @@ void NET_InitPlayers()
NETinitQueue(NETnetQueue(i));
}
NETinitQueue(NETbroadcastQueue());
// 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 @@ -342,6 +338,8 @@ static void NETSendPlayerInfoTo(uint32_t index, unsigned to)
static void NETSendAllPlayerInfoTo(unsigned 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 @@ -2436,6 +2434,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 @@ -2507,6 +2510,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
Expand Up @@ -3246,11 +3246,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 00c92cb

Please sign in to comment.