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

@ -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;
}