From f841d7b8b196a7df278dbf86aa4ee614d9318e4a Mon Sep 17 00:00:00 2001 From: c8060da <99069795+c8060da@users.noreply.github.com> Date: Thu, 2 Jun 2022 17:01:29 +0300 Subject: [PATCH] fix set_npc_allies_global (#58082) --- src/condition.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/condition.cpp b/src/condition.cpp index a433326188d30..ca74b46d71a22 100644 --- a/src/condition.cpp +++ b/src/condition.cpp @@ -773,17 +773,16 @@ void conditional_t::set_npc_allies( const JsonObject &jo ) template void conditional_t::set_npc_allies_global( const JsonObject &jo ) { - int_or_var iov = get_int_or_var( jo, "npc_allies_global" ); + int_or_var iov = get_int_or_var( jo, "npc_allies_global" ); condition = [iov]( const T & d ) { const auto all_npcs = overmap_buffer.get_overmap_npcs(); const size_t count = std::count_if( all_npcs.begin(), all_npcs.end(), []( const shared_ptr_fast &ptr ) { - // Note: it seems that the is_npc check /is/ necessary to avoid including dead friends - return ptr.get()->is_player_ally() && !ptr.get()->hallucination && ptr.get()->is_npc(); + return ptr.get()->is_player_ally() && !ptr.get()->hallucination && !ptr.get()->is_dead(); } ); - return count >= static_cast( iov.evaluate( d.actor( iov.is_npc() ) ) ); + return count >= static_cast( iov.evaluate( d ) ); }; }