Skip to content

Commit

Permalink
perf: change frequency of weapon value (#3283)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrenAudeles authored Sep 27, 2023
1 parent 5f4e2eb commit 6d4eaba
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/npcmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,12 @@ void npc::regen_ai_cache()
ai_cache.can_heal.clear_all();
ai_cache.danger = 0.0f;
ai_cache.total_danger = 0.0f;
ai_cache.my_weapon_value = npc_ai::wielded_value( *this );
// This value is actually used in only one place, npc::character_danger, and only if
// the single caller evaluate_enemy is passed an NPC or Player
// Should be fine to update this every minute since it's an expensive call.
if( calendar::once_every( 1_minutes ) ) {
ai_cache.my_weapon_value = npc_ai::wielded_value( *this );
}
ai_cache.dangerous_explosives = find_dangerous_explosives();

assess_danger();
Expand Down

0 comments on commit 6d4eaba

Please sign in to comment.