From 174b3e1eb6dad192e5f9601a674a01258b82aa6c Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Fri, 24 Jul 2015 15:10:51 +0300 Subject: [PATCH] some more cosmetics --- include/core.h | 15 ++- include/corelib.h | 1 - source/basecode.cpp | 178 +++++++++++++++++------------------ source/combat.cpp | 4 +- source/interface.cpp | 218 +++++++++++++++++++++---------------------- source/manager.cpp | 6 +- source/navigate.cpp | 174 +++++++++++++++++----------------- source/netmsg.cpp | 28 +++--- source/support.cpp | 22 ++--- source/waypoint.cpp | 12 +-- 10 files changed, 334 insertions(+), 324 deletions(-) diff --git a/include/core.h b/include/core.h index 65a6a41..e377ffd 100644 --- a/include/core.h +++ b/include/core.h @@ -1548,6 +1548,17 @@ public: void SetBombPosition (bool shouldReset = false); String CheckSubfolderFile (void); + + // quick access + inline Path *operator [] (int index) + { + extern int g_numWaypoints; + + if (index < 0 || index >= g_numWaypoints) + assert (0); + + return GetPath (index); + } }; // wayponit auto-downloader @@ -1600,8 +1611,8 @@ public: #define netmsg NetworkMsg::GetReference () #define locale Localizer::GetReference () #define convars ConVarWrapper::GetReference () -#define waypoint Waypoint::GetReference () -#define botMgr BotManager::GetReference () +#define waypoints Waypoint::GetReference () +#define bots BotManager::GetReference () // simplify access for console variables class ConVar diff --git a/include/corelib.h b/include/corelib.h index d6b47fe..3ed5378 100644 --- a/include/corelib.h +++ b/include/corelib.h @@ -1609,7 +1609,6 @@ public: } }; - // // Class: Map // Represents associative map container. diff --git a/source/basecode.cpp b/source/basecode.cpp index 5ab8e99..adb41b8 100644 --- a/source/basecode.cpp +++ b/source/basecode.cpp @@ -54,7 +54,7 @@ void Bot::PushMessageQueue (int message) for (int i = 0; i < GetMaxClients (); i++) { - Bot *otherBot = botMgr.GetBot (i); + Bot *otherBot = bots.GetBot (i); if (otherBot != NULL && otherBot->pev != pev) { @@ -185,14 +185,14 @@ void Bot::CheckGrenadeThrow (void) searchRadius = 128.0; // search waypoints - waypoint.FindInRadius (enemyPredict, searchRadius, searchTab, &count); + waypoints.FindInRadius (enemyPredict, searchRadius, searchTab, &count); while (count > 0) { allowThrowing = true; // check the throwing - m_throw = waypoint.GetPath (searchTab[count--])->origin; + m_throw = waypoints.GetPath (searchTab[count--])->origin; Vector src = CheckThrow (EyePosition (), m_throw); if (src.GetLengthSquared () < 100.0) @@ -226,11 +226,11 @@ void Bot::CheckGrenadeThrow (void) bool allowThrowing = true; Array inRadius; - waypoint.FindInRadius (inRadius, 256, m_lastEnemy->v.origin + (m_lastEnemy->v.velocity * 0.5).Get2D ()); + waypoints.FindInRadius (inRadius, 256, m_lastEnemy->v.origin + (m_lastEnemy->v.velocity * 0.5).Get2D ()); FOR_EACH_AE (inRadius, i) { - Path *path = waypoint.GetPath (i); + Path *path = waypoints.GetPath (i); int friendCount = GetNearbyFriendsNearPosition (path->origin, 256.0f); @@ -273,7 +273,7 @@ void Bot::AvoidGrenades (void) { // checks if bot 'sees' a grenade, and avoid it - if (!botMgr.HasActiveGrenades ()) + if (!bots.HasActiveGrenades ()) return; // check if old pointers to grenade is invalid @@ -287,7 +287,7 @@ void Bot::AvoidGrenades (void) m_avoidGrenade = NULL; m_needAvoidGrenade = 0; } - Array activeGrenades = botMgr.GetActiveGrenades (); + Array activeGrenades = bots.GetActiveGrenades (); // find all grenades on the map FOR_EACH_AE (activeGrenades, it) @@ -346,11 +346,11 @@ void Bot::AvoidGrenades (void) bool Bot::IsBehindSmokeClouds (edict_t *ent) { - if (!botMgr.HasActiveGrenades ()) + if (!bots.HasActiveGrenades ()) return false; const Vector &betweenUs = (ent->v.origin - pev->origin).Normalize (); - Array activeGrenades = botMgr.GetActiveGrenades (); + Array activeGrenades = bots.GetActiveGrenades (); // find all grenades on the map FOR_EACH_AE (activeGrenades, it) @@ -718,7 +718,7 @@ void Bot::FindItem (void) PushTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + Random.Float (30.0, 60.0), true); // push camp task on to stack PushTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, index, GetWorldTime () + Random.Float (3.0, 6.0), true); // push move command - if (waypoint.GetPath (index)->vis.crouch <= waypoint.GetPath (index)->vis.stand) + if (waypoints.GetPath (index)->vis.crouch <= waypoints.GetPath (index)->vis.stand) m_campButtons |= IN_DUCK; else m_campButtons &= ~IN_DUCK; @@ -738,10 +738,10 @@ void Bot::FindItem (void) m_defendedBomb = true; int index = FindDefendWaypoint (entityOrigin); - Path *path = waypoint.GetPath (index); + Path *path = waypoints.GetPath (index); float bombTimer = mp_c4timer.GetFloat (); - float timeMidBlowup = g_timeBombPlanted + (bombTimer * 0.5 + bombTimer * 0.25) - waypoint.GetTravelTime (pev->maxspeed, pev->origin, path->origin); + float timeMidBlowup = g_timeBombPlanted + (bombTimer * 0.5 + bombTimer * 0.25) - waypoints.GetTravelTime (pev->maxspeed, pev->origin, path->origin); if (timeMidBlowup > GetWorldTime ()) { @@ -771,7 +771,7 @@ void Bot::FindItem (void) allowPickup = false; // never pickup dead hostage else for (int i = 0; i < GetMaxClients (); i++) { - if ((bot = botMgr.GetBot (i)) != NULL && IsAlive (bot->GetEntity ())) + if ((bot = bots.GetBot (i)) != NULL && IsAlive (bot->GetEntity ())) { for (int j = 0; j < MAX_HOSTAGES; j++) { @@ -795,7 +795,7 @@ void Bot::FindItem (void) if (Random.Long (0, 100) < 90) ChatterMessage (Chatter_FoundBombPlace); - allowPickup = !IsBombDefusing (waypoint.GetBombPosition ()) || m_hasProgressBar; + allowPickup = !IsBombDefusing (waypoints.GetBombPosition ()) || m_hasProgressBar; pickupType = PICKUP_PLANTED_C4; if (!m_defendedBomb && !allowPickup) @@ -803,9 +803,9 @@ void Bot::FindItem (void) m_defendedBomb = true; int index = FindDefendWaypoint (entityOrigin); - Path *path = waypoint.GetPath (index); + Path *path = waypoints.GetPath (index); - float timeToExplode = g_timeBombPlanted + mp_c4timer.GetFloat () - waypoint.GetTravelTime (pev->maxspeed, pev->origin, path->origin); + float timeToExplode = g_timeBombPlanted + mp_c4timer.GetFloat () - waypoints.GetTravelTime (pev->maxspeed, pev->origin, path->origin); RemoveCertainTask (TASK_MOVETOPOSITION); // remove any move tasks @@ -833,7 +833,7 @@ void Bot::FindItem (void) PushTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + Random.Float (30.0, 70.0), true); // push camp task on to stack PushTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, index, GetWorldTime () + Random.Float (10.0, 30.0), true); // push move command - if (waypoint.GetPath (index)->vis.crouch <= waypoint.GetPath (index)->vis.stand) + if (waypoints.GetPath (index)->vis.crouch <= waypoints.GetPath (index)->vis.stand) m_campButtons |= IN_DUCK; else m_campButtons &= ~IN_DUCK; @@ -865,7 +865,7 @@ void Bot::FindItem (void) { for (int i = 0; i < GetMaxClients (); i++) { - if ((bot = botMgr.GetBot (i)) != NULL && IsAlive (bot->GetEntity ()) && bot->m_pickupItem == pickupItem) + if ((bot = bots.GetBot (i)) != NULL && IsAlive (bot->GetEntity ()) && bot->m_pickupItem == pickupItem) { m_pickupItem = NULL; m_pickupType = PICKUP_NONE; @@ -912,14 +912,14 @@ void Bot::GetCampDirection (Vector *dest) // find nearest waypoint to bot and position for (int i = 0; i < g_numWaypoints; i++) { - float distance = (waypoint.GetPath (i)->origin - pev->origin).GetLengthSquared (); + float distance = (waypoints.GetPath (i)->origin - pev->origin).GetLengthSquared (); if (distance < minDistance) { minDistance = distance; tempIndex = i; } - distance = (waypoint.GetPath (i)->origin - *dest).GetLengthSquared (); + distance = (waypoints.GetPath (i)->origin - *dest).GetLengthSquared (); if (distance < maxDistance) { @@ -934,14 +934,14 @@ void Bot::GetCampDirection (Vector *dest) minDistance = 99999.0f; int lookAtWaypoint = -1; - Path *path = waypoint.GetPath (tempIndex); + Path *path = waypoints.GetPath (tempIndex); for (int i = 0; i < MAX_PATH_INDEX; i++) { if (path->index[i] == -1) continue; - float distance = waypoint.GetPathDistance (path->index[i], enemyIndex); + float distance = waypoints.GetPathDistance (path->index[i], enemyIndex); if (distance < minDistance) { @@ -950,7 +950,7 @@ void Bot::GetCampDirection (Vector *dest) } } if (lookAtWaypoint != -1 && lookAtWaypoint < g_numWaypoints) - *dest = waypoint.GetPath (lookAtWaypoint)->origin; + *dest = waypoints.GetPath (lookAtWaypoint)->origin; } } @@ -1158,7 +1158,7 @@ void Bot::CheckMessageQueue (void) for (int i = 0; i < GetMaxClients (); i++) { - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); if (bot != NULL) { @@ -1179,7 +1179,7 @@ void Bot::CheckMessageQueue (void) case TASK_NORMAL: if (GetTask ()->data != -1 && Random.Long (0, 100) < 70) { - Path *path = waypoint.GetPath (GetTask ()->data); + Path *path = waypoints.GetPath (GetTask ()->data); if (path->flags & FLAG_GOAL) { @@ -1403,7 +1403,7 @@ void Bot::PurchaseWeapons (void) int *ptr = g_weaponPrefs[m_personality] + NUM_WEAPONS; bool isPistolMode = g_weaponSelect[25].teamStandard == -1 && g_weaponSelect[3].teamStandard == 2; - bool teamEcoValid = botMgr.EconomicsValid (m_team); + bool teamEcoValid = bots.EconomicsValid (m_team); switch (m_buyState) { @@ -1515,7 +1515,7 @@ void Bot::PurchaseWeapons (void) int moneySave = Random.Long (900, 1100); - if (botMgr.GetLastWinner () == m_team) + if (bots.GetLastWinner () == m_team) moneySave = 0; if (selectedWeapon->price <= (m_moneyAmount - moneySave)) @@ -1996,7 +1996,7 @@ void Bot::ApplyTaskFilters (void) // if half of the round is over, allow hunting // FIXME: it probably should be also team/map dependant - if (GetTaskId () != TASK_ESCAPEFROMBOMB && IsEntityNull (m_enemy) && g_timeRoundMid < GetWorldTime () && !m_isUsingGrenade && m_currentWaypointIndex != waypoint.FindNearest (m_lastEnemyOrigin) && m_personality != PERSONALITY_CAREFUL) + if (GetTaskId () != TASK_ESCAPEFROMBOMB && IsEntityNull (m_enemy) && g_timeRoundMid < GetWorldTime () && !m_isUsingGrenade && m_currentWaypointIndex != waypoints.FindNearest (m_lastEnemyOrigin) && m_personality != PERSONALITY_CAREFUL) { float desireLevel = 4096.0 - ((1.0 - tempAgression) * distance); @@ -2214,11 +2214,11 @@ bool Bot::ReactOnEnemy (void) if (m_enemyReachableTimer < GetWorldTime ()) { - int i = waypoint.FindNearest (pev->origin); - int enemyIndex = waypoint.FindNearest (m_enemy->v.origin); + int i = waypoints.FindNearest (pev->origin); + int enemyIndex = waypoints.FindNearest (m_enemy->v.origin); float lineDist = (m_enemy->v.origin - pev->origin).GetLength (); - float pathDist = waypoint.GetPathDistance (i, enemyIndex); + float pathDist = waypoints.GetPathDistance (i, enemyIndex); if (pathDist - lineDist > 112.0) m_isEnemyReachable = false; @@ -2275,7 +2275,7 @@ void Bot::CheckRadioCommands (void) // Check if no more followers are allowed for (int i = 0; i < GetMaxClients (); i++) { - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); if (bot != NULL) { @@ -2309,7 +2309,7 @@ void Bot::CheckRadioCommands (void) { for (int i = 0; (i < GetMaxClients () && numFollowers > allowedFollowers) ; i++) { - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); if (bot != NULL) { @@ -2472,7 +2472,7 @@ void Bot::CheckRadioCommands (void) SelectWeaponByName ("weapon_knife"); DeleteSearchNodes (); - MoveToVector (waypoint.GetBombPosition ()); + MoveToVector (waypoints.GetBombPosition ()); RadioMessage (Radio_Affirmative); } @@ -2581,19 +2581,19 @@ void Bot::CheckRadioCommands (void) float minDistance = 99999.0f; // find nearest bomb waypoint to player - FOR_EACH_AE (waypoint.m_goalPoints, i) + FOR_EACH_AE (waypoints.m_goalPoints, i) { - distance = (waypoint.GetPath (waypoint.m_goalPoints[i])->origin - m_radioEntity->v.origin).GetLengthSquared (); + distance = (waypoints.GetPath (waypoints.m_goalPoints[i])->origin - m_radioEntity->v.origin).GetLengthSquared (); if (distance < minDistance) { minDistance = distance; - bombPoint = waypoint.m_goalPoints[i]; + bombPoint = waypoints.m_goalPoints[i]; } } // mark this waypoint as restricted point - if (bombPoint != -1 && !waypoint.IsGoalVisited (bombPoint)) + if (bombPoint != -1 && !waypoints.IsGoalVisited (bombPoint)) { // does this bot want to defuse? if (GetTaskId () == TASK_NORMAL) @@ -2606,7 +2606,7 @@ void Bot::CheckRadioCommands (void) } } - waypoint.SetGoalVisited (bombPoint); + waypoints.SetGoalVisited (bombPoint); } g_timeNextBombUpdate = GetWorldTime () + 0.5; } @@ -2663,7 +2663,7 @@ void Bot::CheckRadioCommands (void) // push move command PushTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, index, GetWorldTime () + Random.Float (30.0, 60.0), true); - if (waypoint.GetPath (index)->vis.crouch <= waypoint.GetPath (index)->vis.stand) + if (waypoints.GetPath (index)->vis.crouch <= waypoints.GetPath (index)->vis.stand) m_campButtons |= IN_DUCK; else m_campButtons &= ~IN_DUCK; @@ -2712,7 +2712,7 @@ void Bot::SelectLeaderEachTeam (int team) } else if ((team == TEAM_TF) && !g_leaderChoosen[TEAM_TF]) { - Bot *botLeader = botMgr.GetHighestFragsBot(team); + Bot *botLeader = bots.GetHighestFragsBot(team); if (botLeader != NULL && IsAlive (botLeader->GetEntity())) { @@ -2748,7 +2748,7 @@ void Bot::SelectLeaderEachTeam (int team) } else if (!g_leaderChoosen[TEAM_CF]) { - Bot *botLeader = botMgr.GetHighestFragsBot(team); + Bot *botLeader = bots.GetHighestFragsBot(team); if (botLeader != NULL) { @@ -2762,7 +2762,7 @@ void Bot::SelectLeaderEachTeam (int team) } else if (g_mapType & (MAP_ES | MAP_KA | MAP_FY)) { - Bot *botLeader = botMgr.GetHighestFragsBot (team); + Bot *botLeader = bots.GetHighestFragsBot (team); if (botLeader != NULL) { @@ -2774,7 +2774,7 @@ void Bot::SelectLeaderEachTeam (int team) } else { - Bot *botLeader = botMgr.GetHighestFragsBot(team); + Bot *botLeader = bots.GetHighestFragsBot(team); if (botLeader != NULL) { @@ -2833,7 +2833,7 @@ void Bot::ChooseAimDirection (void) if (changePredictedEnemy) { - m_lookAt = waypoint.GetPath (GetAimingWaypoint (m_lastEnemyOrigin))->origin; + m_lookAt = waypoints.GetPath (GetAimingWaypoint (m_lastEnemyOrigin))->origin; m_camp = m_lookAt; m_timeNextTracking = GetWorldTime () + 2.0f; @@ -2855,12 +2855,12 @@ void Bot::ChooseAimDirection (void) if (m_team == TEAM_TF) { if ((g_experienceData + (index * g_numWaypoints) + index)->team0DangerIndex != -1) - m_lookAt = waypoint.GetPath ((g_experienceData + (index * g_numWaypoints) + index)->team0DangerIndex)->origin; + m_lookAt = waypoints.GetPath ((g_experienceData + (index * g_numWaypoints) + index)->team0DangerIndex)->origin; } else { if ((g_experienceData + (index * g_numWaypoints) + index)->team1DangerIndex != -1) - m_lookAt = waypoint.GetPath ((g_experienceData + (index * g_numWaypoints) + index)->team1DangerIndex)->origin; + m_lookAt = waypoints.GetPath ((g_experienceData + (index * g_numWaypoints) + index)->team1DangerIndex)->origin; } } } @@ -2995,7 +2995,7 @@ void Bot::PeriodicThink (void) m_numFriendsLeft = GetNearbyFriendsNearPosition (pev->origin, 99999.0f); m_numEnemiesLeft = GetNearbyEnemiesNearPosition (pev->origin, 99999.0f); - if (g_bombPlanted && m_team == TEAM_CF && (pev->origin - waypoint.GetBombPosition ()).GetLength () < 700 && !IsBombDefusing (waypoint.GetBombPosition ()) && !m_hasProgressBar && GetTaskId () != TASK_ESCAPEFROMBOMB) + if (g_bombPlanted && m_team == TEAM_CF && (pev->origin - waypoints.GetBombPosition ()).GetLength () < 700 && !IsBombDefusing (waypoints.GetBombPosition ()) && !m_hasProgressBar && GetTaskId () != TASK_ESCAPEFROMBOMB) ResetTasks (); CheckSpawnTimeConditions (); @@ -3035,7 +3035,7 @@ void Bot::RunTask_Normal (void) m_reloadState = RELOAD_PRIMARY; // if bomb planted and it's a CT calculate new path to bomb point if he's not already heading for - if (g_bombPlanted && m_team == TEAM_CF && GetTask ()->data != -1 && !(waypoint.GetPath (GetTask ()->data)->flags & FLAG_GOAL) && GetTaskId () != TASK_ESCAPEFROMBOMB) + if (g_bombPlanted && m_team == TEAM_CF && GetTask ()->data != -1 && !(waypoints.GetPath (GetTask ()->data)->flags & FLAG_GOAL) && GetTaskId () != TASK_ESCAPEFROMBOMB) { DeleteSearchNodes (); GetTask ()->data = -1; @@ -3137,7 +3137,7 @@ void Bot::RunTask_Normal (void) PushTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + Random.Float (60.0, 120.0), true); // push camp task on to stack PushTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, index, GetWorldTime () + Random.Float (5.0, 10.0), true); // push move command - if (waypoint.GetPath (index)->vis.crouch <= waypoint.GetPath (index)->vis.stand) + if (waypoints.GetPath (index)->vis.crouch <= waypoints.GetPath (index)->vis.stand) m_campButtons |= IN_DUCK; else m_campButtons &= ~IN_DUCK; @@ -3170,7 +3170,7 @@ void Bot::RunTask_Normal (void) PushTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + Random.Float (25.0, 40.0), true); // push camp task on to stack PushTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, index, GetWorldTime () + Random.Float (5.0f, 11.0f), true); // push move command - if (waypoint.GetPath (index)->vis.crouch <= waypoint.GetPath (index)->vis.stand) + if (waypoints.GetPath (index)->vis.crouch <= waypoints.GetPath (index)->vis.stand) m_campButtons |= IN_DUCK; else m_campButtons &= ~IN_DUCK; @@ -3305,7 +3305,7 @@ void Bot::RunTask_HuntEnemy (void) if (GetTask ()->data != -1 && GetTask ()->data < g_numWaypoints) destIndex = GetTask ()->data; else // no. we need to find a new one - destIndex = waypoint.FindNearest (m_lastEnemyOrigin); + destIndex = waypoints.FindNearest (m_lastEnemyOrigin); // remember index m_prevGoalIndex = destIndex; @@ -3408,7 +3408,7 @@ void Bot::RunTask_SeekCover (void) destIndex = FindCoverWaypoint (1024.0f); if (destIndex == -1) - destIndex = waypoint.FindNearest (pev->origin, 512.0f); + destIndex = waypoints.FindNearest (pev->origin, 512.0f); } m_campDirection = 0; @@ -3505,7 +3505,7 @@ void Bot::RunTask_Camp (void) m_checkTerrain = false; m_moveToGoal = false; - if (g_bombPlanted && m_defendedBomb && !IsBombDefusing (waypoint.GetBombPosition ()) && !OutOfBombTimer () && m_team == TEAM_CF) + if (g_bombPlanted && m_defendedBomb && !IsBombDefusing (waypoints.GetBombPosition ()) && !OutOfBombTimer () && m_team == TEAM_CF) { m_defendedBomb = false; TaskComplete (); @@ -3558,14 +3558,14 @@ void Bot::RunTask_Camp (void) for (int i = 0; i < g_numWaypoints; i++) { // skip invisible waypoints or current waypoint - if (!waypoint.IsVisible (m_currentWaypointIndex, i) || (i == m_currentWaypointIndex)) + if (!waypoints.IsVisible (m_currentWaypointIndex, i) || (i == m_currentWaypointIndex)) continue; - const Vector &dotB = (waypoint.GetPath (i)->origin - pev->origin).Normalize2D (); + const Vector &dotB = (waypoints.GetPath (i)->origin - pev->origin).Normalize2D (); if ((dotA | dotB) > 0.9) { - int distance = static_cast ((pev->origin - waypoint.GetPath (i)->origin).GetLength ()); + int distance = static_cast ((pev->origin - waypoints.GetPath (i)->origin).GetLength ()); if (numFoundPoints >= 3) { @@ -3591,12 +3591,12 @@ void Bot::RunTask_Camp (void) } if (--numFoundPoints >= 0) - m_camp = waypoint.GetPath (foundPoints[Random.Long (0, numFoundPoints)])->origin; + m_camp = waypoints.GetPath (foundPoints[Random.Long (0, numFoundPoints)])->origin; else - m_camp = waypoint.GetPath (GetAimingWaypoint ())->origin; + m_camp = waypoints.GetPath (GetAimingWaypoint ())->origin; } else - m_camp = waypoint.GetPath (GetAimingWaypoint ())->origin; + m_camp = waypoints.GetPath (GetAimingWaypoint ())->origin; } // press remembered crouch button pev->button |= m_campButtons; @@ -3690,7 +3690,7 @@ void Bot::RunTask_MoveToPos (void) if (GetTask ()->data != -1 && GetTask ()->data < g_numWaypoints) destIndex = GetTask ()->data; else - destIndex = waypoint.FindNearest (m_position); + destIndex = waypoints.FindNearest (m_position); if (destIndex >= 0 && destIndex < g_numWaypoints) { @@ -3747,7 +3747,7 @@ void Bot::RunTask_PlantBomb (void) // push move command PushTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, index, GetWorldTime () + (bombTimer * 0.5 + bombTimer * 0.25), true); - if (waypoint.GetPath (index)->vis.crouch <= waypoint.GetPath (index)->vis.stand) + if (waypoints.GetPath (index)->vis.crouch <= waypoints.GetPath (index)->vis.stand) m_campButtons |= IN_DUCK; else m_campButtons &= ~IN_DUCK; @@ -3766,7 +3766,7 @@ void Bot::RunTask_DefuseBomb (void) bool defuseError = false; // exception: bomb has been defused - if (waypoint.GetBombPosition () == nullvec) + if (waypoints.GetBombPosition () == nullvec) { defuseError = true; g_bombPlanted = false; @@ -3839,7 +3839,7 @@ void Bot::RunTask_DefuseBomb (void) m_strafeSpeed = 0.0; // bot is reloading and we close enough to start defusing - if (m_isReloading && (waypoint.GetBombPosition () - pev->origin).GetLength2D () < 80.0) + if (m_isReloading && (waypoints.GetBombPosition () - pev->origin).GetLength2D () < 80.0) { if (m_numEnemiesLeft == 0 || timeToBlowUp < fullDefuseTime + 7.0 || ((GetAmmoInClip () > 8 && m_reloadState == RELOAD_PRIMARY) || (GetAmmoInClip () > 5 && m_reloadState == RELOAD_SECONDARY))) { @@ -3866,8 +3866,8 @@ void Bot::RunTask_DefuseBomb (void) // head to bomb and press use button m_aimFlags |= AIM_ENTITY; - m_destOrigin = waypoint.GetBombPosition (); - m_entity = waypoint.GetBombPosition (); + m_destOrigin = waypoints.GetBombPosition (); + m_entity = waypoints.GetBombPosition (); pev->button |= IN_USE; @@ -4006,10 +4006,10 @@ void Bot::RunTask_FollowUser (void) { DeleteSearchNodes (); - int destIndex = waypoint.FindNearest (m_targetEntity->v.origin); + int destIndex = waypoints.FindNearest (m_targetEntity->v.origin); Array points; - waypoint.FindInRadius (points, 200, m_targetEntity->v.origin); + waypoints.FindInRadius (points, 200, m_targetEntity->v.origin); while (!points.IsEmpty ()) { @@ -4225,7 +4225,7 @@ void Bot::RunTask_Throw_SG (void) void Bot::RunTask_DoubleJump (void) { - if (IsEntityNull (m_doubleJumpEntity) || !IsAlive (m_doubleJumpEntity) || (m_aimFlags & AIM_ENEMY) || (m_travelStartIndex != -1 && GetTask ()->time + (waypoint.GetTravelTime (pev->maxspeed, waypoint.GetPath (m_travelStartIndex)->origin, m_doubleJumpOrigin) + 11.0) < GetWorldTime ())) + if (IsEntityNull (m_doubleJumpEntity) || !IsAlive (m_doubleJumpEntity) || (m_aimFlags & AIM_ENEMY) || (m_travelStartIndex != -1 && GetTask ()->time + (waypoints.GetTravelTime (pev->maxspeed, waypoints.GetPath (m_travelStartIndex)->origin, m_doubleJumpOrigin) + 11.0) < GetWorldTime ())) { ResetDoubleJumpState (); return; @@ -4276,7 +4276,7 @@ void Bot::RunTask_DoubleJump (void) { DeleteSearchNodes (); - int destIndex = waypoint.FindNearest (m_doubleJumpOrigin); + int destIndex = waypoints.FindNearest (m_doubleJumpOrigin); if (destIndex >= 0 && destIndex < g_numWaypoints) { @@ -4328,10 +4328,10 @@ void Bot::RunTask_EscapeFromBomb (void) for (int i = 0; i < g_numWaypoints; i++) { - if ((waypoint.GetPath (i)->origin - waypoint.GetBombPosition ()).GetLength () < safeRadius || IsPointOccupied (i)) + if ((waypoints.GetPath (i)->origin - waypoints.GetBombPosition ()).GetLength () < safeRadius || IsPointOccupied (i)) continue; - float pathDistance = waypoint.GetPathDistance (m_currentWaypointIndex, i); + float pathDistance = waypoints.GetPathDistance (m_currentWaypointIndex, i); if (minPathDistance > pathDistance) { @@ -4341,7 +4341,7 @@ void Bot::RunTask_EscapeFromBomb (void) } if (lastSelectedGoal < 0) - lastSelectedGoal = waypoint.FindFarest (pev->origin, safeRadius); + lastSelectedGoal = waypoints.FindFarest (pev->origin, safeRadius); m_prevGoalIndex = lastSelectedGoal; GetTask ()->data = lastSelectedGoal; @@ -5181,12 +5181,12 @@ void Bot::BotAI (void) while (node != NULL) { - const Vector &srcPath = waypoint.GetPath (node->index)->origin; + const Vector &srcPath = waypoints.GetPath (node->index)->origin; node = node->next; if (node != NULL) { - const Vector &dstPath = waypoint.GetPath (node->index)->origin; + const Vector &dstPath = waypoints.GetPath (node->index)->origin; DrawArrow (g_hostEntity, srcPath, dstPath, 15, 0, 255, 100, 55, 200, 5, 1); } } @@ -5238,7 +5238,7 @@ void Bot::TakeDamage (edict_t *inflictor, int damage, int armor, int bits) if (IsValidPlayer (inflictor)) { - if (m_seeEnemyTime + 4.0f < GetWorldTime () && yb_tkpunish.GetBool () && GetTeam (inflictor) == m_team && !botMgr.GetBot (inflictor)) + if (m_seeEnemyTime + 4.0f < GetWorldTime () && yb_tkpunish.GetBool () && GetTeam (inflictor) == m_team && !bots.GetBot (inflictor)) { // alright, die you teamkiller!!! m_actualReactionTime = 0.0f; @@ -5288,7 +5288,7 @@ void Bot::TakeDamage (edict_t *inflictor, int damage, int armor, int bits) else // hurt by unusual damage like drowning or gas { // leave the camping/hiding position - if (!waypoint.Reachable (this, waypoint.FindNearest (m_destOrigin))) + if (!waypoints.Reachable (this, waypoints.FindNearest (m_destOrigin))) { DeleteSearchNodes (); FindWaypoint (); @@ -5397,14 +5397,14 @@ void Bot::CollectExperienceData (edict_t *attacker, int damage) // if these are bots also remember damage to rank destination of the bot m_goalValue -= static_cast (damage); - if (botMgr.GetBot (attacker) != NULL) - botMgr.GetBot (attacker)->m_goalValue += static_cast (damage); + if (bots.GetBot (attacker) != NULL) + bots.GetBot (attacker)->m_goalValue += static_cast (damage); if (damage < 20) return; // do not collect damage less than 20 - int attackerIndex = waypoint.FindNearest (attacker->v.origin); - int victimIndex = waypoint.FindNearest (pev->origin); + int attackerIndex = waypoints.FindNearest (attacker->v.origin); + int victimIndex = waypoints.FindNearest (pev->origin); if (pev->health > 20) { @@ -5669,9 +5669,9 @@ Vector Bot::CheckBombAudible (void) return nullvec; // reliability check if (m_difficulty >= 3) - return waypoint.GetBombPosition(); + return waypoints.GetBombPosition(); - const Vector &bombOrigin = waypoint.GetBombPosition (); + const Vector &bombOrigin = waypoints.GetBombPosition (); float timeElapsed = ((GetWorldTime () - g_timeBombPlanted) / mp_c4timer.GetFloat ()) * 100; float desiredRadius = 768.0; @@ -5698,7 +5698,7 @@ void Bot::MoveToVector (const Vector &to) if (to == nullvec) return; - FindPath (m_currentWaypointIndex, waypoint.FindNearest (to), 0); + FindPath (m_currentWaypointIndex, waypoints.FindNearest (to), 0); } byte Bot::ThrottledMsec (void) @@ -5811,7 +5811,7 @@ float Bot::GetEstimatedReachTime (void) // calculate 'real' time that we need to get from one waypoint to another if (m_currentWaypointIndex >= 0 && m_currentWaypointIndex < g_numWaypoints && m_prevWptIndex[0] >= 0 && m_prevWptIndex[0] < g_numWaypoints) { - float distance = (waypoint.GetPath (m_prevWptIndex[0])->origin - m_currentPath->origin).GetLength (); + float distance = (waypoints.GetPath (m_prevWptIndex[0])->origin - m_currentPath->origin).GetLength (); // caclulate estimated time if (pev->maxspeed <= 0.0f) @@ -5846,7 +5846,7 @@ bool Bot::OutOfBombTimer (void) if (timeLeft > 16) return false; - const Vector &bombOrigin = waypoint.GetBombPosition (); + const Vector &bombOrigin = waypoints.GetBombPosition (); // for terrorist, if timer is lower than eleven seconds, return true if (static_cast (timeLeft) < 16 && m_team == TEAM_TF && (bombOrigin - pev->origin).GetLength () < 1000) @@ -5860,7 +5860,7 @@ bool Bot::OutOfBombTimer (void) Bot *bot = NULL; // temporaly pointer to bot // search players with defuse kit - if ((bot = botMgr.GetBot (i)) != NULL && GetTeam (bot->GetEntity ()) == TEAM_CF && bot->m_hasDefuser && (bombOrigin - bot->pev->origin).GetLength () < 500) + if ((bot = bots.GetBot (i)) != NULL && GetTeam (bot->GetEntity ()) == TEAM_CF && bot->m_hasDefuser && (bombOrigin - bot->pev->origin).GetLength () < 500) { hasTeammatesWithDefuserKit = true; break; @@ -5868,7 +5868,7 @@ bool Bot::OutOfBombTimer (void) } // add reach time to left time - float reachTime = waypoint.GetTravelTime (pev->maxspeed, m_currentPath->origin, bombOrigin); + float reachTime = waypoints.GetTravelTime (pev->maxspeed, m_currentPath->origin, bombOrigin); // for counter-terrorist check alos is we have time to reach position plus average defuse time if ((timeLeft < reachTime + 6 && !m_hasDefuser && !hasTeammatesWithDefuserKit) || (timeLeft < reachTime + 2 && m_hasDefuser)) @@ -6026,7 +6026,7 @@ bool Bot::IsBombDefusing (const Vector &bombOrigin) for (int i = 0; i < GetMaxClients (); i++) { - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); if (bot == NULL || bot == this) continue; // skip invalid bots diff --git a/source/combat.cpp b/source/combat.cpp index dbe6c9e..591a457 100644 --- a/source/combat.cpp +++ b/source/combat.cpp @@ -358,7 +358,7 @@ bool Bot::LookupEnemy (void) if (!(g_clients[j].flags & CF_USED) || !(g_clients[j].flags & CF_ALIVE) || g_clients[j].team != m_team || g_clients[j].ent == GetEntity ()) continue; - Bot *friendBot = botMgr.GetBot (g_clients[j].ent); + Bot *friendBot = bots.GetBot (g_clients[j].ent); if (friendBot != NULL) { @@ -1213,7 +1213,7 @@ void Bot::CombatFight (void) if (!IsVisible (m_enemy->v.origin, GetEntity ()) && !IsVisible (m_enemy->v.origin + Vector (0, 0, -enemyHalfHeight), GetEntity ())) shouldDuck = false; - if (shouldDuck && GetTaskId () != TASK_SEEKCOVER && GetTaskId () != TASK_HUNTENEMY && (m_visibility & VISIBLE_BODY) && !(m_visibility & VISIBLE_OTHER) && waypoint.IsDuckVisible (m_currentWaypointIndex, waypoint.FindNearest (m_enemy->v.origin))) + if (shouldDuck && GetTaskId () != TASK_SEEKCOVER && GetTaskId () != TASK_HUNTENEMY && (m_visibility & VISIBLE_BODY) && !(m_visibility & VISIBLE_OTHER) && waypoints.IsDuckVisible (m_currentWaypointIndex, waypoints.FindNearest (m_enemy->v.origin))) m_duckTime = GetWorldTime () + 0.5f; m_moveSpeed = 0.0; diff --git a/source/interface.cpp b/source/interface.cpp index 9094ce3..482855f 100644 --- a/source/interface.cpp +++ b/source/interface.cpp @@ -22,55 +22,55 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c { // adding one bot with random parameters to random team if (stricmp (arg0, "addbot") == 0 || stricmp (arg0, "add") == 0) - botMgr.AddBot (arg4, arg1, arg2, arg3, arg5); + bots.AddBot (arg4, arg1, arg2, arg3, arg5); // adding one bot with high difficulty parameters to random team else if (stricmp (arg0, "addbot_hs") == 0 || stricmp (arg0, "addhs") == 0) - botMgr.AddBot (arg4, "4", "1", arg3, arg5); + bots.AddBot (arg4, "4", "1", arg3, arg5); // adding one bot with random parameters to terrorist team else if (stricmp (arg0, "addbot_t") == 0 || stricmp (arg0, "add_t") == 0) - botMgr.AddBot (arg4, arg1, arg2, "1", arg5); + bots.AddBot (arg4, arg1, arg2, "1", arg5); // adding one bot with random parameters to counter-terrorist team else if (stricmp (arg0, "addbot_ct") == 0 || stricmp (arg0, "add_ct") == 0) - botMgr.AddBot (arg4, arg1, arg2, "2", arg5); + bots.AddBot (arg4, arg1, arg2, "2", arg5); // kicking off one bot from the terrorist team else if (stricmp (arg0, "kickbot_t") == 0 || stricmp (arg0, "kick_t") == 0) - botMgr.RemoveFromTeam (TEAM_TF); + bots.RemoveFromTeam (TEAM_TF); // kicking off one bot from the counter-terrorist team else if (stricmp (arg0, "kickbot_ct") == 0 || stricmp (arg0, "kick_ct") == 0) - botMgr.RemoveFromTeam (TEAM_CF); + bots.RemoveFromTeam (TEAM_CF); // kills all bots on the terrorist team else if (stricmp (arg0, "killbots_t") == 0 || stricmp (arg0, "kill_t") == 0) - botMgr.KillAll (TEAM_TF); + bots.KillAll (TEAM_TF); // kills all bots on the counter-terrorist team else if (stricmp (arg0, "killbots_ct") == 0 || stricmp (arg0, "kill_ct") == 0) - botMgr.KillAll (TEAM_CF); + bots.KillAll (TEAM_CF); // list all bots playeing on the server else if (stricmp (arg0, "listbots") == 0 || stricmp (arg0, "list") == 0) - botMgr.ListBots (); + bots.ListBots (); // kick off all bots from the played server else if (stricmp (arg0, "kickbots") == 0 || stricmp (arg0, "kickall") == 0) - botMgr.RemoveAll (); + bots.RemoveAll (); // kill all bots on the played server else if (stricmp (arg0, "killbots") == 0 || stricmp (arg0, "killall") == 0) - botMgr.KillAll (); + bots.KillAll (); // kick off one random bot from the played server else if (stricmp (arg0, "kickone") == 0 || stricmp (arg0, "kick") == 0) - botMgr.RemoveRandom (); + bots.RemoveRandom (); // fill played server with bots else if (stricmp (arg0, "fillserver") == 0 || stricmp (arg0, "fill") == 0) - botMgr.FillServer (atoi (arg1), IsNullString (arg2) ? -1 : atoi (arg2), IsNullString (arg3) ? -1 : atoi (arg3), IsNullString (arg4) ? -1 : atoi (arg4)); + bots.FillServer (atoi (arg1), IsNullString (arg2) ? -1 : atoi (arg2), IsNullString (arg3) ? -1 : atoi (arg3), IsNullString (arg4) ? -1 : atoi (arg4)); // select the weapon mode for bots else if (stricmp (arg0, "weaponmode") == 0 || stricmp (arg0, "wmode") == 0) @@ -79,7 +79,7 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c // check is selected range valid if (selection >= 1 && selection <= 7) - botMgr.SetWeaponMode (selection); + bots.SetWeaponMode (selection); else ClientPrint (ent, print_withtag, "Choose weapon from 1 to 7 range"); } @@ -94,8 +94,8 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c // loop through all players for (int i = 0; i < GetMaxClients (); i++) { - if (botMgr.GetBot (i) != NULL) - botMgr.GetBot (i)->m_voteMap = nominatedMap; + if (bots.GetBot (i) != NULL) + bots.GetBot (i)->m_voteMap = nominatedMap; } ClientPrint (ent, print_withtag, "All dead bots will vote for map #%d", nominatedMap); } @@ -258,7 +258,7 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c // show direction to specified waypoint else if (stricmp (arg1, "find") == 0) - waypoint.SetFindIndex (atoi (arg2)); + waypoints.SetFindIndex (atoi (arg2)); // opens adding waypoint menu else if (stricmp (arg1, "add") == 0) @@ -270,7 +270,7 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c // creates basic waypoints on the map (ladder/spawn points/goals) else if (stricmp (arg1, "addbasic") == 0) { - waypoint.CreateBasic (); + waypoints.CreateBasic (); CenterPrint ("Basic waypoints was Created"); } @@ -278,7 +278,7 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c else if (stricmp (arg1, "delete") == 0) { g_waypointOn = true; // turn waypoints on - waypoint.Delete (); + waypoints.Delete (); } // save waypoint data into file on hard disk @@ -288,31 +288,31 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c if (FStrEq (arg2, "nocheck")) { - waypoint.Save (); + waypoints.Save (); ServerPrint (waypointSaveMessage); } - else if (waypoint.NodesValid ()) + else if (waypoints.NodesValid ()) { - waypoint.Save (); + waypoints.Save (); ServerPrint (waypointSaveMessage); } } // remove waypoint and all corresponding files from hard disk else if (stricmp (arg1, "erase") == 0) - waypoint.EraseFromHardDisk (); + waypoints.EraseFromHardDisk (); // load all waypoints again (overrides all changes, that wasn't saved) else if (stricmp (arg1, "load") == 0) { - if (waypoint.Load ()) + if (waypoints.Load ()) ServerPrint ("Waypoints loaded"); } // check all nodes for validation else if (stricmp (arg1, "check") == 0) { - if (waypoint.NodesValid ()) + if (waypoints.NodesValid ()) CenterPrint ("Nodes work Fine"); } @@ -322,11 +322,11 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c // setting waypoint radius else if (stricmp (arg1, "setradius") == 0) - waypoint.SetRadius (atoi (arg2)); + waypoints.SetRadius (atoi (arg2)); // remembers nearest waypoint else if (stricmp (arg1, "cache") == 0) - waypoint.CacheWaypoint (); + waypoints.CacheWaypoint (); // teleport player to specified waypoint else if (stricmp (arg1, "teleport") == 0) @@ -335,7 +335,7 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c if (teleportPoint < g_numWaypoints) { - Path *path = waypoint.GetPath (teleportPoint); + Path *path = waypoints.GetPath (teleportPoint); (*g_engfuncs.pfnSetOrigin) (g_hostEntity, path->origin); g_waypointOn = true; @@ -366,19 +366,19 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c // creates incoming path from the cached waypoint else if (stricmp (arg1, "create_in") == 0) - waypoint.CreatePath (CONNECTION_INCOMING); + waypoints.CreatePath (CONNECTION_INCOMING); // creates outgoing path from current waypoint else if (stricmp (arg1, "create_out") == 0) - waypoint.CreatePath (CONNECTION_OUTGOING); + waypoints.CreatePath (CONNECTION_OUTGOING); // creates bidirectional path from cahed to current waypoint else if (stricmp (arg1, "create_both") == 0) - waypoint.CreatePath (CONNECTION_BOTHWAYS); + waypoints.CreatePath (CONNECTION_BOTHWAYS); // delete special path else if (stricmp (arg1, "delete") == 0) - waypoint.DeletePath (); + waypoints.DeletePath (); // sets auto path maximum distance else if (stricmp (arg1, "autodistance") == 0) @@ -415,8 +415,8 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c // write experience table (and visibility table) to hard disk if (stricmp (arg1, "save") == 0) { - waypoint.SaveExperienceTab (); - waypoint.SaveVisibilityTab (); + waypoints.SaveExperienceTab (); + waypoints.SaveVisibilityTab (); ServerPrint ("Experience tab saved"); } @@ -936,7 +936,7 @@ void Touch (edict_t *pentTouched, edict_t *pentOther) if (!IsEntityNull (pentOther) && (pentOther->v.flags & FL_FAKECLIENT)) { - Bot *bot = botMgr.GetBot (pentOther); + Bot *bot = bots.GetBot (pentOther); if (bot != NULL) bot->VerifyBreakable (pentTouched); @@ -1036,7 +1036,7 @@ void UpdateClientData (const struct edict_s *ent, int sendweapons, struct client extern ConVar yb_latency_display; if (yb_latency_display.GetInt () == 2) - botMgr.SendPingDataOffsets (const_cast (ent)); + bots.SendPingDataOffsets (const_cast (ent)); if (g_isMetamod) RETURN_META (MRES_IGNORED); @@ -1046,7 +1046,7 @@ void UpdateClientData (const struct edict_s *ent, int sendweapons, struct client void ClientPutInServer (edict_t *ent) { - botMgr.CheckAutoVacate (); + bots.CheckAutoVacate (); if (g_isMetamod) RETURN_META (MRES_IGNORED); @@ -1109,7 +1109,7 @@ void ClientDisconnect (edict_t *ent) InternalAssert (i >= 0 && i < 32); - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); // check if its a bot if (bot != NULL) @@ -1119,7 +1119,7 @@ void ClientDisconnect (edict_t *ent) bot->SwitchChatterIcon (false); bot->ReleaseUsedName (); - botMgr.Free (i); + bots.Free (i); } } @@ -1220,15 +1220,15 @@ void ClientCommand (edict_t *ent) case 5: case 6: case 7: - waypoint.Add (selection - 1); + waypoints.Add (selection - 1); break; case 8: - waypoint.Add (100); + waypoints.Add (100); break; case 9: - waypoint.SetLearnJumpWaypoint (); + waypoints.SetLearnJumpWaypoint (); break; case 10: @@ -1247,23 +1247,23 @@ void ClientCommand (edict_t *ent) switch (selection) { case 1: - waypoint.ToggleFlags (FLAG_NOHOSTAGE); + waypoints.ToggleFlags (FLAG_NOHOSTAGE); break; case 2: - waypoint.ToggleFlags (FLAG_TF_ONLY); + waypoints.ToggleFlags (FLAG_TF_ONLY); break; case 3: - waypoint.ToggleFlags (FLAG_CF_ONLY); + waypoints.ToggleFlags (FLAG_CF_ONLY); break; case 4: - waypoint.ToggleFlags (FLAG_LIFT); + waypoints.ToggleFlags (FLAG_LIFT); break; case 5: - waypoint.ToggleFlags (FLAG_SNIPER); + waypoints.ToggleFlags (FLAG_SNIPER); break; } if (g_isMetamod) @@ -1286,7 +1286,7 @@ void ClientCommand (edict_t *ent) case 2: g_waypointOn = true; - waypoint.CacheWaypoint (); + waypoints.CacheWaypoint (); break; case 3: @@ -1296,7 +1296,7 @@ void ClientCommand (edict_t *ent) case 4: g_waypointOn = true; - waypoint.DeletePath (); + waypoints.DeletePath (); break; case 5: @@ -1306,7 +1306,7 @@ void ClientCommand (edict_t *ent) case 6: g_waypointOn = true; - waypoint.Delete (); + waypoints.Delete (); break; case 7: @@ -1350,7 +1350,7 @@ void ClientCommand (edict_t *ent) for (int i = 0; i < g_numWaypoints; i++) { - Path *path = waypoint.GetPath (i); + Path *path = waypoints.GetPath (i); if (path->flags & FLAG_TF_ONLY) terrPoints++; @@ -1394,22 +1394,22 @@ void ClientCommand (edict_t *ent) break; case 4: - if (waypoint.NodesValid ()) - waypoint.Save (); + if (waypoints.NodesValid ()) + waypoints.Save (); else CenterPrint ("Waypoint not saved\nThere are errors, see console"); break; case 5: - waypoint.Save (); + waypoints.Save (); break; case 6: - waypoint.Load (); + waypoints.Load (); break; case 7: - if (waypoint.NodesValid ()) + if (waypoints.NodesValid ()) CenterPrint ("Nodes work Find"); else CenterPrint ("There are errors, see console"); @@ -1437,7 +1437,7 @@ void ClientCommand (edict_t *ent) const int radiusValue[] = {0, 8, 16, 32, 48, 64, 80, 96, 128}; if ((selection >= 1) && (selection <= 9)) - waypoint.SetRadius (radiusValue[selection - 1]); + waypoints.SetRadius (radiusValue[selection - 1]); if (g_isMetamod) RETURN_META (MRES_SUPERCEDE); @@ -1465,7 +1465,7 @@ void ClientCommand (edict_t *ent) break; case 4: - botMgr.KillAll (); + bots.KillAll (); break; case 10: @@ -1485,7 +1485,7 @@ void ClientCommand (edict_t *ent) switch (selection) { case 1: - botMgr.AddRandom (); + bots.AddRandom (); break; case 2: @@ -1493,15 +1493,15 @@ void ClientCommand (edict_t *ent) break; case 3: - botMgr.RemoveRandom (); + bots.RemoveRandom (); break; case 4: - botMgr.RemoveAll (); + bots.RemoveAll (); break; case 5: - botMgr.RemoveMenu (ent, 1); + bots.RemoveMenu (ent, 1); break; case 10: @@ -1628,15 +1628,15 @@ void ClientCommand (edict_t *ent) switch (selection) { case 1: - waypoint.CreatePath (CONNECTION_OUTGOING); + waypoints.CreatePath (CONNECTION_OUTGOING); break; case 2: - waypoint.CreatePath (CONNECTION_INCOMING); + waypoints.CreatePath (CONNECTION_INCOMING); break; case 3: - waypoint.CreatePath (CONNECTION_BOTHWAYS); + waypoints.CreatePath (CONNECTION_BOTHWAYS); break; case 10: @@ -1726,7 +1726,7 @@ void ClientCommand (edict_t *ent) case 2: case 3: case 4: - botMgr.FillServer (fillServerTeam, selection - 2, g_storeAddbotVars[0]); + bots.FillServer (fillServerTeam, selection - 2, g_storeAddbotVars[0]); case 10: DisplayMenuToClient (ent, NULL); @@ -1750,7 +1750,7 @@ void ClientCommand (edict_t *ent) if (selection == 5) { g_storeAddbotVars[2] = 5; - botMgr.AddBot ("", g_storeAddbotVars[0], g_storeAddbotVars[3], g_storeAddbotVars[1], g_storeAddbotVars[2]); + bots.AddBot ("", g_storeAddbotVars[0], g_storeAddbotVars[3], g_storeAddbotVars[1], g_storeAddbotVars[2]); } else { @@ -1805,7 +1805,7 @@ void ClientCommand (edict_t *ent) case 4: case 5: g_storeAddbotVars[2] = selection; - botMgr.AddBot ("", g_storeAddbotVars[0], g_storeAddbotVars[3], g_storeAddbotVars[1], g_storeAddbotVars[2]); + bots.AddBot ("", g_storeAddbotVars[0], g_storeAddbotVars[3], g_storeAddbotVars[1], g_storeAddbotVars[2]); break; case 10: @@ -1830,7 +1830,7 @@ void ClientCommand (edict_t *ent) case 5: case 6: case 7: - botMgr.SetWeaponMode (selection); + bots.SetWeaponMode (selection); break; case 10: @@ -1856,11 +1856,11 @@ void ClientCommand (edict_t *ent) case 6: case 7: case 8: - botMgr.GetBot (selection - 1)->Kick (); + bots.GetBot (selection - 1)->Kick (); break; case 9: - botMgr.RemoveMenu (ent, 2); + bots.RemoveMenu (ent, 2); break; case 10: @@ -1886,15 +1886,15 @@ void ClientCommand (edict_t *ent) case 6: case 7: case 8: - botMgr.GetBot (selection + 8 - 1)->Kick (); + bots.GetBot (selection + 8 - 1)->Kick (); break; case 9: - botMgr.RemoveMenu (ent, 3); + bots.RemoveMenu (ent, 3); break; case 10: - botMgr.RemoveMenu (ent, 1); + bots.RemoveMenu (ent, 1); break; } if (g_isMetamod) @@ -1916,15 +1916,15 @@ void ClientCommand (edict_t *ent) case 6: case 7: case 8: - botMgr.GetBot (selection + 16 - 1)->Kick (); + bots.GetBot (selection + 16 - 1)->Kick (); break; case 9: - botMgr.RemoveMenu (ent, 4); + bots.RemoveMenu (ent, 4); break; case 10: - botMgr.RemoveMenu (ent, 2); + bots.RemoveMenu (ent, 2); break; } if (g_isMetamod) @@ -1946,11 +1946,11 @@ void ClientCommand (edict_t *ent) case 6: case 7: case 8: - botMgr.GetBot (selection + 24 - 1)->Kick (); + bots.GetBot (selection + 24 - 1)->Kick (); break; case 10: - botMgr.RemoveMenu (ent, 3); + bots.RemoveMenu (ent, 3); break; } if (g_isMetamod) @@ -1984,7 +1984,7 @@ void ClientCommand (edict_t *ent) if (!(g_clients[i].flags & CF_USED) || (team != -1 && team != g_clients[i].team) || isAlive != IsAlive (g_clients[i].ent)) continue; - Bot *target = botMgr.GetBot (i); + Bot *target = bots.GetBot (i); if (target != NULL) { @@ -2013,7 +2013,7 @@ void ClientCommand (edict_t *ent) { for (int i = 0; i < GetMaxClients (); i++) { - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); // validate bot if (bot != NULL && GetTeam (bot->GetEntity ()) == g_clients[clientIndex].team && VARS (ent) != bot->pev && bot->m_radioOrder == 0) @@ -2049,8 +2049,8 @@ void ServerActivate (edict_t *pentEdictList, int edictCount, int clientMax) InitConfig (); // initialize all config files // do level initialization stuff here... - waypoint.Init (); - waypoint.Load (); + waypoints.Init (); + waypoints.Load (); // execute main config ServerCommand ("exec addons/yapb/conf/yapb.cfg"); @@ -2060,14 +2060,14 @@ void ServerActivate (edict_t *pentEdictList, int edictCount, int clientMax) ServerCommand ("exec maps/%s_yapb.cfg", GetMapName ()); ServerPrint ("Executing Map-Specific config file"); } - botMgr.InitQuota (); + bots.InitQuota (); if (g_isMetamod) RETURN_META (MRES_IGNORED); (*g_functionTable.pfnServerActivate) (pentEdictList, edictCount, clientMax); - waypoint.InitializeVisibility (); + waypoints.InitializeVisibility (); } void ServerDeactivate (void) @@ -2083,8 +2083,8 @@ void ServerDeactivate (void) // the loading of new bots and the new BSP data parsing there. // save collected experience on shutdown - waypoint.SaveExperienceTab (); - waypoint.SaveVisibilityTab (); + waypoints.SaveExperienceTab (); + waypoints.SaveVisibilityTab (); FreeLibraryMemory (); @@ -2105,7 +2105,7 @@ void StartFrame (void) // player population decreases, we should fill the server with other bots. // run periodic update of bot states - botMgr.PeriodicThink (); + bots.PeriodicThink (); // record some stats of all players on the server for (int i = 0; i < GetMaxClients (); i++) @@ -2142,15 +2142,15 @@ void StartFrame (void) if (!IsDedicatedServer () && !IsEntityNull (g_hostEntity)) { if (g_waypointOn) - waypoint.Think (); + waypoints.Think (); CheckWelcomeMessage (); } - botMgr.SetDeathMsgState (false); + bots.SetDeathMsgState (false); if (g_timePerSecondUpdate < GetWorldTime ()) { - botMgr.CalculatePingOffsets (); + bots.CalculatePingOffsets (); for (int i = 0; i < GetMaxClients (); i++) { @@ -2180,7 +2180,7 @@ void StartFrame (void) } } if (g_bombPlanted) - waypoint.SetBombPosition (); + waypoints.SetBombPosition (); if (g_isMetamod) { @@ -2199,10 +2199,10 @@ void StartFrame (void) g_timePerSecondUpdate = GetWorldTime () + 1.0f; } else if (g_timePerSecondUpdate * 0.5f < GetWorldTime ()) - botMgr.UpdateActiveGrenades (); + bots.UpdateActiveGrenades (); // keep bot number up to date - botMgr.MaintainBotQuota (); + bots.MaintainBotQuota (); if (g_isMetamod) RETURN_META (MRES_IGNORED); @@ -2210,7 +2210,7 @@ void StartFrame (void) (*g_functionTable.pfnStartFrame) (); // **** AI EXECUTION STARTS **** - botMgr.Think (); + bots.Think (); // **** AI EXECUTION FINISH **** } @@ -2223,7 +2223,7 @@ void StartFrame_Post (void) // for the bots by the MOD side, remember). Post version called only by metamod. // **** AI EXECUTION STARTS **** - botMgr.Think (); + bots.Think (); // **** AI EXECUTION FINISH **** RETURN_META (MRES_IGNORED); @@ -2254,7 +2254,7 @@ void ServerActivate_Post (edict_t *, int, int) // Once this function has been called, the server can be considered as "running". Post version // called only by metamod. - waypoint.InitializeVisibility (); + waypoints.InitializeVisibility (); RETURN_META (MRES_IGNORED); } @@ -2271,8 +2271,8 @@ void pfnChangeLevel (char *s1, char *s2) // spawn point named "tr_2lm". // save collected experience on map change - waypoint.SaveExperienceTab (); - waypoint.SaveVisibilityTab (); + waypoints.SaveExperienceTab (); + waypoints.SaveVisibilityTab (); if (g_isMetamod) RETURN_META (MRES_IGNORED); @@ -2389,13 +2389,13 @@ void pfnMessageBegin (int msgDest, int msgType, const float *origin, edict_t *ed if (!IsEntityNull (ed)) { - int index = botMgr.GetIndex (ed); + int index = bots.GetIndex (ed); // is this message for a bot? - if (index != -1 && !(ed->v.flags & FL_DORMANT) && botMgr.GetBot (index)->GetEntity () == ed) + if (index != -1 && !(ed->v.flags & FL_DORMANT) && bots.GetBot (index)->GetEntity () == ed) { netmsg.Reset (); - netmsg.SetBot (botMgr.GetBot (index)); + netmsg.SetBot (bots.GetBot (index)); // message handling is done in usermsg.cpp netmsg.HandleMessageIfRequired (msgType, NETMSG_VGUI); @@ -2424,7 +2424,7 @@ void pfnMessageBegin (int msgDest, int msgType, const float *origin, edict_t *ed { for (int i = 0; i < GetMaxClients (); i++) { - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); if (bot != NULL) bot->m_notKilled = false; @@ -2448,13 +2448,13 @@ void pfnMessageEnd (void) MESSAGE_END (); // send latency fix - botMgr.SendDeathMsgFix (); + bots.SendDeathMsgFix (); } void pfnMessageEnd_Post (void) { // send latency fix - botMgr.SendDeathMsgFix (); + bots.SendDeathMsgFix (); RETURN_META (MRES_IGNORED); } @@ -2658,7 +2658,7 @@ void pfnClientPrintf (edict_t *ent, PRINT_TYPE printType, const char *message) void pfnSetClientMaxspeed (const edict_t *ent, float newMaxspeed) { - Bot *bot = botMgr.GetBot (const_cast (ent)); + Bot *bot = bots.GetBot (const_cast (ent)); // check wether it's not a bot if (bot != NULL) @@ -2743,12 +2743,12 @@ void pfnAlertMessage (ALERT_TYPE alertType, char *format, ...) // notify all terrorists that CT is starting bomb defusing for (int i = 0; i < GetMaxClients (); i++) { - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); if (bot != NULL && GetTeam (bot->GetEntity ()) == TEAM_TF && IsAlive (bot->GetEntity ())) { bot->ResetTasks (); - bot->MoveToVector (waypoint.GetBombPosition ()); + bot->MoveToVector (waypoints.GetBombPosition ()); } } } @@ -2978,7 +2978,7 @@ export int Meta_Detach (PLUG_LOADTIME now, PL_UNLOAD_REASON reason) return FALSE; // returning false prevents metamod from unloading this plugin } - botMgr.RemoveAll (); // kick all bots off this server + bots.RemoveAll (); // kick all bots off this server FreeLibraryMemory (); return TRUE; diff --git a/source/manager.cpp b/source/manager.cpp index 3060bac..9e85869 100644 --- a/source/manager.cpp +++ b/source/manager.cpp @@ -650,7 +650,7 @@ Bot *BotManager::GetHighestFragsBot (int team) // search bots in this team for (int i = 0; i < GetMaxClients (); i++) { - highFragBot = botMgr.GetBot (i); + highFragBot = bots.GetBot (i); if (highFragBot != NULL && IsAlive (highFragBot->GetEntity ()) && GetTeam (highFragBot->GetEntity ()) == team) { @@ -1158,8 +1158,8 @@ void Bot::Kick (void) CenterPrint ("Bot '%s' kicked", STRING (pev->netname)); // balances quota - if (botMgr.GetBotsNum () - 1 < yb_quota.GetInt ()) - yb_quota.SetInt (botMgr.GetBotsNum () - 1); + if (bots.GetBotsNum () - 1 < yb_quota.GetInt ()) + yb_quota.SetInt (bots.GetBotsNum () - 1); } void Bot::StartGame (void) diff --git a/source/navigate.cpp b/source/navigate.cpp index 16d229c..79a3458 100644 --- a/source/navigate.cpp +++ b/source/navigate.cpp @@ -22,7 +22,7 @@ int Bot::FindGoal (void) { if (strcmp (STRING (pent->v.model), "models/w_backpack.mdl") == 0) { - int index = waypoint.FindNearest (GetEntityOrigin (pent)); + int index = waypoints.FindNearest (GetEntityOrigin (pent)); if (index >= 0 && index < g_numWaypoints) return m_loosedBombWptIndex = index; @@ -49,13 +49,13 @@ int Bot::FindGoal (void) switch (m_team) { case TEAM_TF: - offensiveWpts = waypoint.m_ctPoints; - defensiveWpts = waypoint.m_terrorPoints; + offensiveWpts = waypoints.m_ctPoints; + defensiveWpts = waypoints.m_terrorPoints; break; case TEAM_CF: - offensiveWpts = waypoint.m_terrorPoints; - defensiveWpts = waypoint.m_ctPoints; + offensiveWpts = waypoints.m_terrorPoints; + defensiveWpts = waypoints.m_ctPoints; break; } @@ -68,7 +68,7 @@ int Bot::FindGoal (void) else if (m_team == TEAM_CF && HasHostage ()) { tactic = 2; - offensiveWpts = waypoint.m_rescuePoints; + offensiveWpts = waypoints.m_rescuePoints; goto TacticChoosen; } @@ -100,7 +100,7 @@ int Bot::FindGoal (void) } else if ((g_mapType & MAP_DE) && m_team == TEAM_CF) { - if (g_bombPlanted && GetTaskId () != TASK_ESCAPEFROMBOMB && waypoint.GetBombPosition () != nullvec) + if (g_bombPlanted && GetTaskId () != TASK_ESCAPEFROMBOMB && waypoints.GetBombPosition () != nullvec) { if (g_bombSayString) { @@ -119,7 +119,7 @@ int Bot::FindGoal (void) { // send some terrorists to guard planter bomb if (g_bombPlanted && GetTaskId () != TASK_ESCAPEFROMBOMB && GetBombTimeleft () >= 15.0) - return m_chosenGoalIndex = FindDefendWaypoint (waypoint.GetBombPosition ()); + return m_chosenGoalIndex = FindDefendWaypoint (waypoints.GetBombPosition ()); } goalDesire = Random.Float (0.0f, 100.0f) + offensive; @@ -153,17 +153,17 @@ TacticChoosen: if (tactic == 0 && !defensiveWpts.IsEmpty ()) // careful goal FilterGoals (defensiveWpts, goalChoices); - else if (tactic == 1 && !waypoint.m_campPoints.IsEmpty ()) // camp waypoint goal + else if (tactic == 1 && !waypoints.m_campPoints.IsEmpty ()) // camp waypoint goal { // pickup sniper points if possible for sniping bots - if (!waypoint.m_sniperPoints.IsEmpty () && UsesSniper ()) - FilterGoals (waypoint.m_sniperPoints, goalChoices); + if (!waypoints.m_sniperPoints.IsEmpty () && UsesSniper ()) + FilterGoals (waypoints.m_sniperPoints, goalChoices); else - FilterGoals (waypoint.m_campPoints, goalChoices); + FilterGoals (waypoints.m_campPoints, goalChoices); } else if (tactic == 2 && !offensiveWpts.IsEmpty ()) // offensive goal FilterGoals (offensiveWpts, goalChoices); - else if (tactic == 3 && !waypoint.m_goalPoints.IsEmpty ()) // map goal waypoint + else if (tactic == 3 && !waypoints.m_goalPoints.IsEmpty ()) // map goal waypoint { // forcee bomber to select closest goal, if round-start goal was reset by something if (m_hasC4 && g_timeRoundStart + 20.0f < GetWorldTime ()) @@ -173,7 +173,7 @@ TacticChoosen: for (int i = 0; i < g_numWaypoints; i++) { - Path *path = waypoint.GetPath (i); + Path *path = waypoints.GetPath (i); if (!(path->flags & FLAG_GOAL)) continue; @@ -195,17 +195,17 @@ TacticChoosen: { if (goalChoices[i] == -1) { - goalChoices[i] = waypoint.m_goalPoints.GetRandomElement (); + goalChoices[i] = waypoints.m_goalPoints.GetRandomElement (); InternalAssert (goalChoices[i] >= 0 && goalChoices[i] < g_numWaypoints); } } } else - FilterGoals (waypoint.m_goalPoints, goalChoices); + FilterGoals (waypoints.m_goalPoints, goalChoices); } if (m_currentWaypointIndex == -1 || m_currentWaypointIndex >= g_numWaypoints) - m_currentWaypointIndex = ChangeWptIndex (waypoint.FindNearest (pev->origin)); + m_currentWaypointIndex = ChangeWptIndex (waypoints.FindNearest (pev->origin)); if (goalChoices[0] == -1) return m_chosenGoalIndex = Random.Long (0, g_numWaypoints - 1); @@ -767,9 +767,9 @@ bool Bot::DoWaypointNav (void) { if ((m_liftState == LIFT_NO_NEARBY || m_liftState == LIFT_WAITING_FOR) && m_navNode->next != NULL) { - if (m_navNode->next->index >= 0 && m_navNode->next->index < g_numWaypoints && (waypoint.GetPath (m_navNode->next->index)->flags & FLAG_LIFT)) + if (m_navNode->next->index >= 0 && m_navNode->next->index < g_numWaypoints && (waypoints.GetPath (m_navNode->next->index)->flags & FLAG_LIFT)) { - TraceLine (m_currentPath->origin, waypoint.GetPath (m_navNode->next->index)->origin, true, true, GetEntity (), &tr); + TraceLine (m_currentPath->origin, waypoints.GetPath (m_navNode->next->index)->origin, true, true, GetEntity (), &tr); if (!IsEntityNull (tr.pHit) && (strcmp (STRING (tr.pHit->v.classname), "func_door") == 0 || strcmp (STRING (tr.pHit->v.classname), "func_plat") == 0 || strcmp (STRING (tr.pHit->v.classname), "func_train") == 0)) m_liftEntity = tr.pHit; @@ -801,7 +801,7 @@ bool Bot::DoWaypointNav (void) // if some bot is following a bot going into lift - he should take the same lift to go for (int i = 0; i < GetMaxClients (); i++) { - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); if (bot == NULL || bot == this) continue; @@ -840,7 +840,7 @@ bool Bot::DoWaypointNav (void) for (int i = 0; i < GetMaxClients (); i++) { - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); if (bot == NULL) continue; // skip invalid bots @@ -898,7 +898,7 @@ bool Bot::DoWaypointNav (void) // is lift activated and bot is standing on it and lift is moving ? if (m_liftState == LIFT_LOOKING_BUTTON_INSIDE || m_liftState == LIFT_ENTERING_IN || m_liftState == LIFT_WAIT_FOR_TEAMMATES || m_liftState == LIFT_WAITING_FOR) { - if (pev->groundentity == m_liftEntity && m_liftEntity->v.velocity.z != 0 && IsOnFloor () && ((waypoint.GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT) || !IsEntityNull (m_targetEntity))) + if (pev->groundentity == m_liftEntity && m_liftEntity->v.velocity.z != 0 && IsOnFloor () && ((waypoints.GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT) || !IsEntityNull (m_targetEntity))) { m_liftState = LIFT_TRAVELING_BY; m_liftUsageTime = GetWorldTime () + 14.0; @@ -941,7 +941,7 @@ bool Bot::DoWaypointNav (void) if (m_buttonPushTime + 8.0 >= GetWorldTime ()) { if ((m_prevWptIndex[0] >= 0) && (m_prevWptIndex[0] < g_numWaypoints)) - m_destOrigin = waypoint.GetPath (m_prevWptIndex[0])->origin; + m_destOrigin = waypoints.GetPath (m_prevWptIndex[0])->origin; else m_destOrigin = pev->origin; @@ -983,7 +983,7 @@ bool Bot::DoWaypointNav (void) if (liftUsed) { if (m_prevWptIndex[0] >= 0 && m_prevWptIndex[0] < g_numWaypoints) - m_destOrigin = waypoint.GetPath (m_prevWptIndex[0])->origin; + m_destOrigin = waypoints.GetPath (m_prevWptIndex[0])->origin; else m_destOrigin = button->v.origin; @@ -1016,10 +1016,10 @@ bool Bot::DoWaypointNav (void) { if ((m_prevWptIndex[0] >= 0) && (m_prevWptIndex[0] < g_numWaypoints)) { - if (!(waypoint.GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT)) - m_destOrigin = waypoint.GetPath (m_prevWptIndex[0])->origin; + if (!(waypoints.GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT)) + m_destOrigin = waypoints.GetPath (m_prevWptIndex[0])->origin; else if ((m_prevWptIndex[1] >= 0) && (m_prevWptIndex[0] < g_numWaypoints)) - m_destOrigin = waypoint.GetPath (m_prevWptIndex[1])->origin; + m_destOrigin = waypoints.GetPath (m_prevWptIndex[1])->origin; } if ((pev->origin - m_destOrigin).GetLengthSquared () < 100) @@ -1040,7 +1040,7 @@ bool Bot::DoWaypointNav (void) // bot fall down somewhere inside the lift's groove :) if (pev->groundentity != m_liftEntity && m_prevWptIndex[0] >= 0 && m_prevWptIndex[0] < g_numWaypoints) { - if ((waypoint.GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT) && (m_currentPath->origin.z - pev->origin.z) > 50.0 && (waypoint.GetPath (m_prevWptIndex[0])->origin.z - pev->origin.z) > 50.0) + if ((waypoints.GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT) && (m_currentPath->origin.z - pev->origin.z) > 50.0 && (waypoints.GetPath (m_prevWptIndex[0])->origin.z - pev->origin.z) > 50.0) { m_liftState = LIFT_NO_NEARBY; m_liftEntity = NULL; @@ -1084,7 +1084,7 @@ bool Bot::DoWaypointNav (void) if (m_prevWptIndex[0] >= 0 && m_prevWptIndex[0] < g_numWaypoints) { - if (!(waypoint.GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT)) + if (!(waypoints.GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT)) ChangeWptIndex (m_prevWptIndex[0]); else FindWaypoint (); @@ -1237,13 +1237,13 @@ bool Bot::DoWaypointNav (void) // bot within 'hearable' bomb tick noises? if (bombOrigin != nullvec) { - float distance = (bombOrigin - waypoint.GetPath (GetTask ()->data)->origin).GetLength (); + float distance = (bombOrigin - waypoints.GetPath (GetTask ()->data)->origin).GetLength (); if (distance > 512.0) - waypoint.SetGoalVisited (GetTask ()->data); // doesn't hear so not a good goal + waypoints.SetGoalVisited (GetTask ()->data); // doesn't hear so not a good goal } else - waypoint.SetGoalVisited (GetTask ()->data); // doesn't hear so not a good goal + waypoints.SetGoalVisited (GetTask ()->data); // doesn't hear so not a good goal } HeadTowardWaypoint (); // do the actual movement checking } @@ -1270,7 +1270,7 @@ void Bot::FindShortestPath (int srcIndex, int destIndex) while (srcIndex != destIndex) { - srcIndex = *(waypoint.m_pathMatrix + (srcIndex * g_numWaypoints) + destIndex); + srcIndex = *(waypoints.m_pathMatrix + (srcIndex * g_numWaypoints) + destIndex); if (srcIndex < 0) { @@ -1415,7 +1415,7 @@ float gfunctionKillsDistT (int currentIndex, int parentIndex) float cost = (g_experienceData + (currentIndex * g_numWaypoints) + currentIndex)->team0Damage + g_highestDamageT; - Path *current = waypoint.GetPath (currentIndex); + Path *current = waypoints.GetPath (currentIndex); for (int i = 0; i < MAX_PATH_INDEX; i++) { @@ -1428,7 +1428,7 @@ float gfunctionKillsDistT (int currentIndex, int parentIndex) if (current->flags & FLAG_CROUCH) cost *= 1.5; - return waypoint.GetPathDistance (parentIndex, currentIndex) + cost; + return waypoints.GetPathDistance (parentIndex, currentIndex) + cost; } @@ -1441,7 +1441,7 @@ float gfunctionKillsDistCT (int currentIndex, int parentIndex) float cost = (g_experienceData + (currentIndex * g_numWaypoints) + currentIndex)->team1Damage + g_highestDamageCT; - Path *current = waypoint.GetPath (currentIndex); + Path *current = waypoints.GetPath (currentIndex); for (int i = 0; i < MAX_PATH_INDEX; i++) { @@ -1454,14 +1454,14 @@ float gfunctionKillsDistCT (int currentIndex, int parentIndex) if (current->flags & FLAG_CROUCH) cost *= 1.5; - return waypoint.GetPathDistance (parentIndex, currentIndex) + cost; + return waypoints.GetPathDistance (parentIndex, currentIndex) + cost; } float gfunctionKillsDistCTWithHostage (int currentIndex, int parentIndex) { // least kills and number of nodes to goal for a team - Path *current = waypoint.GetPath (currentIndex); + Path *current = waypoints.GetPath (currentIndex); if (current->flags & FLAG_NOHOSTAGE) return 65355; @@ -1478,7 +1478,7 @@ float gfunctionKillsT (int currentIndex, int) float cost = (g_experienceData + (currentIndex * g_numWaypoints) + currentIndex)->team0Damage; - Path *current = waypoint.GetPath (currentIndex); + Path *current = waypoints.GetPath (currentIndex); for (int i = 0; i < MAX_PATH_INDEX; i++) { @@ -1503,7 +1503,7 @@ float gfunctionKillsCT (int currentIndex, int parentIndex) float cost = (g_experienceData + (currentIndex * g_numWaypoints) + currentIndex)->team1Damage; - Path *current = waypoint.GetPath (currentIndex); + Path *current = waypoints.GetPath (currentIndex); for (int i = 0; i < MAX_PATH_INDEX; i++) { @@ -1526,7 +1526,7 @@ float gfunctionKillsCTWithHostage (int currentIndex, int parentIndex) if (parentIndex == -1) return 0; - Path *current = waypoint.GetPath (currentIndex); + Path *current = waypoints.GetPath (currentIndex); if (current->flags & FLAG_NOHOSTAGE) return 65355; @@ -1542,8 +1542,8 @@ float gfunctionPathDist (int currentIndex, int parentIndex) if (parentIndex == -1) return 0; - Path *parent = waypoint.GetPath (parentIndex); - Path *current = waypoint.GetPath (currentIndex); + Path *parent = waypoints.GetPath (parentIndex); + Path *current = waypoints.GetPath (currentIndex); for (int i = 0; i < MAX_PATH_INDEX; i++) { @@ -1561,7 +1561,7 @@ float gfunctionPathDist (int currentIndex, int parentIndex) float gfunctionPathDistWithHostage (int currentIndex, int parentIndex) { - Path *current = waypoint.GetPath (currentIndex); + Path *current = waypoints.GetPath (currentIndex); if (current->flags & FLAG_NOHOSTAGE) return 65355; @@ -1576,8 +1576,8 @@ float hfunctionSquareDist (int index, int, int goalIndex) { // square distance heuristic - Path *start = waypoint.GetPath (index); - Path *goal = waypoint.GetPath (goalIndex); + Path *start = waypoints.GetPath (index); + Path *goal = waypoints.GetPath (goalIndex); #if 0 float deltaX = fabsf (start->origin.x - goal->origin.x); @@ -1601,7 +1601,7 @@ float hfunctionSquareDistWithHostage (int index, int startIndex, int goalIndex) { // square distance heuristic with hostages - if (waypoint.GetPath (startIndex)->flags & FLAG_NOHOSTAGE) + if (waypoints.GetPath (startIndex)->flags & FLAG_NOHOSTAGE) return 65355; return hfunctionSquareDist (index, startIndex, goalIndex); @@ -1758,7 +1758,7 @@ void Bot::FindPath (int srcIndex, int destIndex, unsigned char pathType) // now expand the current node for (int i = 0; i < MAX_PATH_INDEX; i++) { - int currentChild = waypoint.GetPath (currentIndex)->index[i]; + int currentChild = waypoints.GetPath (currentIndex)->index[i]; if (currentChild == -1) continue; @@ -1806,20 +1806,20 @@ int Bot::GetAimingWaypoint (const Vector &to) // return the most distant waypoint which is seen from the bot to the target and is within count if (m_currentWaypointIndex == -1) - m_currentWaypointIndex = ChangeWptIndex (waypoint.FindNearest (pev->origin)); + m_currentWaypointIndex = ChangeWptIndex (waypoints.FindNearest (pev->origin)); int srcIndex = m_currentWaypointIndex; - int destIndex = waypoint.FindNearest (to); + int destIndex = waypoints.FindNearest (to); int bestIndex = srcIndex; while (destIndex != srcIndex) { - destIndex = *(waypoint.m_pathMatrix + (destIndex * g_numWaypoints) + srcIndex); + destIndex = *(waypoints.m_pathMatrix + (destIndex * g_numWaypoints) + srcIndex); if (destIndex < 0) break; - if (waypoint.IsVisible (m_currentWaypointIndex, destIndex)) + if (waypoints.IsVisible (m_currentWaypointIndex, destIndex)) { bestIndex = destIndex; break; @@ -1854,11 +1854,11 @@ bool Bot::FindWaypoint (void) #endif continue; - if ((g_mapType & MAP_CS) && HasHostage () && (waypoint.GetPath (i)->flags & FLAG_NOHOSTAGE)) + if ((g_mapType & MAP_CS) && HasHostage () && (waypoints.GetPath (i)->flags & FLAG_NOHOSTAGE)) continue; // ignore non-reacheable waypoints... - if (!waypoint.Reachable (this, i)) + if (!waypoints.Reachable (this, i)) continue; // check if waypoint is already used by another bot... @@ -1869,7 +1869,7 @@ bool Bot::FindWaypoint (void) } // now pick 1-2 random waypoints that near the bot - float distance = (waypoint.GetPath (i)->origin - pev->origin).GetLengthSquared (); + float distance = (waypoints.GetPath (i)->origin - pev->origin).GetLengthSquared (); // now fill the waypoint list for (int j = 0; j < 3; j++) @@ -1902,7 +1902,7 @@ bool Bot::FindWaypoint (void) i = 0; Array found; - waypoint.FindInRadius (found, 256.0f, pev->origin); + waypoints.FindInRadius (found, 256.0f, pev->origin); if (!found.IsEmpty ()) { @@ -1913,7 +1913,7 @@ bool Bot::FindWaypoint (void) { int index = found.Pop (); - if (!waypoint.Reachable (this, index)) + if (!waypoints.Reachable (this, index)) continue; waypointIndeces[i] = index; @@ -2042,7 +2042,7 @@ int Bot::ChangeWptIndex(int waypointIndex) m_currentWaypointIndex = waypointIndex; m_navTimeset = GetWorldTime (); - m_currentPath = waypoint.GetPath (m_currentWaypointIndex); + m_currentPath = waypoints.GetPath (m_currentWaypointIndex); m_waypointFlags = m_currentPath->flags; return m_currentWaypointIndex; // to satisfy static-code analyzers @@ -2052,7 +2052,7 @@ int Bot::ChooseBombWaypoint (void) { // this function finds the best goal (bomb) waypoint for CTs when searching for a planted bomb. - Array goals = waypoint.m_goalPoints; + Array goals = waypoints.m_goalPoints; if (goals.IsEmpty ()) return Random.Long (0, g_numWaypoints - 1); // reliability check @@ -2069,7 +2069,7 @@ int Bot::ChooseBombWaypoint (void) // find nearest goal waypoint either to bomb (if "heard" or player) FOR_EACH_AE (goals, i) { - float distance = (waypoint.GetPath (goals[i])->origin - bombOrigin).GetLengthSquared (); + float distance = (waypoints.GetPath (goals[i])->origin - bombOrigin).GetLengthSquared (); // check if we got more close distance if (distance < lastDistance) @@ -2079,7 +2079,7 @@ int Bot::ChooseBombWaypoint (void) } } - while (waypoint.IsGoalVisited (goal)) + while (waypoints.IsGoalVisited (goal)) { goal = goals.GetRandomElement (); @@ -2105,8 +2105,8 @@ int Bot::FindDefendWaypoint (const Vector &origin) minDistance[i] = 128; } - int posIndex = waypoint.FindNearest (origin); - int srcIndex = waypoint.FindNearest (pev->origin); + int posIndex = waypoints.FindNearest (origin); + int srcIndex = waypoints.FindNearest (pev->origin); // some of points not found, return random one if (srcIndex == -1 || posIndex == -1) @@ -2115,17 +2115,17 @@ int Bot::FindDefendWaypoint (const Vector &origin) for (int i = 0; i < g_numWaypoints; i++) // find the best waypoint now { // exclude ladder & current waypoints - if ((waypoint.GetPath (i)->flags & FLAG_LADDER) || i == srcIndex || !waypoint.IsVisible (i, posIndex) || IsPointOccupied (i)) + if ((waypoints.GetPath (i)->flags & FLAG_LADDER) || i == srcIndex || !waypoints.IsVisible (i, posIndex) || IsPointOccupied (i)) continue; // use the 'real' pathfinding distances - int distances = waypoint.GetPathDistance (srcIndex, i); + int distances = waypoints.GetPathDistance (srcIndex, i); // skip wayponts with distance more than 1024 units if (distances > 1248.0f) continue; - TraceLine (waypoint.GetPath (i)->origin, waypoint.GetPath (posIndex)->origin, true, true, GetEntity (), &tr); + TraceLine (waypoints.GetPath (i)->origin, waypoints.GetPath (posIndex)->origin, true, true, GetEntity (), &tr); // check if line not hit anything if (tr.flFraction != 1.0) @@ -2192,7 +2192,7 @@ int Bot::FindDefendWaypoint (const Vector &origin) for (int i = 0; i < g_numWaypoints; i++) { - if ((waypoint.GetPath (i)->origin - origin).GetLength () <= 1248.0f && !IsPointOccupied (i)) + if ((waypoints.GetPath (i)->origin - origin).GetLength () <= 1248.0f && !IsPointOccupied (i)) found.Push (i); } @@ -2224,7 +2224,7 @@ int Bot::FindCoverWaypoint (float maxDistance) maxDistance = 300.0; int srcIndex = m_currentWaypointIndex; - int enemyIndex = waypoint.FindNearest (m_lastEnemyOrigin); + int enemyIndex = waypoints.FindNearest (m_lastEnemyOrigin); Array enemyIndices; int waypointIndex[MAX_PATH_INDEX]; @@ -2242,8 +2242,8 @@ int Bot::FindCoverWaypoint (float maxDistance) // now get enemies neigbouring points for (int i = 0; i < MAX_PATH_INDEX; i++) { - if (waypoint.GetPath (enemyIndex)->index[i] != -1) - enemyIndices.Push (waypoint.GetPath (enemyIndex)->index[i]); + if (waypoints.GetPath (enemyIndex)->index[i] != -1) + enemyIndices.Push (waypoints.GetPath (enemyIndex)->index[i]); } // ensure we're on valid point @@ -2253,14 +2253,14 @@ int Bot::FindCoverWaypoint (float maxDistance) for (int i = 0; i < g_numWaypoints; i++) { // exclude ladder, current waypoints and waypoints seen by the enemy - if ((waypoint.GetPath (i)->flags & FLAG_LADDER) || i == srcIndex || waypoint.IsVisible (enemyIndex, i)) + if ((waypoints.GetPath (i)->flags & FLAG_LADDER) || i == srcIndex || waypoints.IsVisible (enemyIndex, i)) continue; bool neighbourVisible = false; // now check neighbour waypoints for visibility FOR_EACH_AE (enemyIndices, j) { - if (waypoint.IsVisible (enemyIndices[j], i)) + if (waypoints.IsVisible (enemyIndices[j], i)) { neighbourVisible = true; break; @@ -2272,8 +2272,8 @@ int Bot::FindCoverWaypoint (float maxDistance) continue; // use the 'real' pathfinding distances - int distances = waypoint.GetPathDistance (srcIndex, i); - int enemyDistance = waypoint.GetPathDistance (enemyIndex, i); + int distances = waypoints.GetPathDistance (srcIndex, i); + int enemyDistance = waypoints.GetPathDistance (enemyIndex, i); if (distances >= enemyDistance) continue; @@ -2337,7 +2337,7 @@ int Bot::FindCoverWaypoint (float maxDistance) { if (waypointIndex[i] != -1) { - TraceLine (m_lastEnemyOrigin + Vector (0, 0, 36), waypoint.GetPath (waypointIndex[i])->origin, true, true, GetEntity (), &tr); + TraceLine (m_lastEnemyOrigin + Vector (0, 0, 36), waypoints.GetPath (waypointIndex[i])->origin, true, true, GetEntity (), &tr); if (tr.flFraction < 1.0) return waypointIndex[i]; @@ -2366,9 +2366,9 @@ bool Bot::GetBestNextWaypoint (void) { int id = m_currentPath->index[i]; - if (id != -1 && waypoint.IsConnected (id, m_navNode->next->index) && waypoint.IsConnected (m_currentWaypointIndex, id)) + if (id != -1 && waypoints.IsConnected (id, m_navNode->next->index) && waypoints.IsConnected (m_currentWaypointIndex, id)) { - if (waypoint.GetPath (id)->flags & FLAG_LADDER) // don't use ladder waypoints as alternative + if (waypoints.GetPath (id)->flags & FLAG_LADDER) // don't use ladder waypoints as alternative continue; if (!IsPointOccupied (id)) @@ -2435,7 +2435,7 @@ bool Bot::HeadTowardWaypoint (void) if (m_baseAgressionLevel < kills && HasPrimaryWeapon ()) { PushTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + Random.Float (m_difficulty * 0.5, m_difficulty) * 5, true); - PushTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, FindDefendWaypoint (waypoint.GetPath (nextIndex)->origin), GetWorldTime () + Random.Float (3.0f, 10.0f), true); + PushTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, FindDefendWaypoint (waypoints.GetPath (nextIndex)->origin), GetWorldTime () + Random.Float (3.0f, 10.0f), true); } } else if (g_botsCanPause && !IsOnLadder () && !IsInWater () && !m_currentTravelFlags && IsOnFloor ()) @@ -2479,8 +2479,8 @@ bool Bot::HeadTowardWaypoint (void) { for (int i = 0; i < MAX_PATH_INDEX; i++) { - Path *path = waypoint.GetPath (m_navNode->index); - Path *next = waypoint.GetPath (m_navNode->next->index); + Path *path = waypoints.GetPath (m_navNode->index); + Path *next = waypoints.GetPath (m_navNode->next->index); if (path->index[i] == m_navNode->next->index && (path->connectionFlags[i] & PATHFLAG_JUMP)) { @@ -2500,12 +2500,12 @@ bool Bot::HeadTowardWaypoint (void) SelectWeaponByName ("weapon_knife"); // draw out the knife if we needed // bot not already on ladder but will be soon? - if ((waypoint.GetPath (destIndex)->flags & FLAG_LADDER) && !IsOnLadder ()) + if ((waypoints.GetPath (destIndex)->flags & FLAG_LADDER) && !IsOnLadder ()) { // get ladder waypoints used by other (first moving) bots for (int c = 0; c < GetMaxClients (); c++) { - Bot *otherBot = botMgr.GetBot (c); + Bot *otherBot = bots.GetBot (c); // if another bot uses this ladder, wait 3 secs if (otherBot != NULL && otherBot != this && IsAlive (otherBot->GetEntity ()) && otherBot->m_currentWaypointIndex == m_navNode->index) @@ -3112,10 +3112,10 @@ int Bot::GetAimingWaypoint (void) for (int i = 0; i < g_numWaypoints; i++) { - if (currentWaypoint == i || !waypoint.IsVisible (currentWaypoint, i)) + if (currentWaypoint == i || !waypoints.IsVisible (currentWaypoint, i)) continue; - Path *path = waypoint.GetPath (i); + Path *path = waypoints.GetPath (i); if (count < 3) { @@ -3257,7 +3257,7 @@ int Bot::FindPlantedBomb (void) { if (strcmp (STRING (bombEntity->v.model) + 9, "c4.mdl") == 0) { - int nearestIndex = waypoint.FindNearest (GetEntityOrigin (bombEntity)); + int nearestIndex = waypoints.FindNearest (GetEntityOrigin (bombEntity)); if (nearestIndex >= 0 && nearestIndex < g_numWaypoints) return nearestIndex; @@ -3276,7 +3276,7 @@ bool Bot::IsPointOccupied (int index) // first check if current waypoint of one of the bots is index waypoint for (int i = 0; i < GetMaxClients (); i++) { - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); if (bot == NULL || bot == this) continue; @@ -3287,7 +3287,7 @@ bool Bot::IsPointOccupied (int index) int occupyId = GetShootingConeDeviation (bot->GetEntity (), &pev->origin) >= 0.7f ? bot->m_prevWptIndex[0] : m_currentWaypointIndex; // length check - float length = (waypoint.GetPath (occupyId)->origin - waypoint.GetPath (index)->origin).GetLengthSquared (); + float length = (waypoints.GetPath (occupyId)->origin - waypoints.GetPath (index)->origin).GetLengthSquared (); if (occupyId == index || bot->GetTask ()->data == index || length < GET_SQUARE (64.0f)) return true; diff --git a/source/netmsg.cpp b/source/netmsg.cpp index de01f63..d06f200 100644 --- a/source/netmsg.cpp +++ b/source/netmsg.cpp @@ -255,7 +255,7 @@ void NetworkMsg::Execute (void *p) break; case 2: - botMgr.SetDeathMsgState (true); + bots.SetDeathMsgState (true); if (killerIndex != 0 && killerIndex != victimIndex) { @@ -270,7 +270,7 @@ void NetworkMsg::Execute (void *p) // need to send congrats on well placed shot for (int i = 0; i < GetMaxClients (); i++) { - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); if (bot != NULL && IsAlive (bot->GetEntity ()) && killer != bot->GetEntity () && bot->EntityIsVisible (victim->v.origin) && GetTeam (killer) == GetTeam (bot->GetEntity ()) && GetTeam (killer) != GetTeam (victim)) { @@ -287,7 +287,7 @@ void NetworkMsg::Execute (void *p) // notice nearby to victim teammates, that attacker is near for (int i = 0; i < GetMaxClients (); i++) { - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); if (bot != NULL && IsAlive (bot->GetEntity ()) && GetTeam (bot->GetEntity ()) == GetTeam (victim) && IsVisible (killer->v.origin, bot->GetEntity ()) && IsEntityNull (bot->m_enemy) && GetTeam (killer) != GetTeam (victim)) { @@ -299,7 +299,7 @@ void NetworkMsg::Execute (void *p) } } - Bot *bot = botMgr.GetBot (killer); + Bot *bot = bots.GetBot (killer); // is this message about a bot who killed somebody? if (bot != NULL) @@ -307,7 +307,7 @@ void NetworkMsg::Execute (void *p) else // did a human kill a bot on his team? { - Bot *target = botMgr.GetBot (victim); + Bot *target = bots.GetBot (victim); if (target != NULL) { @@ -393,11 +393,11 @@ void NetworkMsg::Execute (void *p) if (FStrEq (PTR_TO_STR (p), "#CTs_Win")) { - botMgr.SetLastWinner (TEAM_CF); // update last winner for economics + bots.SetLastWinner (TEAM_CF); // update last winner for economics if (yb_communication_type.GetInt () == 2) { - Bot *bot = botMgr.FindOneValidAliveBot (); + Bot *bot = bots.FindOneValidAliveBot (); if (bot != NULL && IsAlive (bot->GetEntity ())) bot->HandleChatterMessage (PTR_TO_STR (p)); @@ -406,23 +406,23 @@ void NetworkMsg::Execute (void *p) if (FStrEq (PTR_TO_STR (p), "#Game_will_restart_in")) { - botMgr.CheckTeamEconomics (TEAM_CF, true); - botMgr.CheckTeamEconomics (TEAM_TF, true); + bots.CheckTeamEconomics (TEAM_CF, true); + bots.CheckTeamEconomics (TEAM_TF, true); } if (FStrEq (PTR_TO_STR (p), "#Terrorists_Win")) { - botMgr.SetLastWinner (TEAM_TF); // update last winner for economics + bots.SetLastWinner (TEAM_TF); // update last winner for economics if (yb_communication_type.GetInt () == 2) { - Bot *bot = botMgr.FindOneValidAliveBot (); + Bot *bot = bots.FindOneValidAliveBot (); if (bot != NULL && IsAlive (bot->GetEntity ())) bot->HandleChatterMessage (PTR_TO_STR (p)); } } - waypoint.SetBombPosition (true); + waypoints.SetBombPosition (true); } else if (!g_bombPlanted && FStrEq (PTR_TO_STR (p), "#Bomb_Planted")) { @@ -431,7 +431,7 @@ void NetworkMsg::Execute (void *p) for (int i = 0; i < GetMaxClients (); i++) { - Bot *bot = botMgr.GetBot (i); + Bot *bot = bots.GetBot (i); if (bot != NULL && IsAlive (bot->GetEntity ())) { @@ -442,7 +442,7 @@ void NetworkMsg::Execute (void *p) bot->ChatterMessage (Chatter_WhereIsTheBomb); } } - waypoint.SetBombPosition (); + waypoints.SetBombPosition (); } else if (m_bot != NULL && FStrEq (PTR_TO_STR (p), "#Switch_To_BurstFire")) m_bot->m_weaponBurstMode = BM_ON; diff --git a/source/support.cpp b/source/support.cpp index 78d915f..4691a1d 100644 --- a/source/support.cpp +++ b/source/support.cpp @@ -287,7 +287,7 @@ void DecalTrace (entvars_t *pev, TraceResult *trace, int logotypeIndex) void FreeLibraryMemory (void) { // this function free's all allocated memory - waypoint.Init (); // frees waypoint data + waypoints.Init (); // frees waypoint data locale.Destroy (); // clear language delete [] g_experienceData; @@ -731,18 +731,18 @@ void RoundInit (void) g_roundEnded = false; // check team economics - botMgr.CheckTeamEconomics (TEAM_TF); - botMgr.CheckTeamEconomics (TEAM_CF); + bots.CheckTeamEconomics (TEAM_TF); + bots.CheckTeamEconomics (TEAM_CF); for (int i = 0; i < GetMaxClients (); i++) { - if (botMgr.GetBot (i)) - botMgr.GetBot (i)->NewRound (); + if (bots.GetBot (i)) + bots.GetBot (i)->NewRound (); g_radioSelect[i] = 0; } - waypoint.SetBombPosition (true); - waypoint.ClearGoalScore (); + waypoints.SetBombPosition (true); + waypoints.ClearGoalScore (); g_bombSayString = false; g_timeBombPlanted = 0.0; @@ -791,7 +791,7 @@ bool IsValidPlayer (edict_t *ent) if (ent->v.flags & FL_PROXY) return false; - if ((ent->v.flags & (FL_CLIENT | FL_FAKECLIENT)) || botMgr.GetBot (ent) != NULL) + if ((ent->v.flags & (FL_CLIENT | FL_FAKECLIENT)) || bots.GetBot (ent) != NULL) return !IsNullString (STRING (ent->v.netname)); return false; @@ -810,7 +810,7 @@ bool IsPlayerVIP (edict_t *ent) bool IsValidBot (edict_t *ent) { - if (botMgr.GetBot (ent) != NULL || (!IsEntityNull (ent) && (ent->v.flags & FL_FAKECLIENT))) + if (bots.GetBot (ent) != NULL || (!IsEntityNull (ent) && (ent->v.flags & FL_FAKECLIENT))) return true; return false; @@ -1030,7 +1030,7 @@ void CheckWelcomeMessage (void) WRITE_SHORT (FixedUnsigned16 (2, 1 << 8)); WRITE_SHORT (FixedUnsigned16 (6, 1 << 8)); WRITE_SHORT (FixedUnsigned16 (0.1, 1 << 8)); - WRITE_STRING (FormatBuffer ("\nServer is running YaPB v%s (Build: %u)\nDeveloped by %s\n\n%s", PRODUCT_VERSION, GenerateBuildNumber (), PRODUCT_AUTHOR, waypoint.GetInfo ())); + WRITE_STRING (FormatBuffer ("\nServer is running YaPB v%s (Build: %u)\nDeveloped by %s\n\n%s", PRODUCT_VERSION, GenerateBuildNumber (), PRODUCT_AUTHOR, waypoints.GetInfo ())); MESSAGE_END (); receiveTime = 0.0; @@ -1256,7 +1256,7 @@ bool FindNearestPlayer (void **pvHolder, edict_t *to, float searchDistance, bool // fill the holder if (needBot) - *pvHolder = reinterpret_cast (botMgr.GetBot (survive)); + *pvHolder = reinterpret_cast (bots.GetBot (survive)); else *pvHolder = reinterpret_cast (survive); diff --git a/source/waypoint.cpp b/source/waypoint.cpp index fecd931..9158a38 100644 --- a/source/waypoint.cpp +++ b/source/waypoint.cpp @@ -174,8 +174,8 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin) if (waypointOrigin == nullvec) newOrigin = g_hostEntity->v.origin; - if (botMgr.GetBotsNum () > 0) - botMgr.RemoveAll (); + if (bots.GetBotsNum () > 0) + bots.RemoveAll (); g_waypointsChanged = true; @@ -459,8 +459,8 @@ void Waypoint::Delete (void) if (g_numWaypoints < 1) return; - if (botMgr.GetBotsNum () > 0) - botMgr.RemoveAll (); + if (bots.GetBotsNum () > 0) + bots.RemoveAll (); int index = FindNearest (g_hostEntity->v.origin, 50.0); @@ -1210,7 +1210,7 @@ bool Waypoint::Load (void) InitVisibilityTab (); InitExperienceTab (); - botMgr.InitQuota (); + bots.InitQuota (); extern ConVar yb_debug_goal; yb_debug_goal.SetInt (-1); @@ -2658,7 +2658,7 @@ WaypointDownloadError WaypointDownloader::DoDownload (void) recvPosition++; } - File fp (waypoint.CheckSubfolderFile (), "wb"); + File fp (waypoints.CheckSubfolderFile (), "wb"); if (!fp.IsValid ()) {