From 97eb5ab8c9be4b2a86a7265d86d370f42114fc13 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sat, 8 Feb 2014 22:24:55 +0100 Subject: [PATCH] Limit variable scope. Issue found by cppcheck. --- src/actions/create.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/actions/create.cpp b/src/actions/create.cpp index bc6a3f51a14..109f88c895a 100644 --- a/src/actions/create.cpp +++ b/src/actions/create.cpp @@ -137,7 +137,6 @@ map_location unit_creator::find_location(const config &cfg, const unit* pass_che BOOST_FOREACH(const std::string& place, placements) { map_location loc; - bool pass((place == "leader_passable") || (place == "map_passable")); if ( place == "recall" ) { return map_location::null_location; @@ -159,6 +158,7 @@ map_location unit_creator::find_location(const config &cfg, const unit* pass_che } if(loc.valid() && resources::game_map->on_board(loc)) { + const bool pass((place == "leader_passable") || (place == "map_passable")); if ( place != "map_overwrite" ) { loc = find_vacant_tile(loc, pathfind::VACANT_ANY, pass ? pass_check : NULL);