graph: move light level calculation to thread worker

fix: nodes with light level 0.0 should trigger bots flashlight now
fix: gcc and msvc builds due to mistake in crlib
refactor: add more const-correctness (ongoing)
This commit is contained in:
jeefo 2023-06-24 03:23:22 +03:00
commit 3d2579c7ea
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
11 changed files with 121 additions and 111 deletions

View file

@ -737,16 +737,6 @@ public:
void sendBotToOrigin (const Vector &origin);
void markStale ();
bool hasHostage ();
bool usesRifle ();
bool usesPistol ();
bool usesSniper ();
bool usesSubmachine ();
bool usesShotgun ();
bool usesHeavy ();
bool usesZoomableRifle ();
bool usesBadWeapon ();
bool usesCampGun ();
bool usesKnife ();
bool hasPrimaryWeapon ();
bool hasSecondaryWeapon ();
bool hasShield ();
@ -778,7 +768,7 @@ public:
return pev->origin + pev->view_ofs;
};
Task getCurrentTaskId () {
Task getCurrentTaskId () {
return getTask ()->id;
}
@ -809,6 +799,57 @@ public:
debugMsgInternal (strings.format (fmt, cr::forward <Args> (args)...));
}
private:
// returns true if bot is using a sniper rifle
bool usesSniper () const {
return m_weaponType == WeaponType::Sniper;
}
// returns true if bot is using a rifle
bool usesRifle () const {
return usesZoomableRifle () || m_weaponType == WeaponType::Rifle;
}
// returns true if bot is using a zoomable rifle
bool usesZoomableRifle () const {
return m_weaponType == WeaponType::ZoomRifle;
}
// returns true if bot is using a pistol
bool usesPistol () const {
return m_weaponType == WeaponType::Pistol;
}
// returns true if bot is using a SMG
bool usesSubmachine () const {
return m_weaponType == WeaponType::SMG;
}
// returns true if bot is using a shotgun
bool usesShotgun () const {
return m_weaponType == WeaponType::Shotgun;
}
// returns true if bot is using m249
bool usesHeavy () const {
return m_weaponType == WeaponType::Heavy;
}
// returns true if bot using not very good weapon
bool usesBadWeapon () const {
return usesShotgun () || m_currentWeapon == Weapon::UMP45 || m_currentWeapon == Weapon::MAC10 || m_currentWeapon == Weapon::TMP;
}
// returns true if bot using a camp gun
bool usesCampGun () const {
return usesSubmachine () || usesRifle () || usesSniper () || usesHeavy ();
}
// returns true if bot using knife
bool usesKnife () const {
return m_weaponType == WeaponType::Melee;
}
// execute client command helper
template <typename ...Args> void issueCommand (const char *fmt, Args &&...args);
};