Fixes for best waypoint searching and waypoint advance code.

Fixed software renderer true for OSX & Linux.
Fixed software renderer is default for OSX & Linux.
Fixed GCCs -pedantic warnings.
This commit is contained in:
jeefo 2019-08-01 23:02:44 +03:00
commit 1d3910d629
12 changed files with 71 additions and 68 deletions

View file

@ -20,7 +20,7 @@
CR_DECLARE_SCOPED_ENUM (ReservePolicy, CR_DECLARE_SCOPED_ENUM (ReservePolicy,
Multiple, Multiple,
Single, Single,
); )
CR_NAMESPACE_BEGIN CR_NAMESPACE_BEGIN

View file

@ -41,7 +41,7 @@ using uint8 = unsigned char;
using uint16 = unsigned short; using uint16 = unsigned short;
using uint32 = unsigned int; using uint32 = unsigned int;
using uint64 = unsigned long long; using uint64 = unsigned long long;
}; }
// make types available for our own use // make types available for our own use
using namespace cr::types; using namespace cr::types;
@ -114,13 +114,13 @@ public:
__VA_ARGS__ \ __VA_ARGS__ \
}; \ }; \
}; \ }; \
}; \ } \
CR_NAMESPACE_END \ CR_NAMESPACE_END \
using enumName = ::cr::enums::_##enumName::Type; \ using enumName = ::cr::enums::_##enumName::Type; \
// same as above, but with int32 type // same as above, but with int32 type
#define CR_DECLARE_SCOPED_ENUM(enumName, ...) \ #define CR_DECLARE_SCOPED_ENUM(enumName, ...) \
CR_DECLARE_SCOPED_ENUM_TYPE(enumName, int32, __VA_ARGS__); \ CR_DECLARE_SCOPED_ENUM_TYPE(enumName, int32, __VA_ARGS__) \
CR_NAMESPACE_END CR_NAMESPACE_END

View file

@ -34,7 +34,7 @@ CR_NAMESPACE_BEGIN
namespace types { namespace types {
using StringArray = Array <String>; using StringArray = Array <String>;
using IntArray = Array <int>; using IntArray = Array <int>;
}; }
using namespace cr::types; using namespace cr::types;

View file

@ -41,7 +41,7 @@ CR_DECLARE_SCOPED_ENUM (HttpClientResult,
Undefined, Undefined,
NoLocalFile = -1, NoLocalFile = -1,
LocalFileExists = -2 LocalFileExists = -2
); )
CR_NAMESPACE_BEGIN CR_NAMESPACE_BEGIN
@ -193,7 +193,7 @@ namespace detail {
return result; return result;
} }
}; };
}; }
// simple http client for downloading/uploading files only // simple http client for downloading/uploading files only
class HttpClient final : public Singleton <HttpClient> { class HttpClient final : public Singleton <HttpClient> {

View file

@ -83,7 +83,7 @@ inline float cosf (const float value) {
inline float atanf (const float x) { inline float atanf (const float x) {
const float sqr = cr::square (x); const float sqr = cr::square (x);
return x * (48.70107004404898384f + sqr * (49.5326263772254345f + sqr * 9.40604244231624f)) / (48.70107004404996166f + sqr * (65.7663163908956299f + sqr * (21.587934067020262f + sqr))); return x * (48.70107004404898384f + sqr * (49.5326263772254345f + sqr * 9.40604244231624f)) / (48.70107004404996166f + sqr * (65.7663163908956299f + sqr * (21.587934067020262f + sqr)));
}; }
inline float atan2f (const float y, const float x) { inline float atan2f (const float y, const float x) {
const float ax = cr::abs (x); const float ax = cr::abs (x);

View file

@ -23,7 +23,7 @@ namespace detail {
template <typename T> struct ClearRef <T &&> { template <typename T> struct ClearRef <T &&> {
using Type = T; using Type = T;
}; };
}; }
template <typename T> typename detail::ClearRef <T>::Type constexpr &&move (T &&type) noexcept { template <typename T> typename detail::ClearRef <T>::Type constexpr &&move (T &&type) noexcept {
return static_cast <typename detail::ClearRef <T>::Type &&> (type); return static_cast <typename detail::ClearRef <T>::Type &&> (type);

View file

@ -14,7 +14,7 @@ CR_DECLARE_SCOPED_ENUM (DrawLine,
Simple, Simple,
Arrow, Arrow,
Count Count
); )
// trace ignore // trace ignore
CR_DECLARE_SCOPED_ENUM (TraceIgnore, CR_DECLARE_SCOPED_ENUM (TraceIgnore,
@ -22,7 +22,7 @@ CR_DECLARE_SCOPED_ENUM (TraceIgnore,
Glass = cr::bit (0), Glass = cr::bit (0),
Monsters = cr::bit (1), Monsters = cr::bit (1),
Everything = Glass | Monsters Everything = Glass | Monsters
); )
// variable type // variable type
CR_DECLARE_SCOPED_ENUM (Var, CR_DECLARE_SCOPED_ENUM (Var,
@ -31,7 +31,7 @@ CR_DECLARE_SCOPED_ENUM (Var,
Password, Password,
NoServer, NoServer,
NoRegister NoRegister
); )
// netmessage functions // netmessage functions
CR_DECLARE_SCOPED_ENUM (NetMsg, CR_DECLARE_SCOPED_ENUM (NetMsg,
@ -59,7 +59,7 @@ CR_DECLARE_SCOPED_ENUM (NetMsg,
Fashlight = 22, Fashlight = 22,
ItemStatus = 23, ItemStatus = 23,
Count = 25 Count = 25
); )
// supported cs's // supported cs's
CR_DECLARE_SCOPED_ENUM (GameFlags, CR_DECLARE_SCOPED_ENUM (GameFlags,
@ -75,7 +75,7 @@ CR_DECLARE_SCOPED_ENUM (GameFlags,
ReGameDLL = cr::bit (9), // server dll is a regamedll ReGameDLL = cr::bit (9), // server dll is a regamedll
HasFakePings = cr::bit (10), // on that game version we can fake bots pings HasFakePings = cr::bit (10), // on that game version we can fake bots pings
HasBotVoice = cr::bit (11) // on that game version we can use chatter HasBotVoice = cr::bit (11) // on that game version we can use chatter
); )
// defines map type // defines map type
CR_DECLARE_SCOPED_ENUM (MapFlags, CR_DECLARE_SCOPED_ENUM (MapFlags,
@ -86,7 +86,7 @@ CR_DECLARE_SCOPED_ENUM (MapFlags,
KnifeArena = cr::bit (4), KnifeArena = cr::bit (4),
Fun = cr::bit (5), Fun = cr::bit (5),
HasDoors = cr::bit (10) // additional flags HasDoors = cr::bit (10) // additional flags
); )
// variable reg pair // variable reg pair
struct VarPair { struct VarPair {

View file

@ -41,7 +41,7 @@ CR_DECLARE_SCOPED_ENUM (Task,
Hide, Hide,
Blind, Blind,
Spraypaint, Spraypaint,
); )
// bot menu ids // bot menu ids
CR_DECLARE_SCOPED_ENUM (Menu, CR_DECLARE_SCOPED_ENUM (Menu,
@ -67,13 +67,13 @@ CR_DECLARE_SCOPED_ENUM (Menu,
KickPage2, KickPage2,
KickPage3, KickPage3,
KickPage4, KickPage4,
); )
// bomb say string // bomb say string
CR_DECLARE_SCOPED_ENUM (BombPlantedSay, CR_DECLARE_SCOPED_ENUM (BombPlantedSay,
ChatSay = cr::bit (1), ChatSay = cr::bit (1),
Chatter = cr::bit (2) Chatter = cr::bit (2)
); )
// chat types id's // chat types id's
CR_DECLARE_SCOPED_ENUM (Chat, CR_DECLARE_SCOPED_ENUM (Chat,
@ -85,7 +85,7 @@ CR_DECLARE_SCOPED_ENUM (Chat,
Hello, // id to welcome chat array Hello, // id to welcome chat array
NoKeyword, // id to no keyword chat array NoKeyword, // id to no keyword chat array
Count // number for array Count // number for array
); )
// personalities defines // personalities defines
CR_DECLARE_SCOPED_ENUM (Personality, CR_DECLARE_SCOPED_ENUM (Personality,
@ -93,7 +93,7 @@ CR_DECLARE_SCOPED_ENUM (Personality,
Rusher, Rusher,
Careful, Careful,
Invalid = -1 Invalid = -1
); )
// bot difficulties // bot difficulties
CR_DECLARE_SCOPED_ENUM (Difficulty, CR_DECLARE_SCOPED_ENUM (Difficulty,
@ -103,7 +103,7 @@ CR_DECLARE_SCOPED_ENUM (Difficulty,
Hard, Hard,
Extreme, Extreme,
Invalid = -1 Invalid = -1
); )
// collision states // collision states
CR_DECLARE_SCOPED_ENUM (CollisionState, CR_DECLARE_SCOPED_ENUM (CollisionState,
@ -114,7 +114,7 @@ CR_DECLARE_SCOPED_ENUM (CollisionState,
Duck, Duck,
StrafeLeft, StrafeLeft,
StrafeRight StrafeRight
); )
// counter-strike team id's // counter-strike team id's
CR_DECLARE_SCOPED_ENUM (Team, CR_DECLARE_SCOPED_ENUM (Team,
@ -123,13 +123,13 @@ CR_DECLARE_SCOPED_ENUM (Team,
Spectator, Spectator,
Unassigned, Unassigned,
Invalid = -1 Invalid = -1
); )
// item status for StatusIcon message // item status for StatusIcon message
CR_DECLARE_SCOPED_ENUM (ItemStatus, CR_DECLARE_SCOPED_ENUM (ItemStatus,
Nightvision = cr::bit (0), Nightvision = cr::bit (0),
DefusalKit = cr::bit (1) DefusalKit = cr::bit (1)
); )
// client flags // client flags
CR_DECLARE_SCOPED_ENUM (ClientFlags, CR_DECLARE_SCOPED_ENUM (ClientFlags,
@ -137,7 +137,7 @@ CR_DECLARE_SCOPED_ENUM (ClientFlags,
Alive = cr::bit (1), Alive = cr::bit (1),
Admin = cr::bit (2), Admin = cr::bit (2),
Icon = cr::bit (3) Icon = cr::bit (3)
); )
// bot create status // bot create status
CR_DECLARE_SCOPED_ENUM (BotCreateResult, CR_DECLARE_SCOPED_ENUM (BotCreateResult,
@ -145,7 +145,7 @@ CR_DECLARE_SCOPED_ENUM (BotCreateResult,
MaxPlayersReached, MaxPlayersReached,
GraphError, GraphError,
TeamStacked TeamStacked
); )
// radio messages // radio messages
CR_DECLARE_SCOPED_ENUM (Radio, CR_DECLARE_SCOPED_ENUM (Radio,
@ -170,7 +170,7 @@ CR_DECLARE_SCOPED_ENUM (Radio,
ShesGonnaBlow = 27, ShesGonnaBlow = 27,
Negative = 28, Negative = 28,
EnemyDown = 29 EnemyDown = 29
); )
// chatter system (extending enum above, messages 30-39 is reserved) // chatter system (extending enum above, messages 30-39 is reserved)
CR_DECLARE_SCOPED_ENUM (Chatter, CR_DECLARE_SCOPED_ENUM (Chatter,
@ -226,7 +226,7 @@ CR_DECLARE_SCOPED_ENUM (Chatter,
BehindSmoke, BehindSmoke,
BombsiteSecured, BombsiteSecured,
Count Count
); )
// counter-strike weapon id's // counter-strike weapon id's
CR_DECLARE_SCOPED_ENUM (Weapon, CR_DECLARE_SCOPED_ENUM (Weapon,
@ -263,7 +263,7 @@ CR_DECLARE_SCOPED_ENUM (Weapon,
Armor = 31, Armor = 31,
ArmorHelm = 32, ArmorHelm = 32,
Defuser = 33 Defuser = 33
); )
// buy counts // buy counts
CR_DECLARE_SCOPED_ENUM (BuyState, CR_DECLARE_SCOPED_ENUM (BuyState,
@ -275,7 +275,7 @@ CR_DECLARE_SCOPED_ENUM (BuyState,
Ammo, Ammo,
NightVision, NightVision,
Done Done
); )
// economics limits // economics limits
CR_DECLARE_SCOPED_ENUM (EcoLimit, CR_DECLARE_SCOPED_ENUM (EcoLimit,
@ -290,7 +290,7 @@ CR_DECLARE_SCOPED_ENUM (EcoLimit,
ProstockRusher, ProstockRusher,
ProstockCareful, ProstockCareful,
ShieldGreater ShieldGreater
); )
// defines for pickup items // defines for pickup items
CR_DECLARE_SCOPED_ENUM (Pickup, CR_DECLARE_SCOPED_ENUM (Pickup,
@ -302,42 +302,42 @@ CR_DECLARE_SCOPED_ENUM (Pickup,
Button, Button,
Shield, Shield,
DefusalKit DefusalKit
); )
// fight style type // fight style type
CR_DECLARE_SCOPED_ENUM (Fight, CR_DECLARE_SCOPED_ENUM (Fight,
None = 0, None = 0,
Strafe, Strafe,
Stay Stay
); )
// dodge type // dodge type
CR_DECLARE_SCOPED_ENUM (Dodge, CR_DECLARE_SCOPED_ENUM (Dodge,
None = 0, None = 0,
Left, Left,
Right Right
); )
// reload state // reload state
CR_DECLARE_SCOPED_ENUM (Reload, CR_DECLARE_SCOPED_ENUM (Reload,
None = 0, // no reload state currently None = 0, // no reload state currently
Primary, // primary weapon reload state Primary, // primary weapon reload state
Secondary // secondary weapon reload state Secondary // secondary weapon reload state
); )
// collision probes // collision probes
CR_DECLARE_SCOPED_ENUM (CollisionProbe, CR_DECLARE_SCOPED_ENUM (CollisionProbe,
Jump = cr::bit (0), // probe jump when colliding Jump = cr::bit (0), // probe jump when colliding
Duck = cr::bit (1), // probe duck when colliding Duck = cr::bit (1), // probe duck when colliding
Strafe = cr::bit (2) // probe strafing when colliding Strafe = cr::bit (2) // probe strafing when colliding
); )
// vgui menus (since latest steam updates is obsolete, but left for old cs) // vgui menus (since latest steam updates is obsolete, but left for old cs)
CR_DECLARE_SCOPED_ENUM (GuiMenu, CR_DECLARE_SCOPED_ENUM (GuiMenu,
TeamSelect = 2, // menu select team TeamSelect = 2, // menu select team
TerroristSelect = 26, // terrorist select menu TerroristSelect = 26, // terrorist select menu
CTSelect = 27 // ct select menu CTSelect = 27 // ct select menu
); )
// lift usage states // lift usage states
CR_DECLARE_SCOPED_ENUM (LiftState, CR_DECLARE_SCOPED_ENUM (LiftState,
@ -349,7 +349,7 @@ CR_DECLARE_SCOPED_ENUM (LiftState,
LookingButtonInside, LookingButtonInside,
TravelingBy, TravelingBy,
Leaving Leaving
); )
// game start messages for counter-strike... // game start messages for counter-strike...
CR_DECLARE_SCOPED_ENUM (BotMsg, CR_DECLARE_SCOPED_ENUM (BotMsg,
@ -360,7 +360,7 @@ CR_DECLARE_SCOPED_ENUM (BotMsg,
Radio = 200, Radio = 200,
Say = 10000, Say = 10000,
SayTeam = 10001 SayTeam = 10001
); )
// sensing states // sensing states
CR_DECLARE_SCOPED_ENUM (Sense, CR_DECLARE_SCOPED_ENUM (Sense,
@ -371,7 +371,7 @@ CR_DECLARE_SCOPED_ENUM (Sense,
ThrowExplosive = cr::bit (4), // could throw he grenade ThrowExplosive = cr::bit (4), // could throw he grenade
ThrowFlashbang = cr::bit (5), // could throw flashbang ThrowFlashbang = cr::bit (5), // could throw flashbang
ThrowSmoke = cr::bit (6) // could throw smokegrenade ThrowSmoke = cr::bit (6) // could throw smokegrenade
); )
// positions to aim at // positions to aim at
CR_DECLARE_SCOPED_ENUM (AimFlags, CR_DECLARE_SCOPED_ENUM (AimFlags,
@ -383,27 +383,27 @@ CR_DECLARE_SCOPED_ENUM (AimFlags,
Enemy = cr::bit (5), // aim at enemy Enemy = cr::bit (5), // aim at enemy
Grenade = cr::bit (6), // aim for grenade throw Grenade = cr::bit (6), // aim for grenade throw
Override = cr::bit (7) // overrides all others (blinded) Override = cr::bit (7) // overrides all others (blinded)
); )
// famas/glock burst mode status + m4a1/usp silencer // famas/glock burst mode status + m4a1/usp silencer
CR_DECLARE_SCOPED_ENUM (BurstMode, CR_DECLARE_SCOPED_ENUM (BurstMode,
On = cr::bit (0), On = cr::bit (0),
Off = cr::bit (1) Off = cr::bit (1)
); )
// visibility flags // visibility flags
CR_DECLARE_SCOPED_ENUM (Visibility, CR_DECLARE_SCOPED_ENUM (Visibility,
Head = cr::bit (1), Head = cr::bit (1),
Body = cr::bit (2), Body = cr::bit (2),
Other = cr::bit (3) Other = cr::bit (3)
); )
// command handler status // command handler status
CR_DECLARE_SCOPED_ENUM (BotCommandResult, CR_DECLARE_SCOPED_ENUM (BotCommandResult,
Handled = 0, // command successfully handled Handled = 0, // command successfully handled
ListenServer, // command is only avaialble on listen server ListenServer, // command is only avaialble on listen server
BadFormat // wrong params BadFormat // wrong params
); )
// defines for nodes flags field (32 bits are available) // defines for nodes flags field (32 bits are available)
CR_DECLARE_SCOPED_ENUM (NodeFlag, CR_DECLARE_SCOPED_ENUM (NodeFlag,
@ -419,45 +419,45 @@ CR_DECLARE_SCOPED_ENUM (NodeFlag,
Sniper = cr::bit (28), // it's a specific sniper point Sniper = cr::bit (28), // it's a specific sniper point
TerroristOnly = cr::bit (29), // it's a specific terrorist point TerroristOnly = cr::bit (29), // it's a specific terrorist point
CTOnly = cr::bit (30), // it's a specific ct point CTOnly = cr::bit (30), // it's a specific ct point
); )
// defines for node connection flags field (16 bits are available) // defines for node connection flags field (16 bits are available)
CR_DECLARE_SCOPED_ENUM_TYPE (PathFlag, uint16, CR_DECLARE_SCOPED_ENUM_TYPE (PathFlag, uint16,
Jump = cr::bit (0) // must jump for this connection Jump = cr::bit (0) // must jump for this connection
); )
// enum pathfind search type // enum pathfind search type
CR_DECLARE_SCOPED_ENUM (FindPath, CR_DECLARE_SCOPED_ENUM (FindPath,
Fast = 0, Fast = 0,
Optimal, Optimal,
Safe Safe
); )
// defines node connection types // defines node connection types
CR_DECLARE_SCOPED_ENUM (PathConnection, CR_DECLARE_SCOPED_ENUM (PathConnection,
Outgoing = 0, Outgoing = 0,
Incoming, Incoming,
Bidirectional Bidirectional
); )
// defines node add commands // defines node add commands
CR_DECLARE_SCOPED_ENUM (GraphAdd, CR_DECLARE_SCOPED_ENUM (GraphAdd,
Normal = 0, Normal = 0,
); )
// a* route state // a* route state
CR_DECLARE_SCOPED_ENUM (RouteState, CR_DECLARE_SCOPED_ENUM (RouteState,
Open = 0, Open = 0,
Closed, Closed,
New New
); )
// node edit states // node edit states
CR_DECLARE_SCOPED_ENUM (GraphEdit, CR_DECLARE_SCOPED_ENUM (GraphEdit,
On = cr::bit (1), On = cr::bit (1),
Noclip = cr::bit (2), Noclip = cr::bit (2),
Auto = cr::bit (3) Auto = cr::bit (3)
); )
CR_DECLARE_SCOPED_ENUM (StorageOption, CR_DECLARE_SCOPED_ENUM (StorageOption,
Practice = cr::bit (0), // this is practice (experience) file Practice = cr::bit (0), // this is practice (experience) file
@ -467,7 +467,7 @@ CR_DECLARE_SCOPED_ENUM (StorageOption,
Official = cr::bit (4), // this is additional flag for graph indicates graph are official Official = cr::bit (4), // this is additional flag for graph indicates graph are official
Recovered = cr::bit (5), // this is additional flag indicates graph converted from podbot and was bad Recovered = cr::bit (5), // this is additional flag indicates graph converted from podbot and was bad
Author = cr::bit (6) // this is additional flag indicates that there's author info Author = cr::bit (6) // this is additional flag indicates that there's author info
); )
CR_DECLARE_SCOPED_ENUM (StorageVersion, CR_DECLARE_SCOPED_ENUM (StorageVersion,
Graph = 1, Graph = 1,
@ -475,7 +475,7 @@ CR_DECLARE_SCOPED_ENUM (StorageVersion,
Vistable = 1, Vistable = 1,
Matrix = 1, Matrix = 1,
Podbot = 7 Podbot = 7
); )
// some hardcoded desire defines used to override calculated ones // some hardcoded desire defines used to override calculated ones
namespace TaskPri { namespace TaskPri {

View file

@ -11,7 +11,7 @@ PROJECT = yapb
SOURCES = ../source SOURCES = ../source
OBJECTS = $(wildcard $(SOURCES)/*.cpp) OBJECTS = $(wildcard $(SOURCES)/*.cpp)
COMPILER_FLAGS = -std=c++11 -m32 -Wall -Wextra -Werror -fno-exceptions -fno-rtti COMPILER_FLAGS = -std=c++11 -m32 -Wall -Wextra -Werror -fno-exceptions -fno-rtti -pedantic
LINKER_FLAGS = -m32 -ldl LINKER_FLAGS = -m32 -ldl
ifeq "$(DEBUG)" "true" ifeq "$(DEBUG)" "true"

View file

@ -316,7 +316,7 @@ Vector Game::getAbsPos (edict_t *ent) {
} }
if (ent->v.origin.empty ()) { if (ent->v.origin.empty ()) {
return (ent->v.absmin + ent->v.absmax) * 0.5f; return ent->v.absmin + (ent->v.size * 0.5);
} }
return ent->v.origin; return ent->v.origin;
} }
@ -423,13 +423,13 @@ bool Game::isSoftwareRenderer () {
if (plat.isWindows) { if (plat.isWindows) {
return plat.hasModule ("sw"); return plat.hasModule ("sw");
} }
return true; return false;
} }
void Game::addNewCvar (const char *variable, const char *value, Var varType, bool regMissing, const char *regVal, ConVar *self) { void Game::addNewCvar (const char *variable, const char *value, Var varType, bool regMissing, const char *regVal, ConVar *self) {
// this function adds globally defined variable to registration stack // this function adds globally defined variable to registration stack
VarPair pair = {}; VarPair pair {};
pair.reg.name = const_cast <char *> (variable); pair.reg.name = const_cast <char *> (variable);
pair.reg.string = const_cast <char *> (value); pair.reg.string = const_cast <char *> (value);

View file

@ -285,7 +285,7 @@ void Bot::ignoreCollision () {
void Bot::avoidIncomingPlayers (edict_t *touch) { void Bot::avoidIncomingPlayers (edict_t *touch) {
auto task = getCurrentTaskId (); auto task = getCurrentTaskId ();
if (task == Task::PlantBomb || task == Task::DefuseBomb || task == Task::Camp || m_moveSpeed <= 100.0f) { if (task == Task::PlantBomb || task == Task::DefuseBomb || task == Task::Camp || m_moveSpeed <= 100.0f || m_avoidTime > game.timebase ()) {
return; return;
} }
@ -1540,13 +1540,13 @@ bool Bot::findBestNearestNode () {
int lessIndex[3] = { kInvalidNodeIndex, kInvalidNodeIndex , kInvalidNodeIndex }; int lessIndex[3] = { kInvalidNodeIndex, kInvalidNodeIndex , kInvalidNodeIndex };
auto &bucket = graph.getNodesInBucket (pev->origin); auto &bucket = graph.getNodesInBucket (pev->origin);
int numToSkip = cr::clamp (rg.int_ (0, static_cast <int> (bucket.length () - 1)), 0, 5); int numToSkip = cr::clamp (rg.int_ (0, 3), 0, static_cast <int> (bucket.length () / 2));
for (const int at : bucket) { for (const int at : bucket) {
bool skip = !!(at == m_currentNodeIndex); bool skip = !!(at == m_currentNodeIndex);
// skip the current node, if any // skip the current node, if any
if (skip) { if (skip && numToSkip > 0) {
continue; continue;
} }
@ -1568,13 +1568,18 @@ bool Bot::findBestNearestNode () {
continue; continue;
} }
// check we're have link to it
if (m_currentNodeIndex != kInvalidNodeIndex && !graph.isConnected (m_currentNodeIndex, at)) {
continue;
}
// ignore non-reacheable nodes... // ignore non-reacheable nodes...
if (!graph.isReachable (this, at)) { if (!graph.isReachable (this, at)) {
continue; continue;
} }
// check if node is already used by another bot... // check if node is already used by another bot...
if (bots.getRoundStartTime () + 5.0f > game.timebase () && isOccupiedPoint (at)) { if (bots.getRoundStartTime () + 5.0f < game.timebase () && isOccupiedPoint (at)) {
busy = at; busy = at;
continue; continue;
} }
@ -2072,7 +2077,7 @@ bool Bot::selectBestNextNode () {
continue; continue;
} }
if (!isOccupiedPoint (link.index)) { if (!isOccupiedPoint (link.index) && graph[link.index].origin.z <= graph[m_currentNodeIndex].origin.z + 10.0f) {
m_pathWalk.first () = link.index; m_pathWalk.first () = link.index;
return true; return true;
} }
@ -3033,15 +3038,13 @@ bool Bot::isOccupiedPoint (int index) {
if (bot != nullptr) { if (bot != nullptr) {
int occupyId = util.getShootingCone (bot->ent (), pev->origin) >= 0.7f ? bot->m_previousNodes[0] : bot->m_currentNodeIndex; int occupyId = util.getShootingCone (bot->ent (), pev->origin) >= 0.7f ? bot->m_previousNodes[0] : bot->m_currentNodeIndex;
if (bot != nullptr) { if (index == occupyId) {
if (index == occupyId) { return true;
return true;
}
} }
} }
float length = (graph[index].origin - client.origin).lengthSq (); float length = (graph[index].origin - client.origin).lengthSq ();
if (length < cr::clamp (graph[index].radius, cr::square (32.0f), cr::square (90.0f))) { if (length < cr::clamp (graph[index].radius, cr::square (64.0f), cr::square (120.0f))) {
return true; return true;
} }
} }

View file

@ -566,7 +566,7 @@ void BotUtils::sendPings (edict_t *to) {
constexpr int kGamePingSVC = 17; constexpr int kGamePingSVC = 17;
for (auto &client : m_clients) { for (auto &client : m_clients) {
if (!(client.flags & ClientFlags::Used)) { if (!(client.flags & ClientFlags::Used) || client.ent == game.getLocalEntity ()) {
continue; continue;
} }
if (!client.pingUpdate) { if (!client.pingUpdate) {