File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -86,14 +86,13 @@ void CMonsterEnemyMemory::update()
8686
8787 float const feel_enemy_max_distance = monster->get_feel_enemy_max_distance ();
8888
89- for (auto I = objects. cbegin (); I != objects. cend (); ++I )
89+ for (const auto & enemy : objects)
9090 {
91- const CEntityAlive* enemy = *I;
9291 const bool feel_enemy =
9392 monster->Position ().distance_to (enemy->Position ()) < feel_enemy_max_distance;
9493
95- if (feel_enemy || monster->memory ().visual ().visible_now (*I ))
96- add_enemy (*I );
94+ if (feel_enemy || monster->memory ().visual ().visible_now (enemy ))
95+ add_enemy (enemy );
9796 }
9897
9998 if (g_actor)
@@ -112,11 +111,13 @@ void CMonsterEnemyMemory::update()
112111 remove_non_actual ();
113112
114113 // обновить опасность
115- for (ENEMIES_MAP_IT it = m_objects.begin (); it != m_objects.end (); it++)
114+ // XXX: review with below example
115+ // for (auto& [entity, memory] : m_objects)
116+ for (auto & it : m_objects)
116117 {
117- u8 relation_value = u8 (monster->tfGetRelationType (it-> first ));
118- float dist = monster->Position ().distance_to (it-> second .position );
119- it-> second .danger = (1 + relation_value * relation_value * relation_value) / (1 + dist);
118+ const u8 relation_value = u8 (monster->tfGetRelationType (it. first ));
119+ const float dist = monster->Position ().distance_to (it. second .position );
120+ it. second .danger = (1 + relation_value * relation_value * relation_value) / (1 + dist);
120121 }
121122}
122123
You can’t perform that action at this time.
0 commit comments