Fix bug introduced in 09ea0be7c30236809536db332be78b2967d3114d 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
(cherry picked from commit fd2843e6431e43cc72b635c422fd18bb19d42c47)

Conflicts:

	lib/netplay/netplay.c
master
buginator 2010-12-05 20:16:12 -05:00
parent 0049223ccb
commit 00c92cbdd7
2 changed files with 14 additions and 10 deletions

View File

@ -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;
@ -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);
}
@ -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;
}
@ -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);

View File

@ -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.
{