From 40dc667e034af5c02adc45bb0aaf0b0163ad87c2 Mon Sep 17 00:00:00 2001 From: jeefo Date: Thu, 20 Mar 2025 08:15:26 +0300 Subject: [PATCH] fix: crash when enabling hitbox aiming between rounds --- ext/crlib | 2 +- src/manager.cpp | 7 ++++++- src/support.cpp | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ext/crlib b/ext/crlib index 0a75fd3..01a2628 160000 --- a/ext/crlib +++ b/ext/crlib @@ -1 +1 @@ -Subproject commit 0a75fd3ec1118db9a3867b9a6210a2cd070ae3c3 +Subproject commit 01a2628642b5d28c42d115bbe99167756376839c diff --git a/src/manager.cpp b/src/manager.cpp index 0f09d88..a49828f 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -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 (); + } } m_approachingLadderTimer.invalidate (); diff --git a/src/support.cpp b/src/support.cpp index 164dca2..4b0de27 100644 --- a/src/support.cpp +++ b/src/support.cpp @@ -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 {