Skip to content

Commit

Permalink
Use the host's SP color as the default color when hosting games.
Browse files Browse the repository at this point in the history
  • Loading branch information
buginator committed Nov 2, 2010
1 parent 92256b2 commit 09ea0be
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 @@ -46,6 +46,7 @@
#include "src/multijoin.h"
#include "src/multiint.h"
#include "src/multiplay.h"
#include "src/warzoneconfig.h"

#if defined(WZ_OS_UNIX)
# include <arpa/inet.h>
Expand Down Expand Up @@ -1511,6 +1512,11 @@ 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
9 changes: 7 additions & 2 deletions src/multiint.c
Expand Up @@ -1682,7 +1682,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 @@ -3343,11 +3343,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 @@ -44,7 +44,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 09ea0be

Please sign in to comment.