fix: crash when enabling hitbox aiming between rounds

This commit is contained in:
jeefo 2025-03-20 08:15:26 +03:00
commit 40dc667e03
No known key found for this signature in database
GPG key ID: D696786B81B667C8
3 changed files with 9 additions and 4 deletions

@ -1 +1 @@
Subproject commit 0a75fd3ec1118db9a3867b9a6210a2cd070ae3c3
Subproject commit 01a2628642b5d28c42d115bbe99167756376839c

View file

@ -1562,7 +1562,12 @@ void Bot::newRound () {
m_hostages.clear ();
if (cv_use_hitbox_enemy_targeting) {
m_hitboxEnumerator->reset ();
if (m_hitboxEnumerator) {
m_hitboxEnumerator->reset ();
}
else {
m_hitboxEnumerator = cr::makeUnique <PlayerHitboxEnumerator> ();
}
}
m_approachingLadderTimer.invalidate ();

View file

@ -86,7 +86,7 @@ bool BotSupport::isAlive (edict_t *ent) {
if (game.isNullEntity (ent)) {
return false;
}
return ent->v.deadflag == DEAD_NO && ent->v.health > 0 && ent->v.movetype != MOVETYPE_NOCLIP;
return ent->v.deadflag == DEAD_NO && ent->v.health > 0.0f && ent->v.movetype != MOVETYPE_NOCLIP;
}
bool BotSupport::isVisible (const Vector &origin, edict_t *ent) {
@ -382,7 +382,7 @@ void BotSupport::updateClients () {
client.ent = player;
client.flags |= ClientFlags::Used;
if (util.isAlive (player)) {
if (isAlive (player)) {
client.flags |= ClientFlags::Alive;
}
else {