Cleanup bot code (server related)
This commit is contained in:
@@ -44,7 +44,6 @@
|
||||
#include "bot_util.h"
|
||||
#include "bot_waypoint.h"
|
||||
|
||||
extern bool dedserv;
|
||||
extern itemstat itemstats[];
|
||||
|
||||
#ifdef RELEASE_BUILD
|
||||
@@ -54,7 +53,7 @@ inline void debugbeam(vec &s, vec &e) { }
|
||||
#else
|
||||
inline void condebug(const char *s, int a = 0, int b = 0, int c = 0) { /*conoutf(s, a, b, c);*/ }
|
||||
inline void debugnav(const char *s, int a = 0, int b = 0, int c = 0) { /*conoutf(s, a, b, c);*/ }
|
||||
inline void debugbeam(vec &s, vec &e) { /*if (!dedserv) particle_trail(1, 500, s, e);*/ }
|
||||
inline void debugbeam(vec &s, vec &e) { /*particle_trail(1, 500, s, e);*/ }
|
||||
#endif
|
||||
|
||||
#define JUMP_HEIGHT 4.0f // NOT accurate
|
||||
|
||||
@@ -129,10 +129,10 @@ bool CBot::FindEnemy(void)
|
||||
float flDist, flNearestDist = 99999.9f;
|
||||
short EnemyVal, BestEnemyVal = -100;
|
||||
|
||||
// First loop through all players
|
||||
loopv(players)
|
||||
// First loop through all bots
|
||||
loopv(bots)
|
||||
{
|
||||
d = players[i]; // Handy shortcut
|
||||
d = bots[i]; // Handy shortcut
|
||||
|
||||
if (d == m_pMyEnt || !d || isteam(d->team, m_pMyEnt->team) || (d->state != CS_ALIVE))
|
||||
continue;
|
||||
@@ -239,10 +239,10 @@ bool CBot::CheckHunt(void)
|
||||
short EnemyVal, BestEnemyVal = -100;
|
||||
vec BestOldPos;
|
||||
|
||||
// First loop through all players
|
||||
loopv(players)
|
||||
// First loop through all bots
|
||||
loopv(bots)
|
||||
{
|
||||
d = players[i]; // Handy shortcut
|
||||
d = bots[i]; // Handy shortcut
|
||||
|
||||
if (d == m_pMyEnt || !d || isteam(d->team, m_pMyEnt->team) || (d->state != CS_ALIVE))
|
||||
continue;
|
||||
@@ -1953,10 +1953,10 @@ void CBot::HearSound(int n, vec *o)
|
||||
float flDist, flNearestDist = 3.0f; // Range of 3 units
|
||||
playerent *pNearest = NULL;
|
||||
|
||||
// Check all players first
|
||||
loopv(players)
|
||||
// Check all bots first
|
||||
loopv(bots)
|
||||
{
|
||||
playerent *d = players[i];
|
||||
playerent *d = bots[i];
|
||||
|
||||
if (d == m_pMyEnt || !d || (d->state != CS_ALIVE) ||
|
||||
isteam(m_pMyEnt->team, d->team))
|
||||
|
||||
@@ -208,11 +208,11 @@ void TraceLine(vec from, vec to, dynent *pTracer, bool CheckPlayers, traceresult
|
||||
|
||||
if (CheckPlayers)
|
||||
{
|
||||
// Check if the 'line' collides with players
|
||||
loopv(players)
|
||||
// Check if the 'line' collides with bots
|
||||
loopv(bots)
|
||||
{
|
||||
playerent *d = players[i];
|
||||
if(!d || (d==pTracer) || (d->state != CS_ALIVE)) continue; // Only check valid players
|
||||
playerent *d = bots[i];
|
||||
if(!d || (d==pTracer) || (d->state != CS_ALIVE)) continue; // Only check valid bots
|
||||
|
||||
flDist = GetDistance(from, d->o);
|
||||
|
||||
@@ -476,15 +476,6 @@ bool IsInGame(dynent *d)
|
||||
{
|
||||
if (d == player1)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
loopv(players)
|
||||
{
|
||||
if (!players[i]) continue;
|
||||
if (players[i] == d)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -544,8 +544,6 @@ void CWaypointClass::SaveWPExpFile()
|
||||
|
||||
void CWaypointClass::Think()
|
||||
{
|
||||
if (dedserv) return;
|
||||
|
||||
#ifdef WP_FLOOD
|
||||
FloodThink();
|
||||
#endif
|
||||
|
||||
@@ -13,9 +13,6 @@
|
||||
#include "cube.h"
|
||||
#include "bot.h"
|
||||
|
||||
bool dedserv = false;
|
||||
#define CS_DEDHOST 0xFF
|
||||
|
||||
extern void respawnself();
|
||||
|
||||
CBotManager BotManager;
|
||||
@@ -74,13 +71,6 @@ void CBotManager::Think()
|
||||
}
|
||||
m_fReAddBotDelay = -1.0f;
|
||||
}
|
||||
// If this is a ded server check if there are any players, if not bots should be idle
|
||||
if (dedserv)
|
||||
{
|
||||
bool botsbeidle = true;
|
||||
loopv(players) { if (players[i] && (players[i]->state != CS_DEDHOST)) { botsbeidle = false; break; } }
|
||||
if (botsbeidle) return;
|
||||
}
|
||||
// Let all bots 'think'
|
||||
loopv(bots)
|
||||
{
|
||||
@@ -168,20 +158,13 @@ const char *CBotManager::GetBotName()
|
||||
{
|
||||
ChoiceVal = 50;
|
||||
|
||||
loopv(players)
|
||||
{
|
||||
if (players[i] && (players[i]->state != CS_DEDHOST) &&
|
||||
!strcasecmp(players[i]->name, m_szBotNames[j]))
|
||||
ChoiceVal -= 10;
|
||||
}
|
||||
|
||||
loopv(bots)
|
||||
{
|
||||
if (bots[i] && (!strcasecmp(bots[i]->name, m_szBotNames[j])))
|
||||
ChoiceVal -= 10;
|
||||
}
|
||||
|
||||
if ((player1->state != CS_DEDHOST) && !strcasecmp(player1->name, m_szBotNames[j]))
|
||||
if (!strcasecmp(player1->name, m_szBotNames[j]))
|
||||
ChoiceVal -= 10;
|
||||
|
||||
if (ChoiceVal <= 0)
|
||||
@@ -258,9 +241,9 @@ const char *CBotManager::GetBotTeam()
|
||||
{
|
||||
teamsize[player1->team]++;
|
||||
}
|
||||
loopv(players) if(players[i] && team_isactive(players[i]->team))
|
||||
loopv(bots) if(bots[i] && team_isactive(bots[i]->team))
|
||||
{
|
||||
teamsize[players[i]->team]++;
|
||||
teamsize[bots[i]->team]++;
|
||||
}
|
||||
biggestTeam = teamsize[1] > teamsize[0];
|
||||
return teamnames[biggestTeam ^ 1];
|
||||
@@ -275,12 +258,6 @@ const char *CBotManager::GetBotTeam()
|
||||
{
|
||||
ChoiceVal = 50;
|
||||
/* UNDONE?
|
||||
loopv(players)
|
||||
{
|
||||
if (players[i] && (!strcasecmp(players[i]->name, m_szBotNames[j])))
|
||||
ChoiceVal -= 10;
|
||||
}
|
||||
|
||||
loopv(bots)
|
||||
{
|
||||
if (bots[i] && (!strcasecmp(bots[i]->name, m_szBotNames[j])))
|
||||
|
||||
Reference in New Issue
Block a user