Display no-tank, no-cyborg or no-VTOL icons if the relevant factories are disabled.
Using random icons for now, until the right icons are drawn.master
parent
2c23ee1b0c
commit
d30e97f54e
|
@ -1091,6 +1091,39 @@ static void addBlueForm(UDWORD parent,UDWORD id, const char *txt,UDWORD x,UDWORD
|
|||
}
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char const *stat;
|
||||
char const *desc;
|
||||
int icon;
|
||||
} LimitIcon;
|
||||
static const LimitIcon limitIcons[] =
|
||||
{
|
||||
{"A0LightFactory", N_("Tanks disabled!!"), IMAGE_FRAGLIMIT},
|
||||
{"A0CyborgFactory", N_("Cyborgs disabled."), IMAGE_FRAGLIMIT},
|
||||
{"A0VTolFactory1", N_("VTOLs disabled."), IMAGE_FRAGLIMIT}
|
||||
};
|
||||
|
||||
void updateLimitFlags()
|
||||
{
|
||||
unsigned i;
|
||||
unsigned flags = 0;
|
||||
|
||||
if (!ingame.bHostSetup)
|
||||
{
|
||||
return; // The host works out the flags.
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(limitIcons); ++i)
|
||||
{
|
||||
int stat = getStructStatFromName(limitIcons[i].stat);
|
||||
bool disabled = asStructLimits[0] != NULL && stat >= 0 && asStructLimits[0][stat].limit == 0;
|
||||
flags |= disabled<<i;
|
||||
}
|
||||
|
||||
ingame.flags = flags;
|
||||
}
|
||||
|
||||
// FIX ME: bRedo is not used anymore since the removal of the forced screenClearFocus()
|
||||
// need to check for side effects.
|
||||
static void addGameOptions(BOOL bRedo)
|
||||
|
@ -1333,7 +1366,22 @@ static void addGameOptions(BOOL bRedo)
|
|||
IMAGE_SLIM, IMAGE_SLIM_HI, IMAGE_SLIM_HI);
|
||||
}
|
||||
|
||||
return;
|
||||
// Add any relevant factory disabled icons.
|
||||
updateLimitFlags();
|
||||
{
|
||||
int i;
|
||||
int y = MULTIOP_NO_SOMETHINGY;
|
||||
for (i = 0; i < ARRAY_SIZE(limitIcons); ++i)
|
||||
{
|
||||
if ((ingame.flags & 1<<i) != 0)
|
||||
{
|
||||
addMultiBut(psWScreen, MULTIOP_OPTIONS, MULTIOP_NO_SOMETHING + i, MULTIOP_NO_SOMETHINGX, y,
|
||||
35, 28, _(limitIcons[i].desc),
|
||||
limitIcons[i].icon, limitIcons[i].icon, limitIcons[i].icon);
|
||||
y += 28 + 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -42,6 +42,8 @@ extern void intProcessConnection (UDWORD id);
|
|||
extern void runGameFind (void);
|
||||
extern void startGameFind (void);
|
||||
|
||||
void updateLimitFlags(void);
|
||||
|
||||
extern void runMultiOptions (void);
|
||||
extern BOOL startMultiOptions (BOOL bReenter);
|
||||
extern void frontendMultiMessages (void);
|
||||
|
@ -266,6 +268,10 @@ void loadMapPreview(bool hideInterface);
|
|||
#define MULTIOP_PASSWORD_BUT 920012
|
||||
#define MULTIOP_PASSWORD_EDIT 920013
|
||||
|
||||
#define MULTIOP_NO_SOMETHING 10331 // Up to 10340 reserved for future use.
|
||||
#define MULTIOP_NO_SOMETHINGX 5
|
||||
#define MULTIOP_NO_SOMETHINGY MROW5+5
|
||||
|
||||
// ///////////////////////////////
|
||||
// Many Button Variations..
|
||||
|
||||
|
|
|
@ -113,6 +113,8 @@ void sendOptions()
|
|||
NETuint8_t(&ingame.pStructureLimits[i].id);
|
||||
NETuint8_t(&ingame.pStructureLimits[i].limit);
|
||||
}
|
||||
updateLimitFlags();
|
||||
NETuint8_t(&ingame.flags);
|
||||
|
||||
NETend();
|
||||
}
|
||||
|
@ -201,6 +203,7 @@ void recvOptions(NETQUEUE queue)
|
|||
NETuint8_t(&ingame.pStructureLimits[i].id);
|
||||
NETuint8_t(&ingame.pStructureLimits[i].limit);
|
||||
}
|
||||
NETuint8_t(&ingame.flags);
|
||||
|
||||
NETend();
|
||||
|
||||
|
@ -630,6 +633,7 @@ BOOL multiGameShutdown(void)
|
|||
free(ingame.pStructureLimits);
|
||||
ingame.pStructureLimits = NULL;
|
||||
}
|
||||
ingame.flags = 0;
|
||||
|
||||
ingame.localJoiningInProgress = false; // Clean up
|
||||
ingame.localOptionsReceived = false;
|
||||
|
|
|
@ -68,6 +68,7 @@ typedef struct {
|
|||
UDWORD startTime;
|
||||
UDWORD numStructureLimits; // number of limits
|
||||
MULTISTRUCTLIMITS *pStructureLimits; // limits chunk.
|
||||
uint8_t flags; ///< Bitmask, shows which structures are disabled.
|
||||
UDWORD skScores[MAX_PLAYERS][2]; // score+kills for local skirmish players.
|
||||
char phrases[5][255]; // 5 favourite text messages.
|
||||
} MULTIPLAYERINGAME;
|
||||
|
|
|
@ -5254,7 +5254,7 @@ SWORD buildFoundation(STRUCTURE *psStruct, UDWORD x, UDWORD y)
|
|||
|
||||
/* gets a structure stat from its name - relies on the name being unique (or it will
|
||||
return the first one it finds!! */
|
||||
SDWORD getStructStatFromName(char *pName)
|
||||
int32_t getStructStatFromName(char const *pName)
|
||||
{
|
||||
UDWORD inc;
|
||||
STRUCTURE_STATS *psStat;
|
||||
|
|
|
@ -176,7 +176,7 @@ extern void initStructLimits(void);
|
|||
/* set the current number of structures of each type built */
|
||||
extern void setCurrentStructQuantity(BOOL displayError);
|
||||
/* get a stat inc based on the name */
|
||||
extern SDWORD getStructStatFromName(char *pName);
|
||||
extern int32_t getStructStatFromName(char const *pName);
|
||||
/*check to see if the structure is 'doing' anything - return true if idle*/
|
||||
extern BOOL structureIdle(STRUCTURE *psBuilding);
|
||||
/*checks to see if any structure exists of a specified type with a specified status */
|
||||
|
|
Loading…
Reference in New Issue