Skip to content

Commit

Permalink
Use the host's SP color as the default color when hosting games. (che…
Browse files Browse the repository at this point in the history
…rry picked from commit 09ea0be)

Conflicts:

	lib/netplay/netplay.c
  • Loading branch information
buginator committed Dec 7, 2010
1 parent 011546e commit 0049223
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions lib/netplay/netplay.c
Expand Up @@ -49,6 +49,7 @@
#include "src/multijoin.h"
#include "src/multiint.h"
#include "src/multiplay.h"
#include "src/warzoneconfig.h"

#ifdef WZ_OS_LINUX
#include <execinfo.h> // Nonfatal runtime backtraces.
Expand Down Expand Up @@ -297,6 +298,11 @@ 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
9 changes: 7 additions & 2 deletions src/multiint.c
Expand Up @@ -1645,7 +1645,7 @@ static BOOL changePosition(UBYTE player, UBYTE position)
return false;
}

static BOOL changeColour(UBYTE player, UBYTE col)
BOOL changeColour(UBYTE player, UBYTE col)
{
int i;

Expand Down Expand Up @@ -3241,11 +3241,16 @@ BOOL startMultiOptions(BOOL bReenter)
{
teamChooserUp = -1;
allowChangePosition = true;
for(i=0;i<MAX_PLAYERS;i++)
for(i=0; i < MAX_PLAYERS; i++)
{
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
2 changes: 1 addition & 1 deletion src/multiint.h
Expand Up @@ -49,7 +49,7 @@ extern BOOL startMultiOptions (BOOL bReenter);
extern void frontendMultiMessages (void);

extern BOOL addMultiBut(W_SCREEN *screen, UDWORD formid, UDWORD id, UDWORD x, UDWORD y, UDWORD width, UDWORD height, const char* tipres, UDWORD norm, UDWORD down, UDWORD hi);

extern BOOL changeColour(UBYTE player, UBYTE col);
extern char sPlayer[128];

void kickPlayer(uint32_t player_id, const char *reason, LOBBY_ERROR_TYPES type);
Expand Down

0 comments on commit 0049223

Please sign in to comment.