Skip to content

Commit

Permalink
= visual_memory_manager.cpp | Fixed the occasion where the visibility…
Browse files Browse the repository at this point in the history
… indicator on the HUD was stuck, due to an enemy changing relations.

Co-Authored-By: Revo Lucas <[email protected]>
  • Loading branch information
qweasdd136963 and revolucas committed Sep 26, 2018
1 parent 7ef837b commit dde9380
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/xrGame/visual_memory_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,13 +705,18 @@ void CVisualMemoryManager::update(float time_delta)
}
#endif

if (m_object && g_actor && m_object->is_relation_enemy(Actor()))
if (m_object && g_actor)
{
xr_vector<CNotYetVisibleObject>::iterator I = std::find_if(
m_not_yet_visible_objects.begin(), m_not_yet_visible_objects.end(), CNotYetVisibleObjectPredicate(Actor()));
if (I != m_not_yet_visible_objects.end())
if (m_object->is_relation_enemy(Actor()))
{
SetActorVisibility(m_object->ID(), clampr((*I).m_value / visibility_threshold(), 0.f, 1.f));
xr_vector<CNotYetVisibleObject>::iterator I = std::find_if(m_not_yet_visible_objects.begin(),
m_not_yet_visible_objects.end(), CNotYetVisibleObjectPredicate(Actor()));
if (I != m_not_yet_visible_objects.end())
{
SetActorVisibility(m_object->ID(), clampr((*I).m_value / visibility_threshold(), 0.f, 1.f));
}
else
SetActorVisibility(m_object->ID(), 0.f);
}
else
SetActorVisibility(m_object->ID(), 0.f);
Expand Down Expand Up @@ -771,7 +776,7 @@ void CVisualMemoryManager::save(NET_Packet& packet) const
packet.w_float((*I).m_object_params.m_orientation.pitch);
packet.w_float((*I).m_object_params.m_orientation.roll);
#endif // USE_ORIENTATION
// self params
// self params
packet.w_u32((*I).m_self_params.m_level_vertex_id);
packet.w_vec3((*I).m_self_params.m_position);
#ifdef USE_ORIENTATION
Expand Down

0 comments on commit dde9380

Please sign in to comment.