save point, testing needed

This commit is contained in:
Dmitriy 2015-06-11 14:19:52 +03:00
commit f0c35ba9e9
7 changed files with 96 additions and 95 deletions

View file

@ -1049,10 +1049,10 @@ private:
bool OutOfBombTimer (void); bool OutOfBombTimer (void);
void SelectLeaderEachTeam (int team); void SelectLeaderEachTeam (int team);
Vector CheckToss (const Vector &start, Vector end); const Vector &CheckToss (const Vector &start, Vector end);
Vector CheckThrow (const Vector &start, Vector end); const Vector &CheckThrow (const Vector &start, Vector end);
Vector GetAimPosition (void); const Vector &GetAimPosition (void);
Vector CheckBombAudible (void); const Vector &CheckBombAudible (void);
float GetZOffset (float distance); float GetZOffset (float distance);
@ -1345,7 +1345,8 @@ public:
// grenades // grenades
void UpdateActiveGrenades (void); void UpdateActiveGrenades (void);
const Array <entity_t> GetActiveGrenades (void); const Array <entity_t> &GetActiveGrenades (void);
inline bool HasActiveGrenades (void) inline bool HasActiveGrenades (void)
{ {
return !m_activeGrenades.IsEmpty (); return !m_activeGrenades.IsEmpty ();
@ -1646,7 +1647,7 @@ extern const char *GetField (const char *string, int fieldId, bool endLine = fal
extern const char *FormatBuffer (const char *format, ...); extern const char *FormatBuffer (const char *format, ...);
extern uint16 GenerateBuildNumber (void); extern uint16 GenerateBuildNumber (void);
extern Vector GetEntityOrigin (edict_t *ent); extern const Vector &GetEntityOrigin (edict_t *ent);
extern void FreeLibraryMemory (void); extern void FreeLibraryMemory (void);
extern void RoundInit (void); extern void RoundInit (void);
@ -1660,7 +1661,6 @@ extern void DetectCSVersion (void);
extern void PlaySound (edict_t *ent, const char *soundName); extern void PlaySound (edict_t *ent, const char *soundName);
extern void ServerPrint (const char *format, ...); extern void ServerPrint (const char *format, ...);
extern void ChartPrint (const char *format, ...); extern void ChartPrint (const char *format, ...);
extern void ServerPrintNoTag (const char *format, ...);
extern void CenterPrint (const char *format, ...); extern void CenterPrint (const char *format, ...);
extern void ClientPrint (edict_t *ent, int dest, const char *format, ...); extern void ClientPrint (edict_t *ent, int dest, const char *format, ...);
extern void HudMessage (edict_t *ent, bool toCenter, Vector rgb, char *format, ...); extern void HudMessage (edict_t *ent, bool toCenter, Vector rgb, char *format, ...);

View file

@ -10,10 +10,10 @@
#pragma once #pragma once
// general product information // general product information
#define PRODUCT_NAME "YaPB" #define PRODUCT_NAME "Yet Another POD-Bot"
#define PRODUCT_VERSION "2.7" #define PRODUCT_VERSION "2.7"
#define PRODUCT_AUTHOR "YaPB Dev Team" #define PRODUCT_AUTHOR "YaPB Dev Team"
#define PRODUCT_URL "http://yapb.jeefo.net/" #define PRODUCT_URL "http://yapb.ru/"
#define PRODUCT_EMAIL "dmitry@jeefo.net" #define PRODUCT_EMAIL "dmitry@jeefo.net"
#define PRODUCT_LOGTAG "YAPB" #define PRODUCT_LOGTAG "YAPB"
#define PRODUCT_DESCRIPTION PRODUCT_NAME " v" PRODUCT_VERSION " - The Counter-Strike Bot" #define PRODUCT_DESCRIPTION PRODUCT_NAME " v" PRODUCT_VERSION " - The Counter-Strike Bot"

View file

@ -246,27 +246,23 @@ void Bot::AvoidGrenades (void)
if (!g_botManager->HasActiveGrenades ()) if (!g_botManager->HasActiveGrenades ())
return; return;
edict_t *ent = m_avoidGrenade;
// check if old pointers to grenade is invalid // check if old pointers to grenade is invalid
if (IsEntityNull (ent)) if (IsEntityNull (m_avoidGrenade))
{ {
m_avoidGrenade = NULL; m_avoidGrenade = NULL;
m_needAvoidGrenade = 0; m_needAvoidGrenade = 0;
} }
else if ((ent->v.flags & FL_ONGROUND) || (ent->v.effects & EF_NODRAW)) else if ((m_avoidGrenade->v.flags & FL_ONGROUND) || (m_avoidGrenade->v.effects & EF_NODRAW))
{ {
m_avoidGrenade = NULL; m_avoidGrenade = NULL;
m_needAvoidGrenade = 0; m_needAvoidGrenade = 0;
} }
ent = NULL; Array <entity_t> activeGrenades = g_botManager->GetActiveGrenades ();
// find all grenades on the map // find all grenades on the map
while (!IsEntityNull (ent = FIND_ENTITY_BY_CLASSNAME (ent, "grenade"))) IterateArray (activeGrenades, it)
{ {
// if grenade is invisible don't care for it edict_t *ent = activeGrenades[it];
if (ent->v.effects & EF_NODRAW)
continue;
// check if visible to the bot // check if visible to the bot
if (!EntityIsVisible (ent->v.origin) && InFieldOfView (ent->v.origin - EyePosition ()) > pev->fov / 2) if (!EntityIsVisible (ent->v.origin) && InFieldOfView (ent->v.origin - EyePosition ()) > pev->fov / 2)
@ -277,7 +273,7 @@ void Bot::AvoidGrenades (void)
{ {
const Vector &position = (GetEntityOrigin (ent) - EyePosition ()).ToAngles (); const Vector &position = (GetEntityOrigin (ent) - EyePosition ()).ToAngles ();
// don't look at flashbang // don't look at flash bang
if (!(m_states & STATE_SEEING_ENEMY)) if (!(m_states & STATE_SEEING_ENEMY))
{ {
pev->v_angle.y = AngleNormalize (position.y + 180.0f); pev->v_angle.y = AngleNormalize (position.y + 180.0f);
@ -301,8 +297,8 @@ void Bot::AvoidGrenades (void)
{ {
MakeVectors (pev->v_angle); MakeVectors (pev->v_angle);
Vector dirToPoint = (pev->origin - ent->v.origin).Normalize2D (); const Vector &dirToPoint = (pev->origin - ent->v.origin).Normalize2D ();
Vector rightSide = g_pGlobals->v_right.Normalize2D (); const Vector &rightSide = g_pGlobals->v_right.Normalize2D ();
if ((dirToPoint | rightSide) > 0) if ((dirToPoint | rightSide) > 0)
m_needAvoidGrenade = -1; m_needAvoidGrenade = -1;
@ -321,21 +317,25 @@ bool Bot::IsBehindSmokeClouds (edict_t *ent)
if (!g_botManager->HasActiveGrenades ()) if (!g_botManager->HasActiveGrenades ())
return false; return false;
edict_t *pentGrenade = NULL; const Vector &betweenUs = (ent->v.origin - pev->origin).Normalize ();
Vector betweenUs = (ent->v.origin - pev->origin).Normalize (); Array <entity_t> activeGrenades = g_botManager->GetActiveGrenades ();
while (!IsEntityNull (pentGrenade = FIND_ENTITY_BY_CLASSNAME (pentGrenade, "grenade"))) // find all grenades on the map
IterateArray (activeGrenades, it)
{ {
edict_t *pentGrenade = activeGrenades[it];
// if grenade is invisible don't care for it // if grenade is invisible don't care for it
if ((pentGrenade->v.effects & EF_NODRAW) || !(pentGrenade->v.flags & (FL_ONGROUND | FL_PARTIALGROUND)) || strcmp (STRING (pentGrenade->v.model) + 9, "smokegrenade.mdl")) if (!(pentGrenade->v.flags & (FL_ONGROUND | FL_PARTIALGROUND)) || strcmp (STRING (pentGrenade->v.model) + 9, "smokegrenade.mdl"))
continue; continue;
// check if visible to the bot // check if visible to the bot
if (!EntityIsVisible (ent->v.origin) && InFieldOfView (ent->v.origin - EyePosition ()) > pev->fov / 3) if (!EntityIsVisible (ent->v.origin) && InFieldOfView (ent->v.origin - EyePosition ()) > pev->fov / 3)
continue; continue;
Vector betweenNade = (GetEntityOrigin (pentGrenade) - pev->origin).Normalize (); const Vector &entityOrigin = GetEntityOrigin (pentGrenade);
Vector betweenResult = ((Vector (betweenNade.y, betweenNade.x, 0) * 150.0 + GetEntityOrigin (pentGrenade)) - pev->origin).Normalize (); const Vector &betweenNade = (entityOrigin - pev->origin).Normalize ();
const Vector &betweenResult = ((Vector (betweenNade.y, betweenNade.x, 0) * 150.0 + entityOrigin) - pev->origin).Normalize ();
if ((betweenNade | betweenUs) > (betweenNade | betweenResult)) if ((betweenNade | betweenUs) > (betweenNade | betweenResult))
return true; return true;
@ -533,26 +533,29 @@ void Bot::FindItem (void)
bool allowPickup = false; bool allowPickup = false;
float distance, minDistance = 341.0; float distance, minDistance = 341.0;
const float searchRadius = 340.0f;
if (!IsEntityNull (m_pickupItem)) if (!IsEntityNull (m_pickupItem))
{ {
bool itemExists = false; bool itemExists = false;
pickupItem = m_pickupItem; pickupItem = m_pickupItem;
while (!IsEntityNull (ent = FIND_ENTITY_IN_SPHERE (ent, pev->origin, 340.0))) while (!IsEntityNull (ent = FIND_ENTITY_IN_SPHERE (ent, pev->origin, searchRadius)))
{ {
if ((ent->v.effects & EF_NODRAW) || IsValidPlayer (ent->v.owner)) if ((ent->v.effects & EF_NODRAW) || IsValidPlayer (ent->v.owner))
continue; // someone owns this weapon or it hasn't respawned yet continue; // someone owns this weapon or it hasn't re spawned yet
if (ent == pickupItem) if (ent == pickupItem)
{ {
if (ItemIsVisible (GetEntityOrigin (ent), const_cast <char *> (STRING (ent->v.classname)))) if (ItemIsVisible (GetEntityOrigin (ent), const_cast <char *> (STRING (ent->v.classname))))
itemExists = true; itemExists = true;
break; break;
} }
} }
if (itemExists) if (itemExists)
return; return;
else else
{ {
m_pickupItem = NULL; m_pickupItem = NULL;
@ -571,7 +574,7 @@ void Bot::FindItem (void)
m_pickupItem = NULL; m_pickupItem = NULL;
m_pickupType = PICKUP_NONE; m_pickupType = PICKUP_NONE;
while (!IsEntityNull (ent = FIND_ENTITY_IN_SPHERE (ent, pev->origin, 340.0))) while (!IsEntityNull (ent = FIND_ENTITY_IN_SPHERE (ent, pev->origin, searchRadius)))
{ {
allowPickup = false; // assume can't use it until known otherwise allowPickup = false; // assume can't use it until known otherwise
@ -665,7 +668,7 @@ void Bot::FindItem (void)
if (pickupType == PICKUP_DROPPED_C4) if (pickupType == PICKUP_DROPPED_C4)
{ {
allowPickup = true; allowPickup = true;
m_destOrigin = entityOrigin; // ensure we reached droped bomb m_destOrigin = entityOrigin; // ensure we reached dropped bomb
ChatterMessage (Chatter_FoundC4); // play info about that ChatterMessage (Chatter_FoundC4); // play info about that
DeleteSearchNodes (); DeleteSearchNodes ();
@ -855,7 +858,7 @@ void Bot::GetCampDirection (Vector *dest)
// mostly used for getting a good camping direction vector if not camping on a camp waypoint // mostly used for getting a good camping direction vector if not camping on a camp waypoint
TraceResult tr; TraceResult tr;
Vector src = EyePosition (); const Vector &src = EyePosition ();
TraceLine (src, *dest, true, GetEntity (), &tr); TraceLine (src, *dest, true, GetEntity (), &tr);
@ -1897,7 +1900,7 @@ void Bot::SetConditions (void)
if (allowThrowing && m_seeEnemyTime + 2.0 < GetWorldTime ()) if (allowThrowing && m_seeEnemyTime + 2.0 < GetWorldTime ())
{ {
Vector enemyPredict = ((m_lastEnemy->v.velocity * 0.5).SkipZ () + m_lastEnemy->v.origin); const Vector &enemyPredict = ((m_lastEnemy->v.velocity * 0.5).SkipZ () + m_lastEnemy->v.origin);
int searchTab[4], count = 4; int searchTab[4], count = 4;
float searchRadius = m_lastEnemy->v.velocity.GetLength2D (); float searchRadius = m_lastEnemy->v.velocity.GetLength2D ();
@ -3007,7 +3010,7 @@ void Bot::ChooseAimDirection (void)
{ {
if ((g_experienceData + (index * g_numWaypoints) + index)->team0DangerIndex != -1) if ((g_experienceData + (index * g_numWaypoints) + index)->team0DangerIndex != -1)
{ {
Vector dest = g_waypoint->GetPath ((g_experienceData + (index * g_numWaypoints) + index)->team0DangerIndex)->origin; const Vector &dest = g_waypoint->GetPath ((g_experienceData + (index * g_numWaypoints) + index)->team0DangerIndex)->origin;
TraceLine (pev->origin, dest, true, GetEntity (), &tr); TraceLine (pev->origin, dest, true, GetEntity (), &tr);
if (tr.flFraction > 0.8 || tr.pHit != g_worldEdict) if (tr.flFraction > 0.8 || tr.pHit != g_worldEdict)
@ -3018,7 +3021,7 @@ void Bot::ChooseAimDirection (void)
{ {
if ((g_experienceData + (index * g_numWaypoints) + index)->team1DangerIndex != -1) if ((g_experienceData + (index * g_numWaypoints) + index)->team1DangerIndex != -1)
{ {
Vector dest = g_waypoint->GetPath ((g_experienceData + (index * g_numWaypoints) + index)->team1DangerIndex)->origin; const Vector &dest = g_waypoint->GetPath ((g_experienceData + (index * g_numWaypoints) + index)->team1DangerIndex)->origin;
TraceLine (pev->origin, dest, true, GetEntity (), &tr); TraceLine (pev->origin, dest, true, GetEntity (), &tr);
if (tr.flFraction > 0.8 || tr.pHit != g_worldEdict) if (tr.flFraction > 0.8 || tr.pHit != g_worldEdict)
@ -3734,7 +3737,7 @@ void Bot::RunTask (void)
int foundPoints[3]; int foundPoints[3];
int distanceTab[3]; int distanceTab[3];
Vector dotA = (destination - pev->origin).Normalize2D (); const Vector &dotA = (destination - pev->origin).Normalize2D ();
for (i = 0; i < g_numWaypoints; i++) for (i = 0; i < g_numWaypoints; i++)
{ {
@ -3742,7 +3745,7 @@ void Bot::RunTask (void)
if (!g_waypoint->IsVisible (m_currentWaypointIndex, i) || (i == m_currentWaypointIndex)) if (!g_waypoint->IsVisible (m_currentWaypointIndex, i) || (i == m_currentWaypointIndex))
continue; continue;
Vector dotB = (g_waypoint->GetPath (i)->origin - pev->origin).Normalize2D (); const Vector &dotB = (g_waypoint->GetPath (i)->origin - pev->origin).Normalize2D ();
if ((dotA | dotB) > 0.9) if ((dotA | dotB) > 0.9)
{ {
@ -4260,9 +4263,13 @@ void Bot::RunTask (void)
else else
{ {
edict_t *ent = NULL; edict_t *ent = NULL;
Array <entity_t> activeGrenades = g_botManager->GetActiveGrenades ();
while (!IsEntityNull (ent = FIND_ENTITY_BY_CLASSNAME (ent, "grenade"))) // find all grenades on the map
IterateArray (activeGrenades, it)
{ {
ent = activeGrenades[it];
if (ent->v.owner == GetEntity () && strcmp (STRING (ent->v.model) + 9, "hegrenade.mdl") == 0) if (ent->v.owner == GetEntity () && strcmp (STRING (ent->v.model) + 9, "hegrenade.mdl") == 0)
{ {
// set the correct velocity for the grenade // set the correct velocity for the grenade
@ -4326,8 +4333,13 @@ void Bot::RunTask (void)
else else
{ {
edict_t *ent = NULL; edict_t *ent = NULL;
while (!IsEntityNull (ent = FIND_ENTITY_BY_CLASSNAME (ent, "grenade"))) Array <entity_t> activeGrenades = g_botManager->GetActiveGrenades ();
// find all grenades on the map
IterateArray (activeGrenades, it)
{ {
ent = activeGrenades[it];
if (ent->v.owner == GetEntity () && strcmp (STRING (ent->v.model) + 9, "flashbang.mdl") == 0) if (ent->v.owner == GetEntity () && strcmp (STRING (ent->v.model) + 9, "flashbang.mdl") == 0)
{ {
// set the correct velocity for the grenade // set the correct velocity for the grenade
@ -4913,10 +4925,10 @@ void Bot::BotAI (void)
SetIdealReactionTimes (); SetIdealReactionTimes ();
// calculate 2 direction vectors, 1 without the up/down component // calculate 2 direction vectors, 1 without the up/down component
Vector directionOld = m_destOrigin - (pev->origin + pev->velocity * m_frameInterval); const Vector &directionOld = m_destOrigin - (pev->origin + pev->velocity * m_frameInterval);
Vector directionNormal = directionOld.Normalize (); Vector directionNormal = directionOld.Normalize ();
Vector direction = directionNormal; const Vector &direction = directionNormal;
directionNormal.z = 0.0; directionNormal.z = 0.0;
m_moveAngles = directionOld.ToAngles (); m_moveAngles = directionOld.ToAngles ();
@ -5251,13 +5263,13 @@ void Bot::BotAI (void)
while (node != NULL) while (node != NULL)
{ {
Vector srcPath = g_waypoint->GetPath (node->index)->origin; const Vector &srcPath = g_waypoint->GetPath (node->index)->origin;
node = node->next; node = node->next;
if (node != NULL) if (node != NULL)
{ {
Vector dest = g_waypoint->GetPath (node->index)->origin; const Vector &dstPath = g_waypoint->GetPath (node->index)->origin;
DrawArrow (g_hostEntity, srcPath, dest, 15, 0, 255, 100, 55, 200, 5, 1); DrawArrow (g_hostEntity, srcPath, dstPath, 15, 0, 255, 100, 55, 200, 5, 1);
} }
} }
} }
@ -5640,13 +5652,13 @@ void Bot::DebugMsg (const char *format, ...)
vsprintf (buffer, format, ap); vsprintf (buffer, format, ap);
va_end (ap); va_end (ap);
ServerPrintNoTag ("%s: %s", STRING (pev->netname), buffer); ServerPrint ("%s: %s", STRING (pev->netname), buffer);
if (yb_debug.GetInt () >= 3) if (yb_debug.GetInt () >= 3)
AddLogEntry (false, LL_DEFAULT, "%s: %s", STRING (pev->netname), buffer); AddLogEntry (false, LL_DEFAULT, "%s: %s", STRING (pev->netname), buffer);
} }
Vector Bot::CheckToss (const Vector &start, Vector end) const Vector &Bot::CheckToss (const Vector &start, Vector end)
{ {
// this function returns the velocity at which an object should looped from start to land near end. // this function returns the velocity at which an object should looped from start to land near end.
// returns null vector if toss is not feasible. // returns null vector if toss is not feasible.
@ -5701,7 +5713,7 @@ Vector Bot::CheckToss (const Vector &start, Vector end)
return nadeVelocity * 0.777; return nadeVelocity * 0.777;
} }
Vector Bot::CheckThrow (const Vector &start, Vector end) const Vector &Bot::CheckThrow (const Vector &start, Vector end)
{ {
// this function returns the velocity vector at which an object should be thrown from start to hit end. // this function returns the velocity vector at which an object should be thrown from start to hit end.
// returns null vector if throw is not feasible. // returns null vector if throw is not feasible.
@ -5740,7 +5752,7 @@ Vector Bot::CheckThrow (const Vector &start, Vector end)
return nadeVelocity * 0.7793; return nadeVelocity * 0.7793;
} }
Vector Bot::CheckBombAudible (void) const Vector &Bot::CheckBombAudible (void)
{ {
// this function checks if bomb is can be heard by the bot, calculations done by manual testing. // this function checks if bomb is can be heard by the bot, calculations done by manual testing.
@ -5750,7 +5762,7 @@ Vector Bot::CheckBombAudible (void)
if (m_difficulty >= 3) if (m_difficulty >= 3)
return g_waypoint->GetBombPosition(); return g_waypoint->GetBombPosition();
Vector bombOrigin = g_waypoint->GetBombPosition (); const Vector &bombOrigin = g_waypoint->GetBombPosition ();
float timeElapsed = ((GetWorldTime () - g_timeBombPlanted) / mp_c4timer.GetFloat ()) * 100; float timeElapsed = ((GetWorldTime () - g_timeBombPlanted) / mp_c4timer.GetFloat ()) * 100;
float desiredRadius = 768.0; float desiredRadius = 768.0;
@ -5925,7 +5937,7 @@ bool Bot::OutOfBombTimer (void)
if (timeLeft > 16) if (timeLeft > 16)
return false; return false;
Vector bombOrigin = g_waypoint->GetBombPosition (); const Vector &bombOrigin = g_waypoint->GetBombPosition ();
// for terrorist, if timer is lower than eleven seconds, return true // for terrorist, if timer is lower than eleven seconds, return true
if (static_cast <int> (timeLeft) < 16 && m_team == TEAM_TF && (bombOrigin - pev->origin).GetLength () < 1000) if (static_cast <int> (timeLeft) < 16 && m_team == TEAM_TF && (bombOrigin - pev->origin).GetLength () < 1000)

View file

@ -271,7 +271,7 @@ bool Bot::LookupEnemy (void)
return false; return false;
} }
Vector Bot::GetAimPosition (void) const Vector &Bot::GetAimPosition (void)
{ {
// the purpose of this function, is to make bot aiming not so ideal. it's mutate m_enemyOrigin enemy vector // the purpose of this function, is to make bot aiming not so ideal. it's mutate m_enemyOrigin enemy vector
// returned from visibility check function. // returned from visibility check function.

View file

@ -165,7 +165,7 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c
"------------------------------------------------\n" "------------------------------------------------\n"
"Name: %s\n" "Name: %s\n"
"Version: %s (Build: %u)\n" "Version: %s (Build: %u)\n"
"Compiled: %s, %s +300 (GMT)\n" "Compiled: %s, %s tz: +3\n"
"------------------------------------------------"; "------------------------------------------------";
ClientPrint (ent, print_console, versionData, PRODUCT_NAME, PRODUCT_VERSION, GenerateBuildNumber (), __DATE__, __TIME__); ClientPrint (ent, print_console, versionData, PRODUCT_NAME, PRODUCT_VERSION, GenerateBuildNumber (), __DATE__, __TIME__);
@ -201,27 +201,27 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c
if (!IsDedicatedServer ()) if (!IsDedicatedServer ())
{ {
ServerPrintNoTag ("yapb autowp - toggle autowppointing."); ServerPrint ("yapb autowp - toggle autowppointing.");
ServerPrintNoTag ("yapb wp - toggle waypoint showing."); ServerPrint ("yapb wp - toggle waypoint showing.");
ServerPrintNoTag ("yapb wp on noclip - enable noclip cheat"); ServerPrint ("yapb wp on noclip - enable noclip cheat");
ServerPrintNoTag ("yapb wp save nocheck - save waypoints without checking."); ServerPrint ("yapb wp save nocheck - save waypoints without checking.");
ServerPrintNoTag ("yapb wp add - open menu for waypoint creation."); ServerPrint ("yapb wp add - open menu for waypoint creation.");
ServerPrintNoTag ("yapb wp menu - open main waypoint menu."); ServerPrint ("yapb wp menu - open main waypoint menu.");
ServerPrintNoTag ("yapb wp addbasic - creates basic waypoints on map."); ServerPrint ("yapb wp addbasic - creates basic waypoints on map.");
ServerPrintNoTag ("yapb wp find - show direction to specified waypoint."); ServerPrint ("yapb wp find - show direction to specified waypoint.");
ServerPrintNoTag ("yapb wp load - wload the waypoint file from hard disk."); ServerPrint ("yapb wp load - wload the waypoint file from hard disk.");
ServerPrintNoTag ("yapb wp check - checks if all waypoints connections are valid."); ServerPrint ("yapb wp check - checks if all waypoints connections are valid.");
ServerPrintNoTag ("yapb wp cache - cache nearest waypoint."); ServerPrint ("yapb wp cache - cache nearest waypoint.");
ServerPrintNoTag ("yapb wp teleport - teleport hostile to specified waypoint."); ServerPrint ("yapb wp teleport - teleport hostile to specified waypoint.");
ServerPrintNoTag ("yapb wp setradius - manually sets the wayzone radius for this waypoint."); ServerPrint ("yapb wp setradius - manually sets the wayzone radius for this waypoint.");
ServerPrintNoTag ("yapb path autodistance - opens menu for setting autopath maximum distance."); ServerPrint ("yapb path autodistance - opens menu for setting autopath maximum distance.");
ServerPrintNoTag ("yapb path cache - remember the nearest to player waypoint."); ServerPrint ("yapb path cache - remember the nearest to player waypoint.");
ServerPrintNoTag ("yapb path create - opens menu for path creation."); ServerPrint ("yapb path create - opens menu for path creation.");
ServerPrintNoTag ("yapb path delete - delete path from cached to nearest waypoint."); ServerPrint ("yapb path delete - delete path from cached to nearest waypoint.");
ServerPrintNoTag ("yapb path create_in - creating incoming path connection."); ServerPrint ("yapb path create_in - creating incoming path connection.");
ServerPrintNoTag ("yapb path create_out - creating outgoing path connection."); ServerPrint ("yapb path create_out - creating outgoing path connection.");
ServerPrintNoTag ("yapb path create_both - creating both-ways path connection."); ServerPrint ("yapb path create_both - creating both-ways path connection.");
ServerPrintNoTag ("yapb exp save - save the experience data."); ServerPrint ("yapb exp save - save the experience data.");
} }
} }
} }
@ -249,7 +249,7 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c
if (stricmp (arg0, "randgen") == 0) if (stricmp (arg0, "randgen") == 0)
{ {
for (int i = 0; i < 500; i++) for (int i = 0; i < 500; i++)
ServerPrintNoTag ("Result Range[0 - 100]: %d", Random.Long (0, 100)); ServerPrint ("Result Range[0 - 100]: %d", Random.Long (0, 100));
} }
#if defined (MMGR_H) #if defined (MMGR_H)
// dump memory information // dump memory information
@ -1440,7 +1440,7 @@ void ClientCommand (edict_t *ent)
if (path->flags & FLAG_NOHOSTAGE) if (path->flags & FLAG_NOHOSTAGE)
noHostagePoints++; noHostagePoints++;
} }
ServerPrintNoTag ("Waypoints: %d - T Points: %d\n" ServerPrint ("Waypoints: %d - T Points: %d\n"
"CT Points: %d - Goal Points: %d\n" "CT Points: %d - Goal Points: %d\n"
"Rescue Points: %d - Camp Points: %d\n" "Rescue Points: %d - Camp Points: %d\n"
"Block Hostage Points: %d - Sniper Points: %d\n", g_numWaypoints, terrPoints, ctPoints, goalPoints, rescuePoints, campPoints, noHostagePoints, sniperPoints); "Block Hostage Points: %d - Sniper Points: %d\n", g_numWaypoints, terrPoints, ctPoints, goalPoints, rescuePoints, campPoints, noHostagePoints, sniperPoints);

View file

@ -244,7 +244,7 @@ void BotManager::Think (void)
// error occurred. kick off all bots and then print a warning message // error occurred. kick off all bots and then print a warning message
RemoveAll (); RemoveAll ();
ServerPrintNoTag ("**** INTERNAL BOT ERROR! PLEASE SHUTDOWN AND RESTART YOUR SERVER! ****"); ServerPrint ("**** INTERNAL BOT ERROR! PLEASE SHUTDOWN AND RESTART YOUR SERVER! ****");
} }
#else #else
m_bots[i]->Think (); m_bots[i]->Think ();
@ -612,7 +612,7 @@ void BotManager::ListBots (void)
{ {
// this function list's bots currently playing on the server // this function list's bots currently playing on the server
ServerPrintNoTag ("%-3.5s %-9.13s %-17.18s %-3.4s %-3.4s %-3.4s", "index", "name", "personality", "team", "difficulty", "frags"); ServerPrint ("%-3.5s %-9.13s %-17.18s %-3.4s %-3.4s %-3.4s", "index", "name", "personality", "team", "difficulty", "frags");
for (int i = 0; i < GetMaxClients (); i++) for (int i = 0; i < GetMaxClients (); i++)
{ {
@ -624,7 +624,7 @@ void BotManager::ListBots (void)
Bot *bot = GetBot (player); Bot *bot = GetBot (player);
if (bot != NULL) if (bot != NULL)
ServerPrintNoTag ("[%-3.1d] %-9.13s %-17.18s %-3.4s %-3.1d %-3.1d", i, STRING (player->v.netname), bot->m_personality == PERSONALITY_RUSHER ? "rusher" : bot->m_personality == PERSONALITY_NORMAL ? "normal" : "careful", GetTeam (player) != 0 ? "CT" : "T", bot->m_difficulty, static_cast <int> (player->v.frags)); ServerPrint ("[%-3.1d] %-9.13s %-17.18s %-3.4s %-3.1d %-3.1d", i, STRING (player->v.netname), bot->m_personality == PERSONALITY_RUSHER ? "rusher" : bot->m_personality == PERSONALITY_NORMAL ? "normal" : "careful", GetTeam (player) != 0 ? "CT" : "T", bot->m_difficulty, static_cast <int> (player->v.frags));
} }
} }
} }
@ -1366,7 +1366,7 @@ void BotManager::UpdateActiveGrenades (void)
} }
} }
const Array <entity_t> BotManager::GetActiveGrenades (void) const Array <entity_t> &BotManager::GetActiveGrenades (void)
{ {
return m_activeGrenades; return m_activeGrenades;
} }

View file

@ -136,7 +136,7 @@ bool IsVisible (const Vector &origin, edict_t *ent)
return true; // line of sight is valid. return true; // line of sight is valid.
} }
Vector GetEntityOrigin (edict_t *ent) const Vector &GetEntityOrigin (edict_t *ent)
{ {
// this expanded function returns the vector origin of a bounded entity, assuming that any // this expanded function returns the vector origin of a bounded entity, assuming that any
// entity that has a bounding box has its center at the center of the bounding box itself. // entity that has a bounding box has its center at the center of the bounding box itself.
@ -881,19 +881,8 @@ void ServerPrint (const char *format, ...)
vsprintf (string, g_localizer->TranslateInput (format), ap); vsprintf (string, g_localizer->TranslateInput (format), ap);
va_end (ap); va_end (ap);
SERVER_PRINT (FormatBuffer ("%s\n", string)); SERVER_PRINT (string);
} SERVER_PRINT ("\n");
void ServerPrintNoTag (const char *format, ...)
{
va_list ap;
char string[3072];
va_start (ap, format);
vsprintf (string, g_localizer->TranslateInput (format), ap);
va_end (ap);
SERVER_PRINT (FormatBuffer ("%s\n", string));
} }
void CenterPrint (const char *format, ...) void CenterPrint (const char *format, ...)
@ -954,7 +943,7 @@ void ClientPrint (edict_t *ent, int dest, const char *format, ...)
if (dest & 0x3ff) if (dest & 0x3ff)
ServerPrint (string); ServerPrint (string);
else else
ServerPrintNoTag (string); ServerPrint (string);
return; return;
} }
@ -1206,7 +1195,7 @@ void AddLogEntry (bool outputToConsole, int logLevel, const char *format, ...)
} }
if (outputToConsole) if (outputToConsole)
ServerPrintNoTag ("%s%s", levelString, buffer); ServerPrint ("%s%s", levelString, buffer);
// now check if logging disabled // now check if logging disabled
if (!(logLevel & LL_IGNORE)) if (!(logLevel & LL_IGNORE))