From a4e01c3bfc90e93a0fa682d35cee2874aee84c5b Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 4 Sep 2016 00:02:50 +0000 Subject: [PATCH] Use none_of in do_controlcen_frame search of segment children This makes the purpose of the code clearer. --- similar/main/cntrlcen.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/similar/main/cntrlcen.cpp b/similar/main/cntrlcen.cpp index 3b8cb1973..6d5de18f7 100644 --- a/similar/main/cntrlcen.cpp +++ b/similar/main/cntrlcen.cpp @@ -322,9 +322,6 @@ void do_controlcen_frame(const vobjptridx_t obj) if (!(Control_center_been_hit || Control_center_player_been_seen)) { if (!(d_tick_count % 8)) { // Do every so often... - int i; - segment *segp = &Segments[obj->segnum]; - // This is a hack. Since the control center is not processed by // ai_do_frame, it doesn't know to deal with cloaked dudes. It // seems to work in single-player mode because it is actually using @@ -338,10 +335,8 @@ void do_controlcen_frame(const vobjptridx_t obj) // Hack for special control centers which are isolated and not reachable because the // real control center is inside the boss. - for (i=0; ichildren[i])) - break; - if (i == MAX_SIDES_PER_SEGMENT) + auto &children = vcsegptr(obj->segnum)->children; + if (std::none_of(children.begin(), children.end(), IS_CHILD)) return; auto vec_to_player = vm_vec_sub(ConsoleObject->pos, obj->pos);