BOOST_FOREACH -> range for
This commit is contained in:
parent
104ccf6e36
commit
ca382018b7
206 changed files with 1263 additions and 1520 deletions
|
@ -38,7 +38,6 @@
|
|||
#include "widgets/button.hpp" // for button
|
||||
|
||||
#include <algorithm> // for max
|
||||
#include <boost/foreach.hpp> // for auto_any_base, etc
|
||||
#include <boost/scoped_ptr.hpp> // for scoped_ptr
|
||||
#include <map> // for map, map<>::mapped_type
|
||||
#include <ostream> // for operator<<, basic_ostream, etc
|
||||
|
@ -71,7 +70,7 @@ static void add_lines(std::vector<std::string> &res, config const &c, bool split
|
|||
// get slight scrolling glitches in the credits screen.
|
||||
const std::vector<std::string>& lines = utils::split(c["title"], '\n');
|
||||
bool first = true;
|
||||
BOOST_FOREACH(const std::string& line, lines) {
|
||||
for(const std::string& line : lines) {
|
||||
if(first) {
|
||||
res.push_back("+" + line);
|
||||
first = false;
|
||||
|
@ -87,7 +86,7 @@ static void add_lines(std::vector<std::string> &res, config const &c, bool split
|
|||
}
|
||||
|
||||
std::vector<std::string> lines = utils::split(c["text"], '\n');
|
||||
BOOST_FOREACH(std::string &line, lines)
|
||||
for(std::string &line : lines)
|
||||
{
|
||||
if (line.size() > 1 && line[0] == '+')
|
||||
line = "+ " + line.substr(1);
|
||||
|
@ -102,7 +101,7 @@ static void add_lines(std::vector<std::string> &res, config const &c, bool split
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config &entry, c.child_range("entry")) {
|
||||
for (const config &entry : c.child_range("entry")) {
|
||||
res.push_back("- "+ entry["name"].str());
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +114,7 @@ std::vector<std::string> get_text(const std::string &campaign, bool split_multil
|
|||
config::child_itors about_entries = about_list.child_range("about");
|
||||
|
||||
if (!campaign.empty()) {
|
||||
BOOST_FOREACH(const config &about, about_entries) {
|
||||
for (const config &about : about_entries) {
|
||||
// just finished a particular campaign
|
||||
if (campaign == about["id"]) {
|
||||
add_lines(res, about, split_multiline_headers);
|
||||
|
@ -123,7 +122,7 @@ std::vector<std::string> get_text(const std::string &campaign, bool split_multil
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config &about, about_entries) {
|
||||
for (const config &about : about_entries) {
|
||||
add_lines(res, about, split_multiline_headers);
|
||||
}
|
||||
|
||||
|
@ -136,7 +135,7 @@ void set_about(const config &cfg)
|
|||
images.clear();
|
||||
images_default = "";
|
||||
|
||||
BOOST_FOREACH(const config &about, cfg.child_range("about"))
|
||||
for (const config &about : cfg.child_range("about"))
|
||||
{
|
||||
about_list.add_child("about", about);
|
||||
const std::string &im = about["images"];
|
||||
|
@ -149,7 +148,7 @@ void set_about(const config &cfg)
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config &campaign, cfg.child_range("campaign"))
|
||||
for (const config &campaign : cfg.child_range("campaign"))
|
||||
{
|
||||
config::const_child_itors abouts = campaign.child_range("about");
|
||||
if (abouts.first == abouts.second) continue;
|
||||
|
@ -161,7 +160,7 @@ void set_about(const config &cfg)
|
|||
temp["id"] = id;
|
||||
std::string campaign_images;
|
||||
|
||||
BOOST_FOREACH(const config &about, abouts)
|
||||
for (const config &about : abouts)
|
||||
{
|
||||
const std::string &subtitle = about["title"];
|
||||
if (!subtitle.empty())
|
||||
|
@ -174,12 +173,12 @@ void set_about(const config &cfg)
|
|||
text << '\n';
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const std::string &line, utils::split(about["text"], '\n'))
|
||||
for (const std::string &line : utils::split(about["text"], '\n'))
|
||||
{
|
||||
text << " " << line << '\n';
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config &entry, about.child_range("entry"))
|
||||
for (const config &entry : about.child_range("entry"))
|
||||
{
|
||||
text << " " << entry["name"] << '\n';
|
||||
}
|
||||
|
|
|
@ -53,8 +53,6 @@
|
|||
#include "whiteboard/manager.hpp"
|
||||
#include "wml_exception.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
#define DBG_NG LOG_STREAM(debug, log_engine)
|
||||
#define LOG_NG LOG_STREAM(info, log_engine)
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include "variable.hpp"
|
||||
#include "whiteboard/manager.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
|
@ -140,7 +139,7 @@ namespace { // Helpers for get_recalls()
|
|||
|
||||
const unit_filter ufilt(vconfig(leader->recall_filter()), resources::filter_con);
|
||||
|
||||
BOOST_FOREACH(const unit_const_ptr & recall_unit_ptr, leader_team.recall_list())
|
||||
for (const unit_const_ptr & recall_unit_ptr : leader_team.recall_list())
|
||||
{
|
||||
const unit & recall_unit = *recall_unit_ptr;
|
||||
// Do not add a unit twice.
|
||||
|
@ -220,7 +219,7 @@ std::vector<unit_const_ptr > get_recalls(int side, const map_location &recall_lo
|
|||
if ( !leader_in_place )
|
||||
{
|
||||
// Return the full recall list.
|
||||
BOOST_FOREACH(const unit_const_ptr & recall, (*resources::teams)[side-1].recall_list())
|
||||
for (const unit_const_ptr & recall : (*resources::teams)[side-1].recall_list())
|
||||
{
|
||||
result.push_back(recall);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "units/udisplay.hpp"
|
||||
#include "units/map.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
|
@ -98,8 +97,7 @@ namespace {
|
|||
return POISON_CURE;
|
||||
|
||||
// Regeneration?
|
||||
BOOST_FOREACH (const unit_ability & regen,
|
||||
patient.get_abilities("regenerate"))
|
||||
for (const unit_ability & regen : patient.get_abilities("regenerate"))
|
||||
{
|
||||
curing = std::max(curing, poison_status((*regen.first)["poison"]));
|
||||
if ( curing == POISON_CURE )
|
||||
|
@ -111,7 +109,7 @@ namespace {
|
|||
// Look through the healers to find a curer.
|
||||
unit_map::iterator curer = units.end();
|
||||
// Assumed: curing is not POISON_CURE at the start of any iteration.
|
||||
BOOST_FOREACH (const unit_ability & heal, patient.get_abilities("heals"))
|
||||
for (const unit_ability & heal : patient.get_abilities("heals"))
|
||||
{
|
||||
POISON_STATUS this_cure = poison_status((*heal.first)["poison"]);
|
||||
if ( this_cure <= curing )
|
||||
|
@ -219,7 +217,7 @@ namespace {
|
|||
if ( update_healing(healing, harming, heal_effect.get_composite_value()) )
|
||||
{
|
||||
// Collect the healers involved.
|
||||
BOOST_FOREACH (const unit_abilities::individual_effect & heal, heal_effect)
|
||||
for (const unit_abilities::individual_effect & heal : heal_effect)
|
||||
healers.push_back(&*units.find(heal.loc));
|
||||
|
||||
if ( !healers.empty() ) {
|
||||
|
@ -300,7 +298,7 @@ void calculate_healing(int side, bool update_display)
|
|||
std::list<heal_unit> unit_list;
|
||||
|
||||
// We look for all allied units, then we see if our healer is near them.
|
||||
BOOST_FOREACH(unit &patient, *resources::units) {
|
||||
for (unit &patient : *resources::units) {
|
||||
|
||||
if ( patient.get_state("unhealable") || patient.incapacitated() ) {
|
||||
if ( patient.side() == side )
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "units/animation_component.hpp"
|
||||
#include "whiteboard/manager.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
@ -585,7 +584,7 @@ namespace { // Private helpers for move_unit()
|
|||
reveal_ambusher(blocked_loc_, false);
|
||||
|
||||
// Reveal ambushers.
|
||||
BOOST_FOREACH(const map_location & reveal, ambushers_) {
|
||||
for(const map_location & reveal : ambushers_) {
|
||||
reveal_ambusher(reveal, true);
|
||||
}
|
||||
|
||||
|
@ -840,7 +839,7 @@ namespace { // Private helpers for move_unit()
|
|||
*/
|
||||
std::string unit_mover::read_ambush_string(const unit & ambusher)
|
||||
{
|
||||
BOOST_FOREACH( const unit_ability &hide, ambusher.get_abilities("hides") )
|
||||
for(const unit_ability &hide : ambusher.get_abilities("hides"))
|
||||
{
|
||||
const std::string & ambush_string = (*hide.first)["alert"].str();
|
||||
if ( !ambush_string.empty() )
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#include "undo_update_shroud_action.hpp"
|
||||
|
||||
#include <algorithm> // for reverse
|
||||
#include <boost/foreach.hpp> // for auto_any_base, etc
|
||||
#include <boost/intrusive_ptr.hpp> // for intrusive_ptr
|
||||
#include <boost/ptr_container/detail/static_move_ptr.hpp>
|
||||
#include <boost/ptr_container/detail/void_ptr_iterator.hpp>
|
||||
|
@ -299,7 +298,7 @@ void undo_list::read(const config & cfg)
|
|||
committed_actions_ = committed_actions_ || cfg["committed"].to_bool();
|
||||
|
||||
// Build the undo stack.
|
||||
BOOST_FOREACH( const config & child, cfg.child_range("undo") ) {
|
||||
for (const config & child : cfg.child_range("undo")) {
|
||||
try {
|
||||
undo_action_base * action = create_action(child);
|
||||
if ( action ) {
|
||||
|
@ -317,7 +316,7 @@ void undo_list::read(const config & cfg)
|
|||
}
|
||||
|
||||
// Build the redo stack.
|
||||
BOOST_FOREACH( const config & child, cfg.child_range("redo") ) {
|
||||
for (const config & child : cfg.child_range("redo")) {
|
||||
try {
|
||||
undo_action_base * action = create_action(child);
|
||||
if ( undo_action* undoable_action = dynamic_cast<undo_action*>(action)) {
|
||||
|
|
|
@ -5,14 +5,13 @@
|
|||
#include "game_events/pump.hpp" //game_events::queued_event
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace actions
|
||||
{
|
||||
void undo_action::execute_undo_umc_wml()
|
||||
{
|
||||
assert(resources::lua_kernel);
|
||||
BOOST_FOREACH(const config& c, umc_commands_undo)
|
||||
for(const config& c : umc_commands_undo)
|
||||
{
|
||||
resources::lua_kernel->run_wml_action("command", vconfig(c), game_events::queued_event("undo", map_location(), map_location(), config()));
|
||||
}
|
||||
|
@ -21,7 +20,7 @@ void undo_action::execute_undo_umc_wml()
|
|||
void undo_action::execute_redo_umc_wml()
|
||||
{
|
||||
assert(resources::lua_kernel);
|
||||
BOOST_FOREACH(const config& c, umc_commands_redo)
|
||||
for(const config& c : umc_commands_redo)
|
||||
{
|
||||
resources::lua_kernel->run_wml_action("command", vconfig(c), game_events::queued_event("redo", map_location(), map_location(), config()));
|
||||
}
|
||||
|
@ -34,7 +33,7 @@ void undo_action::read_tconfig_vector(tconfig_vector& vec, const config& cfg, co
|
|||
}
|
||||
void undo_action::write_tconfig_vector(const tconfig_vector& vec, config& cfg, const std::string& tag)
|
||||
{
|
||||
BOOST_FOREACH(const config& c, vec)
|
||||
for(const config& c : vec)
|
||||
{
|
||||
cfg.add_child(tag, c);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
#include "game_display.hpp" // for resources::screen
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
|
@ -113,7 +112,7 @@ map_location unit_creator::find_location(const config &cfg, const unit* pass_che
|
|||
placements.push_back("map");
|
||||
placements.push_back("recall");
|
||||
|
||||
BOOST_FOREACH(const std::string& place, placements)
|
||||
for (const std::string& place : placements)
|
||||
{
|
||||
map_location loc;
|
||||
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
#include "team.hpp"
|
||||
#include "units/unit.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
class unit_animation;
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
|
@ -57,13 +55,13 @@ static void create_jamming_map(std::map<map_location, int> & jamming,
|
|||
jamming.clear();
|
||||
|
||||
// Build the map.
|
||||
BOOST_FOREACH (const unit &u, *resources::units)
|
||||
for (const unit &u : *resources::units)
|
||||
{
|
||||
if ( u.jamming() < 1 || !view_team.is_enemy(u.side()) )
|
||||
continue;
|
||||
|
||||
pathfind::jamming_path jam_path(u, u.get_location());
|
||||
BOOST_FOREACH(const pathfind::paths::step& st, jam_path.destinations) {
|
||||
for (const pathfind::paths::step& st : jam_path.destinations) {
|
||||
if ( jamming[st.curr] < st.move_left )
|
||||
jamming[st.curr] = st.move_left;
|
||||
}
|
||||
|
@ -365,14 +363,14 @@ bool shroud_clearer::clear_unit(const map_location &view_loc, team &view_team,
|
|||
resources::screen->draw(true);
|
||||
|
||||
// Clear the fog.
|
||||
BOOST_FOREACH (const pathfind::paths::step &dest, sight.destinations) {
|
||||
for (const pathfind::paths::step &dest : sight.destinations) {
|
||||
bool known = known_units && known_units->count(dest.curr) != 0;
|
||||
if ( clear_loc(view_team, dest.curr, view_loc, real_loc, viewer_id, !known,
|
||||
*enemy_count, *friend_count, spectator) )
|
||||
cleared_something = true;
|
||||
}
|
||||
//TODO guard with game_config option
|
||||
BOOST_FOREACH (const map_location &dest, sight.edges) {
|
||||
for (const map_location &dest : sight.edges) {
|
||||
bool known = known_units && known_units->count(dest) != 0;
|
||||
if ( clear_loc(view_team, dest, view_loc, real_loc, viewer_id, !known,
|
||||
*enemy_count, *friend_count, spectator) )
|
||||
|
@ -558,7 +556,7 @@ bool shroud_clearer::fire_events()
|
|||
std::vector<sight_data> sight_list;
|
||||
sight_list.swap(sightings_);
|
||||
|
||||
BOOST_FOREACH (const sight_data & event, sight_list) {
|
||||
for (const sight_data & event : sight_list) {
|
||||
// Try to locate the sighting unit.
|
||||
unit_map::const_iterator find_it = units.find(event.sighter_id);
|
||||
const map_location & sight_loc =
|
||||
|
@ -641,7 +639,7 @@ bool actor_sighted(const unit & target, const std::vector<int> * cache)
|
|||
std::vector<bool> needs_event(teams_size, cache == nullptr);
|
||||
if ( cache != nullptr ) {
|
||||
// Flag just the sides in the cache as needing events.
|
||||
BOOST_FOREACH (int side, *cache)
|
||||
for (int side : *cache)
|
||||
needs_event[side-1] = true;
|
||||
}
|
||||
// Exclude the target's own team.
|
||||
|
@ -659,7 +657,7 @@ bool actor_sighted(const unit & target, const std::vector<int> * cache)
|
|||
// Look for units that can be used as the second unit in sighted events.
|
||||
std::vector<const unit *> second_units(teams_size, nullptr);
|
||||
std::vector<size_t> distances(teams_size, UINT_MAX);
|
||||
BOOST_FOREACH (const unit & viewer, *resources::units) {
|
||||
for (const unit & viewer : *resources::units) {
|
||||
const size_t index = viewer.side() - 1;
|
||||
// Does viewer belong to a team for which we still need a unit?
|
||||
if ( needs_event[index] && distances[index] != 0 ) {
|
||||
|
@ -713,7 +711,7 @@ void recalculate_fog(int side)
|
|||
|
||||
// Exclude currently seen units from sighted events.
|
||||
std::set<map_location> visible_locs;
|
||||
BOOST_FOREACH (const unit &u, *resources::units) {
|
||||
for (const unit &u : *resources::units) {
|
||||
const map_location & u_location = u.get_location();
|
||||
|
||||
if ( !tm.fogged(u_location) )
|
||||
|
@ -726,7 +724,7 @@ void recalculate_fog(int side)
|
|||
resources::screen->invalidate_all();
|
||||
|
||||
shroud_clearer clearer;
|
||||
BOOST_FOREACH(const unit &u, *resources::units)
|
||||
for (const unit &u : *resources::units)
|
||||
{
|
||||
if ( u.side() == side )
|
||||
clearer.clear_unit(u.get_location(), u, tm, &visible_locs);
|
||||
|
@ -762,7 +760,7 @@ bool clear_shroud(int side, bool reset_fog, bool fire_events)
|
|||
bool result = false;
|
||||
|
||||
shroud_clearer clearer;
|
||||
BOOST_FOREACH(const unit &u, *resources::units)
|
||||
for (const unit &u : *resources::units)
|
||||
{
|
||||
if ( u.side() == side )
|
||||
result |= clearer.clear_unit(u.get_location(), u, tm);
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "log.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_addons_client("addons-client");
|
||||
#define ERR_AC LOG_STREAM(err , log_addons_client)
|
||||
#define LOG_AC LOG_STREAM(info, log_addons_client)
|
||||
|
@ -45,7 +43,7 @@ namespace {
|
|||
return;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const std::string& dep, base_deps) {
|
||||
for(const std::string& dep : base_deps) {
|
||||
if(base_id == dep) {
|
||||
LOG_AC << dep << " depends upon itself; breaking circular dependency\n";
|
||||
continue;
|
||||
|
@ -76,7 +74,7 @@ void addon_info::read(const config& cfg)
|
|||
|
||||
const config::const_child_itors& locales = cfg.child_range("translation");
|
||||
|
||||
BOOST_FOREACH(const config& locale, locales) {
|
||||
for(const config& locale : locales) {
|
||||
this->locales.push_back(locale["language"].str());
|
||||
}
|
||||
|
||||
|
@ -101,7 +99,7 @@ void addon_info::write(config& cfg) const
|
|||
cfg["uploads"] = this->uploads;
|
||||
cfg["type"] = get_addon_type_string(this->type);
|
||||
|
||||
BOOST_FOREACH(const std::string& locale_id, this->locales) {
|
||||
for (const std::string& locale_id : this->locales) {
|
||||
cfg.add_child("translation")["language"] = locale_id;
|
||||
}
|
||||
|
||||
|
@ -204,9 +202,10 @@ void read_addons_list(const config& cfg, addons_list& dest)
|
|||
|
||||
unsigned order = 0;
|
||||
|
||||
/** @todo FIXME: get rid of this legacy "campaign"/"campaigns" silliness */
|
||||
/** @todo FIXME: get rid of this legacy "campaign"/"campaigns" silliness
|
||||
*/
|
||||
const config::const_child_itors &addon_cfgs = cfg.child_range("campaign");
|
||||
BOOST_FOREACH(const config& addon_cfg, addon_cfgs) {
|
||||
for(const config& addon_cfg : addon_cfgs) {
|
||||
const std::string& id = addon_cfg["name"].str();
|
||||
if(dest.find(id) != dest.end()) {
|
||||
ERR_AC << "add-ons list has multiple entries for '" << id << "', not good; ignoring them" << std::endl;
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
#include "formula/string_utils.hpp"
|
||||
#include "addon/client.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_config("config");
|
||||
#define ERR_CFG LOG_STREAM(err , log_config)
|
||||
#define LOG_CFG LOG_STREAM(info, log_config)
|
||||
|
@ -317,11 +315,11 @@ static void unarchive_dir(const std::string& path, const config& cfg)
|
|||
|
||||
filesystem::make_directory(dir);
|
||||
|
||||
BOOST_FOREACH(const config &d, cfg.child_range("dir")) {
|
||||
for(const config &d : cfg.child_range("dir")) {
|
||||
unarchive_dir(dir, d);
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config &f, cfg.child_range("file")) {
|
||||
for(const config &f : cfg.child_range("file")) {
|
||||
unarchive_file(dir, f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "wml_exception.hpp"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "addon/client.hpp"
|
||||
|
||||
|
@ -166,7 +165,7 @@ addon_op_result do_resolve_addon_dependencies(CVideo& v, addons_client& client,
|
|||
std::vector<std::string> missing_deps;
|
||||
std::vector<std::string> broken_deps;
|
||||
|
||||
BOOST_FOREACH(const std::string& dep, deps) {
|
||||
for(const std::string& dep : deps) {
|
||||
if(!is_addon_installed(dep)) {
|
||||
if(addons.find(dep) != addons.end()) {
|
||||
missing_deps.push_back(dep);
|
||||
|
@ -187,7 +186,7 @@ addon_op_result do_resolve_addon_dependencies(CVideo& v, addons_client& client,
|
|||
broken_deps.size());
|
||||
broken_deps_report += "\n";
|
||||
|
||||
BOOST_FOREACH(const std::string& broken_dep_id, broken_deps) {
|
||||
for(const std::string& broken_dep_id : broken_deps) {
|
||||
broken_deps_report += "\n " + utils::unicode_bullet + " " + make_addon_title(broken_dep_id);
|
||||
}
|
||||
|
||||
|
@ -216,7 +215,7 @@ addon_op_result do_resolve_addon_dependencies(CVideo& v, addons_client& client,
|
|||
|
||||
cursor_setter.reset(new cursor::setter(cursor::WAIT));
|
||||
|
||||
BOOST_FOREACH(const std::string& dep, missing_deps) {
|
||||
for(const std::string& dep : missing_deps) {
|
||||
const addon_info& addon = addon_at(dep, addons);
|
||||
|
||||
const std::string& display_size = size_display_string(addon.size);
|
||||
|
@ -264,7 +263,7 @@ addon_op_result do_resolve_addon_dependencies(CVideo& v, addons_client& client,
|
|||
|
||||
std::vector<std::string> failed_titles;
|
||||
|
||||
BOOST_FOREACH(const std::string& dep, missing_deps) {
|
||||
for(const std::string& dep : missing_deps) {
|
||||
const addon_info& addon = addon_at(dep, addons);
|
||||
|
||||
if(!try_fetch_addon(v, client, addon)) {
|
||||
|
@ -599,7 +598,7 @@ sorted_addon_pointer_list sort_addons_list(addons_list& addons, ADDON_SORT sort,
|
|||
sorted_addon_pointer_list res;
|
||||
addon_pointer_list_sorter sorter(sort, direction);
|
||||
|
||||
BOOST_FOREACH(const addons_list::value_type& entry, addons) {
|
||||
for(const addons_list::value_type& entry : addons) {
|
||||
res.push_back(&entry);
|
||||
}
|
||||
|
||||
|
@ -681,7 +680,7 @@ void show_addons_manager_dialog(CVideo& v, addons_client& client, addons_list& a
|
|||
|
||||
bool have_upgradable_addons = false;
|
||||
|
||||
BOOST_FOREACH(const sorted_addon_pointer_list::value_type& sorted_entry, sorted_addons) {
|
||||
for(const sorted_addon_pointer_list::value_type& sorted_entry : sorted_addons) {
|
||||
const addons_list::value_type& entry = *sorted_entry;
|
||||
const addon_info& addon = entry.second;
|
||||
tracking[addon.id] = get_addon_tracking_info(addon);
|
||||
|
@ -781,7 +780,7 @@ void show_addons_manager_dialog(CVideo& v, addons_client& client, addons_list& a
|
|||
utils::string_map i18n_syms;
|
||||
|
||||
// Enter publish and remote deletion options
|
||||
BOOST_FOREACH(const std::string& pub_id, can_publish_ids) {
|
||||
for(const std::string& pub_id : can_publish_ids) {
|
||||
i18n_syms["addon_title"] = make_addon_title(pub_id);
|
||||
|
||||
static const std::string publish_icon = "icons/icon-game.png~BLIT(icons/icon-addon-publish.png)";
|
||||
|
@ -790,7 +789,7 @@ void show_addons_manager_dialog(CVideo& v, addons_client& client, addons_list& a
|
|||
options.push_back(IMAGE_PREFIX + publish_icon + COLUMN_SEPARATOR + font::GOOD_TEXT + text);
|
||||
filter_options.push_back(text);
|
||||
}
|
||||
BOOST_FOREACH(const std::string& del_id, can_delete_ids) {
|
||||
for(const std::string& del_id : can_delete_ids) {
|
||||
i18n_syms["addon_title"] = make_addon_title(del_id);
|
||||
|
||||
static const std::string delete_icon = "icons/icon-game.png~BLIT(icons/icon-addon-delete.png)";
|
||||
|
@ -929,7 +928,7 @@ void show_addons_manager_dialog(CVideo& v, addons_client& client, addons_list& a
|
|||
std::vector<std::string> failed_titles;
|
||||
|
||||
if(update_everything) {
|
||||
BOOST_FOREACH(const std::string& id, option_ids) {
|
||||
for(const std::string& id : option_ids) {
|
||||
if(tracking[id].state == ADDON_INSTALLED_UPGRADABLE) {
|
||||
ids_to_install.push_back(id);
|
||||
}
|
||||
|
@ -940,7 +939,7 @@ void show_addons_manager_dialog(CVideo& v, addons_client& client, addons_list& a
|
|||
ids_to_install.push_back(option_ids[result]);
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const std::string& id, ids_to_install) {
|
||||
for(const std::string& id : ids_to_install) {
|
||||
const addon_info& addon = addon_at(id, addons);
|
||||
|
||||
addon_op_result res = try_fetch_addon_with_checks(v, client, addons, addon);
|
||||
|
@ -1093,7 +1092,7 @@ bool uninstall_local_addons(CVideo& v)
|
|||
|
||||
std::map<std::string, std::string> addon_titles_map;
|
||||
|
||||
BOOST_FOREACH(const std::string& id, addons) {
|
||||
for(const std::string& id : addons) {
|
||||
std::string title;
|
||||
|
||||
if(have_addon_install_info(id)) {
|
||||
|
@ -1133,7 +1132,7 @@ bool uninstall_local_addons(CVideo& v)
|
|||
|
||||
remove_names.clear();
|
||||
|
||||
BOOST_FOREACH(const std::string& id, remove_ids) {
|
||||
for(const std::string& id : remove_ids) {
|
||||
remove_names.insert(addon_titles_map[id]);
|
||||
}
|
||||
|
||||
|
@ -1150,7 +1149,7 @@ bool uninstall_local_addons(CVideo& v)
|
|||
|
||||
std::set<std::string> failed_names, skipped_names, succeeded_names;
|
||||
|
||||
BOOST_FOREACH(const std::string& id, remove_ids) {
|
||||
for(const std::string& id : remove_ids) {
|
||||
const std::string& name = addon_titles_map[id];
|
||||
|
||||
if(have_addon_pbl_info(id) || have_addon_in_vcs_tree(id)) {
|
||||
|
@ -1244,7 +1243,7 @@ bool ad_hoc_addon_fetch_session(CVideo& v, const std::vector<std::string>& addon
|
|||
}
|
||||
|
||||
bool return_value = true;
|
||||
BOOST_FOREACH(const std::string & addon_id, addon_ids) {
|
||||
for(const std::string & addon_id : addon_ids) {
|
||||
addons_list::const_iterator it = addons.find(addon_id);
|
||||
if(it != addons.end()) {
|
||||
const addon_info& addon = it->second;
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
#include "addon/validation.hpp"
|
||||
#include "config.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
const unsigned short default_campaignd_port = 15008;
|
||||
|
||||
namespace {
|
||||
|
@ -71,10 +69,10 @@ bool addon_filename_legal(const std::string& name)
|
|||
|
||||
bool check_names_legal(const config& dir)
|
||||
{
|
||||
BOOST_FOREACH(const config &path, dir.child_range("file")) {
|
||||
for (const config &path : dir.child_range("file")) {
|
||||
if (!addon_filename_legal(path["name"])) return false;
|
||||
}
|
||||
BOOST_FOREACH(const config &path, dir.child_range("dir")) {
|
||||
for (const config &path : dir.child_range("dir")) {
|
||||
if (!addon_filename_legal(path["name"])) return false;
|
||||
if (!check_names_legal(path)) return false;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include <boost/bind.hpp>
|
||||
#include "utils/boost_function_guarded.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace ai {
|
||||
|
||||
|
@ -60,7 +59,7 @@ void ai_composite::on_create()
|
|||
cfg_["id"]<<"]"<<std::endl;
|
||||
|
||||
// init the composite ai stages
|
||||
BOOST_FOREACH(const config &cfg_element, cfg_.child_range("stage")){
|
||||
for (const config &cfg_element : cfg_.child_range("stage")) {
|
||||
add_stage(cfg_element);
|
||||
}
|
||||
|
||||
|
@ -126,7 +125,7 @@ bool ai_composite::add_stage(const config &cfg)
|
|||
std::vector< stage_ptr > stages;
|
||||
create_stage(stages,cfg);
|
||||
int j=0;
|
||||
BOOST_FOREACH(stage_ptr b, stages ){
|
||||
for (stage_ptr b : stages) {
|
||||
stages_.push_back(b);
|
||||
j++;
|
||||
}
|
||||
|
@ -139,7 +138,7 @@ bool ai_composite::add_goal(const config &cfg)
|
|||
std::vector< goal_ptr > goals;
|
||||
create_goal(goals,cfg);
|
||||
int j=0;
|
||||
BOOST_FOREACH(goal_ptr b, goals ){
|
||||
for (goal_ptr b : goals) {
|
||||
get_goals().push_back(b);
|
||||
j++;
|
||||
}
|
||||
|
@ -148,7 +147,7 @@ bool ai_composite::add_goal(const config &cfg)
|
|||
|
||||
|
||||
void ai_composite::play_turn(){
|
||||
BOOST_FOREACH(stage_ptr &s, stages_){
|
||||
for (stage_ptr &s : stages_) {
|
||||
s->play_stage();
|
||||
}
|
||||
}
|
||||
|
@ -218,7 +217,7 @@ config ai_composite::to_config() const
|
|||
config cfg;
|
||||
|
||||
//serialize the composite ai stages
|
||||
BOOST_FOREACH(const stage_ptr &s, stages_){
|
||||
for (const stage_ptr &s : stages_) {
|
||||
cfg.add_child("stage",s->to_config());
|
||||
}
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ public:
|
|||
, default_()
|
||||
, parent_id_(id)
|
||||
{
|
||||
BOOST_FOREACH(const config &cfg_element, this->cfg_.child_range("facet") ){
|
||||
for (const config &cfg_element : this->cfg_.child_range("facet")) {
|
||||
add_facet(-1,cfg_element);
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ public:
|
|||
{
|
||||
std::vector<aspect_ptr> facets_base;
|
||||
engine::parse_aspect_from_config(*this,cfg,parent_id_,std::back_inserter(facets_base));
|
||||
BOOST_FOREACH(aspect_ptr a, facets_base ){
|
||||
for (aspect_ptr a : facets_base) {
|
||||
typename aspect_type<T>::typesafe_ptr b = boost::dynamic_pointer_cast< typesafe_aspect<T> > (a);
|
||||
if (composite_aspect<T>* c = dynamic_cast<composite_aspect<T>*>(b.get())) {
|
||||
c->parent_id_ = parent_id_;
|
||||
|
@ -308,7 +308,7 @@ public:
|
|||
virtual void recalculate() const
|
||||
{
|
||||
///@todo 1.9 optimize in case of an aspect which returns variant
|
||||
BOOST_FOREACH(const typename aspect_type<T>::typesafe_ptr &f, make_pair(facets_.rbegin(),facets_.rend())) {
|
||||
for (const typename aspect_type<T>::typesafe_ptr &f : make_pair(facets_.rbegin(),facets_.rend())) {
|
||||
if (f->active()) {
|
||||
this->value_ = boost::shared_ptr<T>(f->get_ptr());
|
||||
this->valid_ = true;
|
||||
|
@ -325,7 +325,7 @@ public:
|
|||
virtual config to_config() const
|
||||
{
|
||||
config cfg = aspect::to_config();
|
||||
BOOST_FOREACH(const typename aspect_type<T>::typesafe_ptr f, facets_) {
|
||||
for (const typename aspect_type<T>::typesafe_ptr f : facets_) {
|
||||
cfg.add_child("facet",f->to_config());
|
||||
}
|
||||
if (default_) {
|
||||
|
@ -344,7 +344,7 @@ public:
|
|||
std::vector< aspect_ptr > facets;
|
||||
engine::parse_aspect_from_config(*this,cfg,parent_id_,std::back_inserter(facets));
|
||||
int j=0;
|
||||
BOOST_FOREACH(aspect_ptr a, facets ){
|
||||
for (aspect_ptr a : facets) {
|
||||
typename aspect_type<T>::typesafe_ptr b = boost::dynamic_pointer_cast< typesafe_aspect<T> > (a);
|
||||
if (composite_aspect<T>* c = dynamic_cast<composite_aspect<T>*>(b.get())) {
|
||||
c->parent_id_ = parent_id_;
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace pathfind {
|
||||
|
||||
|
@ -124,7 +123,7 @@ std::vector<component*> component::get_children(const std::string &type)
|
|||
std::vector<std::string> component::get_children_types()
|
||||
{
|
||||
std::vector<std::string> types;
|
||||
BOOST_FOREACH(property_handler_map::value_type &ph, property_handlers_) {
|
||||
for (property_handler_map::value_type &ph : property_handlers_) {
|
||||
types.push_back(ph.first);
|
||||
}
|
||||
return types;
|
||||
|
@ -240,9 +239,9 @@ static void print_component(component *root, const std::string &type, std::strin
|
|||
|
||||
s << offset_str << type<<"["<<root->get_id() <<"] "<<root->get_engine()<<" "<<root->get_name()<< std::endl;
|
||||
|
||||
BOOST_FOREACH(std::string t, t_list) {
|
||||
for (std::string t : t_list) {
|
||||
std::vector<component*> c_list = root->get_children(t);
|
||||
BOOST_FOREACH(component *c, c_list) {
|
||||
for (component *c : c_list) {
|
||||
print_component(c,t,s,offset+1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "wml_exception.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
|
||||
|
@ -154,7 +153,7 @@ void target_unit_goal::add_targets(std::back_insert_iterator< std::vector< targe
|
|||
|
||||
//find the enemy leaders and explicit targets
|
||||
const unit_filter ufilt(vconfig(criteria), resources::filter_con);
|
||||
BOOST_FOREACH(const unit &u, *resources::units) {
|
||||
for (const unit &u : *resources::units) {
|
||||
if (ufilt( u )) {
|
||||
LOG_AI_GOAL << "found explicit target unit at ... " << u.get_location() << " with value: " << value() << "\n";
|
||||
*target_list = target(u.get_location(), value(), target::TYPE::EXPLICIT);
|
||||
|
@ -204,7 +203,7 @@ void target_location_goal::add_targets(std::back_insert_iterator< std::vector< t
|
|||
|
||||
std::set<map_location> items;
|
||||
filter_ptr_->get_locations(items);
|
||||
BOOST_FOREACH(const map_location &loc, items)
|
||||
for (const map_location &loc : items)
|
||||
{
|
||||
LOG_AI_GOAL << "found explicit target location ... " << loc << " with value: " << value() << std::endl;
|
||||
*target_list = target(loc, value(), target::TYPE::EXPLICIT);
|
||||
|
@ -285,7 +284,7 @@ void protect_goal::add_targets(std::back_insert_iterator< std::vector< target >
|
|||
std::set<map_location> items;
|
||||
if (protect_unit_) {
|
||||
const unit_filter ufilt(vconfig(criteria), resources::filter_con);
|
||||
BOOST_FOREACH(const unit &u, units)
|
||||
for (const unit &u : units)
|
||||
{
|
||||
//TODO: we will protect hidden units, by not testing for invisibility to current side
|
||||
if (ufilt(u)) {
|
||||
|
@ -298,9 +297,9 @@ void protect_goal::add_targets(std::back_insert_iterator< std::vector< target >
|
|||
}
|
||||
DBG_AI_GOAL << "side " << get_side() << ": seaching for threats in "+goal_type+" goal" << std::endl;
|
||||
// Look for directions to protect a specific location or specific unit.
|
||||
BOOST_FOREACH(const map_location &loc, items)
|
||||
for (const map_location &loc : items)
|
||||
{
|
||||
BOOST_FOREACH(const unit &u, units)
|
||||
for (const unit &u : units)
|
||||
{
|
||||
int distance = distance_between(u.get_location(), loc);
|
||||
if (current_team().is_enemy(u.side()) && distance < radius_ &&
|
||||
|
@ -355,7 +354,7 @@ void lua_goal::add_targets(std::back_insert_iterator< std::vector< target > > ta
|
|||
try {
|
||||
std::vector < target > targets = *(l_obj->get());
|
||||
|
||||
BOOST_FOREACH(target tg, targets)
|
||||
for (target tg : targets)
|
||||
{
|
||||
*target_list = tg;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#define AI_COMPOSITE_PROPERTY_HANDLER_HPP_INCLUDED
|
||||
|
||||
#include "utils/boost_function_guarded.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "config.hpp"
|
||||
#include "ai/composite/component.hpp"
|
||||
|
@ -136,7 +135,7 @@ public:
|
|||
std::vector<component*> handle_get_children()
|
||||
{
|
||||
std::vector<component*> children;
|
||||
BOOST_FOREACH(t_ptr v, values_) {
|
||||
for (t_ptr v : values_) {
|
||||
children.push_back(&*v);
|
||||
}
|
||||
return children;
|
||||
|
@ -156,7 +155,7 @@ private:
|
|||
t_ptr_vector values;
|
||||
call_factory(values,cfg);
|
||||
int j=0;
|
||||
BOOST_FOREACH(t_ptr b, values ){
|
||||
for (t_ptr b : values ) {
|
||||
values_.insert(values_.begin()+pos+j,b);
|
||||
j++;
|
||||
}
|
||||
|
@ -261,9 +260,9 @@ public:
|
|||
//* is a special case - 'delete all facets'
|
||||
if (child.id == "*") {
|
||||
bool b = false;
|
||||
BOOST_FOREACH(typename aspect_map::value_type a, aspects_) {
|
||||
b |= a.second->delete_all_facets();
|
||||
}
|
||||
for (typename aspect_map::value_type a : aspects_) {
|
||||
b |= a.second->delete_all_facets();
|
||||
}
|
||||
return b;
|
||||
}
|
||||
return false;
|
||||
|
@ -273,7 +272,7 @@ public:
|
|||
std::vector<component*> handle_get_children()
|
||||
{
|
||||
std::vector<component*> children;
|
||||
BOOST_FOREACH(typename aspect_map::value_type a, aspects_) {
|
||||
for (typename aspect_map::value_type a : aspects_) {
|
||||
children.push_back(&*a.second);
|
||||
}
|
||||
return children;
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#include "wml_exception.hpp"
|
||||
#include "config_assign.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <set>
|
||||
|
@ -55,7 +53,7 @@ void configuration::init(const config &game_config)
|
|||
}
|
||||
|
||||
|
||||
BOOST_FOREACH(const config &ai_configuration, ais.child_range("ai")) {
|
||||
for (const config &ai_configuration : ais.child_range("ai")) {
|
||||
const std::string &id = ai_configuration["id"];
|
||||
if (id.empty()){
|
||||
|
||||
|
@ -80,7 +78,7 @@ void configuration::init(const config &game_config)
|
|||
namespace {
|
||||
void extract_ai_configurations(std::map<std::string, description> &storage, const config &input)
|
||||
{
|
||||
BOOST_FOREACH(const config &ai_configuration, input.child_range("ai")) {
|
||||
for (const config &ai_configuration : input.child_range("ai")) {
|
||||
const std::string &id = ai_configuration["id"];
|
||||
if (id.empty()){
|
||||
|
||||
|
@ -112,7 +110,7 @@ void configuration::add_era_ai_from_config(const config &era)
|
|||
void configuration::add_mod_ai_from_config(config::const_child_itors mods)
|
||||
{
|
||||
mod_ai_configurations_.clear();
|
||||
BOOST_FOREACH(const config &mod, mods) {
|
||||
for (const config &mod : mods) {
|
||||
extract_ai_configurations(mod_ai_configurations_, mod);
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +182,7 @@ bool configuration::parse_side_config(side_number side, const config& original_c
|
|||
|
||||
//leave only the [ai] children
|
||||
cfg = config();
|
||||
BOOST_FOREACH(const config &aiparam, original_cfg.child_range("ai")) {
|
||||
for (const config &aiparam : original_cfg.child_range("ai")) {
|
||||
cfg.add_child("ai",aiparam);
|
||||
}
|
||||
|
||||
|
@ -212,7 +210,7 @@ bool configuration::parse_side_config(side_number side, const config& original_c
|
|||
config parsed_cfg = config();
|
||||
|
||||
LOG_AI_CONFIGURATION << "side "<< side <<": merging AI configurations"<< std::endl;
|
||||
BOOST_FOREACH(const config &aiparam, cfg.child_range("ai")) {
|
||||
for (const config &aiparam : cfg.child_range("ai")) {
|
||||
parsed_cfg.append(aiparam);
|
||||
}
|
||||
|
||||
|
@ -221,7 +219,7 @@ bool configuration::parse_side_config(side_number side, const config& original_c
|
|||
parsed_cfg.merge_children_by_attribute("aspect","id");
|
||||
|
||||
LOG_AI_CONFIGURATION << "side "<< side <<": removing duplicate [default] tags from aspects"<< std::endl;
|
||||
BOOST_FOREACH(config &aspect_cfg, parsed_cfg.child_range("aspect")) {
|
||||
for (config &aspect_cfg : parsed_cfg.child_range("aspect")) {
|
||||
if (aspect_cfg["name"] != "composite_aspect") {
|
||||
// No point in warning about Lua or standard aspects lacking [default]
|
||||
continue;
|
||||
|
@ -254,7 +252,7 @@ static const std::set<std::string> old_goal_tags = {"target", "target_location",
|
|||
void configuration::expand_simplified_aspects(side_number side, config &cfg) {
|
||||
std::string algorithm;
|
||||
config base_config, parsed_config;
|
||||
BOOST_FOREACH(const config &aiparam, cfg.child_range("ai")) {
|
||||
for (const config &aiparam : cfg.child_range("ai")) {
|
||||
std::string turns, time_of_day, engine = "cpp";
|
||||
if (aiparam.has_attribute("turns")) {
|
||||
turns = aiparam["turns"].str();
|
||||
|
@ -274,7 +272,7 @@ void configuration::expand_simplified_aspects(side_number side, config &cfg) {
|
|||
}
|
||||
}
|
||||
std::deque<std::pair<std::string, config> > facet_configs;
|
||||
BOOST_FOREACH(const config::attribute &attr, aiparam.attribute_range()) {
|
||||
for (const config::attribute &attr : aiparam.attribute_range()) {
|
||||
if (non_aspect_attributes.count(attr.first)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -286,7 +284,7 @@ void configuration::expand_simplified_aspects(side_number side, config &cfg) {
|
|||
facet_config["value"] = attr.second;
|
||||
facet_configs.push_back(std::make_pair(attr.first, facet_config));
|
||||
}
|
||||
BOOST_FOREACH(const config::any_child &child, aiparam.all_children_range()) {
|
||||
for (const config::any_child &child : aiparam.all_children_range()) {
|
||||
if (just_copy_tags.count(child.key)) {
|
||||
// These aren't simplified, so just copy over unchanged.
|
||||
parsed_config.add_child(child.key, child.cfg);
|
||||
|
@ -340,14 +338,14 @@ void configuration::expand_simplified_aspects(side_number side, config &cfg) {
|
|||
facet_configs.pop_front();
|
||||
}
|
||||
typedef std::map<std::string, config>::value_type aspect_pair;
|
||||
BOOST_FOREACH(const aspect_pair& p, aspect_configs) {
|
||||
for (const aspect_pair& p : aspect_configs) {
|
||||
parsed_config.add_child("aspect", p.second);
|
||||
}
|
||||
}
|
||||
if (algorithm.empty() && !parsed_config.has_child("stage")) {
|
||||
base_config = get_ai_config_for("ai_default_rca");
|
||||
}
|
||||
BOOST_FOREACH(const config::any_child &child, parsed_config.all_children_range()) {
|
||||
for (const config::any_child &child : parsed_config.all_children_range()) {
|
||||
base_config.add_child(child.key, child.cfg);
|
||||
}
|
||||
cfg.clear_children("ai");
|
||||
|
|
|
@ -58,7 +58,6 @@
|
|||
#include "formula/variant.hpp" // for variant
|
||||
|
||||
#include <algorithm> // for find, count, max, fill_n
|
||||
#include <boost/foreach.hpp> // for auto_any_base, etc
|
||||
#include <boost/smart_ptr/intrusive_ptr.hpp> // for intrusive_ptr
|
||||
#include <boost/smart_ptr/shared_ptr.hpp> // for dynamic_pointer_cast, etc
|
||||
#include <cmath> // for sqrt
|
||||
|
@ -265,19 +264,19 @@ readonly_context_impl::readonly_context_impl(side_context &context, const config
|
|||
|
||||
void readonly_context_impl::on_readonly_context_create() {
|
||||
//init the composite ai engines
|
||||
BOOST_FOREACH(const config &cfg_element, cfg_.child_range("engine")){
|
||||
for(const config &cfg_element : cfg_.child_range("engine")) {
|
||||
engine::parse_engine_from_config(*this,cfg_element,std::back_inserter(engines_));
|
||||
}
|
||||
|
||||
// init the composite ai aspects
|
||||
BOOST_FOREACH(const config &cfg_element, cfg_.child_range("aspect")){
|
||||
for(const config &cfg_element : cfg_.child_range("aspect")) {
|
||||
std::vector<aspect_ptr> aspects;
|
||||
engine::parse_aspect_from_config(*this,cfg_element,cfg_element["id"],std::back_inserter(aspects));
|
||||
add_aspects(aspects);
|
||||
}
|
||||
|
||||
// init the composite ai goals
|
||||
BOOST_FOREACH(const config &cfg_element, cfg_.child_range("goal")){
|
||||
for(const config &cfg_element : cfg_.child_range("goal")) {
|
||||
engine::parse_goal_from_config(*this,cfg_element,std::back_inserter(get_goals()));
|
||||
}
|
||||
}
|
||||
|
@ -297,13 +296,13 @@ config readwrite_context_impl::to_readwrite_context_config() const
|
|||
config readonly_context_impl::to_readonly_context_config() const
|
||||
{
|
||||
config cfg;
|
||||
BOOST_FOREACH(const engine_ptr e, engines_) {
|
||||
for(const engine_ptr e : engines_) {
|
||||
cfg.add_child("engine",e->to_config());
|
||||
}
|
||||
BOOST_FOREACH(const aspect_map::value_type a, aspects_) {
|
||||
for(const aspect_map::value_type a : aspects_) {
|
||||
cfg.add_child("aspect",a.second->to_config());
|
||||
}
|
||||
BOOST_FOREACH(const goal_ptr g, goals_) {
|
||||
for(const goal_ptr g : goals_) {
|
||||
cfg.add_child("goal",g->to_config());
|
||||
}
|
||||
return cfg;
|
||||
|
@ -419,7 +418,7 @@ void readonly_context_impl::calculate_moves(const unit_map& units, std::map<map_
|
|||
}
|
||||
|
||||
for(std::map<map_location,pathfind::paths>::iterator m = res.begin(); m != res.end(); ++m) {
|
||||
BOOST_FOREACH(const pathfind::paths::step &dest, m->second.destinations)
|
||||
for(const pathfind::paths::step &dest : m->second.destinations)
|
||||
{
|
||||
const map_location& src = m->first;
|
||||
const map_location& dst = dest.curr;
|
||||
|
@ -459,7 +458,7 @@ void readonly_context_impl::calculate_moves(const unit_map& units, std::map<map_
|
|||
|
||||
void readonly_context_impl::add_aspects(std::vector< aspect_ptr > &aspects )
|
||||
{
|
||||
BOOST_FOREACH(aspect_ptr a, aspects) {
|
||||
for(aspect_ptr a : aspects) {
|
||||
const std::string id = a->get_id();
|
||||
known_aspect_map::iterator i = known_aspects_.find(id);
|
||||
if (i != known_aspects_.end()) {
|
||||
|
@ -1130,7 +1129,7 @@ double readonly_context_impl::power_projection(const map_location& loc, const mo
|
|||
// The 0.5 power avoids underestimating too much the damage of a wounded unit.
|
||||
int hp = int(sqrt(double(un.hitpoints()) / un.max_hitpoints()) * 1000);
|
||||
int most_damage = 0;
|
||||
BOOST_FOREACH(const attack_type &att, un.attacks())
|
||||
for(const attack_type &att : un.attacks())
|
||||
{
|
||||
int damage = att.damage() * att.num_attacks() * (100 + tod_modifier);
|
||||
if (damage > most_damage) {
|
||||
|
@ -1245,7 +1244,7 @@ const map_location& readonly_context_impl::suitable_keep(const map_location& lea
|
|||
map_location const* best_occupied_keep = &map_location::null_location();
|
||||
double move_left_at_best_occupied_keep = 0.0;
|
||||
|
||||
BOOST_FOREACH(const pathfind::paths::step &dest, leader_paths.destinations)
|
||||
for(const pathfind::paths::step &dest : leader_paths.destinations)
|
||||
{
|
||||
const map_location &loc = dest.curr;
|
||||
if (keeps().find(loc)!=keeps().end()){
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
#include "pathfind/pathfind.hpp"
|
||||
#include "pathfind/teleport.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <numeric>
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -307,7 +305,7 @@ double move_leader_to_goals_phase::evaluate()
|
|||
possible_moves.insert(std::pair<map_location,pathfind::paths>(leader->get_location(), leader_paths));
|
||||
|
||||
map_location loc;
|
||||
BOOST_FOREACH(const map_location &l, route.steps)
|
||||
for (const map_location &l : route.steps)
|
||||
{
|
||||
if (leader_paths.destinations.contains(l) &&
|
||||
power_projection(l, get_enemy_dstsrc()) < leader->hitpoints() * max_risk)
|
||||
|
@ -390,7 +388,7 @@ double move_leader_to_keep_phase::evaluate()
|
|||
map_location best_keep;
|
||||
int shortest_distance = 99999;
|
||||
|
||||
BOOST_FOREACH(const unit_map::const_iterator& leader, leaders) {
|
||||
for (const unit_map::const_iterator& leader : leaders) {
|
||||
if (leader->incapacitated() || leader->movement_left() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
@ -454,7 +452,7 @@ double move_leader_to_keep_phase::evaluate()
|
|||
// find next hop
|
||||
map_location next_hop = map_location::null_location();
|
||||
int next_hop_cost = 0;
|
||||
BOOST_FOREACH(const map_location& step, route.steps) {
|
||||
for (const map_location& step : route.steps) {
|
||||
if (leader_paths.destinations.contains(step)) {
|
||||
next_hop = step;
|
||||
next_hop_cost += leader->movement_cost(resources::gameboard->map().get_terrain(step));
|
||||
|
@ -468,7 +466,7 @@ double move_leader_to_keep_phase::evaluate()
|
|||
//define the next hop to have the lowest cost (0)
|
||||
moves_toward_keep.insert(std::make_pair(0, next_hop));
|
||||
|
||||
BOOST_FOREACH(const pathfind::paths::step &dest, leader_paths.destinations) {
|
||||
for (const pathfind::paths::step &dest : leader_paths.destinations) {
|
||||
if (!units_.find(dest.curr).valid()) {
|
||||
route = pathfind::a_star_search(dest.curr, next_hop, 10000.0, &calc,
|
||||
resources::gameboard->map().w(), resources::gameboard->map().h(), &allowed_teleports);
|
||||
|
@ -480,7 +478,7 @@ double move_leader_to_keep_phase::evaluate()
|
|||
|
||||
// Find the first location which we can move to,
|
||||
// without the threat of enemies.
|
||||
BOOST_FOREACH(const ordered_locations::value_type& pair, moves_toward_keep) {
|
||||
for (const ordered_locations::value_type& pair : moves_toward_keep) {
|
||||
const map_location& loc = pair.second;
|
||||
if (get_enemy_dstsrc().count(loc) == 0) {
|
||||
move_ = check_move_action(leader->get_location(), loc, true);
|
||||
|
@ -1415,12 +1413,12 @@ double retreat_phase::evaluate()
|
|||
}*/
|
||||
//int leader_adj_count = 0;
|
||||
std::vector<map_location> leaders_adj_v;
|
||||
BOOST_FOREACH(unit_map::const_iterator leader, leaders){
|
||||
for (unit_map::const_iterator leader : leaders) {
|
||||
map_location tmp_leader_adj[6];
|
||||
get_adjacent_tiles(leader->get_location(), tmp_leader_adj);
|
||||
BOOST_FOREACH(map_location &loc, tmp_leader_adj){
|
||||
for (map_location &loc : tmp_leader_adj) {
|
||||
bool found = false;
|
||||
BOOST_FOREACH(map_location &new_loc, leaders_adj_v){
|
||||
for (map_location &new_loc : leaders_adj_v) {
|
||||
if(new_loc == loc){
|
||||
found = true;
|
||||
break;
|
||||
|
@ -1591,7 +1589,7 @@ double leader_shares_keep_phase::evaluate()
|
|||
return BAD_SCORE;
|
||||
}
|
||||
bool allied_leaders_available = false;
|
||||
BOOST_FOREACH(team &tmp_team, *resources::teams){
|
||||
for(team &tmp_team : *resources::teams) {
|
||||
if(!current_team().is_enemy(tmp_team.side())){
|
||||
std::vector<unit_map::unit_iterator> allied_leaders = resources::units->find_leaders(get_side());
|
||||
if (!allied_leaders.empty()){
|
||||
|
@ -1618,7 +1616,7 @@ void leader_shares_keep_phase::execute()
|
|||
calculate_moves(*resources::units, possible_moves, friends_srcdst, friends_dstsrc, false, true);
|
||||
|
||||
//check for each ai leader if he should move away from his keep
|
||||
BOOST_FOREACH(unit_map::unit_iterator &ai_leader, ai_leaders){
|
||||
for (unit_map::unit_iterator &ai_leader : ai_leaders) {
|
||||
//only if leader is on a keep
|
||||
const map_location &keep = ai_leader->get_location();
|
||||
if ( !resources::gameboard->map().is_keep(keep) ) {
|
||||
|
@ -1679,7 +1677,7 @@ void leader_shares_keep_phase::execute()
|
|||
}
|
||||
ai_leader->remove_movement_ai();
|
||||
}
|
||||
BOOST_FOREACH(unit_map::unit_iterator &leader, ai_leaders){
|
||||
for(unit_map::unit_iterator &leader : ai_leaders) {
|
||||
leader->remove_movement_ai();
|
||||
}
|
||||
//ERR_AI_TESTING_AI_DEFAULT << get_name() << ": evaluate - not yet implemented" << std::endl;
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "wml_exception.hpp"
|
||||
#include "config_assign.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <cmath>
|
||||
|
||||
|
@ -170,7 +169,7 @@ double recruitment::evaluate() {
|
|||
const unit_map& units = *resources::units;
|
||||
const std::vector<unit_map::const_iterator> leaders = units.find_leaders(get_side());
|
||||
|
||||
BOOST_FOREACH(const unit_map::const_iterator& leader, leaders) {
|
||||
for (const unit_map::const_iterator& leader : leaders) {
|
||||
if (leader == resources::units->end()) {
|
||||
return BAD_SCORE;
|
||||
}
|
||||
|
@ -208,7 +207,7 @@ void recruitment::execute() {
|
|||
|
||||
std::set<std::string> global_recruits;
|
||||
|
||||
BOOST_FOREACH(const unit_map::const_iterator& leader, leaders) {
|
||||
for (const unit_map::const_iterator& leader : leaders) {
|
||||
const map_location& keep = leader->get_location();
|
||||
if (!resources::gameboard->map().is_keep(keep)) {
|
||||
LOG_AI_RECRUITMENT << "Leader " << leader->name() << " is not on keep. \n";
|
||||
|
@ -229,7 +228,7 @@ void recruitment::execute() {
|
|||
data data(leader);
|
||||
|
||||
// Add team recruits.
|
||||
BOOST_FOREACH(const std::string& recruit, current_team().recruits()) {
|
||||
for (const std::string& recruit : current_team().recruits()) {
|
||||
if (!unit_types.find(recruit)) {
|
||||
lg::wml_error() << "Unit-type \"" << recruit << "\" doesn't exist.\n";
|
||||
}
|
||||
|
@ -239,7 +238,7 @@ void recruitment::execute() {
|
|||
}
|
||||
|
||||
// Add extra recruits.
|
||||
BOOST_FOREACH(const std::string& recruit, leader->recruits()) {
|
||||
for (const std::string& recruit : leader->recruits()) {
|
||||
if (!unit_types.find(recruit)) {
|
||||
lg::wml_error() << "Unit-type \"" << recruit << "\" doesn't exist.\n";
|
||||
}
|
||||
|
@ -251,7 +250,7 @@ void recruitment::execute() {
|
|||
// Add recalls.
|
||||
// Recalls are treated as recruits. While recruiting
|
||||
// we'll check if we can do a recall instead of a recruitment.
|
||||
BOOST_FOREACH(const unit_const_ptr & recall, current_team().recall_list()) {
|
||||
for (const unit_const_ptr & recall : current_team().recall_list()) {
|
||||
// Check if this leader is allowed to recall this unit.
|
||||
const unit_filter ufilt( vconfig(leader->recall_filter()), resources::filter_con);
|
||||
if (!ufilt(*recall, map_location::null_location())) {
|
||||
|
@ -296,7 +295,7 @@ void recruitment::execute() {
|
|||
show_important_hexes();
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const map_location& hex, important_hexes_) {
|
||||
for (const map_location& hex : important_hexes_) {
|
||||
++important_terrain_[map[hex]];
|
||||
}
|
||||
|
||||
|
@ -311,7 +310,7 @@ void recruitment::execute() {
|
|||
do_combat_analysis(&leader_data);
|
||||
|
||||
LOG_AI_RECRUITMENT << "Scores before extra treatments:\n";
|
||||
BOOST_FOREACH(const data& data, leader_data) {
|
||||
for (const data& data : leader_data) {
|
||||
LOG_AI_RECRUITMENT << "\n" << data.to_string();
|
||||
}
|
||||
|
||||
|
@ -320,7 +319,7 @@ void recruitment::execute() {
|
|||
handle_recruitment_more(&leader_data);
|
||||
|
||||
LOG_AI_RECRUITMENT << "Scores after extra treatments:\n";
|
||||
BOOST_FOREACH(const data& data, leader_data) {
|
||||
for (const data& data : leader_data) {
|
||||
LOG_AI_RECRUITMENT << "\n" << data.to_string();
|
||||
}
|
||||
|
||||
|
@ -473,7 +472,7 @@ const std::string* recruitment::get_appropriate_recall(const std::string& type,
|
|||
const data& leader_data) const {
|
||||
const std::string* best_recall_id = nullptr;
|
||||
double best_recall_value = -1;
|
||||
BOOST_FOREACH(const unit_const_ptr & recall_unit, current_team().recall_list()) {
|
||||
for (const unit_const_ptr & recall_unit : current_team().recall_list()) {
|
||||
if (type != recall_unit->type_id()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -485,7 +484,7 @@ const std::string* recruitment::get_appropriate_recall(const std::string& type,
|
|||
}
|
||||
double average_cost_of_advanced_unit = 0;
|
||||
int counter = 0;
|
||||
BOOST_FOREACH(const std::string& advancement, recall_unit->advances_to()) {
|
||||
for (const std::string& advancement : recall_unit->advances_to()) {
|
||||
const unit_type* advancement_type = unit_types.find(advancement);
|
||||
if (!advancement_type) {
|
||||
continue;
|
||||
|
@ -523,7 +522,7 @@ data* recruitment::get_best_leader_from_ratio_scores(std::vector<data>& leader_d
|
|||
// Find things for normalization.
|
||||
int total_recruit_count = 0;
|
||||
double ratio_score_sum = 0.0;
|
||||
BOOST_FOREACH(const data& data, leader_data) {
|
||||
for (const data& data : leader_data) {
|
||||
ratio_score_sum += data.ratio_score;
|
||||
total_recruit_count += data.recruit_count;
|
||||
}
|
||||
|
@ -535,7 +534,7 @@ data* recruitment::get_best_leader_from_ratio_scores(std::vector<data>& leader_d
|
|||
// Find which leader should recruit according to ratio_scores.
|
||||
data* best_leader_data = nullptr;
|
||||
double biggest_difference = -99999.;
|
||||
BOOST_FOREACH(data& data, leader_data) {
|
||||
for (data& data : leader_data) {
|
||||
if (!leader_matches_job(data, job)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -564,7 +563,7 @@ const std::string recruitment::get_best_recruit_from_scores(const data& leader_d
|
|||
}
|
||||
std::string best_recruit = "";
|
||||
double biggest_difference = -99999.;
|
||||
BOOST_FOREACH(const score_map::value_type& i, leader_data.get_normalized_scores()) {
|
||||
for (const score_map::value_type& i : leader_data.get_normalized_scores()) {
|
||||
const std::string& unit = i.first;
|
||||
const double score = i.second;
|
||||
|
||||
|
@ -639,7 +638,7 @@ void recruitment::compare_cost_maps_and_update_important_hexes(
|
|||
} // for
|
||||
double threshold = (biggest_border_movecost - smallest_border_movecost) *
|
||||
MAP_BORDER_WIDTH + smallest_border_movecost;
|
||||
BOOST_FOREACH(const border_cost_map::value_type& candidate, important_hexes_candidates) {
|
||||
for (const border_cost_map::value_type& candidate : important_hexes_candidates) {
|
||||
if (candidate.second < threshold) {
|
||||
important_hexes_.insert(candidate.first);
|
||||
}
|
||||
|
@ -658,7 +657,7 @@ double recruitment::get_average_defense(const std::string& u_type) const {
|
|||
}
|
||||
long summed_defense = 0;
|
||||
int total_terrains = 0;
|
||||
BOOST_FOREACH(const terrain_count_map::value_type& entry, important_terrain_) {
|
||||
for (const terrain_count_map::value_type& entry : important_terrain_) {
|
||||
const t_translation::t_terrain& terrain = entry.first;
|
||||
int count = entry.second;
|
||||
int defense = 100 - u_info->movement_type().defense_modifier(terrain);
|
||||
|
@ -685,7 +684,7 @@ const pathfind::full_cost_map recruitment::get_cost_map_of_side(int side) const
|
|||
|
||||
// First add all existing units to cost_map.
|
||||
unsigned int unit_count = 0;
|
||||
BOOST_FOREACH(const unit& unit, units) {
|
||||
for (const unit& unit : units) {
|
||||
if (unit.side() != side || unit.can_recruit() ||
|
||||
unit.incapacitated() || unit.total_movement() <= 0) {
|
||||
continue;
|
||||
|
@ -697,14 +696,14 @@ const pathfind::full_cost_map recruitment::get_cost_map_of_side(int side) const
|
|||
// If this side has not so many units yet, add unit_types with the leaders position as origin.
|
||||
if (unit_count < UNIT_THRESHOLD) {
|
||||
std::vector<unit_map::const_iterator> leaders = units.find_leaders(side);
|
||||
BOOST_FOREACH(const unit_map::const_iterator& leader, leaders) {
|
||||
for (const unit_map::const_iterator& leader : leaders) {
|
||||
// First add team-recruits (it's fine when (team-)recruits are added multiple times).
|
||||
BOOST_FOREACH(const std::string& recruit, team.recruits()) {
|
||||
for (const std::string& recruit : team.recruits()) {
|
||||
cost_map.add_unit(leader->get_location(), unit_types.find(recruit), side);
|
||||
}
|
||||
|
||||
// Next add extra-recruits.
|
||||
BOOST_FOREACH(const std::string& recruit, leader->recruits()) {
|
||||
for (const std::string& recruit : leader->recruits()) {
|
||||
cost_map.add_unit(leader->get_location(), unit_types.find(recruit), side);
|
||||
}
|
||||
}
|
||||
|
@ -721,7 +720,7 @@ void recruitment::show_important_hexes() const {
|
|||
return;
|
||||
}
|
||||
resources::screen->labels().clear_all();
|
||||
BOOST_FOREACH(const map_location& loc, important_hexes_) {
|
||||
for (const map_location& loc : important_hexes_) {
|
||||
// Little hack: use map_location north from loc and make 2 linebreaks to center the "X".
|
||||
resources::screen->labels().set_label(loc.get_direction(map_location::NORTH), "\n\nX");
|
||||
}
|
||||
|
@ -734,7 +733,7 @@ void recruitment::show_important_hexes() const {
|
|||
void recruitment::update_average_lawful_bonus() {
|
||||
int sum = 0;
|
||||
int counter = 0;
|
||||
BOOST_FOREACH(const time_of_day& time, resources::tod_manager->times()) {
|
||||
for (const time_of_day& time : resources::tod_manager->times()) {
|
||||
sum += time.lawful_bonus;
|
||||
++counter;
|
||||
}
|
||||
|
@ -757,7 +756,7 @@ void recruitment::update_average_local_cost() {
|
|||
map_location loc(x, y);
|
||||
int summed_cost = 0;
|
||||
int count = 0;
|
||||
BOOST_FOREACH(const std::string& recruit, team.recruits()){
|
||||
for (const std::string& recruit : team.recruits()) {
|
||||
const unit_type* const unit_type = unit_types.find(recruit);
|
||||
if (!unit_type) {
|
||||
continue;
|
||||
|
@ -789,7 +788,7 @@ void recruitment::update_important_hexes() {
|
|||
// Mark battle areas as important
|
||||
// This are locations where one of my units is adjacent
|
||||
// to a enemies unit.
|
||||
BOOST_FOREACH(const unit& unit, units) {
|
||||
for (const unit& unit : units) {
|
||||
if (unit.side() != get_side()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -812,7 +811,7 @@ void recruitment::update_important_hexes() {
|
|||
// The important hexes are those where my value on the cost map is
|
||||
// similar to a enemies one.
|
||||
const pathfind::full_cost_map my_cost_map = get_cost_map_of_side(get_side());
|
||||
BOOST_FOREACH(const team& team, *resources::teams) {
|
||||
for (const team& team : *resources::teams) {
|
||||
if (current_team().is_enemy(team.side())) {
|
||||
const pathfind::full_cost_map enemy_cost_map = get_cost_map_of_side(team.side());
|
||||
|
||||
|
@ -825,21 +824,21 @@ void recruitment::update_important_hexes() {
|
|||
// important villages first and add them and their surroundings
|
||||
// to important_hexes_ in a second step.
|
||||
std::vector<map_location> important_villages;
|
||||
BOOST_FOREACH(const map_location& village, map.villages()) {
|
||||
for (const map_location& village : map.villages()) {
|
||||
std::vector<map_location> surrounding;
|
||||
get_tiles_in_radius(village, MAP_VILLAGE_NEARNESS_THRESHOLD, surrounding);
|
||||
BOOST_FOREACH(const map_location& hex, surrounding) {
|
||||
for (const map_location& hex : surrounding) {
|
||||
if (important_hexes_.find(hex) != important_hexes_.end()) {
|
||||
important_villages.push_back(village);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
BOOST_FOREACH(const map_location& village, important_villages) {
|
||||
for (const map_location& village : important_villages) {
|
||||
important_hexes_.insert(village);
|
||||
std::vector<map_location> surrounding;
|
||||
get_tiles_in_radius(village, MAP_VILLAGE_SURROUNDING, surrounding);
|
||||
BOOST_FOREACH(const map_location& hex, surrounding) {
|
||||
for (const map_location& hex : surrounding) {
|
||||
// only add hex if one of our units can reach the hex
|
||||
if (map.on_board(hex) && my_cost_map.get_cost_at(hex.x, hex.y) != -1) {
|
||||
important_hexes_.insert(hex);
|
||||
|
@ -926,7 +925,7 @@ void recruitment::do_combat_analysis(std::vector<data>* leader_data) {
|
|||
// Collect all enemy units (and their hp) we want to take into account in enemy_units.
|
||||
typedef std::vector<std::pair<std::string, int> > unit_hp_vector;
|
||||
unit_hp_vector enemy_units;
|
||||
BOOST_FOREACH(const unit& unit, units) {
|
||||
for (const unit& unit : units) {
|
||||
if (!current_team().is_enemy(unit.side()) || unit.incapacitated()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -934,7 +933,7 @@ void recruitment::do_combat_analysis(std::vector<data>* leader_data) {
|
|||
}
|
||||
if (enemy_units.size() < UNIT_THRESHOLD) {
|
||||
// Use also enemies recruitment lists and insert units into enemy_units.
|
||||
BOOST_FOREACH(const team& team, *resources::teams) {
|
||||
for (const team& team : *resources::teams) {
|
||||
if (!current_team().is_enemy(team.side())) {
|
||||
continue;
|
||||
}
|
||||
|
@ -943,11 +942,11 @@ void recruitment::do_combat_analysis(std::vector<data>* leader_data) {
|
|||
possible_recruits.insert(team.recruits().begin(), team.recruits().end());
|
||||
// Add extra recruits.
|
||||
const std::vector<unit_map::const_iterator> leaders = units.find_leaders(team.side());
|
||||
BOOST_FOREACH(unit_map::const_iterator leader, leaders) {
|
||||
for (unit_map::const_iterator leader : leaders) {
|
||||
possible_recruits.insert(leader->recruits().begin(), leader->recruits().end());
|
||||
}
|
||||
// Insert set in enemy_units.
|
||||
BOOST_FOREACH(const std::string& possible_recruit, possible_recruits) {
|
||||
for (const std::string& possible_recruit : possible_recruits) {
|
||||
const unit_type* recruit_type = unit_types.find(possible_recruit);
|
||||
if (recruit_type) {
|
||||
int hp = recruit_type->hitpoints();
|
||||
|
@ -957,17 +956,17 @@ void recruitment::do_combat_analysis(std::vector<data>* leader_data) {
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(data& leader, *leader_data) {
|
||||
for (data& leader : *leader_data) {
|
||||
if (leader.recruits.empty()) {
|
||||
continue;
|
||||
}
|
||||
typedef std::map<std::string, double> simple_score_map;
|
||||
simple_score_map temp_scores;
|
||||
|
||||
BOOST_FOREACH(const unit_hp_vector::value_type& entry, enemy_units) {
|
||||
for (const unit_hp_vector::value_type& entry : enemy_units) {
|
||||
const std::string& enemy_unit = entry.first;
|
||||
int enemy_unit_hp = entry.second;
|
||||
BOOST_FOREACH(const std::string& recruit, leader.recruits) {
|
||||
for (const std::string& recruit : leader.recruits) {
|
||||
double score = compare_unit_types(recruit, enemy_unit);
|
||||
score *= enemy_unit_hp;
|
||||
score = pow(score, COMBAT_SCORE_POWER);
|
||||
|
@ -981,7 +980,7 @@ void recruitment::do_combat_analysis(std::vector<data>* leader_data) {
|
|||
// Find things for normalization.
|
||||
double max = -99999.;
|
||||
double sum = 0;
|
||||
BOOST_FOREACH(const simple_score_map::value_type& entry, temp_scores) {
|
||||
for (const simple_score_map::value_type& entry : temp_scores) {
|
||||
double score = entry.second;
|
||||
if (score > max) {
|
||||
max = score;
|
||||
|
@ -1005,7 +1004,7 @@ void recruitment::do_combat_analysis(std::vector<data>* leader_data) {
|
|||
new_0 -= 0.000001;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const simple_score_map::value_type& entry, temp_scores) {
|
||||
for (const simple_score_map::value_type& entry : temp_scores) {
|
||||
const std::string& recruit = entry.first;
|
||||
double score = entry.second;
|
||||
|
||||
|
@ -1031,7 +1030,7 @@ const double* recruitment::get_cached_combat_value(const std::string& a, const s
|
|||
double best_distance = 999;
|
||||
const double* best_value = nullptr;
|
||||
const std::set<cached_combat_value>& cache = combat_cache_[a][b];
|
||||
BOOST_FOREACH(const cached_combat_value& entry, cache) {
|
||||
for (const cached_combat_value& entry : cache) {
|
||||
double distance_a = std::abs(entry.a_defense - a_defense);
|
||||
double distance_b = std::abs(entry.b_defense - b_defense);
|
||||
if (distance_a <= COMBAT_CACHE_TOLERANCY && distance_b <= COMBAT_CACHE_TOLERANCY) {
|
||||
|
@ -1126,10 +1125,10 @@ void recruitment::simulate_attack(
|
|||
boost::shared_ptr<attack_simulation> best_att_attack;
|
||||
|
||||
// Let attacker choose weapon
|
||||
BOOST_FOREACH(const attack_type& att_weapon, attacker_weapons) {
|
||||
for (const attack_type& att_weapon : attacker_weapons) {
|
||||
boost::shared_ptr<attack_simulation> best_def_response;
|
||||
// Let defender choose weapon
|
||||
BOOST_FOREACH(const attack_type& def_weapon, defender_weapons) {
|
||||
for (const attack_type& def_weapon : defender_weapons) {
|
||||
if (att_weapon.range() != def_weapon.range()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1170,7 +1169,7 @@ config* recruitment::get_most_important_job() {
|
|||
config* most_important_job = nullptr;
|
||||
int most_important_importance = -1;
|
||||
int biggest_number = -1;
|
||||
BOOST_FOREACH(config& job, recruitment_instructions_.child_range("recruit")) {
|
||||
for (config& job : recruitment_instructions_.child_range("recruit")) {
|
||||
if (job.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1181,7 +1180,7 @@ config* recruitment::get_most_important_job() {
|
|||
// If the total flag is set we have to subtract
|
||||
// all existing units which matches the type.
|
||||
update_own_units_count();
|
||||
BOOST_FOREACH(const count_map::value_type& entry, own_units_count_) {
|
||||
for (const count_map::value_type& entry : own_units_count_) {
|
||||
const std::string& unit_type = entry.first;
|
||||
const int count = entry.second;
|
||||
if (recruit_matches_job(unit_type, &job)) {
|
||||
|
@ -1228,7 +1227,7 @@ const std::string recruitment::get_random_pattern_type_if_exists(const data& lea
|
|||
// Iteration through all elements.
|
||||
while (job_types_it != job_types.end()) {
|
||||
bool type_ok = false;
|
||||
BOOST_FOREACH(const std::string& recruit, leader_data.recruits) {
|
||||
for (const std::string& recruit : leader_data.recruits) {
|
||||
if (recruit_matches_type(recruit, *job_types_it) && limit_ok(recruit)) {
|
||||
type_ok = true;
|
||||
break;
|
||||
|
@ -1288,7 +1287,7 @@ bool recruitment::leader_matches_job(const data& leader_data, const config* job)
|
|||
// First we make sure that this leader can recruit
|
||||
// at least one unit-type specified in the job.
|
||||
bool is_ok = false;
|
||||
BOOST_FOREACH(const std::string& recruit, leader_data.recruits) {
|
||||
for (const std::string& recruit : leader_data.recruits) {
|
||||
if (recruit_matches_job(recruit, job) && limit_ok(recruit)) {
|
||||
is_ok = true;
|
||||
break;
|
||||
|
@ -1315,13 +1314,13 @@ bool recruitment::limit_ok(const std::string& recruit) const {
|
|||
// retrieve the aspect again. So the [limit]s can be altered during a turn.
|
||||
const config aspect = get_recruitment_instructions();
|
||||
|
||||
BOOST_FOREACH(const config& limit, aspect.child_range("limit")) {
|
||||
for (const config& limit : aspect.child_range("limit")) {
|
||||
std::vector<std::string> types = utils::split(limit["type"]);
|
||||
// First check if the recruit matches one of the types.
|
||||
if (recruit_matches_types(recruit, types)) {
|
||||
// Count all own existing units which matches the type.
|
||||
int count = 0;
|
||||
BOOST_FOREACH(const count_map::value_type& entry, own_units_count_) {
|
||||
for (const count_map::value_type& entry : own_units_count_) {
|
||||
const std::string& unit = entry.first;
|
||||
int number = entry.second;
|
||||
if (recruit_matches_types(unit, types)) {
|
||||
|
@ -1383,7 +1382,7 @@ bool recruitment::recruit_matches_types(const std::string& recruit,
|
|||
if (types.empty()) {
|
||||
return true;
|
||||
}
|
||||
BOOST_FOREACH(const std::string& type, types) {
|
||||
for (const std::string& type : types) {
|
||||
if (recruit_matches_type(recruit, type)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -1444,7 +1443,7 @@ double recruitment::get_estimated_unit_gain() const {
|
|||
double recruitment::get_estimated_village_gain() const {
|
||||
const gamemap& map = resources::gameboard->map();
|
||||
int neutral_villages = 0;
|
||||
BOOST_FOREACH(const map_location& village, map.villages()) {
|
||||
for (const map_location& village : map.villages()) {
|
||||
if (resources::gameboard->village_owner(village) == -1) {
|
||||
++neutral_villages;
|
||||
}
|
||||
|
@ -1461,7 +1460,7 @@ double recruitment::get_unit_ratio() const {
|
|||
double own_total_value = 0.;
|
||||
double team_total_value = 0.;
|
||||
double enemy_total_value = 0.;
|
||||
BOOST_FOREACH(const unit& unit, units) {
|
||||
for (const unit& unit : units) {
|
||||
if (unit.incapacitated() || unit.total_movement() <= 0 || unit.can_recruit()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1476,7 +1475,7 @@ double recruitment::get_unit_ratio() const {
|
|||
}
|
||||
}
|
||||
int allies_count = 0;
|
||||
BOOST_FOREACH(const team& team, *resources::teams) {
|
||||
for (const team& team : *resources::teams) {
|
||||
if (!current_team().is_enemy(team.side())) {
|
||||
++allies_count;
|
||||
}
|
||||
|
@ -1542,8 +1541,8 @@ void recruitment::do_randomness(std::vector<data>* leader_data) const {
|
|||
if (!leader_data) {
|
||||
return;
|
||||
}
|
||||
BOOST_FOREACH(data& data, *leader_data) {
|
||||
BOOST_FOREACH(score_map::value_type& entry, data.scores) {
|
||||
for (data& data : *leader_data) {
|
||||
for (score_map::value_type& entry : data.scores) {
|
||||
double& score = entry.second;
|
||||
score += (static_cast<double>(rand()) / RAND_MAX) * get_recruitment_randomness();
|
||||
}
|
||||
|
@ -1562,7 +1561,7 @@ void recruitment::do_similarity_penalty(std::vector<data>* leader_data) const {
|
|||
if (!leader_data) {
|
||||
return;
|
||||
}
|
||||
BOOST_FOREACH(data& data, *leader_data) {
|
||||
for (data& data : *leader_data) {
|
||||
// First we count how many similarities each recruit have to other ones (in a map).
|
||||
// Some examples:
|
||||
// If unit A and unit B have nothing to do with each other, they have similarity = 0.
|
||||
|
@ -1571,13 +1570,13 @@ void recruitment::do_similarity_penalty(std::vector<data>* leader_data) const {
|
|||
// If A advances to B or C, A have similarity = 2. B and C have similarity = 1.
|
||||
typedef std::map<std::string, int> similarity_map;
|
||||
similarity_map similarities;
|
||||
BOOST_FOREACH(const score_map::value_type& entry, data.scores) {
|
||||
for (const score_map::value_type& entry : data.scores) {
|
||||
const std::string& recruit = entry.first;
|
||||
const unit_type* recruit_type = unit_types.find(recruit);
|
||||
if (!recruit_type) {
|
||||
continue;
|
||||
}
|
||||
BOOST_FOREACH(const std::string& advanced_type, recruit_type->advancement_tree()){
|
||||
for (const std::string& advanced_type : recruit_type->advancement_tree()) {
|
||||
if (data.scores.count(advanced_type) != 0) {
|
||||
++similarities[recruit];
|
||||
++similarities[advanced_type];
|
||||
|
@ -1585,7 +1584,7 @@ void recruitment::do_similarity_penalty(std::vector<data>* leader_data) const {
|
|||
}
|
||||
}
|
||||
// Now we divide each score by similarity + 1.
|
||||
BOOST_FOREACH(score_map::value_type& entry, data.scores) {
|
||||
for (score_map::value_type& entry : data.scores) {
|
||||
const std::string& recruit = entry.first;
|
||||
double& score = entry.second;
|
||||
score /= (similarities[recruit] + 1);
|
||||
|
@ -1605,7 +1604,7 @@ int recruitment::get_cheapest_unit_cost_for_leader(const unit_map::const_iterato
|
|||
int cheapest_cost = 999999;
|
||||
|
||||
// team recruits
|
||||
BOOST_FOREACH(const std::string& recruit, current_team().recruits()) {
|
||||
for (const std::string& recruit : current_team().recruits()) {
|
||||
const unit_type* const info = unit_types.find(recruit);
|
||||
if (!info) {
|
||||
continue;
|
||||
|
@ -1615,7 +1614,7 @@ int recruitment::get_cheapest_unit_cost_for_leader(const unit_map::const_iterato
|
|||
}
|
||||
}
|
||||
// extra recruits
|
||||
BOOST_FOREACH(const std::string& recruit, leader->recruits()) {
|
||||
for (const std::string& recruit : leader->recruits()) {
|
||||
const unit_type* const info = unit_types.find(recruit);
|
||||
if (!info) {
|
||||
continue;
|
||||
|
@ -1641,9 +1640,9 @@ void recruitment::handle_recruitment_more(std::vector<data>* leader_data) const
|
|||
return;
|
||||
}
|
||||
const std::vector<std::string> aspect = get_recruitment_more();
|
||||
BOOST_FOREACH(const std::string& type, aspect) {
|
||||
BOOST_FOREACH(data& data, *leader_data) {
|
||||
BOOST_FOREACH(score_map::value_type& entry, data.scores) {
|
||||
for (const std::string& type : aspect) {
|
||||
for (data& data : *leader_data) {
|
||||
for (score_map::value_type& entry : data.scores) {
|
||||
const std::string& recruit = entry.first;
|
||||
double& score = entry.second;
|
||||
if (recruit_matches_type(recruit, type)) {
|
||||
|
@ -1665,7 +1664,7 @@ bool recruitment::is_enemy_in_radius(const map_location& loc, int radius) const
|
|||
if (surrounding.empty()) {
|
||||
return false;
|
||||
}
|
||||
BOOST_FOREACH(const map_location& loc, surrounding) {
|
||||
for (const map_location& loc : surrounding) {
|
||||
const unit_map::const_iterator& enemy_it = units.find(loc);
|
||||
if(enemy_it == units.end()) {
|
||||
continue;
|
||||
|
@ -1687,7 +1686,7 @@ void recruitment::update_own_units_count() {
|
|||
own_units_count_.clear();
|
||||
total_own_units_ = 0;
|
||||
const unit_map& units = *resources::units;
|
||||
BOOST_FOREACH(const unit& unit, units) {
|
||||
for (const unit& unit : units) {
|
||||
if (unit.side() != get_side() || unit.can_recruit() ||
|
||||
unit.incapacitated() || unit.total_movement() <= 0) {
|
||||
continue;
|
||||
|
@ -1709,7 +1708,7 @@ void recruitment::update_scouts_wanted() {
|
|||
int neutral_villages = 0;
|
||||
// We recruit the initial allocation of scouts
|
||||
// based on how many neutral villages there are.
|
||||
BOOST_FOREACH(const map_location& village, resources::gameboard->map().villages()) {
|
||||
for (const map_location& village : resources::gameboard->map().villages()) {
|
||||
if (resources::gameboard->village_owner(village) == -1) {
|
||||
++neutral_villages;
|
||||
}
|
||||
|
@ -1729,7 +1728,7 @@ void recruitment::update_scouts_wanted() {
|
|||
}
|
||||
|
||||
// Subtract already recruited scouts.
|
||||
BOOST_FOREACH(const count_map::value_type& entry, own_units_count_) {
|
||||
for (const count_map::value_type& entry : own_units_count_) {
|
||||
const std::string& unit_type = entry.first;
|
||||
const int count = entry.second;
|
||||
if (recruit_matches_type(unit_type, "scout")) {
|
||||
|
@ -1783,12 +1782,12 @@ recruitment_aspect::recruitment_aspect(readonly_context &context, const config &
|
|||
{
|
||||
config parsed_cfg(cfg.has_child("value") ? cfg.child("value") : cfg);
|
||||
// First, transform simplified tags into [recruit] tags.
|
||||
BOOST_FOREACH (config pattern, parsed_cfg.child_range("pattern")) {
|
||||
for (config pattern : parsed_cfg.child_range("pattern")) {
|
||||
parsed_cfg["pattern"] = true;
|
||||
parsed_cfg.add_child("recruit", pattern);
|
||||
}
|
||||
parsed_cfg.clear_children("pattern");
|
||||
BOOST_FOREACH (config total, parsed_cfg.child_range("total")) {
|
||||
for (config total : parsed_cfg.child_range("total")) {
|
||||
parsed_cfg["total"] = true;
|
||||
parsed_cfg.add_child("recruit", total);
|
||||
}
|
||||
|
@ -1798,10 +1797,10 @@ recruitment_aspect::recruitment_aspect(readonly_context &context, const config &
|
|||
parsed_cfg.add_child("recruit", config_of("importance", 0));
|
||||
}
|
||||
// Finally, populate our lists
|
||||
BOOST_FOREACH (config job, parsed_cfg.child_range("recruit")) {
|
||||
for (config job : parsed_cfg.child_range("recruit")) {
|
||||
create_job(jobs_, job);
|
||||
}
|
||||
BOOST_FOREACH (config lim, parsed_cfg.child_range("limit")) {
|
||||
for (config lim : parsed_cfg.child_range("limit")) {
|
||||
create_limit(limits_, lim);
|
||||
}
|
||||
boost::function2<void, std::vector<boost::shared_ptr<recruit_job> >&, const config&> factory_jobs =
|
||||
|
@ -1814,10 +1813,10 @@ recruitment_aspect::recruitment_aspect(readonly_context &context, const config &
|
|||
|
||||
void recruitment_aspect::recalculate() const {
|
||||
config cfg;
|
||||
BOOST_FOREACH (const boost::shared_ptr<recruit_job>& job, jobs_) {
|
||||
for (const boost::shared_ptr<recruit_job>& job : jobs_) {
|
||||
cfg.add_child("recruit", job->to_config());
|
||||
}
|
||||
BOOST_FOREACH (const boost::shared_ptr<recruit_limit>& lim, limits_) {
|
||||
for (const boost::shared_ptr<recruit_limit>& lim : limits_) {
|
||||
cfg.add_child("limit", lim->to_config());
|
||||
}
|
||||
*this->value_ = cfg;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "units/unit.hpp"
|
||||
#include "units/map.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <iomanip>
|
||||
|
||||
|
@ -71,7 +70,7 @@ struct data {
|
|||
: leader(leader), ratio_score(1.0), recruit_count(0), in_danger(false) { }
|
||||
double get_score_sum() const {
|
||||
double sum = 0.0;
|
||||
BOOST_FOREACH(const score_map::value_type& entry, scores) {
|
||||
for (const score_map::value_type& entry : scores) {
|
||||
sum += entry.second;
|
||||
}
|
||||
return sum;
|
||||
|
@ -82,7 +81,7 @@ struct data {
|
|||
return scores;
|
||||
}
|
||||
score_map normalized;
|
||||
BOOST_FOREACH(const score_map::value_type& entry, scores) {
|
||||
for (const score_map::value_type& entry : scores) {
|
||||
normalized[entry.first] = entry.second / sum;
|
||||
}
|
||||
return normalized;
|
||||
|
@ -93,7 +92,7 @@ struct data {
|
|||
s << "For leader: " << leader->name() << "\n";
|
||||
s << "ratio_score: " << ratio_score << "\n";
|
||||
s << "recruit_count: " << recruit_count << "\n\n";
|
||||
BOOST_FOREACH(const score_map::value_type& entry, scores) {
|
||||
for (const score_map::value_type& entry : scores) {
|
||||
s << std::setw(20) << entry.first <<
|
||||
" score: " << std::setw(7) << entry.second << "\n";
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "log.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace ai {
|
||||
|
||||
|
@ -49,7 +48,7 @@ candidate_action_evaluation_loop::candidate_action_evaluation_loop( ai_context &
|
|||
void candidate_action_evaluation_loop::on_create()
|
||||
{
|
||||
//init the candidate actions
|
||||
BOOST_FOREACH(const config &cfg_element, cfg_.child_range("candidate_action")){
|
||||
for (const config &cfg_element : cfg_.child_range("candidate_action")) {
|
||||
engine::parse_candidate_action_from_config(*this,cfg_element,back_inserter(candidate_actions_));
|
||||
}
|
||||
|
||||
|
@ -69,7 +68,7 @@ void candidate_action_evaluation_loop::create_candidate_action(std::vector<candi
|
|||
config candidate_action_evaluation_loop::to_config() const
|
||||
{
|
||||
config cfg = stage::to_config();
|
||||
BOOST_FOREACH(candidate_action_ptr ca, candidate_actions_){
|
||||
for (candidate_action_ptr ca : candidate_actions_) {
|
||||
cfg.add_child("candidate_action",ca->to_config());
|
||||
}
|
||||
return cfg;
|
||||
|
@ -88,7 +87,7 @@ bool candidate_action_evaluation_loop::do_play_stage()
|
|||
{
|
||||
LOG_AI_TESTING_RCA_DEFAULT << "Starting candidate action evaluation loop for side "<< get_side() << std::endl;
|
||||
|
||||
BOOST_FOREACH(candidate_action_ptr ca, candidate_actions_){
|
||||
for (candidate_action_ptr ca : candidate_actions_) {
|
||||
ca->enable();
|
||||
}
|
||||
|
||||
|
@ -103,7 +102,7 @@ bool candidate_action_evaluation_loop::do_play_stage()
|
|||
candidate_action_ptr best_ptr;
|
||||
|
||||
//Evaluation
|
||||
BOOST_FOREACH(candidate_action_ptr ca_ptr, candidate_actions_){
|
||||
for (candidate_action_ptr ca_ptr : candidate_actions_) {
|
||||
if (!ca_ptr->is_enabled()){
|
||||
DBG_AI_TESTING_RCA_DEFAULT << "Skipping disabled candidate action: "<< *ca_ptr << std::endl;
|
||||
continue;
|
||||
|
|
|
@ -54,8 +54,6 @@
|
|||
#include "ai/game_info.hpp" // for move_result_ptr, move_map, etc
|
||||
#include "candidates.hpp" // for base_candidate_action, etc
|
||||
|
||||
|
||||
#include <boost/foreach.hpp> // for auto_any_base, etc
|
||||
#include <boost/intrusive_ptr.hpp> // for intrusive_ptr
|
||||
#include <boost/lexical_cast.hpp> // for lexical_cast
|
||||
#include <boost/shared_ptr.hpp> // for shared_ptr
|
||||
|
@ -571,7 +569,7 @@ template<typename Container>
|
|||
variant villages_from_set(const Container& villages,
|
||||
const std::set<map_location>* exclude=nullptr) {
|
||||
std::vector<variant> vars;
|
||||
BOOST_FOREACH(const map_location& loc, villages) {
|
||||
for(const map_location& loc : villages) {
|
||||
if(exclude && exclude->count(loc)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -632,7 +630,7 @@ variant formula_ai::get_value(const std::string& key) const
|
|||
{
|
||||
const std::vector<std::string> &rp = get_recruitment_pattern();
|
||||
std::vector<variant> vars;
|
||||
BOOST_FOREACH(const std::string &i, rp) {
|
||||
for(const std::string &i : rp) {
|
||||
vars.push_back(variant(i));
|
||||
}
|
||||
return variant(&vars);
|
||||
|
@ -766,7 +764,7 @@ variant formula_ai::get_value(const std::string& key) const
|
|||
std::vector<variant> v;
|
||||
tmp.push_back( v );
|
||||
}
|
||||
BOOST_FOREACH(const unit &u, units) {
|
||||
for(const unit &u : units) {
|
||||
tmp[u.side() - 1].push_back(variant(new unit_callable(u)));
|
||||
}
|
||||
for( size_t i = 0; i<tmp.size(); ++i)
|
||||
|
@ -939,7 +937,7 @@ void formula_ai::on_create(){
|
|||
//make sure we don't run out of refcount
|
||||
vars_.add_ref();
|
||||
|
||||
BOOST_FOREACH(const config &func, cfg_.child_range("function"))
|
||||
for(const config &func : cfg_.child_range("function"))
|
||||
{
|
||||
const t_string &name = func["name"];
|
||||
const t_string &inputs = func["inputs"];
|
||||
|
@ -962,7 +960,7 @@ void formula_ai::on_create(){
|
|||
if (const config &ai_vars = cfg_.child("vars"))
|
||||
{
|
||||
variant var;
|
||||
BOOST_FOREACH(const config::attribute &i, ai_vars.attribute_range()) {
|
||||
for(const config::attribute &i : ai_vars.attribute_range()) {
|
||||
var.serialize_from_string(i.second);
|
||||
vars_.add(i.first, var);
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "log.hpp"
|
||||
#include "resources.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_formula_ai("ai/engine/fai");
|
||||
#define ERR_AI LOG_STREAM(err, log_formula_ai)
|
||||
|
||||
|
@ -66,7 +64,7 @@ candidate_action_with_filters::candidate_action_with_filters(
|
|||
const config & filter_params = cfg.child("filter");
|
||||
|
||||
if( filter_params ) {
|
||||
BOOST_FOREACH( const config::attribute filter_param, filter_params.attribute_range() )
|
||||
for(const config::attribute filter_param : filter_params.attribute_range())
|
||||
{
|
||||
game_logic::const_formula_ptr filter_formula(
|
||||
new game_logic::formula(filter_param.second, function_table));
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
#include "units/unit.hpp"
|
||||
#include "pathfind/pathfind.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_formula_ai("ai/engine/fai");
|
||||
#define LOG_AI LOG_STREAM(info, log_formula_ai)
|
||||
#define WRN_AI LOG_STREAM(warn, log_formula_ai)
|
||||
|
@ -343,7 +341,7 @@ private:
|
|||
if( scores[current_side][i] > 98 )
|
||||
continue;
|
||||
|
||||
BOOST_FOREACH( int side , enemies) {
|
||||
for (int side : enemies) {
|
||||
int diff = scores[current_side][i] - scores[side][i];
|
||||
if ( diff > enemy_tollerancy) {
|
||||
valid = false;
|
||||
|
@ -353,7 +351,7 @@ private:
|
|||
}
|
||||
|
||||
if( valid ) {
|
||||
BOOST_FOREACH( int side , allies) {
|
||||
for (int side : allies) {
|
||||
if ( scores[current_side][i] - scores[side][i] > ally_tollerancy ) {
|
||||
valid = false;
|
||||
break;
|
||||
|
@ -549,7 +547,7 @@ private:
|
|||
visited_locs.erase(starting_loc);
|
||||
|
||||
std::vector<variant> res;
|
||||
BOOST_FOREACH( const map_location& ml, visited_locs) {
|
||||
for (const map_location& ml : visited_locs) {
|
||||
res.push_back( variant(new location_callable( ml ) ) );
|
||||
}
|
||||
|
||||
|
@ -825,7 +823,7 @@ private:
|
|||
ai::attack_analysis* analysis = convert_variant<ai::attack_analysis>(attack);
|
||||
//unit_map units_with_moves(*resources::units);
|
||||
//typedef std::pair<map_location, map_location> mv;
|
||||
//BOOST_FOREACH(const mv &m, analysis->movements) {
|
||||
//for(const mv &m : analysis->movements) {
|
||||
// units_with_moves.move(m.first, m.second);
|
||||
//}
|
||||
|
||||
|
@ -1602,7 +1600,7 @@ private:
|
|||
|
||||
std::vector<attack_type> attacks = attacker.attacks();
|
||||
|
||||
BOOST_FOREACH(const attack_type &attack, attacks) {
|
||||
for (const attack_type &attack : attacks) {
|
||||
const int dmg = round_damage(attack.damage(), defender.damage_from(attack), 100) * attack.num_attacks();
|
||||
if (attack.range() == "melee") {
|
||||
highest_melee_damage = std::max(highest_melee_damage, dmg);
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
|
||||
|
||||
#include <algorithm> // for min
|
||||
#include <boost/foreach.hpp> // for auto_any_base, etc
|
||||
#include <cassert> // for assert
|
||||
#include <iterator> // for reverse_iterator, etc
|
||||
#include <map> // for _Rb_tree_iterator, etc
|
||||
|
@ -107,7 +106,7 @@ void holder::init( side_number side )
|
|||
|
||||
if (this->ai_) {
|
||||
ai_->on_create();
|
||||
BOOST_FOREACH(config &mod_ai, cfg_.child_range("modify_ai")) {
|
||||
for (config &mod_ai : cfg_.child_range("modify_ai")) {
|
||||
if (!mod_ai.has_attribute("side")) {
|
||||
mod_ai["side"] = side;
|
||||
}
|
||||
|
@ -169,8 +168,8 @@ void holder::modify_side_ai_config(config cfg)
|
|||
cfg_.merge_children_by_attribute("aspect","id");
|
||||
} else {
|
||||
// else run 'add_facet' command on each [aspect][facet]
|
||||
BOOST_FOREACH(const config &cfg_a, cfg.child_range("aspect")) {
|
||||
BOOST_FOREACH(const config &cfg_f, cfg_a.child_range("facet")) {
|
||||
for (const config &cfg_a : cfg.child_range("aspect")) {
|
||||
for (const config &cfg_f : cfg_a.child_range("facet")) {
|
||||
readonly_context_->add_facet(cfg_a["id"],cfg_f);
|
||||
}
|
||||
}
|
||||
|
@ -714,7 +713,7 @@ void manager::clear_ais()
|
|||
|
||||
void manager::modify_active_ai_config_old_for_side ( side_number side, const config::const_child_itors &ai_parameters )
|
||||
{
|
||||
BOOST_FOREACH(const config& cfg, ai_parameters) {
|
||||
for (const config& cfg : ai_parameters) {
|
||||
get_active_ai_holder_for_side(side).modify_side_ai_config(cfg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include "log.hpp"
|
||||
#include "resources.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_arrows("arrows");
|
||||
#define ERR_ARR LOG_STREAM(err, log_arrows)
|
||||
#define WRN_ARR LOG_STREAM(warn, log_arrows)
|
||||
|
@ -289,7 +287,7 @@ void arrow::invalidate_arrow_path(arrow_path_t const& path)
|
|||
{
|
||||
if(!SCREEN) return;
|
||||
|
||||
BOOST_FOREACH(map_location const& loc, path)
|
||||
for (map_location const& loc : path)
|
||||
{
|
||||
SCREEN->invalidate(loc);
|
||||
}
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "log.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_network("network");
|
||||
#define LOG_CS if (lg::err().dont_log(log_network)) ; else lg::err()(log_network, false)
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#include "serialization/string_utils.hpp"
|
||||
#include "serialization/unicode.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_campaignd_bl("campaignd/blacklist");
|
||||
#define LOG_BL LOG_STREAM(err, log_campaignd_bl)
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include <csignal>
|
||||
#include <ctime>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/iostreams/filter/gzip.hpp>
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/random.hpp>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "config.hpp"
|
||||
#include "team.hpp"
|
||||
#include "units/unit.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <cassert>
|
||||
|
||||
carryover::carryover(const config& side)
|
||||
|
@ -32,7 +31,7 @@ carryover::carryover(const config& side)
|
|||
, save_id_(side["save_id"])
|
||||
, variables_(side.child_or_empty("variables"))
|
||||
{
|
||||
BOOST_FOREACH(const config& u, side.child_range("unit")){
|
||||
for(const config& u : side.child_range("unit")) {
|
||||
recall_list_.push_back(u);
|
||||
config& u_back = recall_list_.back();
|
||||
u_back.remove_attribute("side");
|
||||
|
@ -52,7 +51,7 @@ carryover::carryover(const team& t, const int gold, const bool add)
|
|||
, save_id_(t.save_id())
|
||||
, variables_(t.variables())
|
||||
{
|
||||
BOOST_FOREACH(const unit_const_ptr & u, t.recall_list()) {
|
||||
for(const unit_const_ptr & u : t.recall_list()) {
|
||||
recall_list_.push_back(config());
|
||||
u->write(recall_list_.back());
|
||||
}
|
||||
|
@ -87,7 +86,7 @@ void carryover::transfer_all_recruits_to(config& side_cfg){
|
|||
}
|
||||
|
||||
void carryover::transfer_all_recalls_to(config& side_cfg){
|
||||
BOOST_FOREACH(const config & u_cfg, recall_list_) {
|
||||
for(const config & u_cfg : recall_list_) {
|
||||
side_cfg.add_child("unit", u_cfg);
|
||||
}
|
||||
recall_list_.clear();
|
||||
|
@ -106,7 +105,7 @@ std::string carryover::get_recruits(bool erase){
|
|||
const std::string carryover::to_string(){
|
||||
std::string side = "";
|
||||
side.append("Side " + save_id_ + ": gold " + std::to_string(gold_) + " recruits " + get_recruits(false) + " units ");
|
||||
BOOST_FOREACH(const config & u_cfg, recall_list_) {
|
||||
for(const config & u_cfg : recall_list_) {
|
||||
side.append(u_cfg["name"].str() + ", ");
|
||||
}
|
||||
return side;
|
||||
|
@ -119,8 +118,9 @@ void carryover::to_config(config& cfg){
|
|||
side["add"] = add_;
|
||||
side["current_player"] = current_player_;
|
||||
side["previous_recruits"] = get_recruits(false);
|
||||
BOOST_FOREACH(const config & u_cfg, recall_list_)
|
||||
for(const config & u_cfg : recall_list_) {
|
||||
side.add_child("unit", u_cfg);
|
||||
}
|
||||
}
|
||||
|
||||
carryover_info::carryover_info(const config& cfg, bool from_snpashot)
|
||||
|
@ -131,7 +131,7 @@ carryover_info::carryover_info(const config& cfg, bool from_snpashot)
|
|||
, next_scenario_(cfg["next_scenario"])
|
||||
, next_underlying_unit_id_(cfg["next_underlying_unit_id"].to_int(0))
|
||||
{
|
||||
BOOST_FOREACH(const config& side, cfg.child_range("side"))
|
||||
for(const config& side : cfg.child_range("side"))
|
||||
{
|
||||
if(side["lost"].to_bool(false) || !side["persistent"].to_bool(true))
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ carryover_info::carryover_info(const config& cfg, bool from_snpashot)
|
|||
}
|
||||
this->carryover_sides_.push_back(carryover(side));
|
||||
}
|
||||
BOOST_FOREACH(const config& item, cfg.child_range("menu_item"))
|
||||
for(const config& item : cfg.child_range("menu_item"))
|
||||
{
|
||||
wml_menu_items_.push_back(new config(item));
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ void carryover_info::transfer_to(config& level)
|
|||
}
|
||||
|
||||
if(!level.has_child("menu_item")){
|
||||
BOOST_FOREACH(config& item , wml_menu_items_)
|
||||
for(config& item : wml_menu_items_)
|
||||
{
|
||||
level.add_child("menu_item").swap(item);
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ const config carryover_info::to_config()
|
|||
cfg["next_underlying_unit_id"] = next_underlying_unit_id_;
|
||||
cfg["next_scenario"] = next_scenario_;
|
||||
|
||||
BOOST_FOREACH(carryover& c, carryover_sides_){
|
||||
for(carryover& c : carryover_sides_) {
|
||||
c.to_config(cfg);
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ const config carryover_info::to_config()
|
|||
cfg["random_calls"] = rng_.get_random_calls();
|
||||
|
||||
cfg.add_child("variables", variables_);
|
||||
BOOST_FOREACH(const config& item , wml_menu_items_)
|
||||
for(const config& item : wml_menu_items_)
|
||||
{
|
||||
cfg.add_child("menu_item", item);
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ const config carryover_info::to_config()
|
|||
}
|
||||
|
||||
carryover* carryover_info::get_side(std::string save_id){
|
||||
BOOST_FOREACH(carryover& side, carryover_sides_){
|
||||
for(carryover& side : carryover_sides_) {
|
||||
if(side.get_save_id() == save_id){
|
||||
return &side;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ carryover* carryover_info::get_side(std::string save_id){
|
|||
|
||||
void carryover_info::merge_old_carryover(const carryover_info& old_carryover)
|
||||
{
|
||||
BOOST_FOREACH(const carryover & old_side, old_carryover.carryover_sides_)
|
||||
for(const carryover & old_side : old_carryover.carryover_sides_)
|
||||
{
|
||||
std::vector<carryover>::iterator iside = std::find_if(
|
||||
carryover_sides_.begin(),
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "util.hpp" // for lexical_cast
|
||||
|
||||
#include <boost/any.hpp> // for any
|
||||
#include <boost/foreach.hpp> // for auto_any_base, etc
|
||||
#include <boost/program_options/cmdline.hpp>
|
||||
#include <boost/program_options/errors.hpp> // for validation_error, etc
|
||||
#include <boost/program_options/parsers.hpp>
|
||||
|
@ -497,7 +496,7 @@ commandline_options::commandline_options (const std::vector<std::string>& args)
|
|||
void commandline_options::parse_log_domains_(const std::string &domains_string, const int severity)
|
||||
{
|
||||
const std::vector<std::string> domains = utils::split(domains_string, ',');
|
||||
BOOST_FOREACH(const std::string& domain, domains)
|
||||
for (const std::string& domain : domains)
|
||||
{
|
||||
if (!log)
|
||||
log = std::vector<boost::tuple<int, std::string> >();
|
||||
|
@ -507,7 +506,7 @@ void commandline_options::parse_log_domains_(const std::string &domains_string,
|
|||
|
||||
void commandline_options::parse_log_strictness (const std::string & severity ) {
|
||||
static lg::logger const *loggers[] = { &lg::err(), &lg::warn(), &lg::info(), &lg::debug() };
|
||||
BOOST_FOREACH (const lg::logger * l, loggers ) {
|
||||
for (const lg::logger * l : loggers ) {
|
||||
if (severity == l->get_name()) {
|
||||
lg::set_strict_severity(*l);
|
||||
return ;
|
||||
|
@ -543,7 +542,7 @@ std::vector<boost::tuple<unsigned int,std::string> > commandline_options::parse_
|
|||
const std::string& expected_format
|
||||
= std::string() + "UINT" + separator + "STRING";
|
||||
|
||||
BOOST_FOREACH(const std::string &s, strings)
|
||||
for (const std::string &s : strings)
|
||||
{
|
||||
const std::vector<std::string> tokens = utils::split(s, separator);
|
||||
if(tokens.size() != 2) {
|
||||
|
@ -571,7 +570,7 @@ std::vector<boost::tuple<unsigned int,std::string,std::string> > commandline_opt
|
|||
const std::string& expected_format
|
||||
= std::string() + "UINT" + separator + "STRING" + separator + "STRING";
|
||||
|
||||
BOOST_FOREACH(const std::string &s, strings)
|
||||
for (const std::string &s : strings)
|
||||
{
|
||||
const std::vector<std::string> tokens = utils::split(s, separator);
|
||||
if(tokens.size() != 3) {
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <istream>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/variant/apply_visitor.hpp>
|
||||
#include <boost/variant/get.hpp>
|
||||
#include <boost/variant/static_visitor.hpp>
|
||||
|
@ -501,7 +500,7 @@ bool config::valid_id(const std::string& id)
|
|||
if (id.empty()) {
|
||||
return false;
|
||||
}
|
||||
BOOST_FOREACH(char c, id) {
|
||||
for (char c : id) {
|
||||
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_') {
|
||||
//valid character.
|
||||
}
|
||||
|
@ -542,7 +541,7 @@ void config::append_children(const config &cfg)
|
|||
{
|
||||
check_valid(cfg);
|
||||
|
||||
BOOST_FOREACH(const any_child &value, cfg.all_children_range()) {
|
||||
for (const any_child &value : cfg.all_children_range()) {
|
||||
add_child(value.key, value.cfg);
|
||||
}
|
||||
}
|
||||
|
@ -550,7 +549,7 @@ void config::append_children(const config &cfg)
|
|||
void config::append_attributes(const config &cfg)
|
||||
{
|
||||
check_valid(cfg);
|
||||
BOOST_FOREACH(const attribute &v, cfg.values) {
|
||||
for (const attribute &v : cfg.values) {
|
||||
values[v.first] = v.second;
|
||||
}
|
||||
}
|
||||
|
@ -559,7 +558,7 @@ void config::append_children(const config &cfg, const std::string& key)
|
|||
{
|
||||
check_valid(cfg);
|
||||
|
||||
BOOST_FOREACH(const config &value, cfg.child_range(key)) {
|
||||
for (const config &value : cfg.child_range(key)) {
|
||||
add_child(key, value);
|
||||
}
|
||||
}
|
||||
|
@ -567,7 +566,7 @@ void config::append_children(const config &cfg, const std::string& key)
|
|||
void config::append(const config &cfg)
|
||||
{
|
||||
append_children(cfg);
|
||||
BOOST_FOREACH(const attribute &v, cfg.values) {
|
||||
for (const attribute &v : cfg.values) {
|
||||
values[v.first] = v.second;
|
||||
}
|
||||
}
|
||||
|
@ -579,7 +578,7 @@ void config::merge_children(const std::string& key)
|
|||
if (child_count(key) < 2) return;
|
||||
|
||||
config merged_children;
|
||||
BOOST_FOREACH(const config &cfg, child_range(key)) {
|
||||
for (const config &cfg : child_range(key)) {
|
||||
merged_children.append(cfg);
|
||||
}
|
||||
|
||||
|
@ -595,7 +594,7 @@ void config::merge_children_by_attribute(const std::string& key, const std::stri
|
|||
|
||||
typedef std::map<std::string, config> config_map;
|
||||
config_map merged_children_map;
|
||||
BOOST_FOREACH(const config &cfg, child_range(key)) {
|
||||
for (const config &cfg : child_range(key)) {
|
||||
const std::string &value = cfg[attribute];
|
||||
config_map::iterator m = merged_children_map.find(value);
|
||||
if ( m!=merged_children_map.end() ) {
|
||||
|
@ -606,7 +605,7 @@ void config::merge_children_by_attribute(const std::string& key, const std::stri
|
|||
}
|
||||
|
||||
clear_children(key);
|
||||
BOOST_FOREACH(const config_map::value_type &i, merged_children_map) {
|
||||
for (const config_map::value_type &i : merged_children_map) {
|
||||
add_child(key,i.second);
|
||||
}
|
||||
}
|
||||
|
@ -828,7 +827,7 @@ void config::clear_children(const std::string& key)
|
|||
ordered_children.erase(std::remove_if(ordered_children.begin(),
|
||||
ordered_children.end(), remove_ordered(i)), ordered_children.end());
|
||||
|
||||
BOOST_FOREACH(config *c, i->second) {
|
||||
for (config *c : i->second) {
|
||||
delete c;
|
||||
}
|
||||
|
||||
|
@ -864,7 +863,7 @@ void config::recursive_clear_value(const std::string& key)
|
|||
|
||||
values.erase(key);
|
||||
|
||||
BOOST_FOREACH(const any_child &value, all_children_range()) {
|
||||
for (const any_child &value : all_children_range()) {
|
||||
const_cast<config *>(&value.cfg)->recursive_clear_value(key);
|
||||
}
|
||||
}
|
||||
|
@ -875,7 +874,7 @@ std::vector<config::child_pos>::iterator config::remove_child(
|
|||
/* Find the position with the correct index and decrement all the
|
||||
indices in the ordering that are above this index. */
|
||||
unsigned found = 0;
|
||||
BOOST_FOREACH(child_pos &p, ordered_children)
|
||||
for (child_pos &p : ordered_children)
|
||||
{
|
||||
if (p.pos != pos) continue;
|
||||
if (p.index == index)
|
||||
|
@ -971,7 +970,7 @@ void config::merge_attributes(const config &cfg)
|
|||
check_valid(cfg);
|
||||
|
||||
assert(this != &cfg);
|
||||
BOOST_FOREACH(const attribute &v, cfg.values) {
|
||||
for (const attribute &v : cfg.values) {
|
||||
|
||||
std::string key = v.first;
|
||||
if (key.substr(0,7) == "add_to_") {
|
||||
|
@ -1257,21 +1256,21 @@ void config::apply_diff(const config& diff, bool track /* = false */)
|
|||
if (track) values[diff_track_attribute] = "modified";
|
||||
|
||||
if (const config &inserts = diff.child("insert")) {
|
||||
BOOST_FOREACH(const attribute &v, inserts.attribute_range()) {
|
||||
for (const attribute &v : inserts.attribute_range()) {
|
||||
values[v.first] = v.second;
|
||||
}
|
||||
}
|
||||
|
||||
if (const config &deletes = diff.child("delete")) {
|
||||
BOOST_FOREACH(const attribute &v, deletes.attribute_range()) {
|
||||
for (const attribute &v : deletes.attribute_range()) {
|
||||
values.erase(v.first);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config &i, diff.child_range("change_child"))
|
||||
for (const config &i : diff.child_range("change_child"))
|
||||
{
|
||||
const size_t index = lexical_cast<size_t>(i["index"].str());
|
||||
BOOST_FOREACH(const any_child &item, i.all_children_range())
|
||||
for (const any_child &item : i.all_children_range())
|
||||
{
|
||||
if (item.key.empty()) {
|
||||
continue;
|
||||
|
@ -1286,19 +1285,19 @@ void config::apply_diff(const config& diff, bool track /* = false */)
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config &i, diff.child_range("insert_child"))
|
||||
for (const config &i : diff.child_range("insert_child"))
|
||||
{
|
||||
const size_t index = lexical_cast<size_t>(i["index"].str());
|
||||
BOOST_FOREACH(const any_child &item, i.all_children_range()) {
|
||||
for (const any_child &item : i.all_children_range()) {
|
||||
config& inserted = add_child_at(item.key, item.cfg, index);
|
||||
if (track) inserted[diff_track_attribute] = "new";
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config &i, diff.child_range("delete_child"))
|
||||
for (const config &i : diff.child_range("delete_child"))
|
||||
{
|
||||
const size_t index = lexical_cast<size_t>(i["index"].str());
|
||||
BOOST_FOREACH(const any_child &item, i.all_children_range()) {
|
||||
for (const any_child &item : i.all_children_range()) {
|
||||
if (!track) {
|
||||
remove_child(item.key, index);
|
||||
} else {
|
||||
|
@ -1315,18 +1314,18 @@ void config::apply_diff(const config& diff, bool track /* = false */)
|
|||
void config::clear_diff_track(const config& diff)
|
||||
{
|
||||
remove_attribute(diff_track_attribute);
|
||||
BOOST_FOREACH(const config &i, diff.child_range("delete_child"))
|
||||
for (const config &i : diff.child_range("delete_child"))
|
||||
{
|
||||
const size_t index = lexical_cast<size_t>(i["index"].str());
|
||||
BOOST_FOREACH(const any_child &item, i.all_children_range()) {
|
||||
for (const any_child &item : i.all_children_range()) {
|
||||
remove_child(item.key, index);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config &i, diff.child_range("change_child"))
|
||||
for (const config &i : diff.child_range("change_child"))
|
||||
{
|
||||
const size_t index = lexical_cast<size_t>(i["index"].str());
|
||||
BOOST_FOREACH(const any_child &item, i.all_children_range())
|
||||
for (const any_child &item : i.all_children_range())
|
||||
{
|
||||
if (item.key.empty()) {
|
||||
continue;
|
||||
|
@ -1340,7 +1339,7 @@ void config::clear_diff_track(const config& diff)
|
|||
itor->second[index]->clear_diff_track(item.cfg);
|
||||
}
|
||||
}
|
||||
BOOST_FOREACH(const any_child &value, all_children_range()) {
|
||||
for (const any_child &value : all_children_range()) {
|
||||
const_cast<config *>(&value.cfg)->remove_attribute(diff_track_attribute);
|
||||
}
|
||||
}
|
||||
|
@ -1388,7 +1387,7 @@ void config::merge_with(const config& c)
|
|||
|
||||
// Remove those marked so
|
||||
std::map<std::string, unsigned> removals;
|
||||
BOOST_FOREACH(const child_pos& pos, to_remove) {
|
||||
for (const child_pos& pos : to_remove) {
|
||||
const std::string& tag = pos.pos->first;
|
||||
unsigned &removes = removals[tag];
|
||||
remove_child(tag, pos.index - removes++);
|
||||
|
@ -1412,20 +1411,20 @@ bool config::matches(const config &filter) const
|
|||
{
|
||||
check_valid(filter);
|
||||
|
||||
BOOST_FOREACH(const attribute &i, filter.attribute_range())
|
||||
for (const attribute &i : filter.attribute_range())
|
||||
{
|
||||
const attribute_value *v = get(i.first);
|
||||
if (!v || *v != i.second) return false;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const any_child &i, filter.all_children_range())
|
||||
for (const any_child &i : filter.all_children_range())
|
||||
{
|
||||
if (i.key == "not") {
|
||||
if (matches(i.cfg)) return false;
|
||||
continue;
|
||||
}
|
||||
bool found = false;
|
||||
BOOST_FOREACH(const config &j, child_range(i.key)) {
|
||||
for (const config &j : child_range(i.key)) {
|
||||
if (j.matches(i.cfg)) {
|
||||
found = true;
|
||||
break;
|
||||
|
@ -1449,12 +1448,12 @@ std::ostream& operator << (std::ostream& outstream, const config& cfg)
|
|||
{
|
||||
static int i = 0;
|
||||
i++;
|
||||
BOOST_FOREACH(const config::attribute &val, cfg.attribute_range()) {
|
||||
for (const config::attribute &val : cfg.attribute_range()) {
|
||||
if(val.second.blank()) continue;
|
||||
for (int j = 0; j < i-1; j++){ outstream << char(9); }
|
||||
outstream << val.first << " = " << val.second << '\n';
|
||||
}
|
||||
BOOST_FOREACH(const config::any_child &child, cfg.all_children_range())
|
||||
for (const config::any_child &child : cfg.all_children_range())
|
||||
{
|
||||
for (int j = 0; j < i - 1; ++j) outstream << char(9);
|
||||
outstream << "[" << child.key << "]\n";
|
||||
|
@ -1483,7 +1482,7 @@ std::string config::hash() const
|
|||
hash_str[hash_length] = 0;
|
||||
|
||||
i = 0;
|
||||
BOOST_FOREACH(const attribute &val, values)
|
||||
for (const attribute &val : values)
|
||||
{
|
||||
for (c = val.first.begin(); c != val.first.end(); ++c) {
|
||||
hash_str[i] ^= *c;
|
||||
|
@ -1496,10 +1495,10 @@ std::string config::hash() const
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const any_child &ch, all_children_range())
|
||||
for (const any_child &ch : all_children_range())
|
||||
{
|
||||
std::string child_hash = ch.cfg.hash();
|
||||
BOOST_FOREACH(char c, child_hash) {
|
||||
for (char c : child_hash) {
|
||||
hash_str[i] ^= c;
|
||||
++i;
|
||||
if(i == hash_length) {
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "serialization/string_utils.hpp"
|
||||
#include "version.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/iostreams/filter/gzip.hpp>
|
||||
|
||||
|
@ -112,7 +111,7 @@ void config_cache::write_file(std::string path, const preproc_map& defines)
|
|||
config_writer writer(*stream, true, game_config::cache_compression_level);
|
||||
|
||||
// Write all defines to stream.
|
||||
BOOST_FOREACH(const preproc_map::value_type& define, defines) {
|
||||
for(const preproc_map::value_type& define : defines) {
|
||||
define.second.write(writer, define.first);
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +148,7 @@ void config_cache::read_cache(const std::string& path, config& cfg)
|
|||
|
||||
bool is_valid = true;
|
||||
|
||||
BOOST_FOREACH(const preproc_map::value_type& d, defines_map_) {
|
||||
for(const preproc_map::value_type& d : defines_map_) {
|
||||
//
|
||||
// Only WESNOTH_VERSION is allowed to be non-empty.
|
||||
//
|
||||
|
@ -262,7 +261,7 @@ void config_cache::read_defines_file(const std::string& path)
|
|||
|
||||
// use static preproc_define::read_pair(config) to make a object
|
||||
// and pass that object config_cache_transaction::insert_to_active method
|
||||
BOOST_FOREACH(const config::any_child &value, cfg.all_children_range()) {
|
||||
for(const config::any_child &value : cfg.all_children_range()) {
|
||||
config_cache_transaction::instance().insert_to_active(
|
||||
preproc_define::read_pair(value.cfg));
|
||||
}
|
||||
|
@ -272,7 +271,7 @@ void config_cache::read_defines_queue()
|
|||
{
|
||||
const std::vector<std::string>& files = config_cache_transaction::instance().get_define_files();
|
||||
|
||||
BOOST_FOREACH(const std::string &path, files) {
|
||||
for(const std::string &path : files) {
|
||||
read_defines_file(path);
|
||||
}
|
||||
}
|
||||
|
@ -378,7 +377,7 @@ bool config_cache::delete_cache_files(const std::vector<std::string>& paths,
|
|||
const bool delete_everything = exclude_pattern.empty();
|
||||
bool status = true;
|
||||
|
||||
BOOST_FOREACH(const std::string& path, paths)
|
||||
for(const std::string& path : paths)
|
||||
{
|
||||
if(!delete_everything) {
|
||||
const std::string& fn = filesystem::base_name(path);
|
||||
|
@ -479,7 +478,7 @@ void config_cache_transaction::add_defines_map_diff(preproc_map& new_map)
|
|||
std::insert_iterator<preproc_map>(temp,temp.begin()),
|
||||
&compare_define);
|
||||
|
||||
BOOST_FOREACH(const preproc_map::value_type &def, temp) {
|
||||
for(const preproc_map::value_type &def : temp) {
|
||||
insert_to_active(def);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
#include "scripting/plugins/context.hpp"
|
||||
#include "soundsource.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_display("display");
|
||||
#define ERR_DP LOG_STREAM(err, log_display)
|
||||
|
||||
|
@ -139,7 +137,7 @@ bool controller_base::handle_scroll(CKey& key, int mousex, int mousey, int mouse
|
|||
int dx = 0, dy = 0;
|
||||
int scroll_threshold = (preferences::mouse_scroll_enabled())
|
||||
? preferences::mouse_scroll_threshold() : 0;
|
||||
BOOST_FOREACH(const theme::menu& m, get_display().get_theme().menus()) {
|
||||
for (const theme::menu& m : get_display().get_theme().menus()) {
|
||||
if (sdl::point_in_rect(mousex, mousey, m.get_location())) {
|
||||
scroll_threshold = 0;
|
||||
}
|
||||
|
@ -307,7 +305,7 @@ void controller_base::execute_action(const std::vector<std::string>& items_arg,
|
|||
}
|
||||
|
||||
std::vector<std::string> items;
|
||||
BOOST_FOREACH(const std::string& item, items_arg) {
|
||||
for (const std::string& item : items_arg) {
|
||||
|
||||
const hotkey::hotkey_command& command = hotkey::get_hotkey_command(item);
|
||||
if(cmd_exec->can_execute_command(command))
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include "gui/dialogs/transient_message.hpp"
|
||||
#include "ai/lua/aspect_advancements.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
@ -107,7 +106,7 @@ template<typename T> void dump(const T & units)
|
|||
|
||||
LOG_DP << "size: " << units.size() << "\n";
|
||||
size_t idx = 0;
|
||||
BOOST_FOREACH(const unit_const_ptr & u_ptr, units) {
|
||||
for (const unit_const_ptr & u_ptr : units) {
|
||||
LOG_DP << "unit[" << (idx++) << "]: " << u_ptr->id() << " name = '" << u_ptr->name() << "'\n";
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +193,7 @@ int advance_unit_dialog(const map_location &loc)
|
|||
}
|
||||
|
||||
bool always_display = false;
|
||||
BOOST_FOREACH(const config &mod, u->get_modification_advances())
|
||||
for (const config &mod : u->get_modification_advances())
|
||||
{
|
||||
if (mod["always_display"].to_bool()) always_display = true;
|
||||
sample_units->push_back(::get_amla_unit(*u, mod));
|
||||
|
@ -483,7 +482,7 @@ int recall_dialog(display& disp, const boost::shared_ptr<std::vector< unit_const
|
|||
options.push_back(heading.str());
|
||||
options_to_filter.push_back(options.back());
|
||||
|
||||
BOOST_FOREACH(const unit_const_ptr & u, *units)
|
||||
for (const unit_const_ptr & u : *units)
|
||||
{
|
||||
std::stringstream option, option_to_filter;
|
||||
std::string name = u->name();
|
||||
|
@ -499,7 +498,7 @@ int recall_dialog(display& disp, const boost::shared_ptr<std::vector< unit_const
|
|||
option << "~BLIT(" << unit::leader_crown() << ")";
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const std::string& overlay, u->overlays())
|
||||
for(const std::string& overlay : u->overlays())
|
||||
{
|
||||
option << "~BLIT(" << overlay << ")";
|
||||
}
|
||||
|
@ -545,7 +544,7 @@ int recall_dialog(display& disp, const boost::shared_ptr<std::vector< unit_const
|
|||
option_to_filter << u->type_name() << " " << name << " " << u->level();
|
||||
|
||||
option << COLUMN_SEPARATOR;
|
||||
BOOST_FOREACH(const t_string& trait, u->trait_names()) {
|
||||
for(const t_string& trait : u->trait_names()) {
|
||||
option << trait << '\n';
|
||||
option_to_filter << " " << trait;
|
||||
}
|
||||
|
@ -711,7 +710,7 @@ void unit_preview_pane::draw_contents()
|
|||
image_rect = rect;
|
||||
|
||||
if(!det.overlays.empty()) {
|
||||
BOOST_FOREACH(const std::string& overlay, det.overlays) {
|
||||
for(const std::string& overlay : det.overlays) {
|
||||
sdl::timage oi = image::get_texture(overlay);
|
||||
|
||||
if(!oi.null()) {
|
||||
|
@ -856,7 +855,7 @@ void unit_preview_pane::draw_contents()
|
|||
image_rect = rect;
|
||||
|
||||
if(!det.overlays.empty()) {
|
||||
BOOST_FOREACH(const std::string& overlay, det.overlays) {
|
||||
for(const std::string& overlay : det.overlays) {
|
||||
surface os = image::get_image(overlay);
|
||||
|
||||
if(!os) {
|
||||
|
@ -1049,7 +1048,7 @@ const unit_preview_pane::details units_list_preview_pane::get_details() const
|
|||
det.overlays.push_back(unit::leader_crown());
|
||||
};
|
||||
|
||||
BOOST_FOREACH(const std::string& overlay, u.overlays()) {
|
||||
for(const std::string& overlay : u.overlays()) {
|
||||
det.overlays.push_back(overlay);
|
||||
}
|
||||
|
||||
|
@ -1097,7 +1096,7 @@ const unit_types_preview_pane::details unit_types_preview_pane::get_details() co
|
|||
det.race = t->race()->name(t->genders().front());
|
||||
|
||||
//FIXME: This probably must be move into a unit_type function
|
||||
BOOST_FOREACH(const config &tr, t->possible_traits())
|
||||
for (const config &tr : t->possible_traits())
|
||||
{
|
||||
if (tr["availability"] != "musthave") continue;
|
||||
|
||||
|
@ -1128,7 +1127,7 @@ const unit_types_preview_pane::details unit_types_preview_pane::get_details() co
|
|||
// Check if AMLA color is needed
|
||||
// FIXME: not sure if it's fully accurate (but not very important for unit_type)
|
||||
// xp_color also need a simpler function for doing this
|
||||
BOOST_FOREACH(const config &adv, t->modification_advancements())
|
||||
for (const config &adv : t->modification_advancements())
|
||||
{
|
||||
if (!adv["strict_amla"].to_bool() || !t->can_advance()) {
|
||||
det.xp_color = "<170,0,255>"; // from unit::xp_color()
|
||||
|
|
|
@ -50,8 +50,6 @@
|
|||
|
||||
#include <SDL_image.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#ifdef __SUNPRO_CC
|
||||
// GCC doesn't have hypot in cmath so include it for Sun Studio
|
||||
#include <math.h>
|
||||
|
@ -84,7 +82,7 @@ void display::parse_team_overlays()
|
|||
{
|
||||
const team& curr_team = dc_->teams()[playing_team()];
|
||||
const team& prev_team = dc_->teams()[playing_team()-1 < dc_->teams().size() ? playing_team()-1 : dc_->teams().size()-1];
|
||||
BOOST_FOREACH(const game_display::overlay_map::value_type i, *overlays_) {
|
||||
for (const game_display::overlay_map::value_type i : *overlays_) {
|
||||
const overlay& ov = i.second;
|
||||
if (!ov.team_name.empty() &&
|
||||
((ov.team_name.find(curr_team.team_name()) + 1) != 0) !=
|
||||
|
@ -976,15 +974,15 @@ void display::create_buttons()
|
|||
|
||||
void display::render_buttons()
|
||||
{
|
||||
BOOST_FOREACH(gui::button &btn, menu_buttons_) {
|
||||
for (gui::button &btn : menu_buttons_) {
|
||||
btn.set_dirty(true);
|
||||
}
|
||||
|
||||
BOOST_FOREACH(gui::button &btn, action_buttons_) {
|
||||
for (gui::button &btn : action_buttons_) {
|
||||
btn.set_dirty(true);
|
||||
}
|
||||
|
||||
BOOST_FOREACH(gui::slider &sld, sliders_) {
|
||||
for (gui::slider &sld : sliders_) {
|
||||
sld.set_dirty(true);
|
||||
}
|
||||
}
|
||||
|
@ -1094,7 +1092,7 @@ std::vector<surface> display::get_fog_shroud_images(const map_location& loc, ima
|
|||
std::vector<surface> res;
|
||||
#endif
|
||||
|
||||
BOOST_FOREACH(std::string& name, names) {
|
||||
for (std::string& name : names) {
|
||||
#ifdef SDL_GPU
|
||||
const sdl::timage img(image::get_texture(name, image_type));
|
||||
if (!img.null())
|
||||
|
@ -1336,8 +1334,8 @@ void display::drawing_buffer_commit()
|
|||
* layergroup > location > layer > 'tblit' > surface
|
||||
*/
|
||||
|
||||
BOOST_FOREACH(tblit &blit, drawing_buffer_) {
|
||||
BOOST_FOREACH(sdl::timage& img, blit.images()) {
|
||||
for (tblit &blit : drawing_buffer_) {
|
||||
for (sdl::timage& img : blit.images()) {
|
||||
if (!img.null()) {
|
||||
screen_.draw_texture(img, blit.x(), blit.y());
|
||||
}
|
||||
|
@ -1363,8 +1361,8 @@ void display::drawing_buffer_commit()
|
|||
* layergroup > location > layer > 'tblit' > surface
|
||||
*/
|
||||
|
||||
BOOST_FOREACH(const tblit &blit, drawing_buffer_) {
|
||||
BOOST_FOREACH(const surface& surf, blit.surf()) {
|
||||
for (const tblit &blit : drawing_buffer_) {
|
||||
for (const surface& surf : blit.surf()) {
|
||||
// Note that dstrect can be changed by sdl_blit
|
||||
// and so a new instance should be initialized
|
||||
// to pass to each call to sdl_blit.
|
||||
|
@ -2678,7 +2676,7 @@ void display::redraw_everything()
|
|||
int ticks3 = SDL_GetTicks();
|
||||
LOG_DP << "invalidate and draw: " << (ticks3 - ticks2) << " and " << (ticks2 - ticks1) << "\n";
|
||||
|
||||
BOOST_FOREACH(boost::function<void(display&)> f, redraw_observers_) {
|
||||
for (boost::function<void(display&)> f : redraw_observers_) {
|
||||
f(*this);
|
||||
}
|
||||
|
||||
|
@ -2789,7 +2787,7 @@ void display::draw_invalidated() {
|
|||
SDL_Rect clip_rect = get_clip_rect();
|
||||
surface& screen = get_screen_surface();
|
||||
clip_rect_setter set_clip_rect(screen, &clip_rect);
|
||||
BOOST_FOREACH(const map_location& loc, invalidated_) {
|
||||
for (const map_location& loc : invalidated_) {
|
||||
int xpos = get_location_x(loc);
|
||||
int ypos = get_location_y(loc);
|
||||
|
||||
|
@ -2811,7 +2809,7 @@ void display::draw_invalidated() {
|
|||
|
||||
unit_drawer drawer = unit_drawer(*this, energy_bar_rects_);
|
||||
|
||||
BOOST_FOREACH(const map_location& loc, invalidated_) {
|
||||
for (const map_location& loc : invalidated_) {
|
||||
unit_map::const_iterator u_it = dc_->units().find(loc);
|
||||
exclusive_unit_draw_requests_t::iterator request = exclusive_unit_draw_requests_.find(loc);
|
||||
if (u_it != dc_->units().end()
|
||||
|
@ -2938,7 +2936,7 @@ void display::draw_hex(const map_location& loc) {
|
|||
// Paint arrows
|
||||
arrows_map_t::const_iterator arrows_in_hex = arrows_map_.find(loc);
|
||||
if(arrows_in_hex != arrows_map_.end()) {
|
||||
BOOST_FOREACH(arrow* const a, arrows_in_hex->second) {
|
||||
for (arrow* const a : arrows_in_hex->second) {
|
||||
a->draw_hex(loc);
|
||||
}
|
||||
}
|
||||
|
@ -3543,7 +3541,7 @@ bool display::invalidate(const std::set<map_location>& locs)
|
|||
if(invalidateAll_)
|
||||
return false;
|
||||
bool ret = false;
|
||||
BOOST_FOREACH(const map_location& loc, locs) {
|
||||
for (const map_location& loc : locs) {
|
||||
#ifdef _OPENMP
|
||||
#pragma omp critical(invalidated_)
|
||||
#endif //_OPENMP
|
||||
|
@ -3593,7 +3591,7 @@ bool display::invalidate_locations_in_rect(const SDL_Rect& rect)
|
|||
return false;
|
||||
|
||||
bool result = false;
|
||||
BOOST_FOREACH(const map_location &loc, hexes_under_rect(rect)) {
|
||||
for (const map_location &loc : hexes_under_rect(rect)) {
|
||||
result |= invalidate(loc);
|
||||
}
|
||||
return result;
|
||||
|
@ -3614,7 +3612,7 @@ void display::invalidate_animations()
|
|||
new_animation_frame();
|
||||
animate_map_ = preferences::animate_map();
|
||||
if (animate_map_) {
|
||||
BOOST_FOREACH(const map_location &loc, get_visible_hexes())
|
||||
for (const map_location &loc : get_visible_hexes())
|
||||
{
|
||||
if (shrouded(loc)) continue;
|
||||
if (builder_->update_animation(loc)) {
|
||||
|
@ -3626,22 +3624,22 @@ void display::invalidate_animations()
|
|||
}
|
||||
|
||||
#ifndef _OPENMP
|
||||
BOOST_FOREACH(const unit & u, dc_->units()) {
|
||||
for (const unit & u : dc_->units()) {
|
||||
u.anim_comp().refresh();
|
||||
}
|
||||
BOOST_FOREACH(const unit* u, *fake_unit_man_) {
|
||||
for (const unit* u : *fake_unit_man_) {
|
||||
u->anim_comp().refresh();
|
||||
}
|
||||
#else
|
||||
std::vector<const unit *> open_mp_list;
|
||||
BOOST_FOREACH(const unit & u, dc_->units()) {
|
||||
for (const unit & u : dc_->units()) {
|
||||
open_mp_list.push_back(&u);
|
||||
}
|
||||
// Note that it is an important assumption of the
|
||||
// system that the fake units are added to the list
|
||||
// after the real units, so that e.g. whiteboard
|
||||
// planned moves are drawn over the real units.
|
||||
BOOST_FOREACH(const unit* u, *fake_unit_man_) {
|
||||
for (const unit* u : *fake_unit_man_) {
|
||||
open_mp_list.push_back(u);
|
||||
}
|
||||
|
||||
|
@ -3663,10 +3661,10 @@ void display::invalidate_animations()
|
|||
do {
|
||||
new_inval = false;
|
||||
#ifndef _OPENMP
|
||||
BOOST_FOREACH(const unit & u, dc_->units()) {
|
||||
for (const unit & u : dc_->units()) {
|
||||
new_inval |= u.anim_comp().invalidate(*this);
|
||||
}
|
||||
BOOST_FOREACH(const unit* u, *fake_unit_man_) {
|
||||
for (const unit* u : *fake_unit_man_) {
|
||||
new_inval |= u->anim_comp().invalidate(*this);
|
||||
}
|
||||
#else
|
||||
|
@ -3681,7 +3679,7 @@ void display::invalidate_animations()
|
|||
void display::add_arrow(arrow& arrow)
|
||||
{
|
||||
const arrow_path_t & arrow_path = arrow.get_path();
|
||||
BOOST_FOREACH(const map_location& loc, arrow_path)
|
||||
for (const map_location& loc : arrow_path)
|
||||
{
|
||||
arrows_map_[loc].push_back(&arrow);
|
||||
}
|
||||
|
@ -3690,7 +3688,7 @@ void display::add_arrow(arrow& arrow)
|
|||
void display::remove_arrow(arrow& arrow)
|
||||
{
|
||||
const arrow_path_t & arrow_path = arrow.get_path();
|
||||
BOOST_FOREACH(const map_location& loc, arrow_path)
|
||||
for (const map_location& loc : arrow_path)
|
||||
{
|
||||
arrows_map_[loc].remove(&arrow);
|
||||
}
|
||||
|
@ -3699,12 +3697,12 @@ void display::remove_arrow(arrow& arrow)
|
|||
void display::update_arrow(arrow & arrow)
|
||||
{
|
||||
const arrow_path_t & previous_path = arrow.get_previous_path();
|
||||
BOOST_FOREACH(const map_location& loc, previous_path)
|
||||
for (const map_location& loc : previous_path)
|
||||
{
|
||||
arrows_map_[loc].remove(&arrow);
|
||||
}
|
||||
const arrow_path_t & arrow_path = arrow.get_path();
|
||||
BOOST_FOREACH(const map_location& loc, arrow_path)
|
||||
for (const map_location& loc : arrow_path)
|
||||
{
|
||||
arrows_map_[loc].push_back(&arrow);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "serialization/string_utils.hpp"
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <SDL_timer.h>
|
||||
#include <SDL_video.h>
|
||||
|
||||
|
@ -205,7 +204,7 @@ void display_chat_manager::prune_chat_messages(bool remove_all)
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const chat_message &cm, chat_messages_) {
|
||||
for(const chat_message &cm : chat_messages_) {
|
||||
font::move_floating_label(cm.speaker_handle, 0, - movement);
|
||||
font::move_floating_label(cm.handle, 0, - movement);
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#include "units/unit.hpp"
|
||||
#include "units/map.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
std::vector<std::string>& display_context::hidden_label_categories_ref() {
|
||||
return const_cast<std::vector<std::string>&>(this->hidden_label_categories());
|
||||
}
|
||||
|
@ -31,7 +29,7 @@ bool display_context::would_be_discovered(const map_location & loc, int side_num
|
|||
map_location adjs[6];
|
||||
get_adjacent_tiles(loc,adjs);
|
||||
|
||||
BOOST_FOREACH(const map_location &u_loc, adjs)
|
||||
for (const map_location &u_loc : adjs)
|
||||
{
|
||||
unit_map::const_iterator u_it = units().find(u_loc);
|
||||
if (!u_it.valid()) {
|
||||
|
@ -119,7 +117,7 @@ int display_context::village_owner(const map_location& loc) const
|
|||
*/
|
||||
bool display_context::is_observer() const
|
||||
{
|
||||
BOOST_FOREACH(const team &t, teams()) {
|
||||
for (const team &t : teams()) {
|
||||
if (t.is_local())
|
||||
return false;
|
||||
}
|
||||
|
@ -132,7 +130,7 @@ bool display_context::is_observer() const
|
|||
int display_context::side_units(int side) const
|
||||
{
|
||||
int res = 0;
|
||||
BOOST_FOREACH(const unit &u, units()) {
|
||||
for (const unit &u : units()) {
|
||||
if (u.side() == side) ++res;
|
||||
}
|
||||
return res;
|
||||
|
@ -141,7 +139,7 @@ int display_context::side_units(int side) const
|
|||
int display_context::side_units_cost(int side) const
|
||||
{
|
||||
int res = 0;
|
||||
BOOST_FOREACH(const unit &u, units()) {
|
||||
for (const unit &u : units()) {
|
||||
if (u.side() == side) res += u.cost();
|
||||
}
|
||||
return res;
|
||||
|
@ -150,7 +148,7 @@ int display_context::side_units_cost(int side) const
|
|||
int display_context::side_upkeep(int side) const
|
||||
{
|
||||
int res = 0;
|
||||
BOOST_FOREACH(const unit &u, units()) {
|
||||
for (const unit &u : units()) {
|
||||
if (u.side() == side) res += u.upkeep();
|
||||
}
|
||||
return res;
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
#include "resources.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace editor {
|
||||
|
||||
int editor_action::next_id_ = 1;
|
||||
|
@ -77,25 +75,25 @@ void editor_action_whole_map::perform_without_undo(map_context& mc) const {
|
|||
editor_action_chain::editor_action_chain(const editor::editor_action_chain &other)
|
||||
: editor_action(), actions_()
|
||||
{
|
||||
BOOST_FOREACH(editor_action* a, other.actions_) {
|
||||
for (editor_action* a : other.actions_) {
|
||||
actions_.push_back(a->clone());
|
||||
}
|
||||
}
|
||||
editor_action_chain& editor_action_chain::operator=(const editor_action_chain& other)
|
||||
{
|
||||
if (this == &other) return *this;
|
||||
BOOST_FOREACH(editor_action* a, actions_) {
|
||||
for (editor_action* a : actions_) {
|
||||
delete a;
|
||||
}
|
||||
actions_.clear();
|
||||
BOOST_FOREACH(editor_action* a, other.actions_) {
|
||||
for (editor_action* a : other.actions_) {
|
||||
actions_.push_back(a->clone());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
editor_action_chain::~editor_action_chain()
|
||||
{
|
||||
BOOST_FOREACH(editor_action* a, actions_) {
|
||||
for (editor_action* a : actions_) {
|
||||
delete a;
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +103,7 @@ editor_action_chain* editor_action_chain::clone() const
|
|||
}
|
||||
int editor_action_chain::action_count() const {
|
||||
int count = 0;
|
||||
BOOST_FOREACH(const editor_action* a, actions_) {
|
||||
for (const editor_action* a : actions_) {
|
||||
if (a) {
|
||||
count += a->action_count();
|
||||
}
|
||||
|
@ -135,7 +133,7 @@ editor_action* editor_action_chain::pop_first_action() {
|
|||
}
|
||||
editor_action_chain* editor_action_chain::perform(map_context& mc) const {
|
||||
util::unique_ptr<editor_action_chain> undo(new editor_action_chain());
|
||||
BOOST_FOREACH(editor_action* a, actions_) {
|
||||
for (editor_action* a : actions_) {
|
||||
if (a != nullptr) {
|
||||
undo->append_action(a->perform(mc));
|
||||
}
|
||||
|
@ -145,7 +143,7 @@ editor_action_chain* editor_action_chain::perform(map_context& mc) const {
|
|||
}
|
||||
void editor_action_chain::perform_without_undo(map_context& mc) const
|
||||
{
|
||||
BOOST_FOREACH(editor_action* a, actions_) {
|
||||
for (editor_action* a : actions_) {
|
||||
if (a != nullptr) {
|
||||
a->perform_without_undo(mc);
|
||||
}
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "editor/action/action_select.hpp"
|
||||
#include "editor/map/map_context.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace editor {
|
||||
|
||||
editor_action_select* editor_action_select::clone() const
|
||||
|
@ -32,7 +30,7 @@ editor_action_select* editor_action_select::clone() const
|
|||
|
||||
void editor_action_select::extend(const editor_map& /*map*/, const std::set<map_location>& locs)
|
||||
{
|
||||
BOOST_FOREACH(const map_location& loc, locs) {
|
||||
for (const map_location& loc : locs) {
|
||||
LOG_ED << "Extending by " << loc << "\n";
|
||||
area_.insert(loc);
|
||||
}
|
||||
|
@ -41,7 +39,7 @@ void editor_action_select::extend(const editor_map& /*map*/, const std::set<map_
|
|||
editor_action* editor_action_select::perform(map_context& mc) const
|
||||
{
|
||||
std::set<map_location> undo_locs;
|
||||
BOOST_FOREACH(const map_location& loc, area_) {
|
||||
for (const map_location& loc : area_) {
|
||||
undo_locs.insert(loc);
|
||||
mc.add_changed_location(loc);
|
||||
}
|
||||
|
@ -51,7 +49,7 @@ editor_action* editor_action_select::perform(map_context& mc) const
|
|||
|
||||
void editor_action_select::perform_without_undo(map_context& mc) const
|
||||
{
|
||||
BOOST_FOREACH(const map_location& loc, area_) {
|
||||
for (const map_location& loc : area_) {
|
||||
|
||||
mc.get_map().add_to_selection(loc);
|
||||
mc.add_changed_location(loc);
|
||||
|
@ -65,7 +63,7 @@ editor_action_deselect* editor_action_deselect::clone() const
|
|||
|
||||
void editor_action_deselect::extend(const editor_map& map, const std::set<map_location>& locs)
|
||||
{
|
||||
BOOST_FOREACH(const map_location& loc, locs) {
|
||||
for (const map_location& loc : locs) {
|
||||
LOG_ED << "Checking " << loc << "\n";
|
||||
if (!map.in_selection(loc)) {
|
||||
LOG_ED << "Extending by " << loc << "\n";
|
||||
|
@ -77,7 +75,7 @@ void editor_action_deselect::extend(const editor_map& map, const std::set<map_lo
|
|||
editor_action* editor_action_deselect::perform(map_context& mc) const
|
||||
{
|
||||
std::set<map_location> undo_locs;
|
||||
BOOST_FOREACH(const map_location& loc, area_) {
|
||||
for (const map_location& loc : area_) {
|
||||
if (mc.get_map().in_selection(loc)) {
|
||||
undo_locs.insert(loc);
|
||||
mc.add_changed_location(loc);
|
||||
|
@ -89,7 +87,7 @@ editor_action* editor_action_deselect::perform(map_context& mc) const
|
|||
|
||||
void editor_action_deselect::perform_without_undo(map_context& mc) const
|
||||
{
|
||||
BOOST_FOREACH(const map_location& loc, area_) {
|
||||
for (const map_location& loc : area_) {
|
||||
mc.get_map().remove_from_selection(loc);
|
||||
mc.add_changed_location(loc);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#include "halo.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace {
|
||||
static std::vector<std::string> saved_windows_;
|
||||
|
@ -112,7 +111,7 @@ void editor_controller::init_gui()
|
|||
|
||||
void editor_controller::init_tods(const config& game_config)
|
||||
{
|
||||
BOOST_FOREACH(const config &schedule, game_config.child_range("editor_times")) {
|
||||
for (const config &schedule : game_config.child_range("editor_times")) {
|
||||
|
||||
const std::string& schedule_id = schedule["id"];
|
||||
const std::string& schedule_name = schedule["name"];
|
||||
|
@ -132,7 +131,7 @@ void editor_controller::init_tods(const config& game_config)
|
|||
continue;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config &time, schedule.child_range("time")) {
|
||||
for (const config &time : schedule.child_range("time")) {
|
||||
times->second.second.push_back(time_of_day(time));
|
||||
}
|
||||
|
||||
|
@ -149,8 +148,8 @@ void editor_controller::init_music(const config& game_config)
|
|||
if (!game_config.has_child(tag_name))
|
||||
ERR_ED << "No editor music defined" << std::endl;
|
||||
else {
|
||||
BOOST_FOREACH(const config& editor_music, game_config.child_range(tag_name)) {
|
||||
BOOST_FOREACH(const config& music, editor_music.child_range("music")) {
|
||||
for (const config& editor_music : game_config.child_range(tag_name)) {
|
||||
for (const config& music : editor_music.child_range("music")) {
|
||||
sound::music_track track(music);
|
||||
if (track.file_path().empty())
|
||||
WRN_ED << "Music track " << track.id() << " not found." << std::endl;
|
||||
|
@ -1042,7 +1041,7 @@ void editor_controller::show_menu(const std::vector<std::string>& items_arg, int
|
|||
if (!items.empty() && items.front() == "editor-playlist") {
|
||||
active_menu_ = editor::MUSIC;
|
||||
items.erase(items.begin());
|
||||
BOOST_FOREACH(const sound::music_track& track, music_tracks_) {
|
||||
for (const sound::music_track& track : music_tracks_) {
|
||||
items.push_back(track.title().empty() ? track.id() : track.title());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#include "serialization/string_utils.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace preferences {
|
||||
|
||||
namespace editor {
|
||||
|
@ -119,7 +117,7 @@ namespace editor {
|
|||
return mru;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config& child, cfg.child_range("entry"))
|
||||
for(const config& child : cfg.child_range("entry"))
|
||||
{
|
||||
const std::string& entry = child["path"].str();
|
||||
if(!entry.empty()) {
|
||||
|
@ -137,7 +135,7 @@ namespace editor {
|
|||
config cfg;
|
||||
unsigned n = 0;
|
||||
|
||||
BOOST_FOREACH(const std::string& entry, mru)
|
||||
for(const std::string& entry : mru)
|
||||
{
|
||||
if(entry.empty()) {
|
||||
continue;
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
#include "gui/dialogs/editor/edit_scenario.hpp"
|
||||
#include "gui/dialogs/editor/edit_side.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "terrain/translation.hpp"
|
||||
|
||||
#include "wml_separators.hpp"
|
||||
|
@ -120,7 +118,7 @@ bool context_manager::is_active_transitions_hotkey(const std::string& item) {
|
|||
|
||||
size_t context_manager::modified_maps(std::string& message) {
|
||||
std::vector<std::string> modified;
|
||||
BOOST_FOREACH(map_context* mc, map_contexts_) {
|
||||
for (map_context* mc : map_contexts_) {
|
||||
if (mc->modified()) {
|
||||
if (!mc->get_filename().empty()) {
|
||||
modified.push_back(mc->get_filename());
|
||||
|
@ -129,7 +127,7 @@ size_t context_manager::modified_maps(std::string& message) {
|
|||
}
|
||||
}
|
||||
}
|
||||
BOOST_FOREACH(std::string& str, modified) {
|
||||
for (std::string& str : modified) {
|
||||
message += "\n" + std::string("• ") + str;
|
||||
}
|
||||
return modified.size();
|
||||
|
@ -155,10 +153,10 @@ context_manager::context_manager(editor_display& gui, const config& game_config)
|
|||
|
||||
context_manager::~context_manager()
|
||||
{
|
||||
BOOST_FOREACH(map_generator* m, map_generators_) {
|
||||
for (map_generator* m : map_generators_) {
|
||||
delete m;
|
||||
}
|
||||
BOOST_FOREACH(map_context* mc, map_contexts_) {
|
||||
for (map_context* mc : map_contexts_) {
|
||||
delete mc;
|
||||
}
|
||||
|
||||
|
@ -334,7 +332,7 @@ void context_manager::expand_load_mru_menu(std::vector<std::string>& items)
|
|||
continue;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(std::string& path, mru)
|
||||
for (std::string& path : mru)
|
||||
{
|
||||
// TODO: add proper leading ellipsization instead, since otherwise
|
||||
// it'll be impossible to tell apart files with identical names and
|
||||
|
@ -417,7 +415,7 @@ void context_manager::expand_time_menu(std::vector<std::string>& items)
|
|||
|
||||
assert(tod_m != nullptr);
|
||||
|
||||
BOOST_FOREACH(const time_of_day& time, tod_m->times()) {
|
||||
for (const time_of_day& time : tod_m->times()) {
|
||||
|
||||
std::stringstream label;
|
||||
if (!time.image.empty())
|
||||
|
@ -441,7 +439,7 @@ void context_manager::expand_local_time_menu(std::vector<std::string>& items)
|
|||
|
||||
tod_manager* tod_m = get_map_context().get_time_manager();
|
||||
|
||||
BOOST_FOREACH(const time_of_day& time, tod_m->times(get_map_context().get_active_area())) {
|
||||
for (const time_of_day& time : tod_m->times(get_map_context().get_active_area())) {
|
||||
|
||||
std::stringstream label;
|
||||
if (!time.image.empty())
|
||||
|
@ -532,7 +530,7 @@ void context_manager::refresh_after_action(bool drag_part)
|
|||
get_map_context().set_needs_terrain_rebuild(false);
|
||||
gui_.invalidate_all();
|
||||
} else {
|
||||
BOOST_FOREACH(const map_location& loc, changed_locs) {
|
||||
for (const map_location& loc : changed_locs) {
|
||||
gui_.rebuild_terrain(loc);
|
||||
}
|
||||
gui_.invalidate(changed_locs);
|
||||
|
@ -670,7 +668,7 @@ void context_manager::save_scenario_as_dialog()
|
|||
|
||||
void context_manager::init_map_generators(const config& game_config)
|
||||
{
|
||||
BOOST_FOREACH(const config &i, game_config.child_range("multiplayer")) {
|
||||
for (const config &i : game_config.child_range("multiplayer")) {
|
||||
|
||||
if (!i["map_generation"].empty() || !i["scenario_generation"].empty()) {
|
||||
|
||||
|
@ -745,7 +743,7 @@ void context_manager::create_default_context()
|
|||
map_context* mc = new map_context(editor_map(game_config_, 44, 33, default_terrain), gui_, true, default_schedule);
|
||||
add_map_context(mc);
|
||||
} else {
|
||||
BOOST_FOREACH(const std::string& filename, saved_windows_) {
|
||||
for (const std::string& filename : saved_windows_) {
|
||||
map_context* mc = new map_context(game_config_, filename, gui_);
|
||||
add_map_context(mc);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include "terrain/type_data.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
@ -113,7 +112,7 @@ void editor_map::sanity_check()
|
|||
++errors;
|
||||
}
|
||||
}
|
||||
BOOST_FOREACH(const map_location& loc, selection_) {
|
||||
for (const map_location& loc : selection_) {
|
||||
if (!on_board_with_border(loc)) {
|
||||
ERR_ED << "Off-map tile in selection: " << loc << std::endl;
|
||||
}
|
||||
|
@ -173,7 +172,7 @@ bool editor_map::add_to_selection(const map_location& loc)
|
|||
bool editor_map::set_selection(const std::set<map_location>& area)
|
||||
{
|
||||
clear_selection();
|
||||
BOOST_FOREACH(const map_location& loc, area) {
|
||||
for (const map_location& loc : area) {
|
||||
if (!add_to_selection(loc))
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "formula/string_utils.hpp"
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
|
||||
namespace editor {
|
||||
|
@ -289,31 +288,31 @@ void map_context::load_scenario(const config& game_config)
|
|||
labels_.read(scenario);
|
||||
|
||||
tod_manager_.reset(new tod_manager(scenario));
|
||||
BOOST_FOREACH(const config &time_area, scenario.child_range("time_area")) {
|
||||
for(const config &time_area : scenario.child_range("time_area")) {
|
||||
tod_manager_->add_time_area(map_,time_area);
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config& item, scenario.child_range("item")) {
|
||||
for(const config& item : scenario.child_range("item")) {
|
||||
const map_location loc(item);
|
||||
overlays_.insert(std::pair<map_location,
|
||||
overlay>(loc, overlay(item) ));
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config& music, scenario.child_range("music")) {
|
||||
for(const config& music : scenario.child_range("music")) {
|
||||
music_tracks_.insert(std::pair<std::string, sound::music_track>(music["name"], sound::music_track(music)));
|
||||
}
|
||||
|
||||
resources::teams = &teams_;
|
||||
|
||||
int i = 1;
|
||||
BOOST_FOREACH(config &side, scenario.child_range("side"))
|
||||
for(config &side : scenario.child_range("side"))
|
||||
{
|
||||
team t;
|
||||
side["side"] = i;
|
||||
t.build(side, map_);
|
||||
teams_.push_back(t);
|
||||
|
||||
BOOST_FOREACH(config &a_unit, side.child_range("unit")) {
|
||||
for(config &a_unit : side.child_range("unit")) {
|
||||
map_location loc(a_unit, nullptr);
|
||||
a_unit["side"] = i;
|
||||
units_.add(loc, unit(a_unit, true) );
|
||||
|
@ -370,7 +369,7 @@ void map_context::draw_terrain(const t_translation::t_terrain & terrain,
|
|||
t_translation::t_terrain full_terrain = one_layer_only ? terrain :
|
||||
map_.get_terrain_info(terrain).terrain_with_default_base();
|
||||
|
||||
BOOST_FOREACH(const map_location& loc, locs) {
|
||||
for(const map_location& loc : locs) {
|
||||
draw_terrain_actual(full_terrain, loc, one_layer_only);
|
||||
}
|
||||
}
|
||||
|
@ -454,7 +453,7 @@ config map_context::to_config()
|
|||
item["team_name"] = it->second.team_name;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const music_map::value_type& track, music_tracks_) {
|
||||
for(const music_map::value_type& track : music_tracks_) {
|
||||
track.second.write(scenario, true);
|
||||
}
|
||||
|
||||
|
@ -482,7 +481,7 @@ config map_context::to_config()
|
|||
side["gold"] = t->gold();
|
||||
side["income"] = t->base_income();
|
||||
|
||||
BOOST_FOREACH(const map_location& village, t->villages()) {
|
||||
for(const map_location& village : t->villages()) {
|
||||
village.write(side.add_child("village"));
|
||||
}
|
||||
|
||||
|
@ -719,7 +718,7 @@ void map_context::trim_stack(action_stack& stack)
|
|||
|
||||
void map_context::clear_stack(action_stack& stack)
|
||||
{
|
||||
BOOST_FOREACH(editor_action* a, stack) {
|
||||
for (editor_action* a : stack) {
|
||||
delete a;
|
||||
}
|
||||
stack.clear();
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include "util.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace editor {
|
||||
|
||||
map_fragment::map_fragment()
|
||||
|
@ -44,7 +42,7 @@ void map_fragment::add_tile(const gamemap& map, const map_location& loc)
|
|||
|
||||
void map_fragment::add_tiles(const gamemap& map, const std::set<map_location>& locs)
|
||||
{
|
||||
BOOST_FOREACH(const map_location& loc, locs) {
|
||||
for (const map_location& loc : locs) {
|
||||
add_tile(map, loc);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +55,7 @@ std::set<map_location> map_fragment::get_area() const
|
|||
std::set<map_location> map_fragment::get_offset_area(const map_location& loc) const
|
||||
{
|
||||
std::set<map_location> result;
|
||||
BOOST_FOREACH(const tile_info& i, items_) {
|
||||
for (const tile_info& i : items_) {
|
||||
result.insert(i.offset.vector_sum(loc));
|
||||
}
|
||||
return result;
|
||||
|
@ -65,14 +63,14 @@ std::set<map_location> map_fragment::get_offset_area(const map_location& loc) co
|
|||
|
||||
void map_fragment::paste_into(gamemap& map, const map_location& loc) const
|
||||
{
|
||||
BOOST_FOREACH(const tile_info& i, items_) {
|
||||
for (const tile_info& i : items_) {
|
||||
map.set_terrain(i.offset.vector_sum(loc), i.terrain);
|
||||
}
|
||||
}
|
||||
|
||||
void map_fragment::shift(const map_location& offset)
|
||||
{
|
||||
BOOST_FOREACH(tile_info& ti, items_) {
|
||||
for (tile_info& ti : items_) {
|
||||
ti.offset.vector_sum_assign(offset);
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +78,7 @@ void map_fragment::shift(const map_location& offset)
|
|||
map_location map_fragment::center_of_mass() const
|
||||
{
|
||||
map_location sum(0, 0);
|
||||
BOOST_FOREACH(const tile_info& ti, items_) {
|
||||
for (const tile_info& ti : items_) {
|
||||
sum.vector_sum_assign(ti.offset);
|
||||
}
|
||||
if (items_.size() > 0) {
|
||||
|
@ -94,7 +92,7 @@ void map_fragment::center_by_mass()
|
|||
{
|
||||
shift(center_of_mass().vector_negation());
|
||||
area_.clear();
|
||||
BOOST_FOREACH(tile_info& ti, items_) {
|
||||
for (tile_info& ti : items_) {
|
||||
area_.insert(ti.offset);
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +100,7 @@ void map_fragment::center_by_mass()
|
|||
void map_fragment::rotate_60_cw()
|
||||
{
|
||||
area_.clear();
|
||||
BOOST_FOREACH(tile_info& ti, items_) {
|
||||
for (tile_info& ti : items_) {
|
||||
map_location l = map_location::ZERO();
|
||||
int x = ti.offset.x;
|
||||
int y = ti.offset.y;
|
||||
|
@ -122,7 +120,7 @@ void map_fragment::rotate_60_cw()
|
|||
void map_fragment::rotate_60_ccw()
|
||||
{
|
||||
area_.clear();
|
||||
BOOST_FOREACH(tile_info& ti, items_) {
|
||||
for (tile_info& ti : items_) {
|
||||
map_location l = map_location::ZERO();
|
||||
int x = ti.offset.x;
|
||||
int y = ti.offset.y;
|
||||
|
@ -141,7 +139,7 @@ void map_fragment::rotate_60_ccw()
|
|||
|
||||
void map_fragment::flip_horizontal()
|
||||
{
|
||||
BOOST_FOREACH(tile_info& ti, items_) {
|
||||
for (tile_info& ti : items_) {
|
||||
ti.offset.x = -ti.offset.x;
|
||||
}
|
||||
center_by_mass();
|
||||
|
@ -149,7 +147,7 @@ void map_fragment::flip_horizontal()
|
|||
|
||||
void map_fragment::flip_vertical()
|
||||
{
|
||||
BOOST_FOREACH(tile_info& ti, items_) {
|
||||
for (tile_info& ti : items_) {
|
||||
ti.offset.y = -ti.offset.y;
|
||||
if (ti.offset.x % 2) {
|
||||
ti.offset.y--;
|
||||
|
@ -168,11 +166,11 @@ std::string map_fragment::dump() const
|
|||
{
|
||||
std::stringstream ss;
|
||||
ss << "MF: ";
|
||||
BOOST_FOREACH(const tile_info& ti, items_) {
|
||||
for (const tile_info& ti : items_) {
|
||||
ss << "(" << ti.offset << ")";
|
||||
}
|
||||
ss << " -- ";
|
||||
BOOST_FOREACH(const map_location& loc, area_) {
|
||||
for (const map_location& loc : area_) {
|
||||
ss << "(" << loc << ")";
|
||||
}
|
||||
return ss.str();
|
||||
|
|
|
@ -27,15 +27,13 @@
|
|||
|
||||
#include "wml_separators.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace editor {
|
||||
|
||||
template<class Item>
|
||||
sdl_handler_vector editor_palette<Item>::handler_members()
|
||||
{
|
||||
sdl_handler_vector h;
|
||||
BOOST_FOREACH(gui::widget& b, buttons_) {
|
||||
for (gui::widget& b : buttons_) {
|
||||
h.push_back(&b);
|
||||
}
|
||||
return h;
|
||||
|
@ -169,7 +167,7 @@ void editor_palette<Item>::set_group(const std::string& id)
|
|||
assert(!id.empty());
|
||||
|
||||
bool found = false;
|
||||
BOOST_FOREACH(const item_group& group, groups_) {
|
||||
for (const item_group& group : groups_) {
|
||||
if (group.id == id) {
|
||||
found = true;
|
||||
gui::button* palette_menu_button = gui_.find_menu_button("menu-editor-terrain");
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
#include "common_palette.hpp"
|
||||
#include "tristate_button.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace editor {
|
||||
|
||||
template<class Item>
|
||||
|
@ -135,7 +133,7 @@ private:
|
|||
if (!hidden)
|
||||
help_handle_ = gui_.video().set_help_string(get_help_string());
|
||||
else gui_.video().clear_help_string(help_handle_);
|
||||
BOOST_FOREACH(gui::widget& w, buttons_) {
|
||||
for (gui::widget& w : buttons_) {
|
||||
w.hide(hidden);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "item_palette.hpp"
|
||||
#include "gettext.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace editor {
|
||||
|
@ -34,11 +33,11 @@ std::string item_palette::get_help_string()
|
|||
void item_palette::setup(const config& cfg)
|
||||
{
|
||||
|
||||
BOOST_FOREACH(const config& group, cfg.child_range("item_group")) {
|
||||
for (const config& group : cfg.child_range("item_group")) {
|
||||
|
||||
groups_.push_back(item_group(group));
|
||||
|
||||
BOOST_FOREACH(const config& item, group.child_range("item")) {
|
||||
for (const config& item : group.child_range("item")) {
|
||||
|
||||
item_map_.insert(std::pair<std::string, overlay>(item["id"], overlay(item)));
|
||||
group_map_[group["id"]].push_back(item["id"]);
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "tooltips.hpp"
|
||||
#include "editor/action/mouse/mouse_action.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace editor {
|
||||
|
||||
|
@ -144,7 +143,7 @@ void palette_manager::draw_contents()
|
|||
sdl_handler_vector palette_manager::handler_members()
|
||||
{
|
||||
//handler_vector h;
|
||||
// BOOST_FOREACH(gui::widget& b, active_palette().get_widgets()) {
|
||||
// for (gui::widget& b : active_palette().get_widgets()) {
|
||||
// h.push_back(&b);
|
||||
// }
|
||||
//return h;
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include "gettext.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace {
|
||||
static t_translation::t_terrain fg_terrain;
|
||||
static t_translation::t_terrain bg_terrain;
|
||||
|
@ -79,7 +77,7 @@ void terrain_palette::setup(const config& cfg)
|
|||
|
||||
// Get the available groups and add them to the structure
|
||||
std::set<std::string> group_names;
|
||||
BOOST_FOREACH(const config &group, cfg.child_range("editor_group"))
|
||||
for (const config &group : cfg.child_range("editor_group"))
|
||||
{
|
||||
if (group_names.find(group["id"]) == group_names.end()) {
|
||||
|
||||
|
@ -96,12 +94,12 @@ void terrain_palette::setup(const config& cfg)
|
|||
}
|
||||
|
||||
std::map<std::string, item_group*> id_to_group;
|
||||
BOOST_FOREACH(item_group& group, groups_) {
|
||||
for (item_group& group : groups_) {
|
||||
id_to_group.insert(std::make_pair(group.id, &group));
|
||||
}
|
||||
|
||||
// add the groups for all terrains to the map
|
||||
BOOST_FOREACH(const t_translation::t_terrain& t, items) {
|
||||
for (const t_translation::t_terrain& t : items) {
|
||||
|
||||
const terrain_type& t_info = map().get_terrain_info(t);
|
||||
DBG_ED << "Palette: processing terrain " << t_info.name()
|
||||
|
@ -120,7 +118,7 @@ void terrain_palette::setup(const config& cfg)
|
|||
|
||||
item_map_[get_id(t)] = t;
|
||||
|
||||
BOOST_FOREACH(const std::string& k, keys) {
|
||||
for (const std::string& k : keys) {
|
||||
group_map_[k].push_back(get_id(t));
|
||||
nmax_items_ = std::max(nmax_items_, group_map_[k].size());
|
||||
std::map<std::string, item_group*>::iterator i = id_to_group.find(k);
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
|
||||
#include "units/types.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace editor {
|
||||
|
||||
std::string unit_palette::get_help_string() {
|
||||
|
@ -34,7 +32,7 @@ std::string unit_palette::get_help_string() {
|
|||
|
||||
void unit_palette::setup(const config& /*cfg*/)
|
||||
{
|
||||
BOOST_FOREACH(const unit_type_data::unit_type_map::value_type &i, unit_types.types())
|
||||
for (const unit_type_data::unit_type_map::value_type &i : unit_types.types())
|
||||
{
|
||||
if (i.second.do_not_list())
|
||||
continue;
|
||||
|
@ -52,7 +50,7 @@ void unit_palette::setup(const config& /*cfg*/)
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const race_map::value_type &i, unit_types.races())
|
||||
for (const race_map::value_type &i : unit_types.races())
|
||||
{
|
||||
if (group_map_[i.second.id()].empty())
|
||||
continue;
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
|
||||
#include "pathutils.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace editor {
|
||||
|
||||
/*WIKI
|
||||
|
@ -74,11 +72,11 @@ brush::brush(const config& cfg)
|
|||
if (radius > 0) {
|
||||
std::vector<map_location> in_radius;
|
||||
get_tiles_in_radius(map_location(0, 0), radius, in_radius);
|
||||
BOOST_FOREACH(map_location& loc, in_radius) {
|
||||
for (map_location& loc : in_radius) {
|
||||
add_relative_location(loc.x, loc.y);
|
||||
}
|
||||
}
|
||||
BOOST_FOREACH(const config &relative, cfg.child_range("relative"))
|
||||
for (const config &relative : cfg.child_range("relative"))
|
||||
{
|
||||
int x = relative["x"];
|
||||
int y = relative["y"];
|
||||
|
@ -97,7 +95,7 @@ void brush::add_relative_location(int relative_x, int relative_y)
|
|||
std::set<map_location> brush::project(const map_location& hotspot) const
|
||||
{
|
||||
std::set<map_location> result;
|
||||
BOOST_FOREACH(const map_location& relative, relative_tiles_) {
|
||||
for (const map_location& relative : relative_tiles_) {
|
||||
result.insert(relative.vector_sum(hotspot));
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "editor/action/mouse/mouse_action_item.hpp"
|
||||
#include "editor/action/mouse/mouse_action_select.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace editor {
|
||||
|
||||
editor_toolkit::editor_toolkit(editor_display& gui, const CKey& key,
|
||||
|
@ -44,7 +42,7 @@ editor_toolkit::editor_toolkit(editor_display& gui, const CKey& key,
|
|||
editor_toolkit::~editor_toolkit()
|
||||
{
|
||||
//TODO ask someone about that
|
||||
//BOOST_FOREACH(const mouse_action_map::value_type a, mouse_actions_) {
|
||||
//for (const mouse_action_map::value_type a : mouse_actions_) {
|
||||
// delete a.second;
|
||||
//}
|
||||
//delete palette_manager_.get();
|
||||
|
@ -52,7 +50,7 @@ editor_toolkit::~editor_toolkit()
|
|||
|
||||
void editor_toolkit::init_brushes(const config& game_config)
|
||||
{
|
||||
BOOST_FOREACH(const config &i, game_config.child_range("brush")) {
|
||||
for (const config &i : game_config.child_range("brush")) {
|
||||
brushes_.push_back(brush(i));
|
||||
}
|
||||
if (brushes_.empty()) {
|
||||
|
@ -89,7 +87,7 @@ void editor_toolkit::init_mouse_actions(context_manager& cmanager)
|
|||
mouse_actions_.insert(std::make_pair(hotkey::HOTKEY_EDITOR_TOOL_ITEM,
|
||||
new mouse_action_item(key_, *palette_manager_->item_palette_.get())));
|
||||
|
||||
BOOST_FOREACH(const theme::menu& menu, gui_.get_theme().menus()) {
|
||||
for (const theme::menu& menu : gui_.get_theme().menus()) {
|
||||
if (menu.items().size() == 1) {
|
||||
hotkey::HOTKEY_COMMAND hk = hotkey::get_id(menu.items().front());
|
||||
mouse_action_map::iterator i = mouse_actions_.find(hk);
|
||||
|
@ -152,7 +150,7 @@ void editor_toolkit::clear_mouseover_overlay()
|
|||
|
||||
void editor_toolkit::set_brush(std::string id) {
|
||||
|
||||
BOOST_FOREACH(brush& i, brushes_) {
|
||||
for (brush& i : brushes_) {
|
||||
if (i.id() == id) {
|
||||
brush_ = &i;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/system/windows_error.hpp>
|
||||
#include <boost/iostreams/device/file_descriptor.hpp>
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
|
@ -1002,7 +1001,7 @@ void binary_paths_manager::set_paths(const config& cfg)
|
|||
cleanup();
|
||||
init_binary_paths();
|
||||
|
||||
BOOST_FOREACH(const config &bp, cfg.child_range("binary_path"))
|
||||
for (const config &bp : cfg.child_range("binary_path"))
|
||||
{
|
||||
std::string path = bp["path"].str();
|
||||
if (path.find("..") != std::string::npos) {
|
||||
|
@ -1076,7 +1075,7 @@ const std::vector<std::string>& get_binary_paths(const std::string& type)
|
|||
|
||||
init_binary_paths();
|
||||
|
||||
BOOST_FOREACH(const std::string &path, binary_paths)
|
||||
for(const std::string &path : binary_paths)
|
||||
{
|
||||
res.push_back(get_user_data_dir() + "/" + path + type + "/");
|
||||
|
||||
|
@ -1109,7 +1108,7 @@ std::string get_binary_file_location(const std::string& type, const std::string&
|
|||
if (!is_legal_file(filename))
|
||||
return std::string();
|
||||
|
||||
BOOST_FOREACH(const std::string &bp, get_binary_paths(type))
|
||||
for(const std::string &bp : get_binary_paths(type))
|
||||
{
|
||||
path bpath(bp);
|
||||
bpath /= filename;
|
||||
|
@ -1129,7 +1128,7 @@ std::string get_binary_dir_location(const std::string &type, const std::string &
|
|||
if (!is_legal_file(filename))
|
||||
return std::string();
|
||||
|
||||
BOOST_FOREACH(const std::string &bp, get_binary_paths(type))
|
||||
for (const std::string &bp : get_binary_paths(type))
|
||||
{
|
||||
path bpath(bp);
|
||||
bpath /= filename;
|
||||
|
|
19
src/font.cpp
19
src/font.cpp
|
@ -33,7 +33,6 @@
|
|||
#include "serialization/unicode.hpp"
|
||||
#include "preferences.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <list>
|
||||
|
@ -413,12 +412,12 @@ void manager::init() const
|
|||
#endif
|
||||
|
||||
#if CAIRO_HAS_WIN32_FONT
|
||||
BOOST_FOREACH(const std::string& path, filesystem::get_binary_paths("fonts")) {
|
||||
for(const std::string& path : filesystem::get_binary_paths("fonts")) {
|
||||
std::vector<std::string> files;
|
||||
if(filesystem::is_directory(path)) {
|
||||
filesystem::get_files_in_dir(path, &files, nullptr, filesystem::ENTIRE_FILE_PATH);
|
||||
}
|
||||
BOOST_FOREACH(const std::string& file, files) {
|
||||
for(const std::string& file : files) {
|
||||
if(file.substr(file.length() - 4) == ".ttf" || file.substr(file.length() - 4) == ".ttc")
|
||||
{
|
||||
const std::wstring wfile = unicode_cast<std::wstring>(file);
|
||||
|
@ -436,11 +435,11 @@ void manager::deinit() const
|
|||
#endif
|
||||
|
||||
#if CAIRO_HAS_WIN32_FONT
|
||||
BOOST_FOREACH(const std::string& path, filesystem::get_binary_paths("fonts")) {
|
||||
for(const std::string& path : filesystem::get_binary_paths("fonts")) {
|
||||
std::vector<std::string> files;
|
||||
if(filesystem::is_directory(path))
|
||||
filesystem::get_files_in_dir(path, &files, nullptr, filesystem::ENTIRE_FILE_PATH);
|
||||
BOOST_FOREACH(const std::string& file, files) {
|
||||
for(const std::string& file : files) {
|
||||
if(file.substr(file.length() - 4) == ".ttf" || file.substr(file.length() - 4) == ".ttc")
|
||||
{
|
||||
const std::wstring wfile = unicode_cast<std::wstring>(file);
|
||||
|
@ -487,7 +486,7 @@ font::subset_descriptor::subset_descriptor(const config & font)
|
|||
|
||||
std::vector<std::string> ranges = utils::split(font["codepoints"]);
|
||||
|
||||
BOOST_FOREACH(const std::string & i, ranges) {
|
||||
for (const std::string & i : ranges) {
|
||||
std::vector<std::string> r = utils::split(i, '-');
|
||||
if(r.size() == 1) {
|
||||
size_t r1 = lexical_cast_default<size_t>(r[0], 0);
|
||||
|
@ -546,7 +545,7 @@ static void set_font_list(const std::vector<subset_descriptor>& fontlist)
|
|||
italic_names.push_back("");
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const subset_descriptor::range &cp_range, itor->present_codepoints) {
|
||||
for (const subset_descriptor::range &cp_range : itor->present_codepoints) {
|
||||
char_blocks.insert(cp_range.first, cp_range.second, subset);
|
||||
}
|
||||
}
|
||||
|
@ -705,7 +704,7 @@ void text_surface::measure() const
|
|||
w_ = 0;
|
||||
h_ = 0;
|
||||
|
||||
BOOST_FOREACH(text_chunk const &chunk, chunks_)
|
||||
for(text_chunk const &chunk : chunks_)
|
||||
{
|
||||
TTF_Font* ttfont = get_font(font_id(chunk.subset, font_size_, style_));
|
||||
if(ttfont == nullptr) {
|
||||
|
@ -751,7 +750,7 @@ std::vector<surface> const &text_surface::get_surfaces() const
|
|||
if(width() > max_text_line_width)
|
||||
return surfs_;
|
||||
|
||||
BOOST_FOREACH(text_chunk const &chunk, chunks_)
|
||||
for(text_chunk const &chunk : chunks_)
|
||||
{
|
||||
TTF_Font* ttfont = get_font(font_id(chunk.subset, font_size_, style_));
|
||||
|
||||
|
@ -1071,7 +1070,7 @@ bool load_font_config()
|
|||
return false;
|
||||
|
||||
std::set<std::string> known_fonts;
|
||||
BOOST_FOREACH(const config &font, fonts_config.child_range("font")) {
|
||||
for (const config &font : fonts_config.child_range("font")) {
|
||||
known_fonts.insert(font["name"]);
|
||||
if (font.has_attribute("bold_name")) {
|
||||
known_fonts.insert(font["bold_name"]);
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "random_new.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace game_logic
|
||||
{
|
||||
|
||||
|
@ -123,7 +121,7 @@ private:
|
|||
std::stringstream s;
|
||||
s << '[';
|
||||
bool first_item = true;
|
||||
BOOST_FOREACH(expression_ptr a , items_) {
|
||||
for(expression_ptr a : items_) {
|
||||
if (!first_item) {
|
||||
s << ',';
|
||||
} else {
|
||||
|
@ -236,7 +234,7 @@ public:
|
|||
return variant(string_.as_string().empty());
|
||||
} else if(key == "char" || key == "chars") {
|
||||
std::vector<variant> chars;
|
||||
BOOST_FOREACH(char c , string_.as_string()) {
|
||||
for(char c : string_.as_string()) {
|
||||
chars.push_back(variant(std::string(1, c)));
|
||||
}
|
||||
return variant(&chars);
|
||||
|
@ -255,7 +253,7 @@ public:
|
|||
std::vector<std::string> split = utils::parenthetical_split(string_.as_string(), ',');
|
||||
std::vector<variant> items;
|
||||
items.reserve(split.size());
|
||||
BOOST_FOREACH(const std::string s , split) {
|
||||
for(const std::string s : split) {
|
||||
items.push_back(variant(s));
|
||||
}
|
||||
return variant(&items);
|
||||
|
@ -320,7 +318,7 @@ public:
|
|||
}
|
||||
std::string key = key_variant.as_string();
|
||||
bool valid = true;
|
||||
BOOST_FOREACH(char c , key) {
|
||||
for(char c : key) {
|
||||
if(!isalpha(c) && c != '_') {
|
||||
valid = false;
|
||||
break;
|
||||
|
@ -603,7 +601,7 @@ public:
|
|||
std::stringstream s;
|
||||
s << "{where:(";
|
||||
s << body_->str();
|
||||
BOOST_FOREACH(const expr_table::value_type &a, *clauses_) {
|
||||
for(const expr_table::value_type &a : *clauses_) {
|
||||
s << ", [" << a.first << "] -> ["<< a.second->str()<<"]";
|
||||
}
|
||||
s << ")}";
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "game_config.hpp"
|
||||
#include "log.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
using namespace boost::math::constants;
|
||||
|
||||
|
@ -46,7 +45,7 @@ std::string function_expression::str() const
|
|||
s << get_name();
|
||||
s << '(';
|
||||
bool first_arg = true;
|
||||
BOOST_FOREACH(expression_ptr a , args()) {
|
||||
for (expression_ptr a : args()) {
|
||||
if (!first_arg) {
|
||||
s << ',';
|
||||
} else {
|
||||
|
@ -510,7 +509,7 @@ private:
|
|||
variant execute(const formula_callable& variables, formula_debugger *fdb) const {
|
||||
std::string result;
|
||||
|
||||
BOOST_FOREACH(expression_ptr arg, args()) {
|
||||
for(expression_ptr arg : args()) {
|
||||
result += arg->evaluate(variables, fdb).string_cast();
|
||||
}
|
||||
|
||||
|
@ -1072,7 +1071,7 @@ private:
|
|||
} else {
|
||||
std::vector<variant> input;
|
||||
input.reserve(args().size());
|
||||
BOOST_FOREACH(expression_ptr expr, args()) {
|
||||
for(expression_ptr expr : args()) {
|
||||
input.push_back(expr->evaluate(variables, fdb));
|
||||
}
|
||||
return input;
|
||||
|
@ -1501,7 +1500,7 @@ typedef std::map<std::string, base_function_creator*> functions_map;
|
|||
struct functions_map_manager {
|
||||
functions_map map_;
|
||||
~functions_map_manager() {
|
||||
BOOST_FOREACH (functions_map::value_type & v, map_) {
|
||||
for (functions_map::value_type & v : map_) {
|
||||
delete(v.second);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "terrain/type_data.hpp"
|
||||
#include "units/unit.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
|
@ -68,7 +67,7 @@ game_board & game_board::operator= (game_board other)
|
|||
}
|
||||
|
||||
void game_board::new_turn(int player_num) {
|
||||
BOOST_FOREACH (unit & i, units_) {
|
||||
for (unit & i : units_) {
|
||||
if (i.side() == player_num) {
|
||||
i.new_turn();
|
||||
}
|
||||
|
@ -76,7 +75,7 @@ void game_board::new_turn(int player_num) {
|
|||
}
|
||||
|
||||
void game_board::end_turn(int player_num) {
|
||||
BOOST_FOREACH (unit & i, units_) {
|
||||
for (unit & i : units_) {
|
||||
if (i.side() == player_num) {
|
||||
i.end_turn();
|
||||
}
|
||||
|
@ -84,7 +83,7 @@ void game_board::end_turn(int player_num) {
|
|||
}
|
||||
|
||||
void game_board::set_all_units_user_end_turn() {
|
||||
BOOST_FOREACH (unit & i, units_) {
|
||||
for (unit & i : units_) {
|
||||
i.set_user_end_turn(true);
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +107,7 @@ void game_board::check_victory(bool & continue_level, bool & found_player, bool
|
|||
|
||||
not_defeated = std::set<unsigned>();
|
||||
|
||||
BOOST_FOREACH( const unit & i , units())
|
||||
for (const unit & i : units())
|
||||
{
|
||||
DBG_EE << "Found a unit: " << i.id() << " on side " << i.side() << std::endl;
|
||||
const team& tm = teams()[i.side()-1];
|
||||
|
@ -120,7 +119,7 @@ void game_board::check_victory(bool & continue_level, bool & found_player, bool
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(team& tm, teams_)
|
||||
for (team& tm : teams_)
|
||||
{
|
||||
if(tm.defeat_condition() == team::DEFEAT_CONDITION::NEVER)
|
||||
{
|
||||
|
@ -237,7 +236,7 @@ bool game_board::team_is_defeated(const team& t) const
|
|||
case team::DEFEAT_CONDITION::NO_LEADER:
|
||||
return !units_.find_leader(t.side()).valid();
|
||||
case team::DEFEAT_CONDITION::NO_UNITS:
|
||||
BOOST_FOREACH(const unit& u, units_)
|
||||
for (const unit& u : units_)
|
||||
{
|
||||
if(u.side() == t.side())
|
||||
return false;
|
||||
|
@ -332,7 +331,7 @@ bool game_board::change_terrain(const map_location &loc, const std::string &t_st
|
|||
|
||||
map_->set_terrain(loc, new_t);
|
||||
|
||||
BOOST_FOREACH(const t_translation::t_terrain &ut, map_->underlying_union_terrain(loc)) {
|
||||
for(const t_translation::t_terrain &ut : map_->underlying_union_terrain(loc)) {
|
||||
preferences::encountered_terrains().insert(ut);
|
||||
}
|
||||
return true;
|
||||
|
@ -351,7 +350,7 @@ void game_board::write_config(config & cfg) const
|
|||
|
||||
//current units
|
||||
{
|
||||
BOOST_FOREACH(const unit & i, units_) {
|
||||
for (const unit & i : units_) {
|
||||
if (i.side() == side_num) {
|
||||
config& u = side.add_child("unit");
|
||||
i.get_location().write(u);
|
||||
|
@ -361,7 +360,7 @@ void game_board::write_config(config & cfg) const
|
|||
}
|
||||
//recall list
|
||||
{
|
||||
BOOST_FOREACH(const unit_const_ptr & j, t->recall_list()) {
|
||||
for (const unit_const_ptr & j : t->recall_list()) {
|
||||
config& u = side.add_child("unit");
|
||||
j->write(u);
|
||||
}
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#include "revision.h"
|
||||
#endif
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
#define DBG_NG LOG_STREAM(debug, log_engine)
|
||||
#define LOG_NG LOG_STREAM(info, log_engine)
|
||||
|
@ -301,7 +299,7 @@ namespace game_config
|
|||
}
|
||||
|
||||
server_list.clear();
|
||||
BOOST_FOREACH(const config &server, v.child_range("server"))
|
||||
for (const config &server : v.child_range("server"))
|
||||
{
|
||||
server_info sinf;
|
||||
sinf.name = server["name"].str();
|
||||
|
@ -335,7 +333,7 @@ namespace game_config
|
|||
|
||||
void add_color_info(const config &v)
|
||||
{
|
||||
BOOST_FOREACH(const config &teamC, v.child_range("color_range"))
|
||||
for (const config &teamC : v.child_range("color_range"))
|
||||
{
|
||||
const config::attribute_value *a1 = teamC.get("id"),
|
||||
*a2 = teamC.get("rgb");
|
||||
|
@ -362,9 +360,9 @@ namespace game_config
|
|||
team_rgb_colors.insert(std::make_pair(id,tp));
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config &cp, v.child_range("color_palette"))
|
||||
for (const config &cp : v.child_range("color_palette"))
|
||||
{
|
||||
BOOST_FOREACH(const config::attribute &rgb, cp.attribute_range())
|
||||
for (const config::attribute &rgb : cp.attribute_range())
|
||||
{
|
||||
std::vector<Uint32> temp;
|
||||
if(!string2rgb(rgb.second, temp)) {
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "theme.hpp"
|
||||
#include "image.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
static lg::log_domain log_config("config");
|
||||
|
@ -108,7 +107,7 @@ namespace {
|
|||
/// returns true if every define in special is also defined in general
|
||||
bool map_includes(const preproc_map& general, const preproc_map& special)
|
||||
{
|
||||
BOOST_FOREACH(const preproc_map::value_type& pair, special)
|
||||
for (const preproc_map::value_type& pair : special)
|
||||
{
|
||||
preproc_map::const_iterator it = general.find(pair.first);
|
||||
if (it == general.end() || it->second != pair.second) {
|
||||
|
@ -176,7 +175,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
filesystem::get_files_in_dir(user_campaign_dir, &user_files, &user_dirs,
|
||||
filesystem::ENTIRE_FILE_PATH);
|
||||
}
|
||||
BOOST_FOREACH(const std::string& umc, user_dirs) {
|
||||
for (const std::string& umc : user_dirs) {
|
||||
const std::string cores_file = umc + "/cores.cfg";
|
||||
if (filesystem::file_exists(cores_file)) {
|
||||
config cores;
|
||||
|
@ -189,7 +188,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
config valid_cores;
|
||||
bool current_core_valid = false;
|
||||
std::string wml_tree_root;
|
||||
BOOST_FOREACH(const config& core, cores_cfg.child_range("core")) {
|
||||
for (const config& core : cores_cfg.child_range("core")) {
|
||||
|
||||
const std::string& id = core["id"];
|
||||
if (id.empty()) {
|
||||
|
@ -274,10 +273,10 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
if (const config& campaign = game_config().find_child("campaign", "id", classification->campaign))
|
||||
{
|
||||
const bool require_campaign = campaign["require_campaign"].to_bool(true);
|
||||
BOOST_FOREACH(config& scenario, game_config_.child_range("scenario"))
|
||||
for (config& scenario : game_config_.child_range("scenario"))
|
||||
{
|
||||
scenario["require_scenario"] = require_campaign;
|
||||
BOOST_FOREACH(config& side, scenario.child_range("side"))
|
||||
for (config& side : scenario.child_range("side"))
|
||||
{
|
||||
side["no_leader"] = side["no_leader"].to_bool(true);
|
||||
}
|
||||
|
@ -352,7 +351,7 @@ void game_config_manager::load_addons_cfg()
|
|||
std::vector<std::string> error_log;
|
||||
|
||||
// Append the $user_campaign_dir/*.cfg files to addons_to_load.
|
||||
BOOST_FOREACH(const std::string& uc, user_files) {
|
||||
for(const std::string& uc : user_files) {
|
||||
const std::string file = uc;
|
||||
const int size_minus_extension = file.size() - 4;
|
||||
if(file.substr(size_minus_extension, file.size()) == ".cfg") {
|
||||
|
@ -375,7 +374,7 @@ void game_config_manager::load_addons_cfg()
|
|||
filesystem::FILE_NAME_ONLY);
|
||||
|
||||
// Append the $user_campaign_dir/*/_main.cfg files to addons_to_load.
|
||||
BOOST_FOREACH(const std::string& uc, user_dirs) {
|
||||
for (const std::string& uc : user_dirs) {
|
||||
const std::string addon_id = uc;
|
||||
const std::string addon_dir = user_campaign_dir + "/" + uc;
|
||||
|
||||
|
@ -408,7 +407,7 @@ void game_config_manager::load_addons_cfg()
|
|||
}
|
||||
|
||||
// Load the addons.
|
||||
BOOST_FOREACH(const addon_source & addon, addons_to_load) {
|
||||
for (const addon_source & addon : addons_to_load) {
|
||||
try {
|
||||
// Load this addon from the cache, to a config
|
||||
config umc_cfg;
|
||||
|
@ -419,7 +418,7 @@ void game_config_manager::load_addons_cfg()
|
|||
|
||||
for (const char ** type = tags_with_addon_id; *type; type++)
|
||||
{
|
||||
BOOST_FOREACH(config & cfg, umc_cfg.child_range(*type)) {
|
||||
for (config & cfg : umc_cfg.child_range(*type)) {
|
||||
cfg["addon_id"] = addon.addon_id;
|
||||
// Note that this may reformat the string in a canonical form.
|
||||
cfg["addon_version"] = addon.version.str();
|
||||
|
@ -463,7 +462,7 @@ void game_config_manager::load_addons_cfg()
|
|||
void game_config_manager::set_multiplayer_hashes()
|
||||
{
|
||||
config& hashes = game_config_.add_child("multiplayer_hashes");
|
||||
BOOST_FOREACH(const config &ch, game_config_.child_range("multiplayer")) {
|
||||
for (const config &ch : game_config_.child_range("multiplayer")) {
|
||||
hashes[ch["id"]] = ch.hash();
|
||||
}
|
||||
}
|
||||
|
@ -521,17 +520,13 @@ void game_config_manager::load_game_config_for_game(
|
|||
|
||||
typedef boost::shared_ptr<game_config::scoped_preproc_define> define;
|
||||
std::deque<define> extra_defines;
|
||||
BOOST_FOREACH(const std::string& extra_define,
|
||||
classification.campaign_xtra_defines) {
|
||||
define new_define
|
||||
(new game_config::scoped_preproc_define(extra_define));
|
||||
for (const std::string& extra_define : classification.campaign_xtra_defines) {
|
||||
define new_define(new game_config::scoped_preproc_define(extra_define));
|
||||
extra_defines.push_back(new_define);
|
||||
}
|
||||
std::deque<define> modification_defines;
|
||||
BOOST_FOREACH(const std::string& mod_define,
|
||||
classification.mod_defines) {
|
||||
define new_define
|
||||
(new game_config::scoped_preproc_define(mod_define, !mod_define.empty()));
|
||||
for (const std::string& mod_define : classification.mod_defines) {
|
||||
define new_define(new game_config::scoped_preproc_define(mod_define, !mod_define.empty()));
|
||||
modification_defines.push_back(new_define);
|
||||
}
|
||||
|
||||
|
@ -542,9 +537,8 @@ void game_config_manager::load_game_config_for_game(
|
|||
cache_.clear_defines();
|
||||
|
||||
std::deque<define> previous_defines;
|
||||
BOOST_FOREACH(const preproc_map::value_type& preproc, old_defines_map_) {
|
||||
define new_define
|
||||
(new game_config::scoped_preproc_define(preproc.first));
|
||||
for (const preproc_map::value_type& preproc : old_defines_map_) {
|
||||
define new_define(new game_config::scoped_preproc_define(preproc.first));
|
||||
previous_defines.push_back(new_define);
|
||||
}
|
||||
|
||||
|
@ -568,9 +562,8 @@ void game_config_manager::load_game_config_for_create(bool is_mp)
|
|||
cache_.clear_defines();
|
||||
|
||||
std::deque<define> previous_defines;
|
||||
BOOST_FOREACH(const preproc_map::value_type& preproc, old_defines_map_) {
|
||||
define new_define
|
||||
(new game_config::scoped_preproc_define(preproc.first));
|
||||
for (const preproc_map::value_type& preproc : old_defines_map_) {
|
||||
define new_define(new game_config::scoped_preproc_define(preproc.first));
|
||||
previous_defines.push_back(new_define);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "units/drawer.hpp"
|
||||
#include "whiteboard/manager.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
static lg::log_domain log_display("display");
|
||||
|
@ -275,7 +274,7 @@ void game_display::draw_invalidated()
|
|||
|
||||
unit_drawer drawer = unit_drawer(*this, energy_bar_rects_);
|
||||
|
||||
BOOST_FOREACH(const unit* temp_unit, *fake_unit_man_) {
|
||||
for (const unit* temp_unit : *fake_unit_man_) {
|
||||
const map_location& loc = temp_unit->get_location();
|
||||
exclusive_unit_draw_requests_t::iterator request = exclusive_unit_draw_requests_.find(loc);
|
||||
if (invalidated_.find(loc) != invalidated_.end()
|
||||
|
@ -477,7 +476,7 @@ void game_display::draw_sidebar()
|
|||
|
||||
// We display the unit the mouse is over if it is over a unit,
|
||||
// otherwise we display the unit that is selected.
|
||||
BOOST_FOREACH(const std::string &name, reports_object_->report_list()) {
|
||||
for (const std::string &name : reports_object_->report_list()) {
|
||||
refresh_report(name);
|
||||
}
|
||||
invalidateGameStatus_ = false;
|
||||
|
@ -694,7 +693,7 @@ void game_display::highlight_reach(const pathfind::paths &paths_list)
|
|||
void game_display::highlight_another_reach(const pathfind::paths &paths_list)
|
||||
{
|
||||
// Fold endpoints of routes into reachability map.
|
||||
BOOST_FOREACH(const pathfind::paths::step &dest, paths_list.destinations) {
|
||||
for (const pathfind::paths::step &dest : paths_list.destinations) {
|
||||
reach_map_[dest.curr]++;
|
||||
}
|
||||
reach_map_changed_ = true;
|
||||
|
|
|
@ -67,7 +67,6 @@
|
|||
#include "wml_exception.hpp"
|
||||
#include "whiteboard/manager.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/assign/list_of.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
|
@ -228,7 +227,7 @@ namespace { // Support functions
|
|||
t_filter.get_locations(locs, true);
|
||||
|
||||
// Loop through sides.
|
||||
BOOST_FOREACH(const int &side_num, sides)
|
||||
for (const int &side_num : sides)
|
||||
{
|
||||
team &t = (*resources::teams)[side_num-1];
|
||||
if ( !clear )
|
||||
|
@ -243,8 +242,9 @@ namespace { // Support functions
|
|||
t.add_fog_override(locs);
|
||||
else
|
||||
// Simply clear fog from the locations.
|
||||
BOOST_FOREACH(const map_location &hex, locs)
|
||||
for (const map_location &hex : locs) {
|
||||
t.clear_fog(hex);
|
||||
}
|
||||
}
|
||||
|
||||
// Flag a screen update.
|
||||
|
@ -453,7 +453,7 @@ WML_HANDLER_FUNCTION(move_units_fake, cfg)
|
|||
|
||||
size_t longest_path = 0;
|
||||
|
||||
BOOST_FOREACH(const vconfig& config, unit_cfgs) {
|
||||
for (const vconfig& config : unit_cfgs) {
|
||||
const std::vector<std::string> xvals = utils::split(config["x"]);
|
||||
const std::vector<std::string> yvals = utils::split(config["y"]);
|
||||
int skip_steps = config["skip_steps"];
|
||||
|
@ -533,7 +533,7 @@ WML_HANDLER_FUNCTION(recall, cfg)
|
|||
const map_location cfg_loc = cfg_to_loc(cfg);
|
||||
|
||||
/// @todo fendrin: comment this monster
|
||||
BOOST_FOREACH(unit_map::const_unit_iterator leader, leaders) {
|
||||
for (unit_map::const_unit_iterator leader : leaders) {
|
||||
DBG_NG << "...considering " + leader->id() + " as the recalling leader...\n";
|
||||
map_location loc = cfg_loc;
|
||||
if ( lfilt(*leader) &&
|
||||
|
@ -909,7 +909,7 @@ WML_HANDLER_FUNCTION(set_variable, cfg)
|
|||
|
||||
variable_access_const vi = resources::gamedata->get_variable_access_read(array_name);
|
||||
bool first = true;
|
||||
BOOST_FOREACH(const config &cfg, vi.as_array())
|
||||
for (const config &cfg : vi.as_array())
|
||||
{
|
||||
std::string current_string = cfg[key_name];
|
||||
if (remove_empty && current_string.empty()) continue;
|
||||
|
@ -942,7 +942,7 @@ WML_HANDLER_FUNCTION(set_variables, cfg)
|
|||
try
|
||||
{
|
||||
variable_access_const tovar = resources::gamedata->get_variable_access_read(cfg["to_variable"]);
|
||||
BOOST_FOREACH(const config& c, tovar.as_array())
|
||||
for (const config& c : tovar.as_array())
|
||||
{
|
||||
data.push_back(c);
|
||||
}
|
||||
|
@ -953,7 +953,7 @@ WML_HANDLER_FUNCTION(set_variables, cfg)
|
|||
}
|
||||
} else {
|
||||
typedef std::pair<std::string, vconfig> vchild;
|
||||
BOOST_FOREACH(const vchild& p, cfg.all_ordered()) {
|
||||
for (const vchild& p : cfg.all_ordered()) {
|
||||
if(p.first == "value") {
|
||||
data.push_back(p.second.get_parsed_config());
|
||||
} else if(p.first == "literal") {
|
||||
|
@ -1003,7 +1003,7 @@ WML_HANDLER_FUNCTION(set_variables, cfg)
|
|||
{
|
||||
//merge children into one
|
||||
config merged_children;
|
||||
BOOST_FOREACH(const config &cfg, data) {
|
||||
for (const config &cfg : data) {
|
||||
merged_children.append(cfg);
|
||||
}
|
||||
data = boost::assign::list_of(merged_children).convert_to_container<std::vector<config> >();
|
||||
|
@ -1177,7 +1177,7 @@ WML_HANDLER_FUNCTION(tunnel, cfg)
|
|||
const bool remove = cfg["remove"].to_bool(false);
|
||||
if (remove) {
|
||||
const std::vector<std::string> ids = utils::split(cfg["id"]);
|
||||
BOOST_FOREACH(const std::string &id, ids) {
|
||||
for (const std::string &id : ids) {
|
||||
resources::tunnels->remove(id);
|
||||
}
|
||||
} else if (cfg.get_children("source").empty() ||
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "util.hpp"
|
||||
#include "variable.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/assign/list_of.hpp>
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
|
@ -72,7 +71,7 @@ namespace { // Support functions
|
|||
? utils::parse_ranges((*u)["count"]) : default_counts;
|
||||
int match_count = 0;
|
||||
const unit_filter ufilt(*u, resources::filter_con);
|
||||
BOOST_FOREACH(const unit &i, *resources::units)
|
||||
for (const unit &i : *resources::units)
|
||||
{
|
||||
if ( i.hitpoints() > 0 && ufilt(i) ) {
|
||||
++match_count;
|
||||
|
@ -125,7 +124,7 @@ namespace { // Support functions
|
|||
// to see if the variable matches the conditions or not.
|
||||
const vconfig::child_list& variables = cond.get_children("variable");
|
||||
|
||||
BOOST_FOREACH(const vconfig &values, variables)
|
||||
for (const vconfig &values : variables)
|
||||
{
|
||||
const std::string name = values["name"];
|
||||
config::attribute_value value = resources::gamedata->get_variable_const(name);
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "soundsource.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <iostream>
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "soundsource.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <iostream>
|
||||
|
||||
|
@ -72,10 +71,10 @@ manager::manager()
|
|||
|
||||
void manager::read_scenario(const config& scenario_cfg)
|
||||
{
|
||||
BOOST_FOREACH(const config &ev, scenario_cfg.child_range("event")) {
|
||||
for(const config &ev : scenario_cfg.child_range("event")) {
|
||||
add_event_handler(ev);
|
||||
}
|
||||
BOOST_FOREACH(const std::string &id, utils::split(scenario_cfg["unit_wml_ids"])) {
|
||||
for(const std::string &id : utils::split(scenario_cfg["unit_wml_ids"])) {
|
||||
unit_wml_ids_.insert(id);
|
||||
}
|
||||
|
||||
|
@ -169,7 +168,7 @@ void manager::add_events(const config::const_child_itors &cfgs, const std::strin
|
|||
if(std::find(unit_wml_ids_.begin(),unit_wml_ids_.end(),type) != unit_wml_ids_.end()) return;
|
||||
unit_wml_ids_.insert(type);
|
||||
}
|
||||
BOOST_FOREACH(const config &new_ev, cfgs) {
|
||||
for(const config &new_ev : cfgs) {
|
||||
if(type.empty() && new_ev["id"].empty())
|
||||
{
|
||||
WRN_NG << "attempt to add an [event] with empty id=, ignoring " << std::endl;
|
||||
|
@ -181,7 +180,7 @@ void manager::add_events(const config::const_child_itors &cfgs, const std::strin
|
|||
|
||||
void manager::write_events(config& cfg)
|
||||
{
|
||||
BOOST_FOREACH(const handler_ptr &eh, *event_handlers_) {
|
||||
for(const handler_ptr &eh : *event_handlers_) {
|
||||
if ( !eh || eh->is_menu_item() ) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "soundsource.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <iostream>
|
||||
|
||||
|
@ -50,7 +49,7 @@ namespace game_events {
|
|||
|
||||
std::stringstream ss;
|
||||
|
||||
BOOST_FOREACH( const handler_ptr & h, active_ ) {
|
||||
for (const handler_ptr & h : active_) {
|
||||
if ( !h )
|
||||
continue;
|
||||
const config& cfg = h->get_config();
|
||||
|
@ -132,7 +131,7 @@ namespace game_events {
|
|||
dynamic_.push_back(new_handler);
|
||||
else {
|
||||
std::vector<std::string> name_list = utils::split(name);
|
||||
BOOST_FOREACH( const std::string & single_name, name_list )
|
||||
for (const std::string & single_name : name_list)
|
||||
by_name_[standardize_name(single_name)].push_back(new_handler);
|
||||
}
|
||||
// File by ID.
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "variable.hpp"
|
||||
#include "resources.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
|
@ -192,21 +191,21 @@ namespace { // Support functions
|
|||
unit_map::const_iterator unit2 = units->find(ev.loc2);
|
||||
vconfig filters(handler.get_config());
|
||||
|
||||
BOOST_FOREACH(const vconfig &condition, filters.get_children("filter_condition"))
|
||||
for (const vconfig &condition : filters.get_children("filter_condition"))
|
||||
{
|
||||
if (!conditional_passed(condition)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const vconfig &f, filters.get_children("filter_side"))
|
||||
for (const vconfig &f : filters.get_children("filter_side"))
|
||||
{
|
||||
side_filter ssf(f, &resources::controller->gamestate());
|
||||
if ( !ssf.match(resources::controller->current_side()) )
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const vconfig &f, filters.get_children("filter"))
|
||||
for (const vconfig &f : filters.get_children("filter"))
|
||||
{
|
||||
if ( !ev.loc1.matches_unit_filter(unit1, f) ) {
|
||||
return false;
|
||||
|
@ -219,7 +218,7 @@ namespace { // Support functions
|
|||
{
|
||||
const bool matches_unit = ev.loc1.matches_unit(unit1);
|
||||
const config & attack = ev.data.child("first");
|
||||
BOOST_FOREACH(const vconfig &f, special_filters)
|
||||
for (const vconfig &f : special_filters)
|
||||
{
|
||||
if ( f.empty() )
|
||||
special_matches = true;
|
||||
|
@ -234,7 +233,7 @@ namespace { // Support functions
|
|||
return false;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const vconfig &f, filters.get_children("filter_second"))
|
||||
for (const vconfig &f : filters.get_children("filter_second"))
|
||||
{
|
||||
if ( !ev.loc2.matches_unit_filter(unit2, f) ) {
|
||||
return false;
|
||||
|
@ -247,7 +246,7 @@ namespace { // Support functions
|
|||
{
|
||||
const bool matches_unit = ev.loc2.matches_unit(unit2);
|
||||
const config & attack = ev.data.child("second");
|
||||
BOOST_FOREACH(const vconfig &f, special_filters)
|
||||
for (const vconfig &f : special_filters)
|
||||
{
|
||||
if ( f.empty() )
|
||||
special_matches = true;
|
||||
|
@ -508,7 +507,7 @@ bool t_pump::operator()()
|
|||
}
|
||||
if(!lg::debug().dont_log("event_handler")) {
|
||||
std::stringstream ss;
|
||||
BOOST_FOREACH(const queued_event& ev, impl_->events_queue) {
|
||||
for(const queued_event& ev : impl_->events_queue) {
|
||||
ss << "name=" << ev.name << "; ";
|
||||
}
|
||||
DBG_EH << "processing queued events: " << ss.str() << "\n";
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
#include "log.hpp"
|
||||
#include "map/location.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
#define WRN_NG LOG_STREAM(warn, log_engine)
|
||||
#define LOG_NG LOG_STREAM(info, log_engine)
|
||||
|
@ -122,7 +120,7 @@ std::vector<std::pair<boost::shared_ptr<const wml_menu_item>, std::string> > wmi
|
|||
scoped_xy_unit highlighted_unit("unit", hex.x, hex.y, units);
|
||||
|
||||
// Check each menu item.
|
||||
BOOST_FOREACH( const item_ptr & item, std::make_pair (start, finish) )
|
||||
for (const item_ptr & item : std::make_pair (start, finish))
|
||||
{
|
||||
// Can this item be shown?
|
||||
if ( item->use_wml_menu() && (!item->is_synced() || resources::controller->can_use_synced_wml_menu()) && item->can_show(hex, gamedata, fc) )
|
||||
|
@ -151,7 +149,7 @@ void wmi_container::init_handlers() const
|
|||
unsigned wmi_count = 0;
|
||||
|
||||
// Loop through each menu item.
|
||||
BOOST_FOREACH( const item_ptr & wmi, *this ) {
|
||||
for (const item_ptr & wmi : *this) {
|
||||
// If this menu item has a [command], add a handler for it.
|
||||
wmi->init_handler();
|
||||
// Count the menu items (for the diagnostic message).
|
||||
|
@ -167,7 +165,7 @@ void wmi_container::init_handlers() const
|
|||
void wmi_container::to_config(config& cfg) const
|
||||
{
|
||||
// Loop through our items.
|
||||
BOOST_FOREACH( const item_ptr & item, *this )
|
||||
for (const item_ptr & item : *this)
|
||||
{
|
||||
// Add this item as a child of cfg.
|
||||
item->to_config(cfg.add_child("menu_item"));
|
||||
|
@ -198,7 +196,7 @@ void wmi_container::set_item(const std::string& id, const vconfig& menu_item)
|
|||
void wmi_container::set_menu_items(const config& cfg)
|
||||
{
|
||||
wml_menu_items_.clear();
|
||||
BOOST_FOREACH(const config &item, cfg.child_range("menu_item"))
|
||||
for (const config &item : cfg.child_range("menu_item"))
|
||||
{
|
||||
if(!item.has_attribute("id")){ continue; }
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "settings.hpp"
|
||||
#include "tod_manager.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
@ -28,7 +27,7 @@ configure_engine::configure_engine(saved_game& state) :
|
|||
|
||||
set_use_map_settings(use_map_settings_default());
|
||||
if(state_.classification().get_tagname() == "scenario") {
|
||||
BOOST_FOREACH(const config& scenario,
|
||||
for (const config& scenario :
|
||||
game_config_manager::get()->game_config().child_range(state_.classification().get_tagname())) {
|
||||
|
||||
if (scenario["allow_new_game"].to_bool(true) || game_config::debug) {
|
||||
|
@ -216,7 +215,7 @@ void configure_engine::write_parameters()
|
|||
scenario["experience_modifier"] = params.xp_modifier;
|
||||
scenario["turns"] = params.num_turns;
|
||||
|
||||
BOOST_FOREACH(config& side, scenario.child_range("side"))
|
||||
for (config& side : scenario.child_range("side"))
|
||||
{
|
||||
side["fog"] = params.fog_game;
|
||||
side["shroud"] = params.shroud_game;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "playcampaign.hpp"
|
||||
#include "tod_manager.hpp"
|
||||
#include "multiplayer_ui.hpp" // For get_color_string
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/assign.hpp>
|
||||
#include <stdlib.h>
|
||||
#include <ctime>
|
||||
|
@ -113,7 +112,7 @@ connect_engine::connect_engine(saved_game& state,
|
|||
std::vector<std::string> original_team_names;
|
||||
std::string team_prefix(std::string(_("Team")) + " ");
|
||||
int side_count = 1;
|
||||
BOOST_FOREACH(config& side, sides) {
|
||||
for (config& side : sides) {
|
||||
const std::string side_str = std::to_string(side_count);
|
||||
config::attribute_value& team_name = side["team_name"];
|
||||
config::attribute_value& user_team_name =
|
||||
|
@ -170,8 +169,7 @@ connect_engine::connect_engine(saved_game& state,
|
|||
}
|
||||
|
||||
// Selected era's factions.
|
||||
BOOST_FOREACH(const config& era,
|
||||
level_.child("era").child_range("multiplayer_side")) {
|
||||
for (const config& era : level_.child("era").child_range("multiplayer_side")) {
|
||||
|
||||
era_factions_.push_back(&era);
|
||||
}
|
||||
|
@ -179,7 +177,7 @@ connect_engine::connect_engine(saved_game& state,
|
|||
game_config::add_color_info(scenario());
|
||||
// Create side engines.
|
||||
int index = 0;
|
||||
BOOST_FOREACH(const config &s, sides) {
|
||||
for (const config &s : sides) {
|
||||
side_engine_ptr new_side_engine(new side_engine(s, *this, index));
|
||||
side_engines_.push_back(new_side_engine);
|
||||
|
||||
|
@ -244,7 +242,7 @@ void connect_engine::import_user(const config& data, const bool observer,
|
|||
}
|
||||
|
||||
// Check if user has a side(s) reserved for him.
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
|
||||
for (side_engine_ptr side : side_engines_) {
|
||||
if (side->reserved_for() == username && side->player_id().empty() && side->controller() != CNTR_COMPUTER) {
|
||||
side->place_user(data);
|
||||
|
||||
|
@ -255,7 +253,7 @@ void connect_engine::import_user(const config& data, const bool observer,
|
|||
// If no sides were assigned for a user,
|
||||
// take a first available side.
|
||||
if (side_taken < 0 && !side_assigned) {
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
|
||||
for (side_engine_ptr side : side_engines_) {
|
||||
if (side->available_for_user(username) ||
|
||||
side->controller() == CNTR_LOCAL) {
|
||||
side->place_user(data);
|
||||
|
@ -268,9 +266,9 @@ void connect_engine::import_user(const config& data, const bool observer,
|
|||
|
||||
// Check if user has taken any sides, which should get control
|
||||
// over any other sides.
|
||||
BOOST_FOREACH(side_engine_ptr user_side, side_engines_) {
|
||||
for (side_engine_ptr user_side : side_engines_) {
|
||||
if(user_side->player_id() == username && !user_side->previous_save_id().empty()) {
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_){
|
||||
for (side_engine_ptr side : side_engines_){
|
||||
if(side->player_id().empty() && side->previous_save_id() == user_side->previous_save_id()) {
|
||||
side->place_user(data);
|
||||
}
|
||||
|
@ -281,7 +279,7 @@ void connect_engine::import_user(const config& data, const bool observer,
|
|||
|
||||
bool connect_engine::sides_available() const
|
||||
{
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
|
||||
for (side_engine_ptr side : side_engines_) {
|
||||
if (side->available_for_user()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -296,7 +294,7 @@ void connect_engine::update_level()
|
|||
|
||||
scenario().clear_children("side");
|
||||
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
|
||||
for (side_engine_ptr side : side_engines_) {
|
||||
scenario().add_child("side", side->new_config());
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +319,7 @@ bool connect_engine::can_start_game() const
|
|||
}
|
||||
|
||||
// First check if all sides are ready to start the game.
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
|
||||
for (side_engine_ptr side : side_engines_) {
|
||||
if (!side->ready_for_start()) {
|
||||
const int side_num = side->index() + 1;
|
||||
DBG_MP << "not all sides are ready, side " <<
|
||||
|
@ -339,7 +337,7 @@ bool connect_engine::can_start_game() const
|
|||
* creative in what is used in multiplayer [1] so use a simpler test now.
|
||||
* [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=568029
|
||||
*/
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
|
||||
for (side_engine_ptr side : side_engines_) {
|
||||
if (side->controller() != CNTR_EMPTY && side->allow_player()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -363,22 +361,24 @@ std::multimap<std::string, config> side_engine::get_side_children()
|
|||
{
|
||||
std::multimap<std::string, config> children;
|
||||
|
||||
BOOST_FOREACH(const std::string& children_to_swap, get_children_to_swap())
|
||||
BOOST_FOREACH(const config& child, cfg_.child_range(children_to_swap))
|
||||
for (const std::string& children_to_swap : get_children_to_swap()) {
|
||||
for (const config& child : cfg_.child_range(children_to_swap)) {
|
||||
children.insert(std::pair<std::string, config>(children_to_swap, child));
|
||||
}
|
||||
}
|
||||
|
||||
return children;
|
||||
}
|
||||
|
||||
void side_engine::set_side_children(std::multimap<std::string, config> children)
|
||||
{
|
||||
BOOST_FOREACH(const std::string& children_to_remove, get_children_to_swap())
|
||||
cfg_.clear_children(children_to_remove);
|
||||
for (const std::string& children_to_remove : get_children_to_swap()) {
|
||||
cfg_.clear_children(children_to_remove);
|
||||
}
|
||||
|
||||
std::pair<std::string, config> child_map;
|
||||
|
||||
BOOST_FOREACH(child_map, children)
|
||||
cfg_.add_child(child_map.first, child_map.second);
|
||||
for (std::pair<std::string, config> child_map : children) {
|
||||
cfg_.add_child(child_map.first, child_map.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -389,12 +389,12 @@ void connect_engine::start_game()
|
|||
// Resolves the "random faction", "random gender" and "random message"
|
||||
// Must be done before shuffle sides, or some cases will cause errors
|
||||
rand_rng::mt_rng rng; // Make an RNG for all the shuffling and random faction operations
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
|
||||
for (side_engine_ptr side : side_engines_) {
|
||||
std::vector<std::string> avoid_faction_ids;
|
||||
|
||||
// If we aren't resolving random factions independently at random, calculate which factions should not appear for this side.
|
||||
if (params_.random_faction_mode != mp_game_settings::RANDOM_FACTION_MODE::DEFAULT) {
|
||||
BOOST_FOREACH(side_engine_ptr side2, side_engines_) {
|
||||
for (side_engine_ptr side2 : side_engines_) {
|
||||
if (!side2->flg().is_random_faction()) {
|
||||
switch(params_.random_faction_mode.v) {
|
||||
case mp_game_settings::RANDOM_FACTION_MODE::NO_MIRROR:
|
||||
|
@ -420,7 +420,7 @@ void connect_engine::start_game()
|
|||
|
||||
// Only playable sides should be shuffled.
|
||||
std::vector<int> playable_sides;
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
|
||||
for (side_engine_ptr side : side_engines_) {
|
||||
if (side->allow_player() && side->allow_shuffle()) {
|
||||
playable_sides.push_back(side->index());
|
||||
}
|
||||
|
@ -481,13 +481,12 @@ void connect_engine::start_game_commandline(
|
|||
rand_rng::mt_rng rng;
|
||||
|
||||
unsigned num = 0;
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
|
||||
for (side_engine_ptr side : side_engines_) {
|
||||
num++;
|
||||
|
||||
// Set the faction, if commandline option is given.
|
||||
if (cmdline_opts.multiplayer_side) {
|
||||
BOOST_FOREACH(const mp_option& option,
|
||||
*cmdline_opts.multiplayer_side) {
|
||||
for (const mp_option& option : *cmdline_opts.multiplayer_side) {
|
||||
|
||||
if (option.get<0>() == num) {
|
||||
DBG_MP << "\tsetting side " << option.get<0>() <<
|
||||
|
@ -500,8 +499,7 @@ void connect_engine::start_game_commandline(
|
|||
|
||||
// Set the controller, if commandline option is given.
|
||||
if (cmdline_opts.multiplayer_controller) {
|
||||
BOOST_FOREACH(const mp_option& option,
|
||||
*cmdline_opts.multiplayer_controller) {
|
||||
for (const mp_option& option : *cmdline_opts.multiplayer_controller) {
|
||||
|
||||
if (option.get<0>() == num) {
|
||||
DBG_MP << "\tsetting side " << option.get<0>() <<
|
||||
|
@ -516,8 +514,7 @@ void connect_engine::start_game_commandline(
|
|||
// then override if commandline option was given.
|
||||
side->set_ai_algorithm("ai_default_rca");
|
||||
if (cmdline_opts.multiplayer_algorithm) {
|
||||
BOOST_FOREACH(const mp_option& option,
|
||||
*cmdline_opts.multiplayer_algorithm) {
|
||||
for (const mp_option& option : *cmdline_opts.multiplayer_algorithm) {
|
||||
|
||||
if (option.get<0>() == num) {
|
||||
DBG_MP << "\tsetting side " << option.get<0>() <<
|
||||
|
@ -542,11 +539,10 @@ void connect_engine::start_game_commandline(
|
|||
scenario()["turns"] = *cmdline_opts.multiplayer_turns;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(config &side, scenario().child_range("side"))
|
||||
for (config &side : scenario().child_range("side"))
|
||||
{
|
||||
if (cmdline_opts.multiplayer_ai_config) {
|
||||
BOOST_FOREACH(const mp_option& option,
|
||||
*cmdline_opts.multiplayer_ai_config) {
|
||||
for (const mp_option& option : *cmdline_opts.multiplayer_ai_config) {
|
||||
|
||||
if (option.get<0>() == side["side"].to_unsigned()) {
|
||||
DBG_MP << "\tsetting side " << side["side"] <<
|
||||
|
@ -570,8 +566,7 @@ void connect_engine::start_game_commandline(
|
|||
mp_parameter;
|
||||
|
||||
if (cmdline_opts.multiplayer_parm) {
|
||||
BOOST_FOREACH(const mp_parameter& parameter,
|
||||
*cmdline_opts.multiplayer_parm) {
|
||||
for (const mp_parameter& parameter : *cmdline_opts.multiplayer_parm) {
|
||||
|
||||
if (parameter.get<0>() == side["side"].to_unsigned()) {
|
||||
DBG_MP << "\tsetting side " << side["side"] << " " <<
|
||||
|
@ -662,7 +657,7 @@ std::pair<bool, bool> connect_engine::process_network_data(const config& data,
|
|||
// This side is already taken.
|
||||
// Try to reassing the player to a different position.
|
||||
side_taken = 0;
|
||||
BOOST_FOREACH(side_engine_ptr s, side_engines_) {
|
||||
for (side_engine_ptr s : side_engines_) {
|
||||
if (s->available_for_user()) {
|
||||
break;
|
||||
}
|
||||
|
@ -753,7 +748,7 @@ void connect_engine::process_network_error(network::error& error)
|
|||
int connect_engine::find_user_side_index_by_id(const std::string& id) const
|
||||
{
|
||||
size_t i = 0;
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
|
||||
for (side_engine_ptr side : side_engines_) {
|
||||
if (side->player_id() == id) {
|
||||
break;
|
||||
}
|
||||
|
@ -793,7 +788,7 @@ void connect_engine::save_reserved_sides_information()
|
|||
// N.B. This information is needed only for a host player.
|
||||
std::map<std::string, std::string> side_users =
|
||||
utils::map_split(level_.child_or_empty("multiplayer")["side_users"]);
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
|
||||
for (side_engine_ptr side : side_engines_) {
|
||||
const std::string& save_id = side->save_id();
|
||||
const std::string& player_id = side->player_id();
|
||||
if (!save_id.empty() && !player_id.empty()) {
|
||||
|
@ -808,7 +803,7 @@ void connect_engine::load_previous_sides_users()
|
|||
std::map<std::string, std::string> side_users =
|
||||
utils::map_split(level_.child("multiplayer")["side_users"]);
|
||||
std::set<std::string> names;
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
|
||||
for (side_engine_ptr side : side_engines_) {
|
||||
const std::string& save_id = side->previous_save_id();
|
||||
if (side_users.find(save_id) != side_users.end()) {
|
||||
side->set_reserved_for(side_users[save_id]);
|
||||
|
@ -822,7 +817,7 @@ void connect_engine::load_previous_sides_users()
|
|||
}
|
||||
}
|
||||
//Do this in an extra loop to make sure we import each user only once.
|
||||
BOOST_FOREACH(const std::string& name, names)
|
||||
for (const std::string& name : names)
|
||||
{
|
||||
if (connected_users().find(name) != connected_users().end() || !campaign_info_) {
|
||||
import_user(name, false);
|
||||
|
@ -832,7 +827,7 @@ void connect_engine::load_previous_sides_users()
|
|||
|
||||
void connect_engine::update_side_controller_options()
|
||||
{
|
||||
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
|
||||
for (side_engine_ptr side : side_engines_) {
|
||||
side->update_controller_options();
|
||||
}
|
||||
}
|
||||
|
@ -924,7 +919,7 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine,
|
|||
|
||||
// Initialize team and color.
|
||||
unsigned team_name_index = 0;
|
||||
BOOST_FOREACH(const std::string& name, parent_.team_names_) {
|
||||
for (const std::string& name : parent_.team_names_) {
|
||||
if (name == cfg["team_name"]) {
|
||||
break;
|
||||
}
|
||||
|
@ -1064,7 +1059,7 @@ config side_engine::new_config() const
|
|||
// and gender values for it.
|
||||
config* leader = &res;
|
||||
if (flg_.default_leader_cfg() != nullptr) {
|
||||
BOOST_FOREACH(config& side_unit, res.child_range("unit")) {
|
||||
for (config& side_unit : res.child_range("unit")) {
|
||||
if (*flg_.default_leader_cfg() == side_unit) {
|
||||
leader = &side_unit;
|
||||
if (flg_.current_leader() != (*leader)["type"]) {
|
||||
|
@ -1095,7 +1090,7 @@ config side_engine::new_config() const
|
|||
if (parent_.params_.use_map_settings && !parent_.params_.saved_game) {
|
||||
config trimmed = cfg_;
|
||||
|
||||
BOOST_FOREACH(const std::string& attribute, attributes_to_trim) {
|
||||
for (const std::string& attribute : attributes_to_trim) {
|
||||
trimmed.remove_attribute(attribute);
|
||||
}
|
||||
|
||||
|
@ -1259,7 +1254,7 @@ void side_engine::update_controller_options()
|
|||
|
||||
// Connected users.
|
||||
add_controller_option(CNTR_LAST, _("--give--"), "human");
|
||||
BOOST_FOREACH(const std::string& user, parent_.connected_users()) {
|
||||
for (const std::string& user : parent_.connected_users()) {
|
||||
add_controller_option(parent_.default_controller_, user, "human");
|
||||
}
|
||||
|
||||
|
@ -1269,7 +1264,7 @@ void side_engine::update_controller_options()
|
|||
void side_engine::update_current_controller_index()
|
||||
{
|
||||
int i = 0;
|
||||
BOOST_FOREACH(const controller_option& option, controller_options_) {
|
||||
for (const controller_option& option : controller_options_) {
|
||||
if (option.first == controller_) {
|
||||
current_controller_index_ = i;
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "serialization/preprocessor.hpp"
|
||||
#include "serialization/parser.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <sstream>
|
||||
#include <cctype>
|
||||
|
||||
|
@ -215,7 +214,7 @@ void scenario::set_sides()
|
|||
}
|
||||
|
||||
num_players_ = 0;
|
||||
BOOST_FOREACH(const config &scenario, data_.child_range("side")) {
|
||||
for (const config &scenario : data_.child_range("side")) {
|
||||
if (scenario["allow_player"].to_bool(true)) {
|
||||
++num_players_;
|
||||
}
|
||||
|
@ -436,7 +435,7 @@ create_engine::create_engine(CVideo& v, saved_game& state) :
|
|||
|
||||
state_.mp_settings().saved_game = false;
|
||||
|
||||
BOOST_FOREACH (const std::string& str, preferences::modifications(state_.classification().campaign_type ==
|
||||
for (const std::string& str : preferences::modifications(state_.classification().campaign_type ==
|
||||
game_classification::CAMPAIGN_TYPE::MULTIPLAYER)) {
|
||||
if (game_config_manager::get()->
|
||||
game_config().find_child("modification", "id", str))
|
||||
|
@ -522,7 +521,7 @@ void create_engine::prepare_for_era_and_mods()
|
|||
state_.classification().era_define =
|
||||
game_config_manager::get()->game_config().find_child(
|
||||
"era", "id", get_parameters().mp_era)["define"].str();
|
||||
BOOST_FOREACH(const std::string& mod_id, get_parameters().active_mods) {
|
||||
for (const std::string& mod_id : get_parameters().active_mods) {
|
||||
state_.classification().mod_defines.push_back(
|
||||
game_config_manager::get()->game_config().find_child(
|
||||
"modification", "id", mod_id)["define"].str());
|
||||
|
@ -584,7 +583,7 @@ std::string create_engine::select_campaign_difficulty(int set_value)
|
|||
// Verify the existence of difficulties
|
||||
std::vector<std::string> difficulties;
|
||||
|
||||
BOOST_FOREACH(const config &d, current_level().data().child_range("difficulty"))
|
||||
for (const config &d : current_level().data().child_range("difficulty"))
|
||||
{
|
||||
difficulties.push_back(d["define"]);
|
||||
}
|
||||
|
@ -705,7 +704,7 @@ std::vector<std::string> create_engine::levels_menu_item_names() const
|
|||
{
|
||||
std::vector<std::string> menu_names;
|
||||
|
||||
BOOST_FOREACH(level_ptr level, get_levels_by_type(current_level_type_)) {
|
||||
for (level_ptr level : get_levels_by_type(current_level_type_)) {
|
||||
menu_names.push_back(IMAGE_PREFIX + level->icon() + IMG_TEXT_SEPARATOR + level->name()
|
||||
+ HELP_STRING_SEPARATOR + level->name());
|
||||
}
|
||||
|
@ -718,8 +717,7 @@ std::vector<std::string> create_engine::extras_menu_item_names(
|
|||
{
|
||||
std::vector<std::string> names;
|
||||
|
||||
BOOST_FOREACH(extras_metadata_ptr extra,
|
||||
get_const_extras_by_type(extra_type)) {
|
||||
for (extras_metadata_ptr extra : get_const_extras_by_type(extra_type)) {
|
||||
if (escape_markup) {
|
||||
names.push_back(font::NULL_MARKUP + extra->name);
|
||||
} else {
|
||||
|
@ -860,7 +858,7 @@ void create_engine::generator_user_config(CVideo& v)
|
|||
int create_engine::find_level_by_id(const std::string& id) const
|
||||
{
|
||||
int i = 0;
|
||||
BOOST_FOREACH(user_map_ptr user_map, user_maps_) {
|
||||
for (user_map_ptr user_map : user_maps_) {
|
||||
if (user_map->id() == id) {
|
||||
return i;
|
||||
}
|
||||
|
@ -868,7 +866,7 @@ int create_engine::find_level_by_id(const std::string& id) const
|
|||
}
|
||||
|
||||
i = 0;
|
||||
BOOST_FOREACH(random_map_ptr random_map, random_maps_) {
|
||||
for (random_map_ptr random_map : random_maps_) {
|
||||
if (random_map->id() == id) {
|
||||
return i;
|
||||
}
|
||||
|
@ -876,7 +874,7 @@ int create_engine::find_level_by_id(const std::string& id) const
|
|||
}
|
||||
|
||||
i = 0;
|
||||
BOOST_FOREACH(scenario_ptr scenario, scenarios_) {
|
||||
for (scenario_ptr scenario : scenarios_) {
|
||||
if (scenario->id() == id) {
|
||||
return i;
|
||||
}
|
||||
|
@ -884,7 +882,7 @@ int create_engine::find_level_by_id(const std::string& id) const
|
|||
}
|
||||
|
||||
i = 0;
|
||||
BOOST_FOREACH(scenario_ptr scenario, user_scenarios_) {
|
||||
for (scenario_ptr scenario : user_scenarios_) {
|
||||
if (scenario->id() == id) {
|
||||
return i;
|
||||
}
|
||||
|
@ -892,7 +890,7 @@ int create_engine::find_level_by_id(const std::string& id) const
|
|||
}
|
||||
|
||||
i = 0;
|
||||
BOOST_FOREACH(campaign_ptr campaign, campaigns_) {
|
||||
for (campaign_ptr campaign : campaigns_) {
|
||||
if (campaign->id() == id) {
|
||||
return i;
|
||||
}
|
||||
|
@ -900,7 +898,7 @@ int create_engine::find_level_by_id(const std::string& id) const
|
|||
}
|
||||
|
||||
i = 0;
|
||||
BOOST_FOREACH(campaign_ptr sp_campaign, sp_campaigns_) {
|
||||
for (campaign_ptr sp_campaign : sp_campaigns_) {
|
||||
if (sp_campaign->id() == id) {
|
||||
return i;
|
||||
}
|
||||
|
@ -914,8 +912,7 @@ int create_engine::find_extra_by_id(const MP_EXTRA extra_type,
|
|||
const std::string& id) const
|
||||
{
|
||||
int i = 0;
|
||||
BOOST_FOREACH(extras_metadata_ptr extra,
|
||||
get_const_extras_by_type(extra_type)) {
|
||||
for (extras_metadata_ptr extra : get_const_extras_by_type(extra_type)) {
|
||||
if (extra->id == id) {
|
||||
return i;
|
||||
}
|
||||
|
@ -927,27 +924,27 @@ int create_engine::find_extra_by_id(const MP_EXTRA extra_type,
|
|||
|
||||
level::TYPE create_engine::find_level_type_by_id(const std::string& id) const
|
||||
{
|
||||
BOOST_FOREACH(user_map_ptr user_map, user_maps_) {
|
||||
for (user_map_ptr user_map : user_maps_) {
|
||||
if (user_map->id() == id) {
|
||||
return level::TYPE::USER_MAP;
|
||||
}
|
||||
}
|
||||
BOOST_FOREACH(random_map_ptr random_map, random_maps_) {
|
||||
for (random_map_ptr random_map : random_maps_) {
|
||||
if (random_map->id() == id) {
|
||||
return level::TYPE::RANDOM_MAP;
|
||||
}
|
||||
}
|
||||
BOOST_FOREACH(scenario_ptr scenario, scenarios_) {
|
||||
for (scenario_ptr scenario : scenarios_) {
|
||||
if (scenario->id() == id) {
|
||||
return level::TYPE::SCENARIO;
|
||||
}
|
||||
}
|
||||
BOOST_FOREACH(scenario_ptr scenario, user_scenarios_) {
|
||||
for (scenario_ptr scenario : user_scenarios_) {
|
||||
if (scenario->id() == id) {
|
||||
return level::TYPE::USER_SCENARIO;
|
||||
}
|
||||
}
|
||||
BOOST_FOREACH(campaign_ptr campaign, campaigns_) {
|
||||
for (campaign_ptr campaign : campaigns_) {
|
||||
if (campaign->id() == id) {
|
||||
return level::TYPE::CAMPAIGN;
|
||||
}
|
||||
|
@ -1057,8 +1054,7 @@ void create_engine::init_all_levels()
|
|||
}
|
||||
|
||||
// Stand-alone scenarios.
|
||||
BOOST_FOREACH(const config &data,
|
||||
game_config_manager::get()->game_config().child_range("multiplayer"))
|
||||
for (const config &data : game_config_manager::get()->game_config().child_range("multiplayer"))
|
||||
{
|
||||
if (!data["allow_new_game"].to_bool(true))
|
||||
continue;
|
||||
|
@ -1078,8 +1074,7 @@ void create_engine::init_all_levels()
|
|||
}
|
||||
|
||||
// Campaigns.
|
||||
BOOST_FOREACH(const config &data,
|
||||
game_config_manager::get()->game_config().child_range("campaign"))
|
||||
for (const config &data : game_config_manager::get()->game_config().child_range("campaign"))
|
||||
{
|
||||
const std::string& type = data["type"];
|
||||
bool mp = state_.classification().campaign_type == game_classification::CAMPAIGN_TYPE::MULTIPLAYER;
|
||||
|
@ -1106,7 +1101,7 @@ void create_engine::init_extras(const MP_EXTRA extra_type)
|
|||
std::vector<extras_metadata_ptr>& extras = get_extras_by_type(extra_type);
|
||||
const std::string extra_name = (extra_type == ERA) ? "era" : "modification";
|
||||
ng::depcheck::component_availabilty default_availabilty = (extra_type == ERA) ? ng::depcheck::component_availabilty::MP : ng::depcheck::component_availabilty::HYBRID;
|
||||
BOOST_FOREACH(const config &extra, game_config_manager::get()->game_config().child_range(extra_name))
|
||||
for (const config &extra : game_config_manager::get()->game_config().child_range(extra_name))
|
||||
{
|
||||
ng::depcheck::component_availabilty type = extra["type"].to_enum(default_availabilty);
|
||||
bool mp = state_.classification().campaign_type == game_classification::CAMPAIGN_TYPE::MULTIPLAYER;
|
||||
|
@ -1189,32 +1184,32 @@ std::vector<create_engine::level_ptr>
|
|||
std::vector<level_ptr> levels;
|
||||
switch (type.v) {
|
||||
case level::TYPE::SCENARIO:
|
||||
BOOST_FOREACH(level_ptr level, scenarios_) {
|
||||
for (level_ptr level : scenarios_) {
|
||||
levels.push_back(level);
|
||||
}
|
||||
break;
|
||||
case level::TYPE::USER_MAP:
|
||||
BOOST_FOREACH(level_ptr level, user_maps_) {
|
||||
for (level_ptr level : user_maps_) {
|
||||
levels.push_back(level);
|
||||
}
|
||||
break;
|
||||
case level::TYPE::USER_SCENARIO:
|
||||
BOOST_FOREACH(level_ptr level, user_scenarios_) {
|
||||
for (level_ptr level : user_scenarios_) {
|
||||
levels.push_back(level);
|
||||
}
|
||||
break;
|
||||
case level::TYPE::RANDOM_MAP:
|
||||
BOOST_FOREACH(level_ptr level, random_maps_) {
|
||||
for (level_ptr level : random_maps_) {
|
||||
levels.push_back(level);
|
||||
}
|
||||
break;
|
||||
case level::TYPE::CAMPAIGN:
|
||||
BOOST_FOREACH(level_ptr level, campaigns_) {
|
||||
for (level_ptr level : campaigns_) {
|
||||
levels.push_back(level);
|
||||
}
|
||||
break;
|
||||
case level::TYPE::SP_CAMPAIGN:
|
||||
BOOST_FOREACH(level_ptr level, sp_campaigns_) {
|
||||
for (level_ptr level : sp_campaigns_) {
|
||||
levels.push_back(level);
|
||||
}
|
||||
break;
|
||||
|
@ -1228,32 +1223,32 @@ std::vector<create_engine::level_ptr> create_engine::get_levels_by_type(level::T
|
|||
std::vector<level_ptr> levels;
|
||||
switch (type.v) {
|
||||
case level::TYPE::SCENARIO:
|
||||
BOOST_FOREACH(size_t level, scenarios_filtered_) {
|
||||
for (size_t level : scenarios_filtered_) {
|
||||
levels.push_back(scenarios_[level]);
|
||||
}
|
||||
break;
|
||||
case level::TYPE::USER_MAP:
|
||||
BOOST_FOREACH(size_t level, user_maps_filtered_) {
|
||||
for (size_t level : user_maps_filtered_) {
|
||||
levels.push_back(user_maps_[level]);
|
||||
}
|
||||
break;
|
||||
case level::TYPE::USER_SCENARIO:
|
||||
BOOST_FOREACH(size_t level, user_scenarios_filtered_) {
|
||||
for (size_t level : user_scenarios_filtered_) {
|
||||
levels.push_back(user_scenarios_[level]);
|
||||
}
|
||||
break;
|
||||
case level::TYPE::RANDOM_MAP:
|
||||
BOOST_FOREACH(size_t level, random_maps_filtered_) {
|
||||
for (size_t level : random_maps_filtered_) {
|
||||
levels.push_back(random_maps_[level]);
|
||||
}
|
||||
break;
|
||||
case level::TYPE::CAMPAIGN:
|
||||
BOOST_FOREACH(size_t level, campaigns_filtered_) {
|
||||
for (size_t level : campaigns_filtered_) {
|
||||
levels.push_back(campaigns_[level]);
|
||||
}
|
||||
break;
|
||||
case level::TYPE::SP_CAMPAIGN:
|
||||
BOOST_FOREACH(size_t level, sp_campaigns_filtered_) {
|
||||
for (size_t level : sp_campaigns_filtered_) {
|
||||
levels.push_back(sp_campaigns_[level]);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "wml_separators.hpp"
|
||||
#include "log.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_mp_connect_engine("mp/connect/engine");
|
||||
#define DBG_MP LOG_STREAM(debug, log_mp_connect_engine)
|
||||
#define LOG_MP LOG_STREAM(info, log_mp_connect_engine)
|
||||
|
@ -80,7 +78,7 @@ flg_manager::flg_manager(const std::vector<const config*>& era_factions,
|
|||
}
|
||||
} else if (default_leader_type_.empty()) {
|
||||
// Find a unit which can recruit.
|
||||
BOOST_FOREACH(const config& side_unit, side_.child_range("unit")) {
|
||||
for (const config& side_unit : side_.child_range("unit")) {
|
||||
if (side_unit["canrecruit"].to_bool()) {
|
||||
default_leader_type_ = side_unit["type"].str();
|
||||
default_leader_gender_ = side_unit["gender"].str();
|
||||
|
@ -119,7 +117,7 @@ void flg_manager::set_current_faction(const unsigned index)
|
|||
void flg_manager::set_current_faction(const std::string& id)
|
||||
{
|
||||
unsigned index = 0;
|
||||
BOOST_FOREACH(const config* faction, choosable_factions_) {
|
||||
for (const config* faction : choosable_factions_) {
|
||||
if ((*faction)["id"] == id) {
|
||||
set_current_faction(index);
|
||||
return;
|
||||
|
@ -148,7 +146,7 @@ void flg_manager::set_current_gender(const unsigned index)
|
|||
void flg_manager::reset_leader_combo(gui::combo& combo_leader, const std::string& color) const
|
||||
{
|
||||
std::vector<std::string> leaders;
|
||||
BOOST_FOREACH(const std::string& leader, choosable_leaders_) {
|
||||
for (const std::string& leader : choosable_leaders_) {
|
||||
const unit_type* unit = unit_types.find(leader);
|
||||
if (unit) {
|
||||
leaders.push_back(IMAGE_PREFIX + unit->image() +
|
||||
|
@ -175,7 +173,7 @@ void flg_manager::reset_gender_combo(gui::combo& combo_gender, const std::string
|
|||
const unit_type* unit = unit_types.find(current_leader_);
|
||||
|
||||
std::vector<std::string> genders;
|
||||
BOOST_FOREACH(const std::string& gender, choosable_genders_) {
|
||||
for (const std::string& gender : choosable_genders_) {
|
||||
if (gender == unit_race::s_female || gender == unit_race::s_male) {
|
||||
if (unit) {
|
||||
const unit_type& gender_unit =
|
||||
|
@ -236,7 +234,7 @@ void flg_manager::resolve_random(rand_rng::mt_rng & rng, const std::vector<std::
|
|||
std::vector<int> nonrandom_sides;
|
||||
std::vector<int> fallback_nonrandom_sides;
|
||||
int num = -1;
|
||||
BOOST_FOREACH(const config* i, available_factions_) {
|
||||
for (const config* i : available_factions_) {
|
||||
++num;
|
||||
if (!(*i)["random_faction"].to_bool()) {
|
||||
const std::string& faction_id = (*i)["id"];
|
||||
|
@ -285,7 +283,7 @@ void flg_manager::resolve_random(rand_rng::mt_rng & rng, const std::vector<std::
|
|||
std::vector<std::string> nonrandom_leaders =
|
||||
utils::split((*current_faction_)["random_leader"]);
|
||||
if (nonrandom_leaders.empty()) {
|
||||
BOOST_FOREACH(const std::string& leader, available_leaders_) {
|
||||
for (const std::string& leader : available_leaders_) {
|
||||
if (leader != "random") {
|
||||
nonrandom_leaders.push_back(leader);
|
||||
}
|
||||
|
@ -312,7 +310,7 @@ void flg_manager::resolve_random(rand_rng::mt_rng & rng, const std::vector<std::
|
|||
const unit_type *ut = unit_types.find(current_leader_);
|
||||
if (ut) {
|
||||
std::vector<std::string> nonrandom_genders;
|
||||
BOOST_FOREACH(const std::string& gender, available_genders_) {
|
||||
for (const std::string& gender : available_genders_) {
|
||||
if (gender != "random") {
|
||||
nonrandom_genders.push_back(gender);
|
||||
}
|
||||
|
@ -335,7 +333,7 @@ void flg_manager::update_available_factions()
|
|||
const config* custom_faction = nullptr;
|
||||
const bool show_custom_faction = side_["faction"] == "Custom" || !has_no_recruits_ || faction_lock_;
|
||||
|
||||
BOOST_FOREACH(const config* faction, era_factions_) {
|
||||
for (const config* faction : era_factions_) {
|
||||
if ((*faction)["id"] == "Custom" && !show_custom_faction) {
|
||||
|
||||
// "Custom" faction should not be available if both
|
||||
|
@ -378,7 +376,7 @@ void flg_manager::update_available_leaders()
|
|||
if (!is_random_faction()) {
|
||||
if ((*current_faction_)["id"] == "Custom") {
|
||||
// Allow user to choose a leader from any faction.
|
||||
BOOST_FOREACH(const config* f, available_factions_) {
|
||||
for (const config* f : available_factions_) {
|
||||
if ((*f)["id"] != "Random") {
|
||||
append_leaders_from_faction(f);
|
||||
}
|
||||
|
@ -422,7 +420,7 @@ void flg_manager::update_available_genders()
|
|||
|
||||
if (saved_game_) {
|
||||
std::string gender;
|
||||
BOOST_FOREACH(const config& side_unit, side_.child_range("unit")) {
|
||||
for (const config& side_unit : side_.child_range("unit")) {
|
||||
if (current_leader_ == side_unit["type"] &&
|
||||
side_unit["canrecruit"].to_bool()) {
|
||||
|
||||
|
@ -440,7 +438,7 @@ void flg_manager::update_available_genders()
|
|||
available_genders_.push_back("random");
|
||||
}
|
||||
|
||||
BOOST_FOREACH(unit_race::GENDER gender, unit->genders()) {
|
||||
for (unit_race::GENDER gender : unit->genders()) {
|
||||
std::string gender_str;
|
||||
if (gender == unit_race::FEMALE) {
|
||||
gender_str = unit_race::s_female;
|
||||
|
@ -538,13 +536,13 @@ int flg_manager::find_suitable_faction() const
|
|||
}
|
||||
|
||||
int res = -1, index = 0, best_score = 0;
|
||||
BOOST_FOREACH(const config *faction, choosable_factions_)
|
||||
for (const config *faction : choosable_factions_)
|
||||
{
|
||||
int faction_score = 0;
|
||||
std::vector<std::string> recruit =
|
||||
utils::split((*faction)[search_field]);
|
||||
BOOST_FOREACH(const std::string &search, find) {
|
||||
BOOST_FOREACH(const std::string &r, recruit) {
|
||||
for (const std::string &search : find) {
|
||||
for (const std::string &r : recruit) {
|
||||
if (r == search) {
|
||||
++faction_score;
|
||||
break;
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
#include "savegame.hpp"
|
||||
#include "units/id.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
#define LOG_NG LOG_STREAM(info, log_engine)
|
||||
#define ERR_NG LOG_STREAM(err, log_engine)
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "gui/widgets/toggle_button.hpp"
|
||||
#include "widgets/slider.hpp"
|
||||
#include "widgets/textbox.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
static lg::log_domain log_mp_create_options("mp/create/options");
|
||||
|
@ -37,7 +36,7 @@ namespace options
|
|||
|
||||
void manager::init_info(const config& cfg, const std::string& key)
|
||||
{
|
||||
BOOST_FOREACH (const config& comp, cfg.child_range(key)) {
|
||||
for (const config& comp : cfg.child_range(key)) {
|
||||
config entry;
|
||||
entry["id"] = comp["id"];
|
||||
entry["name"] = comp["name"];
|
||||
|
@ -45,8 +44,7 @@ void manager::init_info(const config& cfg, const std::string& key)
|
|||
if (comp.has_child("options") && comp["allow_new_game"].to_bool(true)) {
|
||||
const config& options = comp.child("options");
|
||||
|
||||
BOOST_FOREACH (const config::any_child& c,
|
||||
options.all_children_range()) {
|
||||
for (const config::any_child& c : options.all_children_range()) {
|
||||
entry.add_child(c.key, c.cfg);
|
||||
}
|
||||
|
||||
|
@ -60,20 +58,20 @@ void manager::init_info(const config& cfg, const std::string& key)
|
|||
|
||||
void manager::init_widgets()
|
||||
{
|
||||
BOOST_FOREACH(option_display* od, widgets_ordered_) {
|
||||
for (option_display* od : widgets_ordered_) {
|
||||
delete od;
|
||||
}
|
||||
|
||||
widgets_.clear();
|
||||
widgets_ordered_.clear();
|
||||
|
||||
BOOST_FOREACH (const config::any_child& comp, options_info_.all_children_range()) {
|
||||
for (const config::any_child& comp : options_info_.all_children_range()) {
|
||||
if (comp.cfg.all_children_count() == 0 || !is_active(comp.cfg["id"])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
widgets_ordered_.push_back(new title_display(video_, comp.cfg["name"]));
|
||||
BOOST_FOREACH (const config::any_child& c, comp.cfg.all_children_range()) {
|
||||
for (const config::any_child& c : comp.cfg.all_children_range()) {
|
||||
const std::string id = c.cfg["id"];
|
||||
if (c.key == "slider") {
|
||||
widgets_ordered_.push_back(new slider_display(video_, c.cfg));
|
||||
|
@ -93,7 +91,7 @@ void manager::init_widgets()
|
|||
|
||||
void manager::restore_defaults(const std::string &component)
|
||||
{
|
||||
BOOST_FOREACH (const config::any_child& i, get_component_cfg(component).all_children_range()) {
|
||||
for (const config::any_child& i : get_component_cfg(component).all_children_range()) {
|
||||
if (!is_valid_option(i.key, i.cfg)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -127,10 +125,9 @@ manager::manager(const config &gamecfg, CVideo &video, gui::scrollpane *pane, co
|
|||
init_info(gamecfg, "multiplayer");
|
||||
init_info(gamecfg, "campaign");
|
||||
|
||||
BOOST_FOREACH (const config::any_child& i,
|
||||
options_info_.all_children_range())
|
||||
for (const config::any_child& i : options_info_.all_children_range())
|
||||
{
|
||||
BOOST_FOREACH (const config::any_child& j, i.cfg.all_children_range())
|
||||
for (const config::any_child& j : i.cfg.all_children_range())
|
||||
{
|
||||
if (is_valid_option(j.key, j.cfg)) {
|
||||
config& value = get_value_cfg(j.cfg["id"]);
|
||||
|
@ -144,7 +141,7 @@ manager::manager(const config &gamecfg, CVideo &video, gui::scrollpane *pane, co
|
|||
|
||||
manager::~manager()
|
||||
{
|
||||
BOOST_FOREACH(option_display* od, widgets_ordered_)
|
||||
for (option_display* od : widgets_ordered_)
|
||||
{
|
||||
delete od;
|
||||
}
|
||||
|
@ -182,7 +179,7 @@ void manager::layout_widgets(int startx, int starty, int w)
|
|||
{
|
||||
int ypos = starty;
|
||||
int border_size = 3;
|
||||
BOOST_FOREACH(option_display* od, widgets_ordered_)
|
||||
for (option_display* od : widgets_ordered_)
|
||||
{
|
||||
od->layout(startx, ypos, w, border_size, pane_);
|
||||
ypos += border_size;
|
||||
|
@ -241,8 +238,8 @@ const config& manager::get_value_cfg_or_empty(const std::string& id) const
|
|||
{
|
||||
static const config empty;
|
||||
|
||||
BOOST_FOREACH (const config::any_child& i, values_.all_children_range()) {
|
||||
BOOST_FOREACH (const config& j, i.cfg.child_range("option")) {
|
||||
for (const config::any_child& i : values_.all_children_range()) {
|
||||
for (const config& j : i.cfg.child_range("option")) {
|
||||
if (j["id"] == id) {
|
||||
return j;
|
||||
}
|
||||
|
@ -258,9 +255,8 @@ config::any_child manager::get_option_parent(const std::string& id) const
|
|||
static const std::string empty_key = "";
|
||||
static config::any_child not_found(&empty_key, &empty);
|
||||
|
||||
BOOST_FOREACH (const config::any_child& i,
|
||||
options_info_.all_children_range()) {
|
||||
BOOST_FOREACH (const config::any_child& j, i.cfg.all_children_range()) {
|
||||
for (const config::any_child& i : options_info_.all_children_range()) {
|
||||
for (const config::any_child& j : i.cfg.all_children_range()) {
|
||||
if (j.cfg["id"] == id) {
|
||||
return i;
|
||||
}
|
||||
|
@ -274,9 +270,8 @@ const config& manager::get_option_info_cfg(const std::string& id) const
|
|||
{
|
||||
static const config empty;
|
||||
|
||||
BOOST_FOREACH (const config::any_child& i,
|
||||
options_info_.all_children_range()) {
|
||||
BOOST_FOREACH (const config::any_child& j, i.cfg.all_children_range()) {
|
||||
for (const config::any_child& i : options_info_.all_children_range()) {
|
||||
for (const config::any_child& j : i.cfg.all_children_range()) {
|
||||
if (j.cfg["id"] == id) {
|
||||
return j.cfg;
|
||||
}
|
||||
|
@ -327,8 +322,7 @@ config::attribute_value manager::get_default_value(const std::string& id) const
|
|||
|
||||
void manager::extract_values(const std::string& key, const std::string& id)
|
||||
{
|
||||
BOOST_FOREACH (const config::any_child& c,
|
||||
options_info_.find_child(key, "id", id).all_children_range())
|
||||
for (const config::any_child& c : options_info_.find_child(key, "id", id).all_children_range())
|
||||
{
|
||||
if (!is_valid_option(c.key, c.cfg)) {
|
||||
continue;
|
||||
|
@ -348,7 +342,7 @@ void manager::update_values()
|
|||
else {
|
||||
extract_values("multiplayer", scenario_);
|
||||
}
|
||||
BOOST_FOREACH(const std::string& str, modifications_) {
|
||||
for (const std::string& str : modifications_) {
|
||||
extract_values("modification", str);
|
||||
}
|
||||
}
|
||||
|
@ -529,7 +523,7 @@ combo_display::combo_display(CVideo &video, const config &cfg) :
|
|||
values_()
|
||||
{
|
||||
std::vector<std::string> items;
|
||||
BOOST_FOREACH(const config& item, cfg.child_range("item")) {
|
||||
for (const config& item : cfg.child_range("item")) {
|
||||
items.push_back(item["name"]);
|
||||
values_.push_back(item["value"]);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "game_config_manager.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_network("network");
|
||||
#define LOG_NW LOG_STREAM(info, log_network)
|
||||
|
@ -669,7 +668,7 @@ static void enter_lobby_mode(CVideo& video, const config& game_config,
|
|||
while (true) {
|
||||
const config &cfg = game_config.child("lobby_music");
|
||||
if (cfg) {
|
||||
BOOST_FOREACH(const config &i, cfg.child_range("music")) {
|
||||
for (const config &i : cfg.child_range("music")) {
|
||||
sound::play_music_config(i);
|
||||
}
|
||||
sound::commit_music_changes();
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "formula/string_utils.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_config("config");
|
||||
#define ERR_CF LOG_STREAM(err, log_config)
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "wml_separators.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_mp_connect("mp/connect");
|
||||
#define DBG_MP LOG_STREAM(debug, log_mp_connect)
|
||||
|
@ -42,7 +41,7 @@ std::vector<std::string> controller_options_names(
|
|||
const std::vector<ng::controller_option>& controller_options)
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
BOOST_FOREACH(const ng::controller_option& option, controller_options) {
|
||||
for (const ng::controller_option& option : controller_options) {
|
||||
names.push_back(option.second);
|
||||
}
|
||||
|
||||
|
@ -298,7 +297,7 @@ void connect::side::add_widgets_to_scrollpane(gui::scrollpane& pane, int pos)
|
|||
void connect::side::update_faction_combo()
|
||||
{
|
||||
std::vector<std::string> factions;
|
||||
BOOST_FOREACH(const config* faction, engine_->flg().choosable_factions()) {
|
||||
for (const config* faction : engine_->flg().choosable_factions()) {
|
||||
const std::string& name = (*faction)["name"];
|
||||
const std::string& icon = (*faction)["image"];
|
||||
if (!icon.empty()) {
|
||||
|
@ -331,7 +330,7 @@ void connect::side::update_controller_ui()
|
|||
int sel = 0;
|
||||
int i = 0;
|
||||
std::vector<std::string> ais;
|
||||
BOOST_FOREACH(const ai::description* desc, parent_->ai_algorithms_){
|
||||
for (const ai::description* desc : parent_->ai_algorithms_) {
|
||||
ais.push_back(desc->text);
|
||||
if (desc->id == engine_->ai_algorithm()) {
|
||||
sel = i;
|
||||
|
@ -407,7 +406,7 @@ connect::connect(CVideo& v, const std::string& game_name,
|
|||
ai_algorithms_ = ai::configuration::get_available_ais();
|
||||
|
||||
// Sides.
|
||||
BOOST_FOREACH(ng::side_engine_ptr s, engine_.side_engines()) {
|
||||
for (ng::side_engine_ptr s : engine_.side_engines()) {
|
||||
sides_.push_back(side(*this, s));
|
||||
}
|
||||
if (sides_.empty() && !game_config::debug) {
|
||||
|
@ -417,7 +416,7 @@ connect::connect(CVideo& v, const std::string& game_name,
|
|||
|
||||
// Add side widgets to scroll pane.
|
||||
int side_pos_y_offset = 0;
|
||||
BOOST_FOREACH(side& s, sides_) {
|
||||
for (side& s : sides_) {
|
||||
if (!s.engine()->allow_player() && !game_config::debug) {
|
||||
continue;
|
||||
}
|
||||
|
@ -463,7 +462,7 @@ void connect::process_event_impl(const process_event_data & data)
|
|||
{
|
||||
bool changed = false;
|
||||
|
||||
BOOST_FOREACH(side& s, sides_) {
|
||||
for (side& s : sides_) {
|
||||
s.process_event();
|
||||
if (s.changed()) {
|
||||
changed = true;
|
||||
|
@ -573,7 +572,7 @@ void connect::process_network_data(const config& data,
|
|||
set_result(QUIT);
|
||||
}
|
||||
|
||||
BOOST_FOREACH(side& s, sides_) {
|
||||
for (side& s : sides_) {
|
||||
s.update_ui();
|
||||
}
|
||||
|
||||
|
@ -606,7 +605,7 @@ void connect::update_playerlist_state(bool silent)
|
|||
} else {
|
||||
// Updates the player list
|
||||
std::vector<std::string> playerlist;
|
||||
BOOST_FOREACH(const std::string& user, engine_.connected_users()) {
|
||||
for (const std::string& user : engine_.connected_users()) {
|
||||
playerlist.push_back(user);
|
||||
}
|
||||
set_user_list(playerlist, silent);
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "sdl/rect.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_config("config");
|
||||
#define ERR_CF LOG_STREAM(err, log_config)
|
||||
|
@ -140,7 +139,7 @@ create::create(CVideo& video, const config& cfg, saved_game& state,
|
|||
|
||||
std::vector<std::string> combo_level_names;
|
||||
|
||||
BOOST_FOREACH(level_type_info type_info, all_level_types) {
|
||||
for (level_type_info type_info : all_level_types) {
|
||||
if (!engine_.get_levels_by_type_unfiltered(type_info.first).empty()) {
|
||||
available_level_types_.push_back(type_info.first);
|
||||
combo_level_names.push_back(type_info.second);
|
||||
|
@ -159,7 +158,7 @@ create::create(CVideo& video, const config& cfg, saved_game& state,
|
|||
|
||||
// Set level selection according to the preferences, if possible.
|
||||
size_t type_index = 0;
|
||||
BOOST_FOREACH(ng::level::TYPE type, available_level_types_) {
|
||||
for (ng::level::TYPE type : available_level_types_) {
|
||||
if (preferences::level_type() == type.cast<int>()) {
|
||||
break;
|
||||
}
|
||||
|
@ -536,7 +535,7 @@ void create::synchronize_selections()
|
|||
levels_menu_.set_items(engine_.levels_menu_item_names());
|
||||
levels_menu_.move_selection(index);
|
||||
type_index = 0;
|
||||
BOOST_FOREACH(ng::level::TYPE type, available_level_types_) {
|
||||
for (ng::level::TYPE type : available_level_types_) {
|
||||
if (level_type_at_index == type) {
|
||||
level_type_combo_.set_selected(type_index);
|
||||
break;
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include <cassert>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
static lg::log_domain log_config("config");
|
||||
|
@ -485,8 +484,7 @@ void gamebrowser::populate_game_item_campaign_or_scenario_info(gamebrowser::game
|
|||
if (map_hashes_ && !item.reloaded) {
|
||||
std::string hash = game["hash"];
|
||||
bool hash_found = false;
|
||||
BOOST_FOREACH(const config::attribute& i,
|
||||
map_hashes_.attribute_range()) {
|
||||
for (const config::attribute& i : map_hashes_.attribute_range()) {
|
||||
|
||||
if (i.first == game["mp_scenario"] &&
|
||||
i.second == hash) {
|
||||
|
@ -547,7 +545,7 @@ void gamebrowser::populate_game_item_campaign_or_scenario_info(gamebrowser::game
|
|||
//TODO: use difficulties instead of difficulty_descriptions if
|
||||
//difficulty_descriptions is not available
|
||||
assert(difficulties.size() == difficulty_options.size());
|
||||
BOOST_FOREACH(const std::string& difficulty, difficulties) {
|
||||
for (const std::string& difficulty : difficulties) {
|
||||
if (difficulty == game["difficulty_define"]) {
|
||||
gui2::tlegacy_menu_item menu_item(difficulty_options[index]);
|
||||
item.map_info += " — ";
|
||||
|
@ -728,7 +726,7 @@ void gamebrowser::populate_game_item_mod_info(gamebrowser::game_item & item, con
|
|||
item.era_and_mod_info += _("Modifications:");
|
||||
item.era_and_mod_info += " ";
|
||||
|
||||
BOOST_FOREACH (const config& m, game.child_range("modification")) {
|
||||
for (const config& m : game.child_range("modification")) {
|
||||
const config& mod_cfg = game_config.find_child("modification", "id", m["id"]);
|
||||
if (mod_cfg) {
|
||||
item.era_and_mod_info += mod_cfg["name"].str();
|
||||
|
@ -754,7 +752,7 @@ void gamebrowser::populate_game_item_mod_info(gamebrowser::game_item & item, con
|
|||
// Do this before populating eras and mods, to get reports of missing add-ons in the most sensible order.
|
||||
void gamebrowser::populate_game_item_addons_installed(gamebrowser::game_item & item, const config & game, const std::vector<std::string> & installed_addons)
|
||||
{
|
||||
BOOST_FOREACH(const config & addon, game.child_range("addon")) {
|
||||
for (const config & addon : game.child_range("addon")) {
|
||||
if (addon.has_attribute("id")) {
|
||||
if (std::find(installed_addons.begin(), installed_addons.end(), addon["id"].str()) == installed_addons.end()) {
|
||||
required_addon r;
|
||||
|
@ -864,7 +862,7 @@ void gamebrowser::set_game_items(const config& cfg, const config& game_config, c
|
|||
|
||||
games_.clear();
|
||||
|
||||
BOOST_FOREACH(const config &game, cfg.child("gamelist").child_range("game"))
|
||||
for (const config &game : cfg.child("gamelist").child_range("game"))
|
||||
{
|
||||
games_.push_back(game_item());
|
||||
populate_game_item(games_.back(), game, game_config, installed_addons);
|
||||
|
@ -926,7 +924,7 @@ bool gamebrowser::game_matches_filter(const game_item& i, const config& cfg)
|
|||
}
|
||||
if(preferences::fi_friends_in_game()) {
|
||||
bool found_friend = false;
|
||||
BOOST_FOREACH(const config &user, cfg.child_range("user")) {
|
||||
for (const config &user : cfg.child_range("user")) {
|
||||
if(preferences::is_friend(user["name"]) && user["game_id"] == i.id) {
|
||||
found_friend = true;
|
||||
break;
|
||||
|
@ -939,7 +937,7 @@ bool gamebrowser::game_matches_filter(const game_item& i, const config& cfg)
|
|||
|
||||
if(!preferences::fi_text().empty()) {
|
||||
bool found_match = true;
|
||||
BOOST_FOREACH(const std::string& search_string, utils::split(preferences::fi_text(), ' ', utils::STRIP_SPACES)) {
|
||||
for (const std::string& search_string : utils::split(preferences::fi_text(), ' ', utils::STRIP_SPACES)) {
|
||||
|
||||
if(!boost::contains(i.map_info, search_string, chars_equal_insensitive) &&
|
||||
!boost::contains(i.name, search_string, chars_equal_insensitive) &&
|
||||
|
@ -1200,7 +1198,7 @@ static void handle_addon_requirements_gui(CVideo & v, const std::vector<required
|
|||
err_msg += _("Details:");
|
||||
err_msg += "\n";
|
||||
|
||||
BOOST_FOREACH(const required_addon & a, reqs) {
|
||||
for (const required_addon & a : reqs) {
|
||||
if (a.outcome == CANNOT_SATISFY) {
|
||||
err_msg += a.message;
|
||||
err_msg += "\n";
|
||||
|
@ -1216,7 +1214,7 @@ static void handle_addon_requirements_gui(CVideo & v, const std::vector<required
|
|||
err_msg += "\n";
|
||||
|
||||
std::vector<std::string> needs_download;
|
||||
BOOST_FOREACH(const required_addon & a, reqs) {
|
||||
for (const required_addon & a : reqs) {
|
||||
if (a.outcome == NEED_DOWNLOAD) {
|
||||
err_msg += a.message;
|
||||
err_msg += "\n";
|
||||
|
|
|
@ -36,8 +36,6 @@
|
|||
#include "sdl/utils.hpp"
|
||||
#include "sdl/rect.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_config("config");
|
||||
#define ERR_CF LOG_STREAM(err, log_config)
|
||||
|
||||
|
@ -564,7 +562,7 @@ void ui::process_network_data(const config& data, const network::connection /*so
|
|||
if (const config &ms = c.child("members")) {
|
||||
std::stringstream ss;
|
||||
ss << "Room " << c["room"].str() << " members: ";
|
||||
BOOST_FOREACH(const config& m, ms.child_range("member")) {
|
||||
for (const config& m : ms.child_range("member")) {
|
||||
ss << m["name"] << " ";
|
||||
}
|
||||
chat_.add_message(time(nullptr), "server", ss.str());
|
||||
|
@ -573,7 +571,7 @@ void ui::process_network_data(const config& data, const network::connection /*so
|
|||
if (const config &rs = c.child("rooms")) {
|
||||
std::stringstream ss;
|
||||
ss << "Rooms: ";
|
||||
BOOST_FOREACH(const config& r, rs.child_range("room")) {
|
||||
for (const config& r : rs.child_range("room")) {
|
||||
ss << r["name"].str() << "(" << r["size"].str() << ") ";
|
||||
}
|
||||
chat_.add_message(time(nullptr), "server", ss.str());
|
||||
|
@ -668,7 +666,7 @@ void ui::gamelist_updated(bool silent)
|
|||
{
|
||||
std::list<user_info> u_list;
|
||||
|
||||
BOOST_FOREACH(const config &user, gamelist_.child_range("user"))
|
||||
for (const config &user : gamelist_.child_range("user"))
|
||||
{
|
||||
user_info u_elem;
|
||||
u_elem.name = user["name"].str();
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "video.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_network("network");
|
||||
#define DBG_NW LOG_STREAM(debug, log_network)
|
||||
|
@ -271,7 +270,7 @@ void wait::join_game(bool observe)
|
|||
//available side.
|
||||
const config *side_choice = nullptr;
|
||||
int side_num = -1, nb_sides = 0;
|
||||
BOOST_FOREACH(const config &sd, get_scenario().child_range("side"))
|
||||
for (const config &sd : get_scenario().child_range("side"))
|
||||
{
|
||||
DBG_MP << "*** side " << nb_sides << "***\n" << sd.debug() << "***\n";
|
||||
|
||||
|
@ -331,7 +330,7 @@ void wait::join_game(bool observe)
|
|||
const std::string color = (*side_choice)["color"].str();
|
||||
|
||||
std::vector<const config*> era_factions;
|
||||
BOOST_FOREACH(const config &side, possible_sides) {
|
||||
for (const config &side : possible_sides) {
|
||||
era_factions.push_back(&side);
|
||||
}
|
||||
|
||||
|
@ -347,7 +346,7 @@ void wait::join_game(bool observe)
|
|||
saved_game);
|
||||
|
||||
std::vector<std::string> choices;
|
||||
BOOST_FOREACH(const config *s, flg.choosable_factions())
|
||||
for (const config *s : flg.choosable_factions())
|
||||
{
|
||||
const config &side = *s;
|
||||
const std::string &name = side["name"];
|
||||
|
@ -520,7 +519,7 @@ void wait::generate_menu()
|
|||
std::vector<std::string> details;
|
||||
std::set<std::string> playerlist;
|
||||
|
||||
BOOST_FOREACH(const config &sd, get_scenario().child_range("side"))
|
||||
for (const config &sd : get_scenario().child_range("side"))
|
||||
{
|
||||
if (!sd["allow_player"].to_bool(true)) {
|
||||
continue;
|
||||
|
@ -535,7 +534,7 @@ void wait::generate_menu()
|
|||
// Hack: if there is a unit which can recruit, use it as a
|
||||
// leader. Necessary to display leader information when loading
|
||||
// saves.
|
||||
BOOST_FOREACH(const config &side_unit, sd.child_range("unit"))
|
||||
for (const config &side_unit : sd.child_range("unit"))
|
||||
{
|
||||
if (side_unit["canrecruit"].to_bool()) {
|
||||
leader_type = side_unit["type"].str();
|
||||
|
@ -647,7 +646,7 @@ bool wait::download_level_data()
|
|||
}
|
||||
else if(config& controllers = revc.child("controllers")) {
|
||||
int index = 0;
|
||||
BOOST_FOREACH(const config& controller, controllers.child_range("controller")) {
|
||||
for (const config& controller : controllers.child_range("controller")) {
|
||||
if(config& side = get_scenario().child("side", index)) {
|
||||
side["is_local"] = controller["is_local"];
|
||||
}
|
||||
|
|
|
@ -48,8 +48,6 @@
|
|||
#include "wml_exception.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#define LOG_G LOG_STREAM(info, lg::general)
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
|
@ -150,7 +148,7 @@ void campaign_controller::show_carryover_message(playsingle_controller& playcont
|
|||
//We need to write the carryover amount to the team thats why we need non const
|
||||
std::vector<team>& teams = *resources::teams;
|
||||
int persistent_teams = 0;
|
||||
BOOST_FOREACH(const team &t, teams) {
|
||||
for (const team &t : teams) {
|
||||
if (t.persistent()){
|
||||
++persistent_teams;
|
||||
}
|
||||
|
@ -162,7 +160,7 @@ void campaign_controller::show_carryover_message(playsingle_controller& playcont
|
|||
gamemap map = playcontroller.get_map_const();
|
||||
tod_manager tod = playcontroller.get_tod_manager_const();
|
||||
int turns_left = std::max<int>(0, tod.number_of_turns() - tod.turn());
|
||||
BOOST_FOREACH(team &t, teams)
|
||||
for (team &t : teams)
|
||||
{
|
||||
if (!t.persistent() || t.lost())
|
||||
{
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
#include "wml_exception.hpp" // for twml_exception
|
||||
|
||||
#include <algorithm> // for copy, max, min, stable_sort
|
||||
#include <boost/foreach.hpp> // for auto_any_base, etc
|
||||
#include <boost/optional.hpp> // for optional
|
||||
#include <boost/tuple/tuple.hpp> // for tuple
|
||||
#include <cstdlib> // for system
|
||||
|
@ -346,7 +345,7 @@ bool game_launcher::init_language()
|
|||
language_def locale;
|
||||
if(cmdline_opts_.language) {
|
||||
std::vector<language_def> langs = get_languages();
|
||||
BOOST_FOREACH(const language_def & def, langs) {
|
||||
for(const language_def & def : langs) {
|
||||
if(def.localename == *cmdline_opts_.language) {
|
||||
locale = def;
|
||||
break;
|
||||
|
@ -742,7 +741,7 @@ void game_launcher::set_tutorial()
|
|||
|
||||
void game_launcher::mark_completed_campaigns(std::vector<config> &campaigns)
|
||||
{
|
||||
BOOST_FOREACH(config &campaign, campaigns) {
|
||||
for (config &campaign : campaigns) {
|
||||
campaign["completed"] = preferences::is_campaign_completed(campaign["id"]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "units/map.hpp"
|
||||
#include "wml_exception.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <cassert>
|
||||
#ifdef _WIN32
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
@ -135,11 +134,11 @@ manager::manager() :
|
|||
[/campaign]
|
||||
[/completed_campaigns]
|
||||
*/
|
||||
BOOST_FOREACH(const std::string &c, utils::split(preferences::get("completed_campaigns"))) {
|
||||
for (const std::string &c : utils::split(preferences::get("completed_campaigns"))) {
|
||||
completed_campaigns[c]; // create the elements
|
||||
}
|
||||
if (const config &ccc = preferences::get_child("completed_campaigns")) {
|
||||
BOOST_FOREACH(const config &cc, ccc.child_range("campaign")) {
|
||||
for (const config &cc : ccc.child_range("campaign")) {
|
||||
std::set<std::string> &d = completed_campaigns[cc["name"]];
|
||||
std::vector<std::string> nd = utils::split(cc["difficulty_levels"]);
|
||||
std::copy(nd.begin(), nd.end(), std::inserter(d, d.begin()));
|
||||
|
@ -161,9 +160,9 @@ manager::manager() :
|
|||
message = foobar
|
||||
[/line]
|
||||
*/
|
||||
BOOST_FOREACH(const config::any_child &h, history.all_children_range())
|
||||
for (const config::any_child &h : history.all_children_range())
|
||||
{
|
||||
BOOST_FOREACH(const config &l, h.cfg.child_range("line")) {
|
||||
for (const config &l : h.cfg.child_range("line")) {
|
||||
history_map[h.key].push_back(l["message"]);
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +175,7 @@ manager::~manager()
|
|||
{
|
||||
config campaigns;
|
||||
typedef const std::pair<std::string, std::set<std::string> > cc_elem;
|
||||
BOOST_FOREACH(cc_elem &elem, completed_campaigns) {
|
||||
for (cc_elem &elem : completed_campaigns) {
|
||||
config cmp;
|
||||
cmp["name"] = elem.first;
|
||||
cmp["difficulty_levels"] = utils::join(elem.second);
|
||||
|
@ -197,10 +196,10 @@ manager::~manager()
|
|||
*/
|
||||
config history;
|
||||
typedef std::pair<std::string, std::vector<std::string> > hack;
|
||||
BOOST_FOREACH(const hack& history_id, history_map) {
|
||||
for (const hack& history_id : history_map) {
|
||||
|
||||
config history_id_cfg; // [history_id]
|
||||
BOOST_FOREACH(const std::string& line, history_id.second) {
|
||||
for (const std::string& line : history_id.second) {
|
||||
config cfg; // [line]
|
||||
|
||||
cfg["message"] = line;
|
||||
|
@ -240,7 +239,7 @@ admin_authentication_reset::~admin_authentication_reset()
|
|||
|
||||
static void load_acquaintances() {
|
||||
if(acquaintances.empty()) {
|
||||
BOOST_FOREACH(const config &acfg, preferences::get_prefs()->child_range("acquaintance")) {
|
||||
for (const config &acfg : preferences::get_prefs()->child_range("acquaintance")) {
|
||||
acquaintance ac = acquaintance(acfg);
|
||||
acquaintances[ac.get_nick()] = ac;
|
||||
}
|
||||
|
@ -408,7 +407,7 @@ const std::vector<game_config::server_info>& server_list()
|
|||
std::vector<game_config::server_info> &game_servers = game_config::server_list;
|
||||
VALIDATE(!game_servers.empty(), _("No server has been defined."));
|
||||
pref_servers.insert(pref_servers.begin(), game_servers.begin(), game_servers.end());
|
||||
BOOST_FOREACH(const config &server, get_prefs()->child_range("server")) {
|
||||
for(const config &server : get_prefs()->child_range("server")) {
|
||||
game_config::server_info sinf;
|
||||
sinf.name = server["name"].str();
|
||||
sinf.address = server["address"].str();
|
||||
|
@ -1150,8 +1149,8 @@ void encounter_start_units(const unit_map& units){
|
|||
}
|
||||
|
||||
static void encounter_recallable_units(const std::vector<team>& teams){
|
||||
BOOST_FOREACH(const team& t, teams) {
|
||||
BOOST_FOREACH(const unit_const_ptr & u, t.recall_list()) {
|
||||
for (const team& t : teams) {
|
||||
for (const unit_const_ptr & u : t.recall_list()) {
|
||||
encountered_units_set.insert(u->type_id());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "gui/dialogs/loadscreen.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <SDL_timer.h>
|
||||
|
@ -135,7 +134,7 @@ void game_state::place_sides_in_preferred_locations(const config& level)
|
|||
int num_pos = board_.map().num_valid_starting_positions();
|
||||
|
||||
int side_num = 1;
|
||||
BOOST_FOREACH(const config &side, level.child_range("side"))
|
||||
for(const config &side : level.child_range("side"))
|
||||
{
|
||||
for(int p = 1; p <= num_pos; ++p) {
|
||||
const map_location& pos = board_.map().starting_position(p);
|
||||
|
@ -173,7 +172,7 @@ void game_state::init(const config& level, play_controller & pc)
|
|||
}
|
||||
|
||||
LOG_NG << "initialized time of day regions... " << (SDL_GetTicks() - pc.ticks()) << std::endl;
|
||||
BOOST_FOREACH(const config &t, level.child_range("time_area")) {
|
||||
for (const config &t : level.child_range("time_area")) {
|
||||
tod_manager_.add_time_area(board_.map(),t);
|
||||
}
|
||||
|
||||
|
@ -184,7 +183,7 @@ void game_state::init(const config& level, play_controller & pc)
|
|||
std::vector<team_builder_ptr> team_builders;
|
||||
|
||||
int team_num = 0;
|
||||
BOOST_FOREACH(const config &side, level.child_range("side"))
|
||||
for (const config &side : level.child_range("side"))
|
||||
{
|
||||
if (first_human_team_ == -1) {
|
||||
const std::string &controller = side["controller"];
|
||||
|
@ -204,7 +203,7 @@ void game_state::init(const config& level, play_controller & pc)
|
|||
|
||||
tod_manager_.resolve_random(*random_new::generator);
|
||||
|
||||
BOOST_FOREACH(team_builder_ptr tb_ptr, team_builders)
|
||||
for(team_builder_ptr tb_ptr : team_builders)
|
||||
{
|
||||
build_team_stage_two(tb_ptr);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "serialization/string_utils.hpp"
|
||||
#include "util.hpp"
|
||||
#include "seed_rng.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
#define LOG_NG LOG_STREAM(info, log_engine)
|
||||
|
@ -140,7 +139,7 @@ void cave_map_generator::cave_map_generator_job::build_chamber(map_location loc,
|
|||
|
||||
void cave_map_generator::cave_map_generator_job::generate_chambers()
|
||||
{
|
||||
BOOST_FOREACH(const config &ch, params.cfg_.child_range("chamber"))
|
||||
for (const config &ch : params.cfg_.child_range("chamber"))
|
||||
{
|
||||
// If there is only a chance of the chamber appearing, deal with that here.
|
||||
if (ch.has_attribute("chance") && int(rng_() % 100) < ch["chance"].to_int()) {
|
||||
|
@ -187,7 +186,7 @@ void cave_map_generator::cave_map_generator_job::generate_chambers()
|
|||
|
||||
chambers_.push_back(new_chamber);
|
||||
|
||||
BOOST_FOREACH(const config &p, ch.child_range("passage"))
|
||||
for(const config &p : ch.child_range("passage"))
|
||||
{
|
||||
const std::string &dst = p["destination"];
|
||||
|
||||
|
@ -212,7 +211,7 @@ void cave_map_generator::cave_map_generator_job::place_chamber(const chamber& c)
|
|||
if (c.items == nullptr || c.locs.empty()) return;
|
||||
|
||||
size_t index = 0;
|
||||
BOOST_FOREACH(const config::any_child &it, c.items->all_children_range())
|
||||
for (const config::any_child &it : c.items->all_children_range())
|
||||
{
|
||||
config cfg = it.cfg;
|
||||
config &filter = cfg.child("filter");
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "formula/string_utils.hpp"
|
||||
#include <SDL.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include "seed_rng.hpp"
|
||||
static lg::log_domain log_mapgen("mapgen");
|
||||
#define ERR_NG LOG_STREAM(err, log_mapgen)
|
||||
|
@ -793,7 +792,7 @@ std::string default_map_generator_job::default_generate_map(size_t width, size_t
|
|||
|
||||
std::vector<terrain_height_mapper> height_conversion;
|
||||
|
||||
BOOST_FOREACH(const config &h, cfg.child_range("height")) {
|
||||
for(const config &h : cfg.child_range("height")) {
|
||||
height_conversion.push_back(terrain_height_mapper(h));
|
||||
}
|
||||
|
||||
|
@ -928,7 +927,7 @@ std::string default_map_generator_job::default_generate_map(size_t width, size_t
|
|||
LOG_NG << (SDL_GetTicks() - ticks) << "\n"; ticks = SDL_GetTicks();
|
||||
|
||||
std::vector<terrain_converter> converters;
|
||||
BOOST_FOREACH(const config &cv, cfg.child_range("convert")) {
|
||||
for(const config &cv : cfg.child_range("convert")) {
|
||||
converters.push_back(terrain_converter(cv));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
lua_map_generator::lua_map_generator(const config & cfg)
|
||||
: id_(cfg["id"])
|
||||
, config_name_(cfg["config_name"])
|
||||
|
@ -32,7 +30,7 @@ lua_map_generator::lua_map_generator(const config & cfg)
|
|||
, generator_data_(cfg)
|
||||
{
|
||||
const char* required[] = {"id", "config_name", "create_map"};
|
||||
BOOST_FOREACH(std::string req, required) {
|
||||
for (std::string req : required) {
|
||||
if (!cfg.has_attribute(req)) {
|
||||
std::string msg = "Error when constructing a lua map generator -- missing a required attribute '";
|
||||
msg += req + "'\n";
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <iostream>
|
||||
#include <locale>
|
||||
#include <boost/locale.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
// including boost/thread fixes linking of boost locale for msvc on boost 1.60
|
||||
#include <boost/thread.hpp>
|
||||
#include <set>
|
||||
|
@ -78,7 +77,7 @@ namespace
|
|||
, is_dirty_(true)
|
||||
{
|
||||
const bl::localization_backend_manager& g_mgr = bl::localization_backend_manager::global();
|
||||
BOOST_FOREACH(const std::string& name, g_mgr.get_all_backends())
|
||||
for(const std::string& name : g_mgr.get_all_backends())
|
||||
{
|
||||
LOG_G << "Found boost locale backend: '" << name << "'\n";
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "formula/string_utils.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "gettext.hpp"
|
||||
|
||||
|
@ -81,7 +80,7 @@ tadvanced_graphics_options::tadvanced_graphics_options()
|
|||
|
||||
void tadvanced_graphics_options::pre_show(twindow& window)
|
||||
{
|
||||
BOOST_FOREACH(const std::string & i, scale_cases) {
|
||||
for(const std::string & i : scale_cases) {
|
||||
setup_scale_case(i, window);
|
||||
}
|
||||
|
||||
|
@ -95,7 +94,7 @@ void tadvanced_graphics_options::pre_show(twindow& window)
|
|||
void tadvanced_graphics_options::post_show(twindow& /*window*/)
|
||||
{
|
||||
if(get_retval() == twindow::OK) {
|
||||
BOOST_FOREACH(const std::string & i, scale_cases) {
|
||||
for(const std::string & i : scale_cases) {
|
||||
update_scale_case(i);
|
||||
}
|
||||
image::update_from_preferences();
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include "gui/dialogs/editor/set_starting_position.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include "formatter.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "gettext.hpp"
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "mp_ui_alerts.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
static lg::log_domain log_network("network");
|
||||
#define DBG_NW LOG_STREAM(debug, log_network)
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "formula/string_utils.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "gettext.hpp"
|
||||
|
||||
|
@ -111,7 +110,7 @@ static void set_pref_and_button(const std::string & id, bool value, twindow & wi
|
|||
|
||||
static void revert_to_default_pref_values(twindow & window)
|
||||
{
|
||||
BOOST_FOREACH(const std::string & i, mp_ui_alerts::items) {
|
||||
for (const std::string & i : mp_ui_alerts::items) {
|
||||
set_pref_and_button(i+"_sound", mp_ui_alerts::get_def_pref_sound(i), window);
|
||||
set_pref_and_button(i+"_notif", mp_ui_alerts::get_def_pref_notif(i), window);
|
||||
set_pref_and_button(i+"_lobby", mp_ui_alerts::get_def_pref_lobby(i), window);
|
||||
|
@ -126,7 +125,7 @@ tmp_alerts_options::tmp_alerts_options()
|
|||
|
||||
void tmp_alerts_options::pre_show(twindow& window)
|
||||
{
|
||||
BOOST_FOREACH(const std::string & i, mp_ui_alerts::items) {
|
||||
for (const std::string & i : mp_ui_alerts::items) {
|
||||
setup_item(i, window);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
|
||||
#include "utils/const_clone.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
||||
|
@ -59,7 +57,7 @@ struct tgrid_implementation
|
|||
const bool must_be_active)
|
||||
{
|
||||
typedef typename utils::tconst_clone<tgrid::tchild, W>::type hack;
|
||||
BOOST_FOREACH(hack & child, grid.children_)
|
||||
for(hack & child : grid.children_)
|
||||
{
|
||||
|
||||
W* widget = child.widget();
|
||||
|
@ -95,7 +93,7 @@ struct tgrid_implementation
|
|||
}
|
||||
|
||||
typedef typename utils::tconst_clone<tgrid::tchild, W>::type hack;
|
||||
BOOST_FOREACH(hack & child, grid.children_)
|
||||
for(hack & child : grid.children_)
|
||||
{
|
||||
|
||||
widget = child.widget();
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "gui/widgets/window.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__
|
||||
#define LOG_HEADER LOG_SCOPE_HEADER + ':'
|
||||
|
@ -121,7 +120,7 @@ tlist::add_row(const std::map<std::string /* widget id */, string_map>& data,
|
|||
|
||||
void tlist::append_rows(const std::vector<string_map>& items)
|
||||
{
|
||||
BOOST_FOREACH(const string_map & item, items)
|
||||
for(const string_map & item : items)
|
||||
{
|
||||
add_row(item);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
|
||||
#include <assert.h> // for assert
|
||||
#include <algorithm> // for sort, find, transform, etc
|
||||
#include <boost/foreach.hpp> // for auto_any_base, etc
|
||||
#include <boost/shared_ptr.hpp> // for shared_ptr
|
||||
#include <iostream> // for operator<<, basic_ostream, etc
|
||||
#include <iterator> // for back_insert_iterator, etc
|
||||
|
@ -105,7 +104,7 @@ bool section_is_referenced(const std::string §ion_id, const config &cfg)
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config §ion, cfg.child_range("section"))
|
||||
for (const config §ion : cfg.child_range("section"))
|
||||
{
|
||||
const std::vector<std::string> sections_refd
|
||||
= utils::quoted_split(section["sections"]);
|
||||
|
@ -129,7 +128,7 @@ bool topic_is_referenced(const std::string &topic_id, const config &cfg)
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config §ion, cfg.child_range("section"))
|
||||
for (const config §ion : cfg.child_range("section"))
|
||||
{
|
||||
const std::vector<std::string> topics_refd
|
||||
= utils::quoted_split(section["topics"]);
|
||||
|
@ -366,7 +365,7 @@ std::vector<topic> generate_time_of_day_topics(const bool /*sort_generated*/)
|
|||
return topics;
|
||||
}
|
||||
const std::vector<time_of_day>& times = resources::tod_manager->times();
|
||||
BOOST_FOREACH(const time_of_day& time, times)
|
||||
for (const time_of_day& time : times)
|
||||
{
|
||||
const std::string id = "time_of_day_" + time.id;
|
||||
const std::string image = "<img>src='" + time.image + "'</img>";
|
||||
|
@ -394,7 +393,7 @@ std::vector<topic> generate_weapon_special_topics(const bool sort_generated)
|
|||
std::map<t_string, std::string> special_description;
|
||||
std::map<t_string, std::set<std::string, string_less> > special_units;
|
||||
|
||||
BOOST_FOREACH(const unit_type_data::unit_type_map::value_type &i, unit_types.types())
|
||||
for (const unit_type_data::unit_type_map::value_type &i : unit_types.types())
|
||||
{
|
||||
const unit_type &type = i.second;
|
||||
// Only show the weapon special if we find it on a unit that
|
||||
|
@ -456,7 +455,7 @@ std::vector<topic> generate_ability_topics(const bool sort_generated)
|
|||
// should have a full description, if so, add this units abilities
|
||||
// for display. We do not want to show abilities that the user has
|
||||
// not encountered yet.
|
||||
BOOST_FOREACH(const unit_type_data::unit_type_map::value_type &i, unit_types.types())
|
||||
for (const unit_type_data::unit_type_map::value_type &i : unit_types.types())
|
||||
{
|
||||
const unit_type &type = i.second;
|
||||
if (description_type(type) == FULL_DESCRIPTION) {
|
||||
|
@ -521,7 +520,7 @@ std::vector<topic> generate_era_topics(const bool sort_generated, const std::str
|
|||
topics = generate_faction_topics(era, sort_generated);
|
||||
|
||||
std::vector<std::string> faction_links;
|
||||
BOOST_FOREACH(const topic & t, topics) {
|
||||
for (const topic & t : topics) {
|
||||
faction_links.push_back(make_link(t.title, t.id));
|
||||
}
|
||||
|
||||
|
@ -537,7 +536,7 @@ std::vector<topic> generate_era_topics(const bool sort_generated, const std::str
|
|||
text << "<header>text='" << _("Factions") << "'</header>" << "\n";
|
||||
|
||||
std::sort(faction_links.begin(), faction_links.end());
|
||||
BOOST_FOREACH(const std::string &link, faction_links) {
|
||||
for (const std::string &link : faction_links) {
|
||||
text << "• " << link << "\n";
|
||||
}
|
||||
|
||||
|
@ -551,7 +550,7 @@ std::vector<topic> generate_era_topics(const bool sort_generated, const std::str
|
|||
std::vector<topic> generate_faction_topics(const config & era, const bool sort_generated)
|
||||
{
|
||||
std::vector<topic> topics;
|
||||
BOOST_FOREACH(const config &f, era.child_range("multiplayer_side")) {
|
||||
for (const config &f : era.child_range("multiplayer_side")) {
|
||||
const std::string& id = f["id"];
|
||||
if (id == "Random")
|
||||
continue;
|
||||
|
@ -568,7 +567,7 @@ std::vector<topic> generate_faction_topics(const config & era, const bool sort_g
|
|||
std::set<std::string> races;
|
||||
std::set<std::string> alignments;
|
||||
|
||||
BOOST_FOREACH(const std::string & u_id, recruit_ids) {
|
||||
for (const std::string & u_id : recruit_ids) {
|
||||
if (const unit_type * t = unit_types.find(u_id, unit_type::HELP_INDEXED)) {
|
||||
assert(t);
|
||||
const unit_type & type = *t;
|
||||
|
@ -602,7 +601,7 @@ std::vector<topic> generate_faction_topics(const config & era, const bool sort_g
|
|||
text << "<header>text='" << _("Leaders") << "'</header>" << "\n";
|
||||
const std::vector<std::string> leaders =
|
||||
make_unit_links_list( utils::split(f["leader"]), true );
|
||||
BOOST_FOREACH(const std::string &link, leaders) {
|
||||
for (const std::string &link : leaders) {
|
||||
text << "• " << link << "\n";
|
||||
}
|
||||
|
||||
|
@ -611,7 +610,7 @@ std::vector<topic> generate_faction_topics(const config & era, const bool sort_g
|
|||
text << "<header>text='" << _("Recruits") << "'</header>" << "\n";
|
||||
const std::vector<std::string> recruit_links =
|
||||
make_unit_links_list( recruit_ids, true );
|
||||
BOOST_FOREACH(const std::string &link, recruit_links) {
|
||||
for (const std::string &link : recruit_links) {
|
||||
text << "• " << link << "\n";
|
||||
}
|
||||
|
||||
|
@ -653,7 +652,7 @@ std::string make_unit_link(const std::string& type_id)
|
|||
std::vector<std::string> make_unit_links_list(const std::vector<std::string>& type_id_list, bool ordered)
|
||||
{
|
||||
std::vector<std::string> links_list;
|
||||
BOOST_FOREACH(const std::string &type_id, type_id_list) {
|
||||
for (const std::string &type_id : type_id_list) {
|
||||
std::string unit_link = make_unit_link(type_id);
|
||||
if (!unit_link.empty())
|
||||
links_list.push_back(unit_link);
|
||||
|
@ -670,7 +669,7 @@ void generate_races_sections(const config *help_cfg, section &sec, int level)
|
|||
std::set<std::string, string_less> races;
|
||||
std::set<std::string, string_less> visible_races;
|
||||
|
||||
BOOST_FOREACH(const unit_type_data::unit_type_map::value_type &i, unit_types.types())
|
||||
for (const unit_type_data::unit_type_map::value_type &i : unit_types.types())
|
||||
{
|
||||
const unit_type &type = i.second;
|
||||
UNIT_DESCRIPTION_TYPE desc_type = description_type(type);
|
||||
|
@ -707,7 +706,7 @@ void generate_races_sections(const config *help_cfg, section &sec, int level)
|
|||
|
||||
void generate_era_sections(const config* help_cfg, section & sec, int level)
|
||||
{
|
||||
BOOST_FOREACH(const config & era, game_cfg->child_range("era")) {
|
||||
for (const config & era : game_cfg->child_range("era")) {
|
||||
if (era["hide_help"].to_bool()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -741,7 +740,7 @@ void generate_terrain_sections(const config* /*help_cfg*/, section& sec, int /*l
|
|||
|
||||
const t_translation::t_list& t_listi = tdata->list();
|
||||
|
||||
BOOST_FOREACH(const t_translation::t_terrain& t, t_listi) {
|
||||
for (const t_translation::t_terrain& t : t_listi) {
|
||||
|
||||
const terrain_type& info = tdata->get_terrain_info(t);
|
||||
|
||||
|
@ -757,7 +756,7 @@ void generate_terrain_sections(const config* /*help_cfg*/, section& sec, int /*l
|
|||
terrain_topic.text = new terrain_topic_generator(info);
|
||||
|
||||
t_translation::t_list base_terrains = tdata->underlying_union_terrain(t);
|
||||
BOOST_FOREACH(const t_translation::t_terrain& base, base_terrains) {
|
||||
for (const t_translation::t_terrain& base : base_terrains) {
|
||||
|
||||
const terrain_type& base_info = tdata->get_terrain_info(base);
|
||||
|
||||
|
@ -782,7 +781,7 @@ void generate_terrain_sections(const config* /*help_cfg*/, section& sec, int /*l
|
|||
|
||||
void generate_unit_sections(const config* /*help_cfg*/, section& sec, int level, const bool /*sort_generated*/, const std::string& race)
|
||||
{
|
||||
BOOST_FOREACH(const unit_type_data::unit_type_map::value_type &i, unit_types.types()) {
|
||||
for (const unit_type_data::unit_type_map::value_type &i : unit_types.types()) {
|
||||
const unit_type &type = i.second;
|
||||
|
||||
if (type.race_id() != race)
|
||||
|
@ -792,7 +791,7 @@ void generate_unit_sections(const config* /*help_cfg*/, section& sec, int level,
|
|||
continue;
|
||||
|
||||
section base_unit;
|
||||
BOOST_FOREACH(const std::string &variation_id, type.variations()) {
|
||||
for (const std::string &variation_id : type.variations()) {
|
||||
// TODO: Do we apply encountered stuff to variations?
|
||||
const unit_type &var_type = type.get_variation(variation_id);
|
||||
const std::string topic_name = var_type.type_name() + "\n" + var_type.variation_name();
|
||||
|
@ -821,7 +820,7 @@ std::vector<topic> generate_unit_topics(const bool sort_generated, const std::st
|
|||
std::set<std::string, string_less> race_topics;
|
||||
std::set<std::string> alignments;
|
||||
|
||||
BOOST_FOREACH(const unit_type_data::unit_type_map::value_type &i, unit_types.types())
|
||||
for (const unit_type_data::unit_type_map::value_type &i : unit_types.types())
|
||||
{
|
||||
const unit_type &type = i.second;
|
||||
|
||||
|
@ -857,7 +856,7 @@ std::vector<topic> generate_unit_topics(const bool sort_generated, const std::st
|
|||
race_name = r->plural_name();
|
||||
race_description = r->description();
|
||||
// if (description.empty()) description = _("No description Available");
|
||||
BOOST_FOREACH(const config &additional_topic, r->additional_topics())
|
||||
for (const config &additional_topic : r->additional_topics())
|
||||
{
|
||||
std::string id = additional_topic["id"];
|
||||
std::string title = additional_topic["title"];
|
||||
|
@ -1300,7 +1299,7 @@ void generate_contents()
|
|||
// opening the help browser in the default manner.
|
||||
config hidden_toplevel;
|
||||
std::stringstream ss;
|
||||
BOOST_FOREACH(const config §ion, help_config->child_range("section"))
|
||||
for (const config §ion : help_config->child_range("section"))
|
||||
{
|
||||
const std::string id = section["id"];
|
||||
if (find_section(toplevel, id) == nullptr) {
|
||||
|
@ -1317,7 +1316,7 @@ void generate_contents()
|
|||
}
|
||||
hidden_toplevel["sections"] = ss.str();
|
||||
ss.str("");
|
||||
BOOST_FOREACH(const config &topic, help_config->child_range("topic"))
|
||||
for (const config &topic : help_config->child_range("topic"))
|
||||
{
|
||||
const std::string id = topic["id"];
|
||||
if (find_topic(toplevel, id) == nullptr) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue