From 6515308a590189d173b38fa0c213db2a81448e88 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 15 Oct 2016 00:53:17 +0000 Subject: [PATCH] Simplify loop iteration in copy_group_walls --- similar/editor/medwall.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/similar/editor/medwall.cpp b/similar/editor/medwall.cpp index a789fd6ff..74301bca8 100644 --- a/similar/editor/medwall.cpp +++ b/similar/editor/medwall.cpp @@ -1023,20 +1023,17 @@ static void copy_old_wall_data_to_new(wallnum_t owall, wallnum_t nwall) // ------------------------------------------------------------------------------------------------ void copy_group_walls(int old_group, int new_group) { - group::segment_array_type_t::const_iterator bo = GroupList[old_group].segments.begin(); group::segment_array_type_t::const_iterator bn = GroupList[new_group].segments.begin(); - group::segment_array_type_t::const_iterator eo = GroupList[old_group].segments.end(); - int old_seg, new_seg; - for (; bo != eo; ++bo, ++bn) + range_for (const auto old_seg, GroupList[old_group].segments) { - old_seg = *bo; - new_seg = *bn; - + const auto new_seg = *bn++; + auto &os = vcsegptr(old_seg)->sides; + auto &ns = vsegptr(new_seg)->sides; for (int j=0; j(Num_walls)); w.segnum = new_seg; w.sidenum = j; @@ -1047,7 +1044,7 @@ void copy_group_walls(int old_group, int new_group) } } -int Validate_walls=1; +static int Validate_walls=1; // -------------------------------------------------------------------------------------------------------- // This function should be in medwall.c.