Skip to content

Commit 09ea0be

Browse files
committed
Use the host's SP color as the default color when hosting games.
1 parent 92256b2 commit 09ea0be

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

lib/netplay/netplay.c

+6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "src/multijoin.h"
4747
#include "src/multiint.h"
4848
#include "src/multiplay.h"
49+
#include "src/warzoneconfig.h"
4950

5051
#if defined(WZ_OS_UNIX)
5152
# include <arpa/inet.h>
@@ -1511,6 +1512,11 @@ void NET_InitPlayers()
15111512
{
15121513
NET_InitPlayer(i, true);
15131514
}
1515+
// Now switch player color of the host to what they normally use for SP games
1516+
if ( getPlayerColour(NET_HOST_ONLY) != war_GetSPcolor())
1517+
{
1518+
changeColour(NET_HOST_ONLY, war_GetSPcolor());
1519+
}
15141520
NetPlay.hostPlayer = NET_HOST_ONLY; // right now, host starts always at index zero
15151521
NetPlay.playercount = 0;
15161522
NetPlay.pMapFileHandle = NULL;

src/multiint.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,7 @@ static BOOL changePosition(UBYTE player, UBYTE position)
16821682
return false;
16831683
}
16841684

1685-
static BOOL changeColour(UBYTE player, UBYTE col)
1685+
BOOL changeColour(UBYTE player, UBYTE col)
16861686
{
16871687
int i;
16881688

@@ -3343,11 +3343,16 @@ BOOL startMultiOptions(BOOL bReenter)
33433343
{
33443344
teamChooserUp = -1;
33453345
allowChangePosition = true;
3346-
for(i=0;i<MAX_PLAYERS;i++)
3346+
for(i=0; i < MAX_PLAYERS; i++)
33473347
{
33483348
game.skDiff[i] = (DIFF_SLIDER_STOPS / 2); // reset AI (turn it on again)
33493349
setPlayerColour(i,i); //reset all colors as well
33503350
}
3351+
// Now switch player color of the host to what they normally use
3352+
if (getPlayerColour(NET_HOST_ONLY) != war_GetSPcolor())
3353+
{
3354+
changeColour(NET_HOST_ONLY, war_GetSPcolor());
3355+
}
33513356

33523357
if(!NetPlay.bComms) // force skirmish if no comms.
33533358
{

src/multiint.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ extern BOOL startMultiOptions (BOOL bReenter);
4444
extern void frontendMultiMessages (void);
4545

4646
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);
47-
47+
extern BOOL changeColour(UBYTE player, UBYTE col);
4848
extern char sPlayer[128];
4949

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

0 commit comments

Comments
 (0)