From 6221f64db2811e624e56d706eb2dbca79b49be28 Mon Sep 17 00:00:00 2001 From: Alan Shen Date: Fri, 20 Mar 2026 18:29:55 -0700 Subject: [PATCH 1/2] Bot weapon data access optimizations --- src/game/server/neo/bot/neo_bot.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/game/server/neo/bot/neo_bot.cpp b/src/game/server/neo/bot/neo_bot.cpp index 791f62c2b..3e5d1680b 100644 --- a/src/game/server/neo/bot/neo_bot.cpp +++ b/src/game/server/neo/bot/neo_bot.cpp @@ -1592,22 +1592,24 @@ void CNEOBot::ReloadIfLowClip(bool bForceReload) return; } - if (!(myWeapon->GetNeoWepBits() & NEO_WEP_FIREARM)) + const unsigned int wepBits = myWeapon->GetNeoWepBits(); + + if (!(wepBits & NEO_WEP_FIREARM)) { return; } - if (myWeapon->GetNeoWepBits() & NEO_WEP_BALC) + if (wepBits & NEO_WEP_BALC) { return; } - if (myWeapon->GetNeoWepBits() & NEO_WEP_SMAC) + if (wepBits & NEO_WEP_SMAC) { return; } - if (myWeapon->GetNeoWepBits() & NEO_WEP_SUPA7) + if (wepBits & NEO_WEP_SUPA7) { // Consider loading slug if ( (myWeapon->m_iSecondaryAmmoCount > 0) && (myWeapon->Clip1() == myWeapon->GetMaxClip1() - 1)) @@ -1620,8 +1622,7 @@ void CNEOBot::ReloadIfLowClip(bool bForceReload) } else if (myWeapon->Clip1() > 0) { - auto* pPlayer = ToNEOPlayer(this); - if ( pPlayer->GetTimeSinceWeaponFired() < 3.0f) + if ( GetTimeSinceWeaponFired() < 3.0f) { return; // still in the middle of a fight } From bb3db9c304d5a3516c5a87527a0858fbd840be99 Mon Sep 17 00:00:00 2001 From: Alan Shen Date: Sat, 21 Mar 2026 00:16:36 -0700 Subject: [PATCH 2/2] const auto --- src/game/server/neo/bot/neo_bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/server/neo/bot/neo_bot.cpp b/src/game/server/neo/bot/neo_bot.cpp index 3e5d1680b..b38af9539 100644 --- a/src/game/server/neo/bot/neo_bot.cpp +++ b/src/game/server/neo/bot/neo_bot.cpp @@ -1592,7 +1592,7 @@ void CNEOBot::ReloadIfLowClip(bool bForceReload) return; } - const unsigned int wepBits = myWeapon->GetNeoWepBits(); + const auto wepBits = myWeapon->GetNeoWepBits(); if (!(wepBits & NEO_WEP_FIREARM)) {