Use more of MAX_PLAYERS in the code rather than plain numbers. Define MAX_PLAYERS for scripts. From patch by Cyp.

master
Per Inge Mathisen 2011-01-05 23:09:38 +01:00
parent 6a99f44265
commit 7f5da6ad47
9 changed files with 10 additions and 25 deletions

View File

@ -30,7 +30,6 @@
// Base threat range in world units
#define W_BASE_THREAT_RANGE ((17 + (mapWidth + mapHeight) / 2 / 35) * TILE)
#define ALL_ALLIES -1
#define MAX_PLAYERS 8
#define BASE_DEFEND_DURATION (3 * 60)
#define BASE_DEFEND_RADIUS (15 * TILE)

View File

@ -62,7 +62,7 @@ event initialisedEvent(CALL_GAMEINIT)
addReticuleButton(DESIGN);
playnum = 0;
while (playnum < 8)
while (playnum < MAX_PLAYERS)
{
enableStructure(command ,playnum); //make structures available to build
enableStructure(factory ,playnum);
@ -86,7 +86,7 @@ event initialisedEvent(CALL_GAMEINIT)
event initialisedEventTwo(CALL_GAMEINIT)
{
playnum = 0;
while (playnum < 8)
while (playnum < MAX_PLAYERS)
{
count = 0;
while (count < numBaseRes)

View File

@ -101,7 +101,6 @@ Improve the way the units are gathered. dyDo should be abale to attack from vari
#define EVENT_CHECK_NUMBER 23
#define NUM_AI_PERSONALITIES 4
#define MAX_PLAYERS 8
#define TILE 128
#define MAX_DROIDS 150

View File

@ -30,7 +30,6 @@
// Base threat range in world units
#define W_BASE_THREAT_RANGE ((17 + (mapWidth + mapHeight) / 2 / 35) * TILE)
#define ALL_ALLIES -1
#define MAX_PLAYERS 8
#define BASE_DEFEND_DURATION (3 * 60)
#define BASE_DEFEND_RADIUS (15 * TILE)

View File

@ -136,7 +136,7 @@ typedef enum
#define SESSION_JOINDISABLED 1
#define MAX_CONNECTED_PLAYERS 8
#define MAX_CONNECTED_PLAYERS MAX_PLAYERS
#define MAX_TMP_SOCKETS 16
typedef struct { //Available game storage... JUST FOR REFERENCE!

View File

@ -638,7 +638,7 @@ void missionFlyTransportersIn( SDWORD iPlayer, BOOL bTrackTransporter )
UWORD iX, iY, iZ;
SDWORD iLandX, iLandY, iDx, iDy;
ASSERT_OR_RETURN(, iPlayer < 8, "Flying nonexistent player %d's transporters in", iPlayer);
ASSERT_OR_RETURN(, iPlayer < MAX_PLAYERS, "Flying nonexistent player %d's transporters in", iPlayer);
bTrackingTransporter = bTrackTransporter;

View File

@ -34,8 +34,8 @@
* The number of areas that can be defined to prevent buildings being placed -
* used for Transporter Landing Zones 0-7 are for players, 8 = LIMBO_LANDING
*/
#define MAX_NOGO_AREAS 9
#define LIMBO_LANDING 8
#define MAX_NOGO_AREAS (MAX_PLAYERS + 1)
#define LIMBO_LANDING MAX_PLAYERS
/** Set by scrFlyInTransporter. True if were currenly tracking the transporter. */
extern BOOL bTrackingTransporter;

View File

@ -2004,6 +2004,8 @@ CONST_SYMBOL asConstantTable[] =
// multiplayer
{ "MAX_PLAYERS", VAL_INT, false, MAX_PLAYERS, NULL, NULL, 0.0f },
{ "CAMPAIGN", VAL_INT, false, CAMPAIGN, NULL, NULL, 0.0f },
{ "SKIRMISH", VAL_INT, false, SKIRMISH, NULL, NULL, 0.0f },

View File

@ -2543,9 +2543,6 @@ static bool IsFactoryCommanderGroupFull(const FACTORY* psFactory)
// Disallow manufacture of units once these limits are reached,
// doesn't mean that these numbers can't be exceeded if units are
// put down in the editor or by the scripts.
static UWORD MaxDroidsAllowedPerPlayer[MAX_PLAYERS] = {100, 999, 999, 999, 999, 999, 999, 999};
// FIXME: We should have this variable user defined.
static UWORD MaxDroidsAllowedPerPlayerMultiPlayer[MAX_PLAYERS] = {450, 450, 450, 450, 450, 450, 450, 450};
BOOL IsPlayerStructureLimitReached(UDWORD PlayerNumber)
{
@ -2556,7 +2553,7 @@ BOOL IsPlayerStructureLimitReached(UDWORD PlayerNumber)
UDWORD getMaxDroids(UDWORD PlayerNumber)
{
return (bMultiPlayer ? MaxDroidsAllowedPerPlayerMultiPlayer[PlayerNumber] : MaxDroidsAllowedPerPlayer[PlayerNumber] );
return bMultiPlayer? 450 : PlayerNumber == 0? 100 : 999;
}
@ -2565,18 +2562,7 @@ BOOL IsPlayerDroidLimitReached(UDWORD PlayerNumber)
{
unsigned int numDroids = getNumDroids(PlayerNumber) + getNumMissionDroids(PlayerNumber) + getNumTransporterDroids(PlayerNumber);
if (bMultiPlayer)
{
if ( numDroids >= MaxDroidsAllowedPerPlayerMultiPlayer[PlayerNumber] )
return true;
}
else
{
if( numDroids >= MaxDroidsAllowedPerPlayer[PlayerNumber] )
return true;
}
return false;
return numDroids >= getMaxDroids(PlayerNumber);
}