refactor: use squared distance if possible
refactor: add some const-correctness to code
This commit is contained in:
parent
a49a4000c9
commit
4a35a87b25
24 changed files with 579 additions and 567 deletions
|
|
@ -216,9 +216,6 @@ public:
|
|||
// search entities in sphere
|
||||
void searchEntities (const Vector &position, float radius, EntitySearch functor);
|
||||
|
||||
// this function is checking that pointed by ent pointer obstacle, can be destroyed
|
||||
bool isShootableBreakable (edict_t *ent);
|
||||
|
||||
// print the version to server console on startup
|
||||
void printBotVersion ();
|
||||
|
||||
|
|
|
|||
|
|
@ -199,10 +199,10 @@ public:
|
|||
|
||||
public:
|
||||
int getFacingIndex ();
|
||||
int getFarest (const Vector &origin, float maxDistance = 32.0);
|
||||
int getForAnalyzer (const Vector &origin, float maxDistance);
|
||||
int getNearest (const Vector &origin, float minDistance = kInfiniteDistance, int flags = -1);
|
||||
int getNearestNoBuckets (const Vector &origin, float minDistance = kInfiniteDistance, int flags = -1);
|
||||
int getFarest (const Vector &origin, const float maxRange = 32.0);
|
||||
int getForAnalyzer (const Vector &origin, const float maxRange);
|
||||
int getNearest (const Vector &origin, const float range = kInfiniteDistance, int flags = -1);
|
||||
int getNearestNoBuckets (const Vector &origin, const float range = kInfiniteDistance, int flags = -1);
|
||||
int getEditorNearest ();
|
||||
int clearConnections (int index);
|
||||
int getBspSize ();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
public:
|
||||
constexpr bool operator == (const DangerStorage &rhs) const {
|
||||
return rhs.data[2] == data[2] && rhs.data[1] == data[1] && rhs.data[0] == data[0];
|
||||
return cr::memcmp (rhs.data, data, sizeof (data));
|
||||
}
|
||||
|
||||
constexpr bool operator != (const DangerStorage &rhs) const {
|
||||
|
|
|
|||
|
|
@ -57,6 +57,12 @@ public:
|
|||
// check if entity is a hostage entity
|
||||
bool isHostageEntity (edict_t *ent);
|
||||
|
||||
// check if entity is a door enitty
|
||||
bool isDoorEntity (edict_t *ent);
|
||||
|
||||
// this function is checking that pointed by ent pointer obstacle, can be destroyed
|
||||
bool isShootableBreakable (edict_t *ent);
|
||||
|
||||
// nearest player search helper
|
||||
bool findNearestPlayer (void **holder, edict_t *to, float searchDistance = 4096.0, bool sameTeam = false, bool needBot = false, bool needAlive = false, bool needDrawn = false, bool needBotWithC4 = false);
|
||||
|
||||
|
|
|
|||
12
inc/yapb.h
12
inc/yapb.h
|
|
@ -69,8 +69,8 @@ struct WeaponProp {
|
|||
// weapon info structure
|
||||
struct WeaponInfo {
|
||||
int id; // the weapon id value
|
||||
const char *name; // name of the weapon when selecting it
|
||||
const char *model; // model name to separate cs weapons
|
||||
StringRef name; // name of the weapon when selecting it
|
||||
StringRef model; // model name to separate cs weapons
|
||||
int price; // price when buying
|
||||
int minPrimaryAmmo; // minimum primary ammo
|
||||
int teamStandard; // used by team (number) (standard map)
|
||||
|
|
@ -86,8 +86,8 @@ struct WeaponInfo {
|
|||
|
||||
public:
|
||||
WeaponInfo (int id,
|
||||
const char *name,
|
||||
const char *model,
|
||||
StringRef name,
|
||||
StringRef model,
|
||||
int price,
|
||||
int minPriAmmo,
|
||||
int teamStd,
|
||||
|
|
@ -391,8 +391,8 @@ private:
|
|||
int bestGrenadeCarried ();
|
||||
int bestWeaponCarried ();
|
||||
int changeNodeIndex (int index);
|
||||
int numEnemiesNear (const Vector &origin, float radius);
|
||||
int numFriendsNear (const Vector &origin, float radius);
|
||||
int numEnemiesNear (const Vector &origin, const float radius);
|
||||
int numFriendsNear (const Vector &origin, const float radius);
|
||||
|
||||
float getBombTimeleft ();
|
||||
float getEstimatedNodeReachTime ();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue