From b5915abdccb88407b4d9806fd163874f98288a00 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 15 Apr 2017 17:46:44 +0000 Subject: [PATCH] Change station/robotmaker consistency check to LevelError --- similar/main/fuelcen.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/similar/main/fuelcen.cpp b/similar/main/fuelcen.cpp index e619c5374..2a588ebb1 100644 --- a/similar/main/fuelcen.cpp +++ b/similar/main/fuelcen.cpp @@ -667,23 +667,20 @@ void disable_matcens(void) // Give them all the right number of lives. void init_all_matcens(void) { -#ifndef NDEBUG const auto &&robot_range = partial_const_range(RobotCenters, Num_robot_centers); -#endif for (uint_fast32_t i = 0; i < Num_fuelcenters; i++) if (Station[i].Type == SEGMENT_IS_ROBOTMAKER) { Station[i].Lives = 3; Station[i].Enabled = 0; Station[i].Disable_time = 0; -#ifndef NDEBUG -{ // Make sure this fuelcen is pointed at by a matcen. - assert(std::find_if(robot_range.begin(), robot_range.end(), [i](const matcen_info &mi) { + if (std::find_if(robot_range.begin(), robot_range.end(), [i](const matcen_info &mi) { return mi.fuelcen_num == i; - }) != robot_range.end()); -} -#endif - + }) == robot_range.end()) + { + Station[i].Lives = 0; + LevelError("Station %" PRIuFAST32 " has type robotmaker, but no robotmaker uses it; ignoring.", i); + } } #ifndef NDEBUG