added compile-time support for up to 64 maxplayers

This commit is contained in:
jeefo 2016-03-10 00:37:33 +03:00
commit 5ff6b9ecde
8 changed files with 28 additions and 13 deletions

View file

@ -552,6 +552,7 @@ const int MAX_WAYPOINTS = 1024;
const int MAX_WEAPONS = 32;
const int NUM_WEAPONS = 26;
const int MAX_COLLIDE_MOVES = 3;
const int MAX_ENGINE_PLAYERS = 32; // we can have 64 players with xash
// weapon masks
const int WEAPON_PRIMARY = ((1 << WEAPON_XM1014) | (1 <<WEAPON_M3) | (1 << WEAPON_MAC10) | (1 << WEAPON_UMP45) | (1 << WEAPON_MP5) | (1 << WEAPON_TMP) | (1 << WEAPON_P90) | (1 << WEAPON_AUG) | (1 << WEAPON_M4A1) | (1 << WEAPON_SG552) | (1 << WEAPON_AK47) | (1 << WEAPON_SCOUT) | (1 << WEAPON_SG550) | (1 << WEAPON_AWP) | (1 << WEAPON_G3SG1) | (1 << WEAPON_M249) | (1 << WEAPON_FAMAS) | (1 << WEAPON_GALIL));
@ -1258,7 +1259,7 @@ class BotManager
private:
Array <CreateQueue> m_creationTab; // bot creation tab
Bot *m_bots[32]; // all available bots
Bot *m_bots[MAX_ENGINE_PLAYERS]; // all available bots
float m_maintainTime; // time to maintain bot creation
float m_quotaMaintainTime; // time to maintain bot quota

View file

@ -185,7 +185,7 @@ public:
inline int GetTeam (edict_t *ent)
{
extern Client g_clients[32];
extern Client g_clients[MAX_ENGINE_PLAYERS];
#ifndef XASH_CSDM
return g_clients[IndexOfEntity (ent) - 1].team;

View file

@ -48,7 +48,7 @@ extern int g_rusherWeaponPrefs[NUM_WEAPONS];
extern int g_carefulWeaponPrefs[NUM_WEAPONS];
extern int g_grenadeBuyPrecent[NUM_WEAPONS - 23];
extern int g_botBuyEconomyTable[NUM_WEAPONS - 15];
extern int g_radioSelect[32];
extern int g_radioSelect[MAX_ENGINE_PLAYERS];
extern int g_lastRadio[2];
extern int g_storeAddbotVars[4];
extern int *g_weaponPrefs[];
@ -62,7 +62,7 @@ extern RandomSequenceOfUnique Random;
extern WeaponSelect g_weaponSelect[NUM_WEAPONS + 1];
extern WeaponProperty g_weaponDefs[MAX_WEAPONS + 1];
extern Client g_clients[32];
extern Client g_clients[MAX_ENGINE_PLAYERS];
extern MenuText g_menus[21];
extern TaskItem g_taskFilters[];

View file

@ -37,7 +37,7 @@ float g_autoPathDistance = 250.0f;
int g_lastRadio[2];
int g_storeAddbotVars[4];
int g_radioSelect[32];
int g_radioSelect[MAX_ENGINE_PLAYERS];
int g_gameFlags = 0;
int g_numWaypoints = 0;
int g_mapType = 0;
@ -65,7 +65,7 @@ BlendAPI_t g_serverBlendingAPI = NULL;
FuncPointers_t g_funcPointers = NULL;
enginefuncs_t g_engfuncs;
Client g_clients[32];
Client g_clients[MAX_ENGINE_PLAYERS];
WeaponProperty g_weaponDefs[MAX_WEAPONS + 1];
edict_t *g_hostEntity = NULL;

View file

@ -1,4 +1,4 @@
//
//
// Yet Another POD-Bot, based on PODBot by Markus Klinge ("CountFloyd").
// Copyright (c) YaPB Development Team.
//
@ -1164,7 +1164,7 @@ void ClientDisconnect (edict_t *ent)
int i = engine.IndexOfEntity (ent) - 1;
InternalAssert (i >= 0 && i < 32);
InternalAssert (i >= 0 && i < MAX_ENGINE_PLAYERS);
Bot *bot = bots.GetBot (i);

View file

@ -202,7 +202,7 @@ int BotManager::CreateBot (const String &name, int difficulty, int personality,
}
int index = engine.IndexOfEntity (bot) - 1;
InternalAssert (index >= 0 && index <= 32); // check index
InternalAssert (index >= 0 && index <= MAX_ENGINE_PLAYERS); // check index
InternalAssert (m_bots[index] == NULL); // check bot slot
m_bots[index] = new Bot (bot, difficulty, personality, team, member, steamId);
@ -223,7 +223,7 @@ int BotManager::GetIndex (edict_t *ent)
int index = engine.IndexOfEntity (ent) - 1;
if (index < 0 || index >= 32)
if (index < 0 || index >= MAX_ENGINE_PLAYERS)
return -1;
if (m_bots[index] != NULL)
@ -236,7 +236,7 @@ Bot *BotManager::GetBot (int index)
{
// this function finds a bot specified by index, and then returns pointer to it (using own bot array)
if (index < 0 || index >= 32)
if (index < 0 || index >= MAX_ENGINE_PLAYERS)
return NULL;
if (m_bots[index] != NULL)
@ -830,7 +830,7 @@ void BotManager::Free (void)
{
// this function free all bots slots (used on server shutdown)
for (int i = 0; i < 32; i++)
for (int i = 0; i < MAX_ENGINE_PLAYERS; i++)
Free (i);
}

View file

@ -30,6 +30,10 @@ int Bot::FindGoal (void)
break;
}
}
// forcing terrorist bot to not move to another bombspot
if (m_inBombZone && !m_hasProgressBar && m_hasC4)
return waypoints.FindNearest (pev->origin, 400.0f, FLAG_GOAL);
}
int tactic = 0;

View file

@ -1052,7 +1052,7 @@ void Waypoint::InitTypes (void)
bool Waypoint::Load (void)
{
MemoryFile fp (CheckSubfolderFile ());
File fp (CheckSubfolderFile (), "rb");
WaypointHeader header;
memset (&header, 0, sizeof (header));
@ -1118,6 +1118,16 @@ bool Waypoint::Load (void)
fp.Close ();
return false;
}
// more checks of waypoint quality
if (m_paths[i]->pathNumber < 0 || m_paths[i]->pathNumber > g_numWaypoints)
{
sprintf (m_infoBuffer, "%s.pwf - bad waypoint file (path #%d index is out of bounds)", map, i);
AddLogEntry (true, LL_ERROR, m_infoBuffer);
fp.Close ();
return false;
}
}
m_waypointPaths = true;
}