From 5990ba92f89f50a7e8ad1d6d83c363eecddc4180 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Tue, 25 Jun 2019 12:09:20 +0100 Subject: [PATCH] src/MultiPlayer/multiplaymgr.cxx: use std::initializer_list instead of C array. After review. This simplifies iterating. --- src/MultiPlayer/multiplaymgr.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/MultiPlayer/multiplaymgr.cxx b/src/MultiPlayer/multiplaymgr.cxx index 008d3506f..efa8cf1c1 100644 --- a/src/MultiPlayer/multiplaymgr.cxx +++ b/src/MultiPlayer/multiplaymgr.cxx @@ -2464,11 +2464,8 @@ FGMultiplayMgr::addMultiplayer(const std::string& callsign, views. */ SGPropertyNode* view_1 = set_sim->getNode("view", 1); - int views_with_default_z_offset_m[] = {1, 2, 3, 5, 7, 8}; - for (unsigned i=0; - i != sizeof(views_with_default_z_offset_m)/sizeof(views_with_default_z_offset_m[0]); - ++i) { - int j = views_with_default_z_offset_m[i]; + std::initializer_list views_with_default_z_offset_m = {1, 2, 3, 5, 7, 8}; + for (int j: views_with_default_z_offset_m) { SGPropertyNode* v = set_sim->getChild("view", j); if (!v) { v = set_sim->addChild("view", j, false /*append*/);