[packages/wesnoth] Renamed foreach to wes_foreach to avoid conflicts with boost See https://svn.boost.org/trac/boost/ti
baggins
baggins at pld-linux.org
Wed Jul 11 13:37:30 CEST 2012
commit bedb3e4942608ff050783a784e5c61e82f3e4d04
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Wed Jul 11 13:34:58 2012 +0200
Renamed foreach to wes_foreach to avoid conflicts with boost
See https://svn.boost.org/trac/boost/ticket/6131 for gory details
boost-1.50.patch | 9029 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
wesnoth.spec | 2 +
2 files changed, 9031 insertions(+)
---
diff --git a/boost-1.50.patch b/boost-1.50.patch
new file mode 100644
index 0000000..b4983b7
--- /dev/null
+++ b/boost-1.50.patch
@@ -0,0 +1,9029 @@
+diff -ur wesnoth-1.10.3.orig/doc/design/gui2/progress_bar.cpp wesnoth-1.10.3/doc/design/gui2/progress_bar.cpp
+--- wesnoth-1.10.3.orig/doc/design/gui2/progress_bar.cpp 2010-04-12 21:26:09.000000000 +0200
++++ wesnoth-1.10.3/doc/design/gui2/progress_bar.cpp 2012-07-11 13:16:05.883266695 +0200
+@@ -22,7 +22,7 @@
+ if(percentage_ != percentage) {
+ percentage_ = percentage;
+
+- foreach(tcanvas& c, canvas()) {
++ wes_foreach(tcanvas& c, canvas()) {
+ c.set_variable("percentage", variant(percentage));
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/about.cpp wesnoth-1.10.3/src/about.cpp
+--- wesnoth-1.10.3.orig/src/about.cpp 2012-01-16 05:58:33.000000000 +0100
++++ wesnoth-1.10.3/src/about.cpp 2012-07-11 13:16:06.019933355 +0200
+@@ -52,7 +52,7 @@
+ }
+
+ std::vector<std::string> lines = utils::split(c["text"], '\n');
+- foreach (std::string &line, lines)
++ wes_foreach (std::string &line, lines)
+ {
+ if (line.size() > 1 && line[0] == '+')
+ line = "+ " + line.substr(1);
+@@ -67,7 +67,7 @@
+ }
+ }
+
+- foreach (const config &entry, c.child_range("entry")) {
++ wes_foreach (const config &entry, c.child_range("entry")) {
+ res.push_back("- "+ entry["name"].str());
+ }
+ }
+@@ -80,7 +80,7 @@
+ config::child_itors about_entries = about_list.child_range("about");
+
+ if (!campaign.empty()) {
+- foreach (const config &about, about_entries) {
++ wes_foreach (const config &about, about_entries) {
+ // just finished a particular campaign
+ if (campaign == about["id"]) {
+ add_lines(res, about);
+@@ -88,7 +88,7 @@
+ }
+ }
+
+- foreach (const config &about, about_entries) {
++ wes_foreach (const config &about, about_entries) {
+ add_lines(res, about);
+ }
+
+@@ -101,7 +101,7 @@
+ images.clear();
+ images_default = "";
+
+- foreach (const config &about, cfg.child_range("about"))
++ wes_foreach (const config &about, cfg.child_range("about"))
+ {
+ about_list.add_child("about", about);
+ const std::string &im = about["images"];
+@@ -114,7 +114,7 @@
+ }
+ }
+
+- foreach (const config &campaign, cfg.child_range("campaign"))
++ wes_foreach (const config &campaign, cfg.child_range("campaign"))
+ {
+ config::const_child_itors abouts = campaign.child_range("about");
+ if (abouts.first == abouts.second) continue;
+@@ -126,7 +126,7 @@
+ temp["id"] = id;
+ std::string campaign_images;
+
+- foreach (const config &about, abouts)
++ wes_foreach (const config &about, abouts)
+ {
+ const std::string &subtitle = about["title"];
+ if (!subtitle.empty())
+@@ -139,12 +139,12 @@
+ text << '\n';
+ }
+
+- foreach (const std::string &line, utils::split(about["text"], '\n'))
++ wes_foreach (const std::string &line, utils::split(about["text"], '\n'))
+ {
+ text << " " << line << '\n';
+ }
+
+- foreach (const config &entry, about.child_range("entry"))
++ wes_foreach (const config &entry, about.child_range("entry"))
+ {
+ text << " " << entry["name"] << '\n';
+ }
+diff -ur wesnoth-1.10.3.orig/src/actions.cpp wesnoth-1.10.3/src/actions.cpp
+--- wesnoth-1.10.3.orig/src/actions.cpp 2012-04-07 19:02:33.000000000 +0200
++++ wesnoth-1.10.3/src/actions.cpp 2012-07-11 13:16:05.993266689 +0200
+@@ -206,7 +206,7 @@
+ placements.push_back("map");
+ placements.push_back("recall");
+
+- foreach(std::string place, placements) {
++ wes_foreach(std::string place, placements) {
+ map_location loc;
+ bool pass((place == "leader_passable") || (place == "map_passable"));
+
+@@ -417,7 +417,7 @@
+ leader_in_place= true;
+ else continue;
+
+- foreach (const unit& recall_unit, recall_list)
++ wes_foreach (const unit& recall_unit, recall_list)
+ {
+ //Only units which match the leaders recall filter are valid.
+ scoped_recall_unit this_unit("this_unit", t.save_id(), &recall_unit - &recall_list[0]);
+@@ -435,7 +435,7 @@
+ }
+
+ if (!(recall_loc_is_castle && leader_in_place)) {
+- foreach (const unit &recall, recall_list)
++ wes_foreach (const unit &recall, recall_list)
+ {
+ result.push_back(&recall);
+ }
+@@ -546,7 +546,7 @@
+
+ bool can_recruit_unit = is_on_team_list;
+ if (!can_recruit_unit) {
+- foreach (const std::string &recruitable, leader->recruits()) {
++ wes_foreach (const std::string &recruitable, leader->recruits()) {
+ if (recruitable == unit_type) {
+ can_recruit_unit = true;
+ break;
+@@ -1925,7 +1925,7 @@
+ // Simple algorithm: no maximum number of patients per healer.
+ void reset_resting(unit_map& units, int side)
+ {
+- foreach (unit &u, units) {
++ wes_foreach (unit &u, units) {
+ if (u.side() == side)
+ u.set_resting(true);
+ }
+@@ -1946,7 +1946,7 @@
+ std::list<unit_healing_struct> l;
+
+ // We look for all allied units, then we see if our healer is near them.
+- foreach (unit &u, units) {
++ wes_foreach (unit &u, units) {
+
+ if (u.get_state("unhealable") || u.incapacitated())
+ continue;
+@@ -2307,7 +2307,7 @@
+ }
+
+ pathfind::paths p(*resources::game_map, *resources::units, loc, *resources::teams, true, false, tm, 0, false, true);
+- foreach (const pathfind::paths::step &dest, p.destinations) {
++ wes_foreach (const pathfind::paths::step &dest, p.destinations) {
+ clear_shroud_loc(tm, dest.curr, &cleared_locations);
+ }
+
+@@ -2350,7 +2350,7 @@
+
+ tm.refog();
+
+- foreach (unit &u, *resources::units)
++ wes_foreach (unit &u, *resources::units)
+ {
+ if (u.side() == side) {
+ const unit_movement_resetter move_resetter(u);
+@@ -2372,7 +2372,7 @@
+
+ bool result = false;
+
+- foreach (unit &u, *resources::units)
++ wes_foreach (unit &u, *resources::units)
+ {
+ if (u.side() == side) {
+ const unit_movement_resetter move_resetter(u);
+@@ -2435,7 +2435,7 @@
+
+ std::set<map_location> known_units;
+ if(check_shroud) {
+- foreach (const unit &u, units) {
++ wes_foreach (const unit &u, units) {
+ if (!tm->fogged(u.get_location())) {
+ known_units.insert(u.get_location());
+ tm->see(u.side() - 1);
+@@ -2860,7 +2860,7 @@
+ */
+
+ std::set<map_location> known_units;
+- foreach (const unit &u, units) {
++ wes_foreach (const unit &u, units) {
+ if (!tm.fogged(u.get_location())) {
+ known_units.insert(u.get_location());
+ }
+diff -ur wesnoth-1.10.3.orig/src/addon/manager.cpp wesnoth-1.10.3/src/addon/manager.cpp
+--- wesnoth-1.10.3.orig/src/addon/manager.cpp 2012-03-03 23:11:25.000000000 +0100
++++ wesnoth-1.10.3/src/addon/manager.cpp 2012-07-11 13:16:05.959933359 +0200
+@@ -321,11 +321,11 @@
+
+ make_directory(dir);
+
+- foreach (const config &d, cfg.child_range("dir")) {
++ wes_foreach (const config &d, cfg.child_range("dir")) {
+ unarchive_dir(dir, d);
+ }
+
+- foreach (const config &f, cfg.child_range("file")) {
++ wes_foreach (const config &f, cfg.child_range("file")) {
+ unarchive_file(dir, f);
+ }
+ }
+@@ -701,7 +701,7 @@
+ std::string missing = "";
+ size_t count_missing = 0;
+
+- foreach(const std::string& i, dependencies) {
++ wes_foreach(const std::string& i, dependencies) {
+ if (std::find(installed.begin(), installed.end(), i) == installed.end()) {
+ missing += "\n" + i;
+ ++count_missing;
+@@ -717,7 +717,7 @@
+ std::vector< std::string > unsafe_matches;
+ std::ostringstream unsafe_list;
+ std::map<std::string, version_info> remote_version_map;
+- foreach (const config &remote_addon, remote_addons_list)
++ wes_foreach (const config &remote_addon, remote_addons_list)
+ {
+ const std::string& name = remote_addon["name"];
+ if (std::find(dependencies.begin(), dependencies.end(), name) != dependencies.end()) {
+@@ -837,7 +837,7 @@
+ if(!result) {
+ assert(failed_titles.empty() == false);
+ std::string failed_titles_list_fmt;
+- foreach(const std::string& entry, failed_titles) {
++ wes_foreach(const std::string& entry, failed_titles) {
+ failed_titles_list_fmt += '\n';
+ failed_titles_list_fmt += entry;
+ }
+@@ -870,7 +870,7 @@
+ std::vector<version_info> safe_local_versions;
+ std::vector<version_info> unsafe_local_versions;
+ std::map<std::string, version_info> remote_version_map;
+- foreach (const config &remote_addon, remote_addons_list)
++ wes_foreach (const config &remote_addon, remote_addons_list)
+ {
+ const std::string& name = remote_addon["name"];
+ const std::string& version = remote_addon["version"];
+@@ -1065,7 +1065,7 @@
+ if(!result) {
+ assert(failed_titles.empty() == false);
+ std::string failed_titles_list_fmt;
+- foreach(const std::string& entry, failed_titles) {
++ wes_foreach(const std::string& entry, failed_titles) {
+ failed_titles_list_fmt += '\n';
+ failed_titles_list_fmt += entry;
+ }
+@@ -1090,7 +1090,7 @@
+ const std::string& addon,
+ const std::vector<std::string>& own_addons)
+ {
+- foreach(const std::string& current_own_addon, own_addons) {
++ wes_foreach(const std::string& current_own_addon, own_addons) {
+ if(current_own_addon == addon) {
+ utils::string_map symbols;
+ symbols["addon"] = addon;
+@@ -1171,7 +1171,7 @@
+
+ std::vector< addon_info > infos;
+
+- foreach(const config &c, addon_cfgs)
++ wes_foreach(const config &c, addon_cfgs)
+ {
+ const std::string& name = c["name"];
+ const std::string& downloads = c["downloads"].str();
+@@ -1254,13 +1254,13 @@
+ infos.push_back(inf);
+ }
+
+- foreach(const std::string& pub, publish_options) {
++ wes_foreach(const std::string& pub, publish_options) {
+ static const std::string publish_icon = "icons/icon-addon-publish.png";
+ const std::string text = _("Publish add-on: ") + get_addon_name(pub);
+ options.push_back(IMAGE_PREFIX + publish_icon + COLUMN_SEPARATOR + font::GOOD_TEXT + text);
+ options_to_filter.push_back(text);
+ }
+- foreach(const std::string& del, delete_options) {
++ wes_foreach(const std::string& del, delete_options) {
+ static const std::string delete_icon = "icons/icon-addon-delete.png";
+ const std::string text = _("Delete add-on: ") + get_addon_name(del);
+ options.push_back(IMAGE_PREFIX + delete_icon + COLUMN_SEPARATOR + font::BAD_TEXT + text);
+@@ -1408,7 +1408,7 @@
+
+ remove_names.clear();
+
+- foreach(const std::string& id, remove_ids) {
++ wes_foreach(const std::string& id, remove_ids) {
+ remove_names.push_back(get_addon_name(id));
+ }
+
+@@ -1425,7 +1425,7 @@
+
+ std::vector<std::string> failed_names, skipped_names, succeeded_names;
+
+- foreach(const std::string& id, remove_ids) {
++ wes_foreach(const std::string& id, remove_ids) {
+ const std::string& name = get_addon_name(id);
+
+ if(have_addon_pbl_info(id) || have_addon_in_vcs_tree(id)) {
+@@ -1531,12 +1531,12 @@
+ }
+ static const std::string parentd = get_addon_campaigns_dir();
+ std::vector<std::string> addon_info_files;
+- foreach(std::string const& dir, addons)
++ wes_foreach(std::string const& dir, addons)
+ addon_info_files.push_back(parentd+"/"+dir+"/_info.cfg");
+
+ size_t i = 0;
+
+- foreach(std::string const& info_file, addon_info_files) {
++ wes_foreach(std::string const& info_file, addon_info_files) {
+ assert(i < addons.size());
+
+ std::string const& addon = addons[i];
+diff -ur wesnoth-1.10.3.orig/src/addon/validation.cpp wesnoth-1.10.3/src/addon/validation.cpp
+--- wesnoth-1.10.3.orig/src/addon/validation.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/addon/validation.cpp 2012-07-11 13:16:05.959933359 +0200
+@@ -44,10 +44,10 @@
+
+ bool check_names_legal(const config& dir)
+ {
+- foreach (const config &path, dir.child_range("file")) {
++ wes_foreach (const config &path, dir.child_range("file")) {
+ if (!addon_name_legal(path["name"])) return false;
+ }
+- foreach (const config &path, dir.child_range("dir")) {
++ wes_foreach (const config &path, dir.child_range("dir")) {
+ if (!addon_name_legal(path["name"])) return false;
+ if (!check_names_legal(path)) return false;
+ }
+diff -ur wesnoth-1.10.3.orig/src/ai/composite/ai.cpp wesnoth-1.10.3/src/ai/composite/ai.cpp
+--- wesnoth-1.10.3.orig/src/ai/composite/ai.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/composite/ai.cpp 2012-07-11 13:16:05.909933359 +0200
+@@ -60,7 +60,7 @@
+ cfg_["id"]<<"]"<<std::endl;
+
+ // init the composite ai stages
+- foreach(const config &cfg_element, cfg_.child_range("stage")){
++ wes_foreach(const config &cfg_element, cfg_.child_range("stage")){
+ add_stage(cfg_element);
+ }
+
+@@ -115,7 +115,7 @@
+ std::vector< stage_ptr > stages;
+ create_stage(stages,cfg);
+ int j=0;
+- foreach (stage_ptr b, stages ){
++ wes_foreach (stage_ptr b, stages ){
+ stages_.push_back(b);
+ j++;
+ }
+@@ -128,7 +128,7 @@
+ std::vector< goal_ptr > goals;
+ create_goal(goals,cfg);
+ int j=0;
+- foreach (goal_ptr b, goals ){
++ wes_foreach (goal_ptr b, goals ){
+ get_goals().push_back(b);
+ j++;
+ }
+@@ -137,7 +137,7 @@
+
+
+ void ai_composite::play_turn(){
+- foreach(stage_ptr &s, stages_){
++ wes_foreach(stage_ptr &s, stages_){
+ s->play_stage();
+ }
+ }
+@@ -206,7 +206,7 @@
+ config cfg;
+
+ //serialize the composite ai stages
+- foreach(const stage_ptr &s, stages_){
++ wes_foreach(const stage_ptr &s, stages_){
+ cfg.add_child("stage",s->to_config());
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/ai/composite/aspect.hpp wesnoth-1.10.3/src/ai/composite/aspect.hpp
+--- wesnoth-1.10.3.orig/src/ai/composite/aspect.hpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/composite/aspect.hpp 2012-07-11 13:16:05.909933359 +0200
+@@ -265,7 +265,7 @@
+ , facets_()
+ , default_()
+ {
+- foreach (const config &cfg_element, this->cfg_.child_range("facet") ){
++ wes_foreach (const config &cfg_element, this->cfg_.child_range("facet") ){
+ add_facet(-1,cfg_element);
+ }
+
+@@ -291,7 +291,7 @@
+ {
+ std::vector<aspect_ptr> facets_base;
+ engine::parse_aspect_from_config(*this,cfg,this->get_id(),std::back_inserter(facets_base));
+- foreach (aspect_ptr a, facets_base ){
++ wes_foreach (aspect_ptr a, facets_base ){
+ typename aspect_type<T>::typesafe_ptr b = boost::dynamic_pointer_cast< typesafe_aspect<T> > (a);
+ facets.push_back(b);
+ }
+@@ -301,7 +301,7 @@
+ virtual void recalculate() const
+ {
+ ///@todo 1.9 optimize in case of an aspect which returns variant
+- foreach (const typename aspect_type<T>::typesafe_ptr &f, make_pair(facets_.rbegin(),facets_.rend())) {
++ wes_foreach (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;
+@@ -316,7 +316,7 @@
+ virtual config to_config() const
+ {
+ config cfg = aspect::to_config();
+- foreach (const typename aspect_type<T>::typesafe_ptr f, facets_) {
++ wes_foreach (const typename aspect_type<T>::typesafe_ptr f, facets_) {
+ cfg.add_child("facet",f->to_config());
+ }
+ if (default_) {
+@@ -334,7 +334,7 @@
+ std::vector< aspect_ptr > facets;
+ engine::parse_aspect_from_config(*this,cfg,this->get_id(),std::back_inserter(facets));
+ int j=0;
+- foreach (aspect_ptr a, facets ){
++ wes_foreach (aspect_ptr a, facets ){
+ typename aspect_type<T>::typesafe_ptr b = boost::dynamic_pointer_cast< typesafe_aspect<T> > (a);
+ facets_.insert(facets_.begin()+pos+j,b);
+ j++;
+diff -ur wesnoth-1.10.3.orig/src/ai/composite/component.cpp wesnoth-1.10.3/src/ai/composite/component.cpp
+--- wesnoth-1.10.3.orig/src/ai/composite/component.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/composite/component.cpp 2012-07-11 13:16:05.909933359 +0200
+@@ -125,7 +125,7 @@
+ std::vector<std::string> component::get_children_types()
+ {
+ std::vector<std::string> types;
+- foreach (property_handler_map::value_type &ph, property_handlers_) {
++ wes_foreach (property_handler_map::value_type &ph, property_handlers_) {
+ types.push_back(ph.first);
+ }
+ return types;
+@@ -241,9 +241,9 @@
+
+ s << offset_str << type<<"["<<root->get_id() <<"] "<<root->get_engine()<<" "<<root->get_name()<< std::endl;
+
+- foreach (std::string t, t_list) {
++ wes_foreach (std::string t, t_list) {
+ std::vector<component*> c_list = root->get_children(t);
+- foreach (component *c, c_list) {
++ wes_foreach (component *c, c_list) {
+ print_component(c,t,s,offset+1);
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/ai/composite/goal.cpp wesnoth-1.10.3/src/ai/composite/goal.cpp
+--- wesnoth-1.10.3.orig/src/ai/composite/goal.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/composite/goal.cpp 2012-07-11 13:16:05.913266692 +0200
+@@ -128,7 +128,7 @@
+ if (!criteria) return;
+
+ //find the enemy leaders and explicit targets
+- foreach (const unit &u, *resources::units) {
++ wes_foreach (const unit &u, *resources::units) {
+ if (u.matches_filter(vconfig(criteria), u.get_location())) {
+ LOG_AI_GOAL << "found explicit target unit at ... " << u.get_location() << " with value: " << value() << "\n";
+ *target_list = target(u.get_location(), value(), target::EXPLICIT);
+@@ -173,7 +173,7 @@
+
+ std::set<map_location> items;
+ filter_ptr_->get_locations(items);
+- foreach (const map_location &loc, items)
++ wes_foreach (const map_location &loc, items)
+ {
+ LOG_AI_GOAL << "found explicit target location ... " << loc << " with value: " << value() << std::endl;
+ *target_list = target(loc, value(), target::EXPLICIT);
+@@ -252,7 +252,7 @@
+
+ std::set<map_location> items;
+ if (protect_unit_) {
+- foreach (const unit &u, units)
++ wes_foreach (const unit &u, units)
+ {
+ if (protect_only_own_unit_ && u.side() != get_side()) {
+ continue;
+@@ -268,9 +268,9 @@
+ }
+ 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.
+- foreach (const map_location &loc, items)
++ wes_foreach (const map_location &loc, items)
+ {
+- foreach (const unit &u, units)
++ wes_foreach (const unit &u, units)
+ {
+ int distance = distance_between(u.get_location(), loc);
+ if (current_team().is_enemy(u.side()) && distance < radius_ &&
+@@ -325,7 +325,7 @@
+ handler_->handle(c, true, l_obj);
+ std::vector < target > targets = *(l_obj->get());
+
+- foreach (target tg, targets)
++ wes_foreach (target tg, targets)
+ {
+ *target_list = tg;
+ }
+diff -ur wesnoth-1.10.3.orig/src/ai/composite/property_handler.hpp wesnoth-1.10.3/src/ai/composite/property_handler.hpp
+--- wesnoth-1.10.3.orig/src/ai/composite/property_handler.hpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/composite/property_handler.hpp 2012-07-11 13:16:05.909933359 +0200
+@@ -134,7 +134,7 @@
+ std::vector<component*> handle_get_children()
+ {
+ std::vector<component*> children;
+- foreach (t_ptr v, values_) {
++ wes_foreach (t_ptr v, values_) {
+ children.push_back(&*v);
+ }
+ return children;
+@@ -149,7 +149,7 @@
+ t_ptr_vector values;
+ factory_(values,cfg);
+ int j=0;
+- foreach (t_ptr b, values ){
++ wes_foreach (t_ptr b, values ){
+ values_.insert(values_.begin()+pos+j,b);
+ j++;
+ }
+@@ -200,7 +200,7 @@
+ //* is a special case - 'delete all facets'
+ if (child.id == "*") {
+ bool b = false;
+- foreach(typename aspect_map::value_type a, aspects_) {
++ wes_foreach(typename aspect_map::value_type a, aspects_) {
+ b |= a.second->delete_all_facets();
+ }
+ return b;
+@@ -212,7 +212,7 @@
+ std::vector<component*> handle_get_children()
+ {
+ std::vector<component*> children;
+- foreach(typename aspect_map::value_type a, aspects_) {
++ wes_foreach(typename aspect_map::value_type a, aspects_) {
+ children.push_back(&*a.second);
+ }
+ return children;
+diff -ur wesnoth-1.10.3.orig/src/ai/configuration.cpp wesnoth-1.10.3/src/ai/configuration.cpp
+--- wesnoth-1.10.3.orig/src/ai/configuration.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/configuration.cpp 2012-07-11 13:16:05.923266694 +0200
+@@ -93,7 +93,7 @@
+ }
+
+
+- foreach (const config &ai_configuration, ais.child_range("ai")) {
++ wes_foreach (const config &ai_configuration, ais.child_range("ai")) {
+ const std::string &id = ai_configuration["id"];
+ if (id.empty()){
+
+@@ -118,7 +118,7 @@
+ void configuration::add_era_ai_from_config(const config &era)
+ {
+ era_ai_configurations_.clear();
+- foreach (const config &ai_configuration, era.child_range("ai")) {
++ wes_foreach (const config &ai_configuration, era.child_range("ai")) {
+ const std::string &id = ai_configuration["id"];
+ if (id.empty()){
+
+@@ -196,7 +196,7 @@
+ config aspect_config;
+ aspect_config["id"] = id;
+
+- foreach (const config &aiparam, cfg.child_range("ai")) {
++ wes_foreach (const config &aiparam, cfg.child_range("ai")) {
+ const config &_aspect = aiparam.find_child("aspect","id",id);
+ if (_aspect) {
+ aspect_config.append(_aspect);
+@@ -216,7 +216,7 @@
+ if (aspect_was_attribute) {
+ facet_config["value"] = aiparam[id];
+ } else {
+- foreach (const config &value, aiparam.child_range(id)) {
++ wes_foreach (const config &value, aiparam.child_range(id)) {
+ facet_config.add_child("value",value);
+ }
+ }
+@@ -242,7 +242,7 @@
+
+ //leave only the [ai] children
+ cfg = config();
+- foreach (const config &aiparam, original_cfg.child_range("ai")) {
++ wes_foreach (const config &aiparam, original_cfg.child_range("ai")) {
+ cfg.add_child("ai",aiparam);
+ }
+
+@@ -264,7 +264,7 @@
+
+ //find version
+ int version = 10600;
+- foreach (const config &aiparam, cfg.child_range("ai")) {
++ wes_foreach (const config &aiparam, cfg.child_range("ai")) {
+ if (const config::attribute_value *a = aiparam.get("version")){
+ int v = a->to_int(version);
+ if (version<v) {
+@@ -290,7 +290,7 @@
+ config parsed_cfg = config();
+
+ LOG_AI_CONFIGURATION << "side "<< side <<": merging AI configurations"<< std::endl;
+- foreach (const config &aiparam, cfg.child_range("ai")) {
++ wes_foreach (const config &aiparam, cfg.child_range("ai")) {
+ parsed_cfg.append(aiparam);
+ }
+
+@@ -302,7 +302,7 @@
+ parsed_cfg.merge_children_by_attribute("aspect","id");
+
+ LOG_AI_CONFIGURATION << "side "<< side <<": removing duplicate [default] tags from aspects"<< std::endl;
+- foreach (config &aspect_cfg, parsed_cfg.child_range("aspect")) {
++ wes_foreach (config &aspect_cfg, parsed_cfg.child_range("aspect")) {
+ if (!aspect_cfg.child("default")) {
+ WRN_AI_CONFIGURATION << "side "<< side <<": aspect with id=["<<aspect_cfg["id"]<<"] lacks default config facet!" <<std::endl;
+ continue;
+@@ -341,7 +341,7 @@
+ if (cfg["ai_algorithm"]=="idle_ai") {
+ is_idle_ai = true;
+ } else {
+- foreach (config &aiparam, cfg.child_range("ai")) {
++ wes_foreach (config &aiparam, cfg.child_range("ai")) {
+ if (aiparam["ai_algorithm"]=="idle_ai") {
+ is_idle_ai = true;
+ break;
+@@ -360,8 +360,8 @@
+
+ config fallback_stage_cfg_ai;
+
+- foreach (config &aiparam, cfg.child_range("ai")) {
+- foreach (const well_known_aspect &wka, well_known_aspects) {
++ wes_foreach (config &aiparam, cfg.child_range("ai")) {
++ wes_foreach (const well_known_aspect &wka, well_known_aspects) {
+ if (wka.was_an_attribute_) {
+ aiparam.remove_attribute(wka.name_);
+ } else {
+@@ -370,7 +370,7 @@
+ }
+
+
+- foreach (const config &aitarget, aiparam.child_range("target")) {
++ wes_foreach (const config &aitarget, aiparam.child_range("target")) {
+ config aigoal;
+ transfer_turns_and_time_of_day_data(aiparam,aigoal);
+
+@@ -388,14 +388,14 @@
+ aiparam.clear_children("target");
+
+
+- foreach (config &ai_protect_unit, aiparam.child_range("protect_unit")) {
++ wes_foreach (config &ai_protect_unit, aiparam.child_range("protect_unit")) {
+ transfer_turns_and_time_of_day_data(aiparam,ai_protect_unit);
+ upgrade_protect_goal_config_from_1_07_02_to_1_07_03(side,ai_protect_unit,parsed_cfg,true);
+ }
+ aiparam.clear_children("protect_unit");
+
+
+- foreach (config &ai_protect_location, aiparam.child_range("protect_location")) {
++ wes_foreach (config &ai_protect_location, aiparam.child_range("protect_location")) {
+ transfer_turns_and_time_of_day_data(aiparam,ai_protect_location);
+ upgrade_protect_goal_config_from_1_07_02_to_1_07_03(side,ai_protect_location,parsed_cfg,false);
+ }
+@@ -423,19 +423,19 @@
+ fallback_stage_cfg_ai.clear_children("aspect");
+
+ //move [stage]s to root of the config
+- foreach (const config &aistage, fallback_stage_cfg_ai.child_range("stage")) {
++ wes_foreach (const config &aistage, fallback_stage_cfg_ai.child_range("stage")) {
+ parsed_cfg.add_child("stage",aistage);
+ }
+ fallback_stage_cfg_ai.clear_children("stage");
+
+ //move [goal]s to root of the config
+- foreach (const config &aigoal, fallback_stage_cfg_ai.child_range("goal")) {
++ wes_foreach (const config &aigoal, fallback_stage_cfg_ai.child_range("goal")) {
+ parsed_cfg.add_child("goal",aigoal);
+ }
+ fallback_stage_cfg_ai.clear_children("goal");
+
+ //move [modify_ai]'s to root of the config
+- foreach (const config &aimodifyai, fallback_stage_cfg_ai.child_range("modify_ai")) {
++ wes_foreach (const config &aimodifyai, fallback_stage_cfg_ai.child_range("modify_ai")) {
+ parsed_cfg.add_child("modify_ai",aimodifyai);
+ }
+ fallback_stage_cfg_ai.clear_children("modify_ai");
+@@ -452,12 +452,12 @@
+ {
+ config cfg;
+
+- foreach (const config &aiparam, ai_parameters) {
++ wes_foreach (const config &aiparam, ai_parameters) {
+ cfg.add_child("ai",aiparam);
+ }
+
+ DBG_AI_CONFIGURATION << "side "<< side <<": upgrading aspects from syntax of 1.7.2 to 1.7.3, old-style config is:" << std::endl << cfg << std::endl;
+- foreach (const well_known_aspect &wka, well_known_aspects) {
++ wes_foreach (const well_known_aspect &wka, well_known_aspects) {
+ upgrade_aspect_config_from_1_07_02_to_1_07_03(side, cfg,parsed_cfg,wka.name_,wka.was_an_attribute_);
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/ai/contexts.cpp wesnoth-1.10.3/src/ai/contexts.cpp
+--- wesnoth-1.10.3.orig/src/ai/contexts.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/contexts.cpp 2012-07-11 13:16:05.919933361 +0200
+@@ -223,19 +223,19 @@
+
+ void readonly_context_impl::on_readonly_context_create() {
+ //init the composite ai engines
+- foreach(const config &cfg_element, cfg_.child_range("engine")){
++ wes_foreach(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
+- foreach(const config &cfg_element, cfg_.child_range("aspect")){
++ wes_foreach(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
+- foreach(const config &cfg_element, cfg_.child_range("goal")){
++ wes_foreach(const config &cfg_element, cfg_.child_range("goal")){
+ engine::parse_goal_from_config(*this,cfg_element,std::back_inserter(get_goals()));
+ }
+ }
+@@ -255,13 +255,13 @@
+ config readonly_context_impl::to_readonly_context_config() const
+ {
+ config cfg;
+- foreach(const engine_ptr e, engines_) {
++ wes_foreach(const engine_ptr e, engines_) {
+ cfg.add_child("engine",e->to_config());
+ }
+- foreach(const aspect_map::value_type a, aspects_) {
++ wes_foreach(const aspect_map::value_type a, aspects_) {
+ cfg.add_child("aspect",a.second->to_config());
+ }
+- foreach(const goal_ptr g, goals_) {
++ wes_foreach(const goal_ptr g, goals_) {
+ cfg.add_child("goal",g->to_config());
+ }
+ return cfg;
+@@ -366,7 +366,7 @@
+ }
+
+ for(std::map<map_location,pathfind::paths>::iterator m = res.begin(); m != res.end(); ++m) {
+- foreach (const pathfind::paths::step &dest, m->second.destinations)
++ wes_foreach (const pathfind::paths::step &dest, m->second.destinations)
+ {
+ const map_location& src = m->first;
+ const map_location& dst = dest.curr;
+@@ -406,7 +406,7 @@
+
+ void readonly_context_impl::add_aspects(std::vector< aspect_ptr > &aspects )
+ {
+- foreach (aspect_ptr a, aspects) {
++ wes_foreach (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()) {
+@@ -1024,7 +1024,7 @@
+ // 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;
+- foreach (const attack_type &att, un.attacks())
++ wes_foreach (const attack_type &att, un.attacks())
+ {
+ int damage = att.damage() * att.num_attacks() * (100 + tod_modifier);
+ if (damage > most_damage) {
+@@ -1112,7 +1112,7 @@
+ map_location const* best_occupied_keep = &map_location::null_location;
+ double move_left_at_best_occupied_keep = 0.0;
+
+- foreach (const pathfind::paths::step &dest, leader_paths.destinations)
++ wes_foreach (const pathfind::paths::step &dest, leader_paths.destinations)
+ {
+ const map_location &loc = dest.curr;
+ if (keeps().find(loc)!=keeps().end()){
+diff -ur wesnoth-1.10.3.orig/src/ai/default/ai.cpp wesnoth-1.10.3/src/ai/default/ai.cpp
+--- wesnoth-1.10.3.orig/src/ai/default/ai.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/default/ai.cpp 2012-07-11 13:16:05.909933359 +0200
+@@ -144,7 +144,7 @@
+
+ void ai_default_recruitment_stage::on_create() {
+ stage::on_create();
+- foreach (const config &c, cfg_.child_range("limit")) {
++ wes_foreach (const config &c, cfg_.child_range("limit")) {
+ if (c.has_attribute("type") && c.has_attribute("max") ) {
+ maximum_counts_.insert(std::make_pair(c["type"],lexical_cast_default<int>(c["max"],0)));
+ }
+@@ -193,7 +193,7 @@
+ bool found = false;
+ // Find an available unit that can be recruited,
+ // matches the desired usage type, and comes in under budget.
+- foreach (const std::string &name, current_team().recruits())
++ wes_foreach (const std::string &name, current_team().recruits())
+ {
+ const unit_type *ut = unit_types.find(name);
+ if (!ut) continue;
+@@ -435,7 +435,7 @@
+
+ team &enemy_team = (*resources::teams)[j->side() - 1];
+ const std::set<std::string> &recruits = enemy_team.recruits();
+- foreach (const std::string &rec, recruits) {
++ wes_foreach (const std::string &rec, recruits) {
+ get_combat_score_vs(ut,rec,score,weighting,0,0);
+ }
+ continue;
+@@ -677,7 +677,7 @@
+ double best_combat_score_of_advancement = 0;
+ bool best_combat_score_of_advancement_found = false;
+ int best_cost = recall_cost;
+- foreach (const std::string &i, u.advances_to()) {
++ wes_foreach (const std::string &i, u.advances_to()) {
+ const unit_type *ut = unit_types.find(i);
+ if (!ut) {
+ continue;
+diff -ur wesnoth-1.10.3.orig/src/ai/formula/ai.cpp wesnoth-1.10.3/src/ai/formula/ai.cpp
+--- wesnoth-1.10.3.orig/src/ai/formula/ai.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/formula/ai.cpp 2012-07-11 13:16:05.919933361 +0200
+@@ -548,7 +548,7 @@
+ variant villages_from_set(const Container& villages,
+ const std::set<map_location>* exclude=NULL) {
+ std::vector<variant> vars;
+- foreach(const map_location& loc, villages) {
++ wes_foreach(const map_location& loc, villages) {
+ if(exclude && exclude->count(loc)) {
+ continue;
+ }
+@@ -617,7 +617,7 @@
+ {
+ const std::vector<std::string> &rp = get_recruitment_pattern();
+ std::vector<variant> vars;
+- foreach (const std::string &i, rp) {
++ wes_foreach (const std::string &i, rp) {
+ vars.push_back(variant(i));
+ }
+ return variant(&vars);
+@@ -751,7 +751,7 @@
+ std::vector<variant> v;
+ tmp.push_back( v );
+ }
+- foreach (const unit &u, units) {
++ wes_foreach (const unit &u, units) {
+ tmp[u.side() - 1].push_back(variant(new unit_callable(u)));
+ }
+ for( size_t i = 0; i<tmp.size(); ++i)
+@@ -924,7 +924,7 @@
+ //make sure we don't run out of refcount
+ vars_.add_ref();
+
+- foreach (const config &func, cfg_.child_range("function"))
++ wes_foreach (const config &func, cfg_.child_range("function"))
+ {
+ const t_string &name = func["name"];
+ const t_string &inputs = func["inputs"];
+@@ -947,7 +947,7 @@
+ if (const config &ai_vars = cfg_.child("vars"))
+ {
+ variant var;
+- foreach (const config::attribute &i, ai_vars.attribute_range()) {
++ wes_foreach (const config::attribute &i, ai_vars.attribute_range()) {
+ var.serialize_from_string(i.second);
+ vars_.add(i.first, var);
+ }
+diff -ur wesnoth-1.10.3.orig/src/ai/formula/candidates.cpp wesnoth-1.10.3/src/ai/formula/candidates.cpp
+--- wesnoth-1.10.3.orig/src/ai/formula/candidates.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/formula/candidates.cpp 2012-07-11 13:16:05.919933361 +0200
+@@ -32,7 +32,7 @@
+ void candidate_action_manager::load_config(const config& cfg, ai::formula_ai* ai, function_symbol_table* function_table)
+ {
+ // register candidate actions
+- foreach (const config &rc_action, cfg.child_range("register_candidate_action"))
++ wes_foreach (const config &rc_action, cfg.child_range("register_candidate_action"))
+ {
+ candidate_action_ptr new_ca = load_candidate_action_from_config(rc_action,ai,function_table);
+
+@@ -67,7 +67,7 @@
+ {
+ evaluated_candidate_actions_.clear();
+
+- foreach(candidate_action_ptr cm, candidate_actions_)
++ wes_foreach(candidate_action_ptr cm, candidate_actions_)
+ {
+ cm->evaluate(ai, units);
+ evaluated_candidate_actions_.insert(cm);
+@@ -116,7 +116,7 @@
+ const config & filter_params = cfg.child("filter");
+
+ if( filter_params ) {
+- foreach( const config::attribute filter_param, filter_params.attribute_range() )
++ wes_foreach( 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));
+diff -ur wesnoth-1.10.3.orig/src/ai/formula/function_table.cpp wesnoth-1.10.3/src/ai/formula/function_table.cpp
+--- wesnoth-1.10.3.orig/src/ai/formula/function_table.cpp 2012-02-18 12:53:54.000000000 +0100
++++ wesnoth-1.10.3/src/ai/formula/function_table.cpp 2012-07-11 13:16:05.923266694 +0200
+@@ -355,7 +355,7 @@
+ if( scores[current_side][i] > 98 )
+ continue;
+
+- foreach( int side , enemies) {
++ wes_foreach( int side , enemies) {
+ int diff = scores[current_side][i] - scores[side][i];
+ if ( diff > enemy_tollerancy) {
+ valid = false;
+@@ -365,7 +365,7 @@
+ }
+
+ if( valid ) {
+- foreach( int side , allies) {
++ wes_foreach( int side , allies) {
+ if ( scores[current_side][i] - scores[side][i] > ally_tollerancy ) {
+ valid = false;
+ break;
+@@ -563,7 +563,7 @@
+ visited_locs.erase(starting_loc);
+
+ std::vector<variant> res;
+- foreach( const map_location& ml, visited_locs) {
++ wes_foreach( const map_location& ml, visited_locs) {
+ res.push_back( variant(new location_callable( ml ) ) );
+ }
+
+@@ -841,7 +841,7 @@
+ 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;
+- //foreach (const mv &m, analysis->movements) {
++ //wes_foreach (const mv &m, analysis->movements) {
+ // units_with_moves.move(m.first, m.second);
+ //}
+
+@@ -1629,7 +1629,7 @@
+
+ std::vector<attack_type> attacks = attacker.attacks();
+
+- foreach(const attack_type &attack, attacks) {
++ wes_foreach(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);
+diff -ur wesnoth-1.10.3.orig/src/ai/manager.cpp wesnoth-1.10.3/src/ai/manager.cpp
+--- wesnoth-1.10.3.orig/src/ai/manager.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/manager.cpp 2012-07-11 13:16:05.913266692 +0200
+@@ -89,7 +89,7 @@
+
+ if (this->ai_) {
+ ai_->on_create();
+- foreach (config &mod_ai, cfg_.child_range("modify_ai")) {
++ wes_foreach (config &mod_ai, cfg_.child_range("modify_ai")) {
+ if (!mod_ai.has_attribute("side")) {
+ mod_ai["side"] = side;
+ }
+@@ -149,8 +149,8 @@
+ cfg_.merge_children_by_attribute("aspect","id");
+ } else {
+ // else run 'add_facet' command on each [aspect][facet]
+- foreach (const config &cfg_a, cfg.child_range("aspect")) {
+- foreach (const config &cfg_f, cfg_a.child_range("facet")) {
++ wes_foreach (const config &cfg_a, cfg.child_range("aspect")) {
++ wes_foreach (const config &cfg_f, cfg_a.child_range("facet")) {
+ readonly_context_->add_facet(cfg_a["id"],cfg_f);
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/ai/testing/aspect_attacks.cpp wesnoth-1.10.3/src/ai/testing/aspect_attacks.cpp
+--- wesnoth-1.10.3.orig/src/ai/testing/aspect_attacks.cpp 2012-01-23 16:09:23.000000000 +0100
++++ wesnoth-1.10.3/src/ai/testing/aspect_attacks.cpp 2012-07-11 13:16:05.913266692 +0200
+@@ -468,7 +468,7 @@
+ // 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;
+- foreach (const attack_type &att, un.attacks())
++ wes_foreach (const attack_type &att, un.attacks())
+ {
+ int damage = att.damage() * att.num_attacks() * (100 + tod_modifier);
+ if (damage > most_damage) {
+@@ -572,7 +572,7 @@
+ // 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;
+- foreach (const attack_type &att, un.attacks())
++ wes_foreach (const attack_type &att, un.attacks())
+ {
+ int damage = att.damage() * att.num_attacks() * (100 + tod_modifier);
+ if (damage > most_damage) {
+diff -ur wesnoth-1.10.3.orig/src/ai/testing/ca.cpp wesnoth-1.10.3/src/ai/testing/ca.cpp
+--- wesnoth-1.10.3.orig/src/ai/testing/ca.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/testing/ca.cpp 2012-07-11 13:16:05.916600027 +0200
+@@ -306,7 +306,7 @@
+ bool found = false;
+ // Find an available unit that can be recruited,
+ // matches the desired usage type, and comes in under budget.
+- foreach (const std::string &name, current_team().recruits())
++ wes_foreach (const std::string &name, current_team().recruits())
+ {
+ const unit_type *ut = unit_types.find(name);
+ if (!ut) continue;
+@@ -686,7 +686,7 @@
+ possible_moves.insert(std::pair<map_location,pathfind::paths>(leader->get_location(), leader_paths));
+
+ map_location loc;
+- foreach (const map_location &l, route.steps)
++ wes_foreach (const map_location &l, route.steps)
+ {
+ if (leader_paths.destinations.contains(l) &&
+ power_projection(l, get_enemy_dstsrc()) < leader->hitpoints() * max_risk)
+@@ -779,7 +779,7 @@
+ // The leader can't move to his keep, try to move to the closest location
+ // to the keep where there are no enemies in range.
+ int current_distance = distance_between(leader->get_location(), keep);
+- foreach (const pathfind::paths::step &dest, leader_paths.destinations)
++ wes_foreach (const pathfind::paths::step &dest, leader_paths.destinations)
+ {
+ if (!units_.find(dest.curr).valid()){
+ const int new_distance = distance_between(dest.curr,keep);
+@@ -1728,12 +1728,12 @@
+ }*/
+ //int leader_adj_count = 0;
+ std::vector<map_location> leaders_adj_v;
+- foreach(unit_map::const_iterator leader, leaders){
++ wes_foreach(unit_map::const_iterator leader, leaders){
+ map_location tmp_leader_adj[6];
+ get_adjacent_tiles(leader->get_location(), tmp_leader_adj);
+- foreach(map_location &loc, tmp_leader_adj){
++ wes_foreach(map_location &loc, tmp_leader_adj){
+ bool found = false;
+- foreach(map_location &new_loc, leaders_adj_v){
++ wes_foreach(map_location &new_loc, leaders_adj_v){
+ if(new_loc == loc){
+ found = true;
+ break;
+@@ -1974,7 +1974,7 @@
+ }
+ std::vector<unit_map::unit_iterator> ai_leaders = resources::units->find_leaders(get_side());
+ bool allied_leaders_available = false;
+- foreach(team &tmp_team, *resources::teams){
++ wes_foreach(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()){
+@@ -2001,7 +2001,7 @@
+ 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
+- foreach(unit_map::unit_iterator &ai_leader, ai_leaders){
++ wes_foreach(unit_map::unit_iterator &ai_leader, ai_leaders){
+ //only if leader is on a keep
+ if (!resources::game_map->is_keep(ai_leader->get_location())) {
+ continue;
+@@ -2059,7 +2059,7 @@
+ }
+ ai_leader->remove_movement_ai();
+ }
+- foreach(unit_map::unit_iterator &leader, ai_leaders){
++ wes_foreach(unit_map::unit_iterator &leader, ai_leaders){
+ leader->remove_movement_ai();
+ }
+ //ERR_AI_TESTING_AI_DEFAULT << get_name() << ": evaluate - not yet implemented" << std::endl;
+diff -ur wesnoth-1.10.3.orig/src/ai/testing/ca_global_fallback.cpp wesnoth-1.10.3/src/ai/testing/ca_global_fallback.cpp
+--- wesnoth-1.10.3.orig/src/ai/testing/ca_global_fallback.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/testing/ca_global_fallback.cpp 2012-07-11 13:16:05.913266692 +0200
+@@ -89,7 +89,7 @@
+ LOG_AI << "start" << std::endl;
+ const int ticks = SDL_GetTicks();
+ double res_sum = 0;
+- foreach( unit &u, *resources::units)
++ wes_foreach( unit &u, *resources::units)
+ {
+ if (u.side()!=get_side())
+ {
+diff -ur wesnoth-1.10.3.orig/src/ai/testing/ca_testing_recruitment.cpp wesnoth-1.10.3/src/ai/testing/ca_testing_recruitment.cpp
+--- wesnoth-1.10.3.orig/src/ai/testing/ca_testing_recruitment.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/testing/ca_testing_recruitment.cpp 2012-07-11 13:16:05.916600027 +0200
+@@ -206,7 +206,7 @@
+ int get_current_qty(const std::string &name) const
+ {
+ int counter = 0;
+- foreach(unit &un, *resources::units){
++ wes_foreach(unit &un, *resources::units){
+ if(un.side() == side() && un.type_id() == name) // @todo: is type_id good?
+ {
+ counter++;
+@@ -345,7 +345,7 @@
+ const int hitpoints_const = 100;
+ double score = 0;
+ double total_weight = 0;
+- foreach(const unit &enemy_unit, *resources::units)
++ wes_foreach(const unit &enemy_unit, *resources::units)
+ {
+ if(enemy_unit.can_recruit() || !t.is_enemy(enemy_unit.side()))
+ {
+@@ -358,13 +358,13 @@
+
+ score += compare_unit_types(info, *enemy_info) * weight;
+ }
+- foreach(fake_team &enemy_team, fake_teams)
++ wes_foreach(fake_team &enemy_team, fake_teams)
+ {
+ if(!t.is_enemy(enemy_team.side()))
+ {
+ continue;
+ }
+- foreach(const potential_recruit &enemy_unit, enemy_team.extra_units())
++ wes_foreach(const potential_recruit &enemy_unit, enemy_team.extra_units())
+ {
+ const unit_type *enemy_info = enemy_unit.type();
+ VALIDATE(enemy_info, "Unknown unit type : " + enemy_unit.id() + " while updating recruit quality.");
+@@ -386,7 +386,7 @@
+
+ /*static void update_recruit_qualities(fake_team &t, std::vector<fake_team> &fake_teams)
+ {
+- foreach ( potential_recruit &recruit, t.recruit_list() )
++ wes_foreach ( potential_recruit &recruit, t.recruit_list() )
+ {
+ double score = get_unit_quality(*recruit.type(),t,fake_teams);
+ recruit.set_quality(score);
+@@ -425,11 +425,11 @@
+ }
+
+ std::map<std::string, int> current_units;
+- foreach (const potential_recruit &i, t.extra_units())
++ wes_foreach (const potential_recruit &i, t.extra_units())
+ {
+ current_units[(i.id())]++;
+ }
+- foreach (const unit &i, *resources::units)
++ wes_foreach (const unit &i, *resources::units)
+ {
+ if (i.side()==t.side())
+ {
+@@ -440,7 +440,7 @@
+ double max_quality = recruit_list[0].quality();
+ int max_cost = recruit_list[0].cost();
+ std::vector<const potential_recruit*> sorted = std::vector<const potential_recruit*>();
+- foreach(const potential_recruit &i, recruit_list)
++ wes_foreach(const potential_recruit &i, recruit_list)
+ {
+ if(i.cost() > max_cost)
+ {
+@@ -457,7 +457,7 @@
+ potential_recruit_sorter sorter(max_cost, max_quality, quality_factor);
+ std::sort(sorted.begin(), sorted.end(), sorter);
+ int recruited = 0;
+- foreach(const potential_recruit *i, sorted)
++ wes_foreach(const potential_recruit *i, sorted)
+ {
+ if(recruited < max_units_to_recruit)
+ {
+@@ -488,7 +488,7 @@
+ static void ai_choose_recruits(fake_team &t, int max_units_to_recruit, double quality_factor, bool counter_recruit)
+ {
+ std::vector<potential_recruit> recruits = ai_choose_best_recruits(t, max_units_to_recruit, quality_factor, counter_recruit);
+- foreach(potential_recruit &i, recruits) {
++ wes_foreach(potential_recruit &i, recruits) {
+ t.fake_recruit(i);
+ }
+
+@@ -554,7 +554,7 @@
+ //DBG_AI << "start of get_recruit_qualities" << std::endl;
+ typedef std::map<const unit_type*, std::vector<double> > unit_map;
+ unit_map enemies;
+- foreach(unit &un, *resources::units){
++ wes_foreach(unit &un, *resources::units){
+ if(t.is_enemy(un.side()) && !un.can_recruit()){
+ enemies[un.type()].push_back(
+ static_cast<double>(un.hitpoints())
+@@ -562,10 +562,10 @@
+ }
+ }
+ DBG_AI << "before extra_units of fake_teams: enemies.size() = " << enemies.size() << std::endl;
+- foreach(fake_team &tmp_t, fake_teams)
++ wes_foreach(fake_team &tmp_t, fake_teams)
+ {
+ if (t.is_enemy(tmp_t.side())) {
+- foreach(potential_recruit &rec, tmp_t.extra_units())
++ wes_foreach(potential_recruit &rec, tmp_t.extra_units())
+ {
+ enemies[rec.type()].push_back(1.0);
+ }
+@@ -573,10 +573,10 @@
+ }
+ DBG_AI << "after extra_units of fake_teams: enemies.size() = " << enemies.size() << std::endl;
+
+- foreach(potential_recruit &rec, recruit_list) {
++ wes_foreach(potential_recruit &rec, recruit_list) {
+ double score = 0;
+ double weighting = 0;
+- foreach(unit_map::value_type &enemy, enemies) {
++ wes_foreach(unit_map::value_type &enemy, enemies) {
+ double hitpoints_sum = std::accumulate(enemy.second.begin(),enemy.second.end(),0);
+ score += compare_unit_types(*rec.type(), *enemy.first) * hitpoints_sum;
+ weighting += hitpoints_sum;
+@@ -621,14 +621,14 @@
+ {
+ std::vector<defender_pair_type*> defenders;
+ std::vector<enemy_pair_type*> enemies;
+- foreach(unit &un, *resources::units)
++ wes_foreach(unit &un, *resources::units)
+ {
+ if(t.is_enemy(un.side()))
+ {
+ // const unit_type &enemy_type = *un.type();
+ //enemy_pair_type *pair = new enemy_pair_type(new unit_data(un.id(), un.type()));
+ enemy_pair_type *pair = new enemy_pair_type(un.type());
+- foreach(unit &defender, *resources::units)
++ wes_foreach(unit &defender, *resources::units)
+ {
+ if(!t.is_enemy(defender.side())){
+ //int score = compare_unit_types(*defender.type(), enemy_type);
+@@ -639,9 +639,9 @@
+ //}
+ }
+ }
+- foreach(fake_team &tmp_t, fake_teams){
++ wes_foreach(fake_team &tmp_t, fake_teams){
+ if(!t.is_enemy(tmp_t.side())){
+- foreach(potential_recruit &rec, tmp_t.extra_units()){
++ wes_foreach(potential_recruit &rec, tmp_t.extra_units()){
+ // int score = compare_unit_types(*rec.type(), enemy_type);
+ // if(score >= 0){
+ //pair->add_defender(new unit_data(rec.id(), rec.type()));
+@@ -657,7 +657,7 @@
+ //const unit_type &defender_type = *un.type();
+ //defender_pair_type *pair = new defender_pair_type(new unit_data(un.id(), un.type()));
+ defender_pair_type *pair = new defender_pair_type(un.type());
+- foreach(unit &enemy, *resources::units)
++ wes_foreach(unit &enemy, *resources::units)
+ {
+ //int score = compare_unit_types(defender_type, *enemy.type());
+ //if(score >= 0)
+@@ -666,9 +666,9 @@
+ pair->add_enemy(enemy.type());
+ //}
+ }
+- foreach(fake_team &tmp_t, fake_teams){
++ wes_foreach(fake_team &tmp_t, fake_teams){
+ if(t.is_enemy(tmp_t.side())){
+- foreach(potential_recruit &rec, tmp_t.extra_units()){
++ wes_foreach(potential_recruit &rec, tmp_t.extra_units()){
+ //int score = compare_unit_types(defender_type, *rec.type());
+ //if(score >= 0){
+ //pair->add_enemy(new unit_data(rec.id(), rec.type()));
+@@ -680,14 +680,14 @@
+ defenders.push_back(pair);
+ }
+ }
+- foreach(fake_team &tmp_t, fake_teams)
++ wes_foreach(fake_team &tmp_t, fake_teams)
+ {
+- foreach(potential_recruit &rec, tmp_t.extra_units()){
++ wes_foreach(potential_recruit &rec, tmp_t.extra_units()){
+ if(t.is_enemy(tmp_t.side())){
+ //const unit_type &enemy_type = *rec.type();
+ //enemy_pair_type *pair = new enemy_pair_type(new unit_data(rec.id(), rec.type()));
+ enemy_pair_type *pair = new enemy_pair_type(rec.type());
+- foreach(unit &defender, *resources::units){
++ wes_foreach(unit &defender, *resources::units){
+ if(t.is_enemy(defender.side())){
+ continue;
+ }
+@@ -698,11 +698,11 @@
+ //}
+ }
+ //HIER
+- foreach(fake_team &sub_t, fake_teams){
++ wes_foreach(fake_team &sub_t, fake_teams){
+ if(t.is_enemy(sub_t.side())){
+ continue;
+ }
+- foreach(potential_recruit &sub_rec, sub_t.extra_units()){
++ wes_foreach(potential_recruit &sub_rec, sub_t.extra_units()){
+ //int score = compare_unit_types(*sub_rec.type(), enemy_type);
+ //if(score >= 0){
+ //pair->add_defender(new unit_data(sub_rec.id(), sub_rec.type()));
+@@ -715,7 +715,7 @@
+ //const unit_type &defender_type = *rec.type();
+ //defender_pair_type *pair = new defender_pair_type(new unit_data(rec.id(), rec.type()));
+ defender_pair_type *pair = new defender_pair_type(rec.type());
+- foreach(unit &enemy, *resources::units)
++ wes_foreach(unit &enemy, *resources::units)
+ {
+ if(!t.is_enemy(enemy.side())){
+ continue;
+@@ -726,11 +726,11 @@
+ pair->add_enemy(rec.type());
+ // }
+ }
+- foreach(fake_team &sub_t, fake_teams){
++ wes_foreach(fake_team &sub_t, fake_teams){
+ if(!t.is_enemy(sub_t.side())){
+ continue;
+ }
+- foreach(potential_recruit &sub_rec, sub_t.extra_units()){
++ wes_foreach(potential_recruit &sub_rec, sub_t.extra_units()){
+ // int score = compare_unit_types(defender_type, *sub_rec.type());
+ // if(score >= 0){
+ //pair->add_enemy(new unit_data(sub_rec.id(), sub_rec.type()));
+@@ -744,17 +744,17 @@
+ }
+ double min_score = 0;
+ double max_score = 0;
+- foreach(enemy_pair_type *pair, enemies)
++ wes_foreach(enemy_pair_type *pair, enemies)
+ {
+ // if(pair->defenders.size() == 0)
+ // {
+ // pair->score = -10000;
+ // }else{
+- //foreach(unit_data *defender, pair->defenders)
+- foreach(unit_type *defender, pair->defenders)
++ //wes_foreach(unit_data *defender, pair->defenders)
++ wes_foreach(unit_type *defender, pair->defenders)
+ {
+ unsigned int defender_enemies = 0;
+- foreach(defender_pair_type *defender_p, defenders)
++ wes_foreach(defender_pair_type *defender_p, defenders)
+ {
+ //if(defender->id == defender_p->defender->id){
+ if(defender->type_name()() == defender_p->defender->type_name()){
+@@ -778,7 +778,7 @@
+ }
+ double score = 0;
+ score -= max_score - min_score;
+- foreach(enemy_pair_type *pair, enemies)
++ wes_foreach(enemy_pair_type *pair, enemies)
+ {
+ score += pair->score;
+ }
+@@ -798,16 +798,16 @@
+ typedef std::map<const unit_type*, std::vector<double> > unit_map;
+ unit_map enemies;
+ unit_map defenders;
+- foreach(unit &un, *resources::units){
++ wes_foreach(unit &un, *resources::units){
+ if(t.is_enemy(un.side())){
+ enemies[un.type()].push_back((double)un.hitpoints() / (double)un.max_hitpoints());
+ }else{
+ defenders[un.type()].push_back(un.hitpoints() / un.max_hitpoints());
+ }
+ }
+- foreach(fake_team &tmp_t, fake_teams)
++ wes_foreach(fake_team &tmp_t, fake_teams)
+ {
+- foreach(potential_recruit &rec, tmp_t.extra_units())
++ wes_foreach(potential_recruit &rec, tmp_t.extra_units())
+ {
+ if(t.is_enemy(tmp_t.side())){
+ enemies[rec.type()].push_back(1.0);
+@@ -817,13 +817,13 @@
+ }
+ }
+ double result = 0;
+- foreach(unit_map::value_type &defender, defenders)
++ wes_foreach(unit_map::value_type &defender, defenders)
+ {
+ double defenders_score = 0;
+- foreach(unit_map::value_type &enemy, enemies)
++ wes_foreach(unit_map::value_type &enemy, enemies)
+ {
+ double hitpoints_sum = 0;
+- foreach(double i, enemy.second)
++ wes_foreach(double i, enemy.second)
+ {
+ hitpoints_sum += i;
+ }
+@@ -831,7 +831,7 @@
+
+ }
+ double hitpoints_sum = 0;
+- foreach(double i, defender.second)
++ wes_foreach(double i, defender.second)
+ {
+ hitpoints_sum += i;
+ }
+@@ -842,7 +842,7 @@
+ return result;
+ // vector<defender_pair> defenders;
+ // vector<enemy_pair> enemies;
+-// //foreach(unit &un, *resources::units)
++// //wes_foreach(unit &un, *resources::units)
+ // //{
+ // // if(t.is_enemy(un.side()))
+ // // {
+@@ -851,14 +851,14 @@
+ // // defenders.push_back(un.id());
+ // // }
+ // //}
+-// foreach(unit &un, *resources::units)
++// wes_foreach(unit &un, *resources::units)
+ // {
+ // if(t.is_enemy(un.side()))
+ // {
+ // const unit_type &enemy_type = un.type();
+ // enemy_pair pair;
+ // pair.enemy = new unit_data(un.id(), enemy_type);
+-// foreach(unit &defender, *resources::units)
++// wes_foreach(unit &defender, *resources::units)
+ // {
+ // int score = compare_unit_types(defender.type(), enemy_type);
+ // if(score >= 0)
+@@ -873,7 +873,7 @@
+ // const unit_type &defender_type = un.type();
+ // defender_pair pair;
+ // pair.defender = new unit_data(defender.id(), defender_type);
+-// foreach(unit &enemy, *resources::units)
++// wes_foreach(unit &enemy, *resources::units)
+ // {
+ // int score = compare_unit_types(defender_type, enemy.type());
+ // if(score >= 0)
+@@ -885,10 +885,10 @@
+ // enemies.push_back(pair);
+ // }
+ // }
+-// foreach(fake_team &tmp_t, fake_teams)
++// wes_foreach(fake_team &tmp_t, fake_teams)
+ // {
+ // if(t.is_enemy(tmp_t.side())){
+-// foreach(potential_recruit &rec, tmp_t.extra_units())
++// wes_foreach(potential_recruit &rec, tmp_t.extra_units())
+ // {
+ //
+ // }
+@@ -898,7 +898,7 @@
+ //
+ // }
+ // //std::vector<unit> no_defense_enemies;
+-// foreach(enemy_pair &pair, enemies)
++// wes_foreach(enemy_pair &pair, enemies)
+ // {
+ // if(pair.defenders.size() == 0)
+ // {
+@@ -906,11 +906,11 @@
+ //
+ // pair.score = 0;
+ // }else{
+-// foreach(unit_data &defender, pair.defenders)
++// wes_foreach(unit_data &defender, pair.defenders)
+ // {
+ // //unit_type &defender = defender_data.type;
+ // unsigned int defender_enemies = 0;
+-// foreach(defender_pair &defender_p, defenders)
++// wes_foreach(defender_pair &defender_p, defenders)
+ // {
+ // if(defender.id == defender_p.defender.id){
+ // defender_enemies = defender_p.enemies.size();
+@@ -924,7 +924,7 @@
+ // }
+ // //enemy_pair *worst_pair = &enemies[0];
+ // double total_score = 0;
+-// foreach(enemy_pair &pair, enemies)
++// wes_foreach(enemy_pair &pair, enemies)
+ // {
+ // total_score += pair.score;
+ // }
+@@ -936,7 +936,7 @@
+ // //unit &worst_def_unit;
+ // vector<defender_pair> defenders;
+ // vector<enemy_pair> enemies;
+-// /*foreach(unit &un, *resources::units)
++// /*wes_foreach(unit &un, *resources::units)
+ // {
+ // if(t.is_enemy(un.side()))
+ // {
+@@ -945,14 +945,14 @@
+ // defenders.push_back(un.id());
+ // }
+ // }*/
+-// foreach(unit &un, *resources::units)
++// wes_foreach(unit &un, *resources::units)
+ // {
+ // if(t.is_enemy(un.side()))
+ // {
+ // const unit_type &enemy_type = un.type();
+ // enemy_pair pair;
+ // pair.enemy = un;
+-// foreach(unit &defender, *resources::units)
++// wes_foreach(unit &defender, *resources::units)
+ // {
+ // int score = compare_unit_types(defender.type(), enemy_type);
+ // if(score >= 0)
+@@ -967,7 +967,7 @@
+ // const unit_type &defender_type = un.type();
+ // defender_pair pair;
+ // pair.defender = un;
+-// foreach(unit &enemy, *resources::units)
++// wes_foreach(unit &enemy, *resources::units)
+ // {
+ // int score = compare_unit_types(defender_type, enemy.type());
+ // if(score >= 0)
+@@ -980,7 +980,7 @@
+ // }
+ // }
+ // //std::vector<unit> no_defense_enemies;
+-// foreach(enemy_pair &pair, enemies)
++// wes_foreach(enemy_pair &pair, enemies)
+ // {
+ // if(pair.defenders.size() == 0)
+ // {
+@@ -988,10 +988,10 @@
+ // return pair.enemy;
+ // //pair.score = 0;
+ // }else{
+-// foreach(unit &defender, pair.defenders)
++// wes_foreach(unit &defender, pair.defenders)
+ // {
+ // unsigned int defender_enemies = 0;
+-// foreach(defender_pair &defender_p, defenders)
++// wes_foreach(defender_pair &defender_p, defenders)
+ // {
+ // if(defender.id() == defender_p.defender.id()){
+ // defender_enemies = defender_p.enemies.size();
+@@ -1004,7 +1004,7 @@
+ // }
+ // }
+ // enemy_pair *worst_pair = &enemies[0];
+-// foreach(enemy_pair &pair, enemies)
++// wes_foreach(enemy_pair &pair, enemies)
+ // {
+ // if(pair.score < worst_pair.score)
+ // {
+@@ -1039,16 +1039,16 @@
+ for(int recruited_amount = 0; recruited_amount < max_units_to_recruit; recruited_amount++)
+ {
+
+- foreach(fake_team &t, fake_teams)
++ wes_foreach(fake_team &t, fake_teams)
+ {
+ t.reset();
+ }
+
+ std::vector<potential_recruit> ai_recruit_list = ai_t->recruit_list();
+
+- foreach(potential_recruit &recruit_type, ai_recruit_list)
++ wes_foreach(potential_recruit &recruit_type, ai_recruit_list)
+ {
+- foreach(fake_team &t, fake_teams)
++ wes_foreach(fake_team &t, fake_teams)
+ {
+ t.reset();
+ }
+@@ -1063,7 +1063,7 @@
+ }
+ LOG_AI << "Pretend that we recruited: " << recruit_type.id() << std::endl;
+ ai_t->fake_recruit(recruit_type);
+- foreach(fake_team &t, fake_teams)
++ wes_foreach(fake_team &t, fake_teams)
+ {
+ if(ai_t->side() == t.side())
+ {
+diff -ur wesnoth-1.10.3.orig/src/ai/testing/stage_rca.cpp wesnoth-1.10.3/src/ai/testing/stage_rca.cpp
+--- wesnoth-1.10.3.orig/src/ai/testing/stage_rca.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/ai/testing/stage_rca.cpp 2012-07-11 13:16:05.913266692 +0200
+@@ -49,7 +49,7 @@
+ void candidate_action_evaluation_loop::on_create()
+ {
+ //init the candidate actions
+- foreach(const config &cfg_element, cfg_.child_range("candidate_action")){
++ wes_foreach(const config &cfg_element, cfg_.child_range("candidate_action")){
+ engine::parse_candidate_action_from_config(*this,cfg_element,back_inserter(candidate_actions_));
+ }
+
+@@ -69,7 +69,7 @@
+ config candidate_action_evaluation_loop::to_config() const
+ {
+ config cfg = stage::to_config();
+- foreach(candidate_action_ptr ca, candidate_actions_){
++ wes_foreach(candidate_action_ptr ca, candidate_actions_){
+ cfg.add_child("candidate_action",ca->to_config());
+ }
+ return cfg;
+@@ -88,7 +88,7 @@
+ {
+ LOG_AI_TESTING_RCA_DEFAULT << "Starting candidate action evaluation loop for side "<< get_side() << std::endl;
+
+- foreach(candidate_action_ptr ca, candidate_actions_){
++ wes_foreach(candidate_action_ptr ca, candidate_actions_){
+ ca->enable();
+ }
+
+@@ -103,7 +103,7 @@
+ candidate_action_ptr best_ptr;
+
+ //Evaluation
+- foreach(candidate_action_ptr ca_ptr, candidate_actions_){
++ wes_foreach(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;
+diff -ur wesnoth-1.10.3.orig/src/arrow.cpp wesnoth-1.10.3/src/arrow.cpp
+--- wesnoth-1.10.3.orig/src/arrow.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/arrow.cpp 2012-07-11 13:16:06.023266690 +0200
+@@ -293,7 +293,7 @@
+ {
+ if(!SCREEN) return;
+
+- foreach(map_location const& loc, path)
++ wes_foreach(map_location const& loc, path)
+ {
+ SCREEN->invalidate(loc);
+ }
+diff -ur wesnoth-1.10.3.orig/src/builder.cpp wesnoth-1.10.3/src/builder.cpp
+--- wesnoth-1.10.3.orig/src/builder.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/builder.cpp 2012-07-11 13:16:05.999933356 +0200
+@@ -65,12 +65,12 @@
+ sorted_images = true;
+ }
+
+- foreach(const rule_image_rand& ri, images){
++ wes_foreach(const rule_image_rand& ri, images){
+ bool is_background = ri->is_background();
+
+ imagelist& img_list = is_background ? images_background : images_foreground;
+
+- foreach(const rule_image_variant& variant, ri->variants){
++ wes_foreach(const rule_image_variant& variant, ri->variants){
+ if(!variant.tods.empty() && variant.tods.find(tod) == variant.tods.end())
+ continue;
+
+@@ -250,12 +250,12 @@
+
+ tile& btile = tile_map_[loc];
+
+- foreach(animated<image::locator>& a, btile.images_background) {
++ wes_foreach(animated<image::locator>& a, btile.images_background) {
+ if(a.need_update())
+ changed = true;
+ a.update_last_draw_time();
+ }
+- foreach(animated<image::locator>& a, btile.images_foreground) {
++ wes_foreach(animated<image::locator>& a, btile.images_foreground) {
+ if(a.need_update())
+ changed = true;
+ a.update_last_draw_time();
+@@ -326,7 +326,7 @@
+ }
+ std::vector<std::string> vars = utils::split(variations, ';', 0);
+
+- foreach(const std::string& v, vars){
++ wes_foreach(const std::string& v, vars){
+ res.push_back(base);
+ std::string::size_type pos = 0;
+ while ((pos = res.back().find("@V", pos)) != std::string::npos) {
+@@ -345,21 +345,21 @@
+
+ // Parse images and animations data
+ // If one is not valid, return false.
+- foreach(terrain_constraint &constraint, rule.constraints)
++ wes_foreach(terrain_constraint &constraint, rule.constraints)
+ {
+- foreach(rule_image& ri, constraint.images)
++ wes_foreach(rule_image& ri, constraint.images)
+ {
+- foreach(rule_image_variant& variant, ri.variants)
++ wes_foreach(rule_image_variant& variant, ri.variants)
+ {
+
+ std::vector<std::string> var_strings = get_variations(variant.image_string, variant.variations);
+- foreach(const std::string& var, var_strings)
++ wes_foreach(const std::string& var, var_strings)
+ {
+ /** @todo improve this, 99% of terrains are not animated. */
+ std::vector<std::string> frames = utils::parenthetical_split(var,',');
+ animated<image::locator> res;
+
+- foreach(const std::string& frame, frames)
++ wes_foreach(const std::string& frame, frames)
+ {
+ const std::vector<std::string> items = utils::split(frame, ':');
+ const std::string& str = items.front();
+@@ -499,7 +499,7 @@
+ void terrain_builder::replace_rotate_tokens(rule_image &image, int angle,
+ const std::vector<std::string> &replacement)
+ {
+- foreach(rule_image_variant& variant, image.variants) {
++ wes_foreach(rule_image_variant& variant, image.variants) {
+ replace_rotate_tokens(variant, angle, replacement);
+ }
+ }
+@@ -507,7 +507,7 @@
+ void terrain_builder::replace_rotate_tokens(rule_imagelist &list, int angle,
+ const std::vector<std::string> &replacement)
+ {
+- foreach (rule_image &img, list) {
++ wes_foreach (rule_image &img, list) {
+ replace_rotate_tokens(img, angle, replacement);
+ }
+ }
+@@ -515,16 +515,16 @@
+ void terrain_builder::replace_rotate_tokens(building_rule &rule, int angle,
+ const std::vector<std::string> &replacement)
+ {
+- foreach (terrain_constraint &cons, rule.constraints)
++ wes_foreach (terrain_constraint &cons, rule.constraints)
+ {
+ // Transforms attributes
+- foreach (std::string &flag, cons.set_flag) {
++ wes_foreach (std::string &flag, cons.set_flag) {
+ replace_rotate_tokens(flag, angle, replacement);
+ }
+- foreach (std::string &flag, cons.no_flag) {
++ wes_foreach (std::string &flag, cons.no_flag) {
+ replace_rotate_tokens(flag, angle, replacement);
+ }
+- foreach (std::string &flag, cons.has_flag) {
++ wes_foreach (std::string &flag, cons.has_flag) {
+ replace_rotate_tokens(flag, angle, replacement);
+ }
+ replace_rotate_tokens(cons.images, angle, replacement);
+@@ -541,7 +541,7 @@
+ return;
+ }
+
+- foreach (terrain_constraint &cons, ret.constraints) {
++ wes_foreach (terrain_constraint &cons, ret.constraints) {
+ rotate(cons, angle);
+ }
+
+@@ -549,7 +549,7 @@
+ int minx = INT_MAX;
+ int miny = INT_MAX;
+
+- foreach (const terrain_constraint &cons, ret.constraints) {
++ wes_foreach (const terrain_constraint &cons, ret.constraints) {
+ minx = std::min<int>(cons.loc.x, minx);
+ miny = std::min<int>(2 * cons.loc.y + (cons.loc.x & 1), miny);
+ }
+@@ -559,7 +559,7 @@
+ if(!(miny & 1) && (minx & 1) && (minx > 0))
+ miny -= 2;
+
+- foreach (terrain_constraint &cons, ret.constraints) {
++ wes_foreach (terrain_constraint &cons, ret.constraints) {
+ cons.loc.legacy_sum_assign(map_location(-minx, -((miny - 1) / 2)));
+ }
+
+@@ -581,7 +581,7 @@
+
+ void terrain_builder::add_images_from_config(rule_imagelist& images, const config &cfg, bool global, int dx, int dy)
+ {
+- foreach (const config &img, cfg.child_range("image"))
++ wes_foreach (const config &img, cfg.child_range("image"))
+ {
+ int layer = img["layer"];
+
+@@ -606,7 +606,7 @@
+ images.push_back(rule_image(layer, basex - dx, basey - dy, global, center_x, center_y));
+
+ // Adds the other variants of the image
+- foreach (const config &variant, img.child_range("variant"))
++ wes_foreach (const config &variant, img.child_range("variant"))
+ {
+ const std::string &name = variant["name"];
+ const std::string &variations = img["variations"];
+@@ -631,7 +631,7 @@
+ const t_translation::t_match& type, const config& global_images)
+ {
+ terrain_constraint *cons = NULL;
+- foreach (terrain_constraint &c, constraints) {
++ wes_foreach (terrain_constraint &c, constraints) {
+ if (c.loc == loc) {
+ cons = &c;
+ break;
+@@ -769,7 +769,7 @@
+ log_scope("terrain_builder::parse_config");
+
+ // Parses the list of building rules (BRs)
+- foreach (const config &br, cfg.child_range("terrain_graphics"))
++ wes_foreach (const config &br, cfg.child_range("terrain_graphics"))
+ {
+ building_rule pbr; // Parsed Building rule
+ pbr.local = local;
+@@ -788,7 +788,7 @@
+ parse_mapstring(br["map"], pbr, anchors, br);
+
+ // Parses the terrain constraints (TCs)
+- foreach (const config &tc, br.child_range("tile"))
++ wes_foreach (const config &tc, br.child_range("tile"))
+ {
+ // Adds the terrain constraint to the current built terrain's list
+ // of terrain constraints, if it does not exist.
+@@ -831,7 +831,7 @@
+ const std::vector<std::string> global_has_flag = utils::split(br["has_flag"]);
+ const std::vector<std::string> global_set_no_flag = utils::split(br["set_no_flag"]);
+
+- foreach (terrain_constraint &constraint, pbr.constraints)
++ wes_foreach (terrain_constraint &constraint, pbr.constraints)
+ {
+ constraint.set_flag.insert(constraint.set_flag.end(),
+ global_set_flag.begin(), global_set_flag.end());
+@@ -925,7 +925,7 @@
+ }
+ }
+
+- foreach (const terrain_constraint &cons, rule.constraints)
++ wes_foreach (const terrain_constraint &cons, rule.constraints)
+ {
+ // Translated location
+ const map_location tloc = loc.legacy_sum(cons.loc);
+@@ -943,13 +943,13 @@
+
+ const std::set<std::string> &flags = tile_map_[tloc].flags;
+
+- foreach (const std::string &s, cons.no_flag) {
++ wes_foreach (const std::string &s, cons.no_flag) {
+ // If a flag listed in "no_flag" is present, the rule does not match
+ if (flags.find(s) != flags.end()) {
+ return false;
+ }
+ }
+- foreach (const std::string &s, cons.has_flag) {
++ wes_foreach (const std::string &s, cons.has_flag) {
+ // If a flag listed in "has_flag" is not present, this rule does not match
+ if (flags.find(s) == flags.end()) {
+ return false;
+@@ -964,7 +964,7 @@
+ {
+ unsigned int rand_seed = get_noise(loc, rule.get_hash());
+
+- foreach (const terrain_constraint &constraint, rule.constraints)
++ wes_foreach (const terrain_constraint &constraint, rule.constraints)
+ {
+ const map_location tloc = loc.legacy_sum(constraint.loc);
+ if(!tile_map_.on_map(tloc)) {
+@@ -973,12 +973,12 @@
+
+ tile& btile = tile_map_[tloc];
+
+- foreach (const rule_image &img, constraint.images) {
++ wes_foreach (const rule_image &img, constraint.images) {
+ btile.images.push_back(tile::rule_image_rand(&img, rand_seed));
+ }
+
+ // Sets flags
+- foreach (const std::string &flag, constraint.set_flag) {
++ wes_foreach (const std::string &flag, constraint.set_flag) {
+ btile.flags.insert(flag);
+ }
+
+@@ -1001,9 +1001,9 @@
+ if(hash_ != DUMMY_HASH)
+ return hash_;
+
+- foreach(const terrain_constraint &constraint, constraints) {
+- foreach(const rule_image& ri, constraint.images) {
+- foreach(const rule_image_variant& variant, ri.variants) {
++ wes_foreach(const terrain_constraint &constraint, constraints) {
++ wes_foreach(const rule_image& ri, constraint.images) {
++ wes_foreach(const rule_image_variant& variant, ri.variants) {
+ // we will often hash the same string, but that seems fast enough
+ hash_ += hash_str(variant.image_string);
+ }
+@@ -1031,7 +1031,7 @@
+ }
+ }
+
+- foreach (const building_rule &rule, building_rules_)
++ wes_foreach (const building_rule &rule, building_rules_)
+ {
+ // Find the constraint that contains the less terrain of all terrain rules.
+ // We will keep a track of the matching terrains of this constraint
+@@ -1040,7 +1040,7 @@
+ t_translation::t_list min_types;
+ const terrain_constraint *min_constraint = NULL;
+
+- foreach (const terrain_constraint &constraint, rule.constraints)
++ wes_foreach (const terrain_constraint &constraint, rule.constraints)
+ {
+ const t_translation::t_match& match = constraint.terrain_types_match;
+ t_translation::t_list matching_types;
+diff -ur wesnoth-1.10.3.orig/src/campaign_server/campaign_server.cpp wesnoth-1.10.3/src/campaign_server/campaign_server.cpp
+--- wesnoth-1.10.3.orig/src/campaign_server/campaign_server.cpp 2012-02-01 08:27:31.000000000 +0100
++++ wesnoth-1.10.3/src/campaign_server/campaign_server.cpp 2012-07-11 13:16:06.013266690 +0200
+@@ -202,7 +202,7 @@
+
+ void find_translations(const config& cfg, config& campaign)
+ {
+- foreach (const config &dir, cfg.child_range("dir"))
++ wes_foreach (const config &dir, cfg.child_range("dir"))
+ {
+ if (dir["name"] == "LC_MESSAGES") {
+ config &language = campaign.add_child("translation");
+@@ -249,7 +249,7 @@
+ LOG_CS << "Encoding all stored addons. Number of addons: "
+ << std::distance(camps.first, camps.second) << '\n';
+
+- foreach (const config &cm, camps)
++ wes_foreach (const config &cm, camps)
+ {
+ LOG_CS << "Encoding " << cm["name"] << '\n';
+ std::string filename = cm["filename"], newfilename = filename + ".new";
+@@ -345,7 +345,7 @@
+ } catch(bad_lexical_cast) {}
+
+ std::string name = req["name"], lang = req["language"];
+- foreach (const config &i, campaigns().child_range("campaign"))
++ wes_foreach (const config &i, campaigns().child_range("campaign"))
+ {
+ if (!name.empty() && name != i["name"]) continue;
+ std::string tm = i["timestamp"];
+@@ -353,7 +353,7 @@
+ if (after_flag && (tm.empty() || lexical_cast_default<time_t>(tm, 0) <= after)) continue;
+ if (!lang.empty()) {
+ bool found = false;
+- foreach (const config &j, i.child_range("translation")) {
++ wes_foreach (const config &j, i.child_range("translation")) {
+ if (j["language"] == lang) {
+ found = true;
+ break;
+@@ -364,7 +364,7 @@
+ campaign_list.add_child("campaign", i);
+ }
+
+- foreach (config &j, campaign_list.child_range("campaign")) {
++ wes_foreach (config &j, campaign_list.child_range("campaign")) {
+ j["passphrase"] = t_string();
+ j["upload_ip"] = t_string();
+ j["email"] = t_string();
+@@ -402,7 +402,7 @@
+ std::string lc_name(name.size(), ' ');
+ std::transform(name.begin(), name.end(), lc_name.begin(), tolower);
+ config *campaign = NULL;
+- foreach (config &c, campaigns().child_range("campaign")) {
++ wes_foreach (config &c, campaigns().child_range("campaign")) {
+ if (utils::lowercase(c["name"]) == lc_name) {
+ campaign = &c;
+ break;
+diff -ur wesnoth-1.10.3.orig/src/cavegen.cpp wesnoth-1.10.3/src/cavegen.cpp
+--- wesnoth-1.10.3.orig/src/cavegen.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/cavegen.cpp 2012-07-11 13:16:06.036600021 +0200
+@@ -147,7 +147,7 @@
+
+ void cave_map_generator::generate_chambers()
+ {
+- foreach (const config &ch, cfg_.child_range("chamber"))
++ wes_foreach (const config &ch, cfg_.child_range("chamber"))
+ {
+ // If there is only a chance of the chamber appearing, deal with that here.
+ if (ch.has_attribute("chance") && (rand() % 100) < ch["chance"].to_int()) {
+@@ -195,7 +195,7 @@
+
+ chambers_.push_back(new_chamber);
+
+- foreach (const config &p, ch.child_range("passage"))
++ wes_foreach (const config &p, ch.child_range("passage"))
+ {
+ const std::string &dst = p["destination"];
+
+@@ -220,7 +220,7 @@
+ if (c.items == NULL || c.locs.empty()) return;
+
+ size_t index = 0;
+- foreach (const config::any_child &it, c.items->all_children_range())
++ wes_foreach (const config::any_child &it, c.items->all_children_range())
+ {
+ config cfg = it.cfg;
+ config &filter = cfg.child("filter");
+diff -ur wesnoth-1.10.3.orig/src/commandline_options.cpp wesnoth-1.10.3/src/commandline_options.cpp
+--- wesnoth-1.10.3.orig/src/commandline_options.cpp 2012-01-22 00:20:08.000000000 +0100
++++ wesnoth-1.10.3/src/commandline_options.cpp 2012-07-11 13:16:05.979933358 +0200
+@@ -374,7 +374,7 @@
+ void commandline_options::parse_log_domains_(const std::string &domains_string, const int severity)
+ {
+ const std::vector<std::string> domains = utils::split(domains_string, ',');
+- foreach (const std::string& domain, domains)
++ wes_foreach (const std::string& domain, domains)
+ {
+ if (!log)
+ log = std::vector<boost::tuple<int, std::string> >();
+@@ -396,7 +396,7 @@
+ {
+ std::vector<boost::tuple<unsigned int,std::string> > vec;
+ boost::tuple<unsigned int,std::string> elem;
+- foreach(const std::string &s, strings)
++ wes_foreach(const std::string &s, strings)
+ {
+ const std::vector<std::string> tokens = utils::split(s, separator);
+ if (tokens.size()!=2)
+@@ -415,7 +415,7 @@
+ {
+ std::vector<boost::tuple<unsigned int,std::string,std::string> > vec;
+ boost::tuple<unsigned int,std::string,std::string> elem;
+- foreach(const std::string &s, strings)
++ wes_foreach(const std::string &s, strings)
+ {
+ const std::vector<std::string> tokens = utils::split(s, separator);
+ if (tokens.size()!=3)
+diff -ur wesnoth-1.10.3.orig/src/config_cache.cpp wesnoth-1.10.3/src/config_cache.cpp
+--- wesnoth-1.10.3.orig/src/config_cache.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/config_cache.cpp 2012-07-11 13:16:05.986600025 +0200
+@@ -113,7 +113,7 @@
+ config_writer writer(*stream, gzip, game_config::cache_compression_level);
+
+ // write all defines to stream
+- foreach (const preproc_map::value_type &define, defines_map) {
++ wes_foreach (const preproc_map::value_type &define, defines_map) {
+ define.second.write(writer, define.first);
+ }
+ }
+@@ -262,7 +262,7 @@
+
+ // use static preproc_define::read_pair(config) to make a object
+ // and pass that object config_cache_transaction::insert_to_active method
+- foreach (const config::any_child &value, cfg.all_children_range()) {
++ wes_foreach (const config::any_child &value, cfg.all_children_range()) {
+ config_cache_transaction::instance().insert_to_active(
+ preproc_define::read_pair(value.cfg));
+ }
+@@ -271,7 +271,7 @@
+ void config_cache::read_defines_queue()
+ {
+ const config_cache_transaction::filenames& files = config_cache_transaction::instance().get_define_files();
+- foreach (const std::string &path, files) {
++ wes_foreach (const std::string &path, files) {
+ read_defines_file(path);
+ }
+ }
+@@ -394,7 +394,7 @@
+ std::insert_iterator<preproc_map>(temp,temp.begin()),
+ &compare_define);
+
+- foreach (const preproc_map::value_type &def, temp) {
++ wes_foreach (const preproc_map::value_type &def, temp) {
+ insert_to_active(def);
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/config.cpp wesnoth-1.10.3/src/config.cpp
+--- wesnoth-1.10.3.orig/src/config.cpp 2012-05-05 19:39:03.000000000 +0200
++++ wesnoth-1.10.3/src/config.cpp 2012-07-11 13:16:05.986600025 +0200
+@@ -255,7 +255,7 @@
+ {
+ check_valid(cfg);
+
+- foreach (const any_child &value, cfg.all_children_range()) {
++ wes_foreach (const any_child &value, cfg.all_children_range()) {
+ add_child(value.key, value.cfg);
+ }
+ }
+@@ -263,7 +263,7 @@
+ void config::append(const config &cfg)
+ {
+ append_children(cfg);
+- foreach (const attribute &v, cfg.values) {
++ wes_foreach (const attribute &v, cfg.values) {
+ values[v.first] = v.second;
+ }
+ }
+@@ -275,7 +275,7 @@
+ if (child_count(key) < 2) return;
+
+ config merged_children;
+- foreach (const config &cfg, child_range(key)) {
++ wes_foreach (const config &cfg, child_range(key)) {
+ merged_children.append(cfg);
+ }
+
+@@ -291,7 +291,7 @@
+
+ typedef std::map<std::string, config> config_map;
+ config_map merged_children_map;
+- foreach (const config &cfg, child_range(key)) {
++ wes_foreach (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() ) {
+@@ -302,7 +302,7 @@
+ }
+
+ clear_children(key);
+- foreach (const config_map::value_type &i, merged_children_map) {
++ wes_foreach (const config_map::value_type &i, merged_children_map) {
+ add_child(key,i.second);
+ }
+ }
+@@ -459,7 +459,7 @@
+ ordered_children.erase(std::remove_if(ordered_children.begin(),
+ ordered_children.end(), remove_ordered(i)), ordered_children.end());
+
+- foreach (config *c, i->second) {
++ wes_foreach (config *c, i->second) {
+ delete c;
+ }
+
+@@ -495,7 +495,7 @@
+
+ values.erase(key);
+
+- foreach (const any_child &value, all_children_range()) {
++ wes_foreach (const any_child &value, all_children_range()) {
+ const_cast<config *>(&value.cfg)->recursive_clear_value(key);
+ }
+ }
+@@ -506,7 +506,7 @@
+ /* Find the position with the correct index and decrement all the
+ indices in the ordering that are above this index. */
+ unsigned found = 0;
+- foreach (child_pos &p, ordered_children)
++ wes_foreach (child_pos &p, ordered_children)
+ {
+ if (p.pos != pos) continue;
+ if (p.index == index)
+@@ -590,7 +590,7 @@
+ check_valid(cfg);
+
+ assert(this != &cfg);
+- foreach (const attribute &v, cfg.values) {
++ wes_foreach (const attribute &v, cfg.values) {
+ values[v.first] = v.second;
+ }
+ }
+@@ -860,21 +860,21 @@
+ if (track) values[diff_track_attribute] = "modified";
+
+ if (const config &inserts = diff.child("insert")) {
+- foreach (const attribute &v, inserts.attribute_range()) {
++ wes_foreach (const attribute &v, inserts.attribute_range()) {
+ values[v.first] = v.second;
+ }
+ }
+
+ if (const config &deletes = diff.child("delete")) {
+- foreach (const attribute &v, deletes.attribute_range()) {
++ wes_foreach (const attribute &v, deletes.attribute_range()) {
+ values.erase(v.first);
+ }
+ }
+
+- foreach (const config &i, diff.child_range("change_child"))
++ wes_foreach (const config &i, diff.child_range("change_child"))
+ {
+ const size_t index = lexical_cast<size_t>(i["index"].str());
+- foreach (const any_child &item, i.all_children_range())
++ wes_foreach (const any_child &item, i.all_children_range())
+ {
+ if (item.key.empty()) {
+ continue;
+@@ -889,19 +889,19 @@
+ }
+ }
+
+- foreach (const config &i, diff.child_range("insert_child"))
++ wes_foreach (const config &i, diff.child_range("insert_child"))
+ {
+ const size_t index = lexical_cast<size_t>(i["index"].str());
+- foreach (const any_child &item, i.all_children_range()) {
++ wes_foreach (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";
+ }
+ }
+
+- foreach (const config &i, diff.child_range("delete_child"))
++ wes_foreach (const config &i, diff.child_range("delete_child"))
+ {
+ const size_t index = lexical_cast<size_t>(i["index"].str());
+- foreach (const any_child &item, i.all_children_range()) {
++ wes_foreach (const any_child &item, i.all_children_range()) {
+ if (!track) {
+ remove_child(item.key, index);
+ } else {
+@@ -918,18 +918,18 @@
+ void config::clear_diff_track(const config& diff)
+ {
+ remove_attribute(diff_track_attribute);
+- foreach (const config &i, diff.child_range("delete_child"))
++ wes_foreach (const config &i, diff.child_range("delete_child"))
+ {
+ const size_t index = lexical_cast<size_t>(i["index"].str());
+- foreach (const any_child &item, i.all_children_range()) {
++ wes_foreach (const any_child &item, i.all_children_range()) {
+ remove_child(item.key, index);
+ }
+ }
+
+- foreach (const config &i, diff.child_range("change_child"))
++ wes_foreach (const config &i, diff.child_range("change_child"))
+ {
+ const size_t index = lexical_cast<size_t>(i["index"].str());
+- foreach (const any_child &item, i.all_children_range())
++ wes_foreach (const any_child &item, i.all_children_range())
+ {
+ if (item.key.empty()) {
+ continue;
+@@ -943,7 +943,7 @@
+ itor->second[index]->clear_diff_track(item.cfg);
+ }
+ }
+- foreach (const any_child &value, all_children_range()) {
++ wes_foreach (const any_child &value, all_children_range()) {
+ const_cast<config *>(&value.cfg)->remove_attribute(diff_track_attribute);
+ }
+ }
+@@ -984,20 +984,20 @@
+ {
+ check_valid(filter);
+
+- foreach (const attribute &i, filter.attribute_range())
++ wes_foreach (const attribute &i, filter.attribute_range())
+ {
+ const attribute_value *v = get(i.first);
+ if (!v || *v != i.second) return false;
+ }
+
+- foreach (const any_child &i, filter.all_children_range())
++ wes_foreach (const any_child &i, filter.all_children_range())
+ {
+ if (i.key == "not") {
+ if (matches(i.cfg)) return false;
+ continue;
+ }
+ bool found = false;
+- foreach (const config &j, child_range(i.key)) {
++ wes_foreach (const config &j, child_range(i.key)) {
+ if (j.matches(i.cfg)) {
+ found = true;
+ break;
+@@ -1021,11 +1021,11 @@
+ {
+ static int i = 0;
+ i++;
+- foreach (const config::attribute &val, cfg.attribute_range()) {
++ wes_foreach (const config::attribute &val, cfg.attribute_range()) {
+ for (int j = 0; j < i-1; j++){ outstream << char(9); }
+ outstream << val.first << " = " << val.second << '\n';
+ }
+- foreach (const config::any_child &child, cfg.all_children_range())
++ wes_foreach (const config::any_child &child, cfg.all_children_range())
+ {
+ for (int j = 0; j < i - 1; ++j) outstream << char(9);
+ outstream << "[" << child.key << "]\n";
+@@ -1054,7 +1054,7 @@
+ hash_str[hash_length] = 0;
+
+ i = 0;
+- foreach (const attribute &val, values)
++ wes_foreach (const attribute &val, values)
+ {
+ for (c = val.first.begin(); c != val.first.end(); ++c) {
+ hash_str[i] ^= *c;
+@@ -1067,10 +1067,10 @@
+ }
+ }
+
+- foreach (const any_child &ch, all_children_range())
++ wes_foreach (const any_child &ch, all_children_range())
+ {
+ std::string child_hash = ch.cfg.hash();
+- foreach (char c, child_hash) {
++ wes_foreach (char c, child_hash) {
+ hash_str[i] ^= c;
+ ++i;
+ if(i == hash_length) {
+diff -ur wesnoth-1.10.3.orig/src/controller_base.cpp wesnoth-1.10.3/src/controller_base.cpp
+--- wesnoth-1.10.3.orig/src/controller_base.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/controller_base.cpp 2012-07-11 13:16:06.029933357 +0200
+@@ -144,7 +144,7 @@
+ int dx = 0, dy = 0;
+ int scroll_threshold = (preferences::mouse_scroll_enabled())
+ ? preferences::mouse_scroll_threshold() : 0;
+- foreach (const theme::menu& m, get_display().get_theme().menus()) {
++ wes_foreach (const theme::menu& m, get_display().get_theme().menus()) {
+ if (point_in_rect(mousex, mousey, m.get_location())) {
+ scroll_threshold = 0;
+ }
+diff -ur wesnoth-1.10.3.orig/src/dialogs.cpp wesnoth-1.10.3/src/dialogs.cpp
+--- wesnoth-1.10.3.orig/src/dialogs.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/dialogs.cpp 2012-07-11 13:16:06.236600015 +0200
+@@ -95,7 +95,7 @@
+ }
+
+ bool always_display = false;
+- foreach (const config &mod, u->get_modification_advances())
++ wes_foreach (const config &mod, u->get_modification_advances())
+ {
+ if (mod["always_display"].to_bool()) always_display = true;
+ sample_units.push_back(::get_advanced_unit(*u, u->type_id()));
+@@ -1009,7 +1009,7 @@
+ }
+
+ //FIXME: This probably must be move into a unit_type function
+- foreach (const config &tr, t->possible_traits())
++ wes_foreach (const config &tr, t->possible_traits())
+ {
+ if (tr["availability"] != "musthave") continue;
+ std::string gender_string = (!t->genders().empty() && t->genders().front()== unit_race::FEMALE) ? "female_name" : "male_name";
+@@ -1038,7 +1038,7 @@
+ // 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
+- foreach (const config &adv, t->modification_advancements())
++ wes_foreach (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()
+diff -ur wesnoth-1.10.3.orig/src/display.cpp wesnoth-1.10.3/src/display.cpp
+--- wesnoth-1.10.3.orig/src/display.cpp 2012-04-23 01:53:28.000000000 +0200
++++ wesnoth-1.10.3/src/display.cpp 2012-07-11 13:16:05.976600023 +0200
+@@ -629,7 +629,7 @@
+ // now get the surfaces
+ std::vector<surface> res;
+
+- foreach(std::string& name, names) {
++ wes_foreach(std::string& name, names) {
+ const surface surf(image::get_image(name, image_type));
+ if (surf)
+ res.push_back(surf);
+@@ -828,8 +828,8 @@
+ * layergroup > location > layer > 'tblit' > surface
+ */
+
+- foreach(const tblit &blit, drawing_buffer_) {
+- foreach(const surface& surf, blit.surf()) {
++ wes_foreach(const tblit &blit, drawing_buffer_) {
++ wes_foreach(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.
+@@ -1903,7 +1903,7 @@
+ int ticks3 = SDL_GetTicks();
+ LOG_DP << "invalidate and draw: " << (ticks3 - ticks2) << " and " << (ticks2 - ticks1) << "\n";
+
+- foreach (boost::function<void(display&)> f, redraw_observers_) {
++ wes_foreach (boost::function<void(display&)> f, redraw_observers_) {
+ f(*this);
+ }
+
+@@ -1992,7 +1992,7 @@
+ SDL_Rect clip_rect = get_clip_rect();
+ surface screen = get_screen_surface();
+ clip_rect_setter set_clip_rect(screen, &clip_rect);
+- foreach (const map_location& loc, invalidated_) {
++ wes_foreach (const map_location& loc, invalidated_) {
+ int xpos = get_location_x(loc);
+ int ypos = get_location_y(loc);
+
+@@ -2058,7 +2058,7 @@
+ // Paint arrows
+ arrows_map_t::const_iterator arrows_in_hex = arrows_map_.find(loc);
+ if(arrows_in_hex != arrows_map_.end()) {
+- foreach(arrow* const a, arrows_in_hex->second) {
++ wes_foreach(arrow* const a, arrows_in_hex->second) {
+ a->draw_hex(loc);
+ }
+ }
+@@ -2388,7 +2388,7 @@
+ if(invalidateAll_)
+ return false;
+ bool ret = false;
+- foreach (const map_location& loc, locs) {
++ wes_foreach (const map_location& loc, locs) {
+ #ifdef _OPENMP
+ #pragma omp critical(invalidated_)
+ #endif //_OPENMP
+@@ -2438,7 +2438,7 @@
+ return false;
+
+ bool result = false;
+- foreach (const map_location &loc, hexes_under_rect(rect)) {
++ wes_foreach (const map_location &loc, hexes_under_rect(rect)) {
+ result |= invalidate(loc);
+ }
+ return result;
+@@ -2450,7 +2450,7 @@
+ animate_map_ = preferences::animate_map();
+ if (!animate_map_) return;
+
+- foreach (const map_location &loc, get_visible_hexes())
++ wes_foreach (const map_location &loc, get_visible_hexes())
+ {
+ if (shrouded(loc)) continue;
+ if (builder_->update_animation(loc)) {
+@@ -2464,7 +2464,7 @@
+ void display::add_arrow(arrow& arrow)
+ {
+ const arrow_path_t & arrow_path = arrow.get_path();
+- foreach (const map_location& loc, arrow_path)
++ wes_foreach (const map_location& loc, arrow_path)
+ {
+ arrows_map_[loc].push_back(&arrow);
+ }
+@@ -2473,7 +2473,7 @@
+ void display::remove_arrow(arrow& arrow)
+ {
+ const arrow_path_t & arrow_path = arrow.get_path();
+- foreach (const map_location& loc, arrow_path)
++ wes_foreach (const map_location& loc, arrow_path)
+ {
+ arrows_map_[loc].remove(&arrow);
+ }
+@@ -2482,12 +2482,12 @@
+ void display::update_arrow(arrow & arrow)
+ {
+ const arrow_path_t & previous_path = arrow.get_previous_path();
+- foreach (const map_location& loc, previous_path)
++ wes_foreach (const map_location& loc, previous_path)
+ {
+ arrows_map_[loc].remove(&arrow);
+ }
+ const arrow_path_t & arrow_path = arrow.get_path();
+- foreach (const map_location& loc, arrow_path)
++ wes_foreach (const map_location& loc, arrow_path)
+ {
+ arrows_map_[loc].push_back(&arrow);
+ }
+diff -ur wesnoth-1.10.3.orig/src/editor/action.cpp wesnoth-1.10.3/src/editor/action.cpp
+--- wesnoth-1.10.3.orig/src/editor/action.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/editor/action.cpp 2012-07-11 13:16:05.993266689 +0200
+@@ -75,25 +75,25 @@
+ editor_action_chain::editor_action_chain(const editor::editor_action_chain &other)
+ : editor_action(), actions_()
+ {
+- foreach (editor_action* a, other.actions_) {
++ wes_foreach (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;
+- foreach (editor_action* a, actions_) {
++ wes_foreach (editor_action* a, actions_) {
+ delete a;
+ }
+ actions_.clear();
+- foreach (editor_action* a, other.actions_) {
++ wes_foreach (editor_action* a, other.actions_) {
+ actions_.push_back(a->clone());
+ }
+ return *this;
+ }
+ editor_action_chain::~editor_action_chain()
+ {
+- foreach (editor_action* a, actions_) {
++ wes_foreach (editor_action* a, actions_) {
+ delete a;
+ }
+ }
+@@ -103,7 +103,7 @@
+ }
+ int editor_action_chain::action_count() const {
+ int count = 0;
+- foreach (const editor_action* a, actions_) {
++ wes_foreach (const editor_action* a, actions_) {
+ if (a) {
+ count += a->action_count();
+ }
+@@ -133,7 +133,7 @@
+ }
+ editor_action_chain* editor_action_chain::perform(map_context& mc) const {
+ util::unique_ptr<editor_action_chain> undo(new editor_action_chain());
+- foreach (editor_action* a, actions_) {
++ wes_foreach (editor_action* a, actions_) {
+ if (a != NULL) {
+ undo->append_action(a->perform(mc));
+ }
+@@ -143,7 +143,7 @@
+ }
+ void editor_action_chain::perform_without_undo(map_context& mc) const
+ {
+- foreach (editor_action* a, actions_) {
++ wes_foreach (editor_action* a, actions_) {
+ if (a != NULL) {
+ a->perform_without_undo(mc);
+ }
+@@ -257,7 +257,7 @@
+ }
+ void editor_action_select::extend(const editor_map& map, const std::set<map_location>& locs)
+ {
+- foreach (const map_location& loc, locs) {
++ wes_foreach (const map_location& loc, locs) {
+ LOG_ED << "Checking " << loc << "\n";
+ if (map.in_selection(loc)) {
+ LOG_ED << "Extending by " << loc << "\n";
+@@ -268,7 +268,7 @@
+ editor_action* editor_action_select::perform(map_context& mc) const
+ {
+ std::set<map_location> undo_locs;
+- foreach (const map_location& loc, area_) {
++ wes_foreach (const map_location& loc, area_) {
+ if (!mc.get_map().in_selection(loc)) {
+ undo_locs.insert(loc);
+ mc.add_changed_location(loc);
+@@ -279,7 +279,7 @@
+ }
+ void editor_action_select::perform_without_undo(map_context& mc) const
+ {
+- foreach (const map_location& loc, area_) {
++ wes_foreach (const map_location& loc, area_) {
+ mc.get_map().add_to_selection(loc);
+ mc.add_changed_location(loc);
+ }
+@@ -291,7 +291,7 @@
+ }
+ void editor_action_deselect::extend(const editor_map& map, const std::set<map_location>& locs)
+ {
+- foreach (const map_location& loc, locs) {
++ wes_foreach (const map_location& loc, locs) {
+ LOG_ED << "Checking " << loc << "\n";
+ if (!map.in_selection(loc)) {
+ LOG_ED << "Extending by " << loc << "\n";
+@@ -302,7 +302,7 @@
+ editor_action* editor_action_deselect::perform(map_context& mc) const
+ {
+ std::set<map_location> undo_locs;
+- foreach (const map_location& loc, area_) {
++ wes_foreach (const map_location& loc, area_) {
+ if (mc.get_map().in_selection(loc)) {
+ undo_locs.insert(loc);
+ mc.add_changed_location(loc);
+@@ -313,7 +313,7 @@
+ }
+ void editor_action_deselect::perform_without_undo(map_context& mc) const
+ {
+- foreach (const map_location& loc, area_) {
++ wes_foreach (const map_location& loc, area_) {
+ mc.get_map().remove_from_selection(loc);
+ mc.add_changed_location(loc);
+ }
+diff -ur wesnoth-1.10.3.orig/src/editor/brush.cpp wesnoth-1.10.3/src/editor/brush.cpp
+--- wesnoth-1.10.3.orig/src/editor/brush.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/editor/brush.cpp 2012-07-11 13:16:05.996600022 +0200
+@@ -74,11 +74,11 @@
+ if (radius > 0) {
+ std::vector<map_location> in_radius;
+ get_tiles_in_radius(map_location(0, 0), radius, in_radius);
+- foreach (map_location& loc, in_radius) {
++ wes_foreach (map_location& loc, in_radius) {
+ add_relative_location(loc.x, loc.y);
+ }
+ }
+- foreach (const config &relative, cfg.child_range("relative"))
++ wes_foreach (const config &relative, cfg.child_range("relative"))
+ {
+ int x = relative["x"];
+ int y = relative["y"];
+@@ -97,7 +97,7 @@
+ std::set<map_location> brush::project(const map_location& hotspot) const
+ {
+ std::set<map_location> result;
+- foreach (const map_location& relative, relative_tiles_) {
++ wes_foreach (const map_location& relative, relative_tiles_) {
+ result.insert(relative.vector_sum(hotspot));
+ }
+ return result;
+diff -ur wesnoth-1.10.3.orig/src/editor/editor_controller.cpp wesnoth-1.10.3/src/editor/editor_controller.cpp
+--- wesnoth-1.10.3.orig/src/editor/editor_controller.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/editor/editor_controller.cpp 2012-07-11 13:16:05.996600022 +0200
+@@ -135,7 +135,7 @@
+ image::set_color_adjustment(preferences::editor::tod_r(), preferences::editor::tod_g(), preferences::editor::tod_b());
+ theme& theme = gui().get_theme();
+ const theme::menu* default_tool_menu = NULL;
+- foreach (const theme::menu& m, theme.menus()) {
++ wes_foreach (const theme::menu& m, theme.menus()) {
+ if (m.get_id() == "draw_button_editor") {
+ default_tool_menu = &m;
+ break;
+@@ -173,7 +173,7 @@
+
+ void editor_controller::init_brushes(const config& game_config)
+ {
+- foreach (const config &i, game_config.child_range("brush")) {
++ wes_foreach (const config &i, game_config.child_range("brush")) {
+ brushes_.push_back(brush(i));
+ }
+ if (brushes_.empty()) {
+@@ -196,7 +196,7 @@
+ new mouse_action_starting_position(key_)));
+ mouse_actions_.insert(std::make_pair(hotkey::HOTKEY_EDITOR_PASTE,
+ new mouse_action_paste(clipboard_, key_)));
+- foreach (const theme::menu& menu, gui().get_theme().menus()) {
++ wes_foreach (const theme::menu& menu, gui().get_theme().menus()) {
+ if (menu.items().size() == 1) {
+ hotkey::HOTKEY_COMMAND hk = hotkey::get_hotkey(menu.items().front()).get_id();
+ mouse_action_map::iterator i = mouse_actions_.find(hk);
+@@ -205,7 +205,7 @@
+ }
+ }
+ }
+- foreach (const config &c, game_config.child_range("editor_tool_hint")) {
++ wes_foreach (const config &c, game_config.child_range("editor_tool_hint")) {
+ mouse_action_map::iterator i =
+ mouse_actions_.find(hotkey::get_hotkey(c["id"]).get_id());
+ if (i != mouse_actions_.end()) {
+@@ -216,7 +216,7 @@
+
+ void editor_controller::init_map_generators(const config& game_config)
+ {
+- foreach (const config &i, game_config.child_range("multiplayer"))
++ wes_foreach (const config &i, game_config.child_range("multiplayer"))
+ {
+ if (i["map_generation"] == "default") {
+ const config &generator_cfg = i.child("generator");
+@@ -238,7 +238,7 @@
+ ERR_ED << "No editor time-of-day defined\n";
+ return;
+ }
+- foreach (const config &i, cfg.child_range("time")) {
++ wes_foreach (const config &i, cfg.child_range("time")) {
+ tods_.push_back(time_of_day(i));
+ }
+ }
+@@ -250,7 +250,7 @@
+ ERR_ED << "No editor music defined\n";
+ return;
+ }
+- foreach (const config &i, cfg.child_range("music")) {
++ wes_foreach (const config &i, cfg.child_range("music")) {
+ sound::play_music_config(i);
+ }
+ sound::commit_music_changes();
+@@ -265,13 +265,13 @@
+
+ editor_controller::~editor_controller()
+ {
+- foreach (const mouse_action_map::value_type a, mouse_actions_) {
++ wes_foreach (const mouse_action_map::value_type a, mouse_actions_) {
+ delete a.second;
+ }
+- foreach (map_generator* m, map_generators_) {
++ wes_foreach (map_generator* m, map_generators_) {
+ delete m;
+ }
+- foreach (map_context* mc, map_contexts_) {
++ wes_foreach (map_context* mc, map_contexts_) {
+ delete mc;
+ }
+ }
+@@ -303,7 +303,7 @@
+ void editor_controller::quit_confirm(EXIT_STATUS mode)
+ {
+ std::vector<std::string> modified;
+- foreach (map_context* mc, map_contexts_) {
++ wes_foreach (map_context* mc, map_contexts_) {
+ if (mc->modified()) {
+ if (!mc->get_filename().empty()) {
+ modified.push_back(mc->get_filename());
+@@ -319,7 +319,7 @@
+ message = _("Do you really want to quit? Changes in the map since the last save will be lost.");
+ } else {
+ message = _("Do you really want to quit? The following maps were modified and all changes since the last save will be lost:");
+- foreach (std::string& str, modified) {
++ wes_foreach (std::string& str, modified) {
+ message += "\n" + str;
+ }
+ }
+@@ -342,7 +342,7 @@
+ map_context* mc = new map_context(editor_map(game_config_, 44, 33, t_translation::GRASS_LAND));
+ add_map_context(mc);
+ } else {
+- foreach(const std::string& filename, saved_windows_) {
++ wes_foreach(const std::string& filename, saved_windows_) {
+ map_context* mc = new map_context(game_config_, filename);
+ add_map_context(mc);
+ }
+@@ -796,7 +796,7 @@
+ get_map_context().set_needs_terrain_rebuild(false);
+ gui().invalidate_all();
+ } else {
+- foreach (const map_location& loc, changed_locs) {
++ wes_foreach (const map_location& loc, changed_locs) {
+ gui().rebuild_terrain(loc);
+ }
+ gui().invalidate(changed_locs);
+@@ -1290,7 +1290,7 @@
+
+ void editor_controller::redraw_toolbar()
+ {
+- foreach (mouse_action_map::value_type a, mouse_actions_) {
++ wes_foreach (mouse_action_map::value_type a, mouse_actions_) {
+ if (a.second->toolbar_button() != NULL) {
+ SDL_Rect r = a.second->toolbar_button()->location(gui().screen_area());
+ SDL_Rect outline = create_rect(r.x - 2, r.y - 2, r.h + 4, r.w + 4);
+diff -ur wesnoth-1.10.3.orig/src/editor/editor_map.cpp wesnoth-1.10.3/src/editor/editor_map.cpp
+--- wesnoth-1.10.3.orig/src/editor/editor_map.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/editor/editor_map.cpp 2012-07-11 13:16:05.993266689 +0200
+@@ -111,7 +111,7 @@
+ ++errors;
+ }
+ }
+- foreach (const map_location& loc, selection_) {
++ wes_foreach (const map_location& loc, selection_) {
+ if (!on_board_with_border(loc)) {
+ ERR_ED << "Off-map tile in selection: " << loc << "\n";
+ }
+diff -ur wesnoth-1.10.3.orig/src/editor/editor_palettes.cpp wesnoth-1.10.3/src/editor/editor_palettes.cpp
+--- wesnoth-1.10.3.orig/src/editor/editor_palettes.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/editor/editor_palettes.cpp 2012-07-11 13:16:05.996600022 +0200
+@@ -84,7 +84,7 @@
+
+ // Get the available groups and add them to the structure
+ std::set<std::string> group_names;
+- foreach (const config &g, cfg.child_range("editor_group"))
++ wes_foreach (const config &g, cfg.child_range("editor_group"))
+ {
+ if (group_names.find(g["id"]) == group_names.end()) {
+ terrain_groups_.push_back(terrain_group(g, gui));
+@@ -97,14 +97,14 @@
+ }
+ }
+ std::map<std::string, terrain_group*> id_to_group;
+- foreach (terrain_group& tg, terrain_groups_) {
++ wes_foreach (terrain_group& tg, terrain_groups_) {
+ id_to_group.insert(std::make_pair(tg.id, &tg));
+ }
+ // The rest of the code assumes this is a valid pointer
+ assert(checked_group_btn_ != 0);
+
+ // add the groups for all terrains to the map
+- foreach (const t_translation::t_terrain& t, terrains_) {
++ wes_foreach (const t_translation::t_terrain& t, terrains_) {
+ const terrain_type& t_info = map().get_terrain_info(t);
+ DBG_ED << "Palette: processing terrain " << t_info.name()
+ << "(editor name: '" << t_info.editor_name() << "') "
+@@ -119,7 +119,7 @@
+ // add the terrain to the requested groups
+ const std::vector<std::string>& keys = utils::split(t_info.editor_group());
+ bool core = false;
+- foreach (const std::string& k, keys) {
++ wes_foreach (const std::string& k, keys) {
+ terrain_map_[k].push_back(t);
+ nmax_terrains_ = std::max(nmax_terrains_, terrain_map_[k].size());
+ std::map<std::string, terrain_group*>::iterator i = id_to_group.find(k);
+@@ -381,7 +381,7 @@
+ scroll_down();
+ }
+
+- foreach (terrain_group& g, terrain_groups_) {
++ wes_foreach (terrain_group& g, terrain_groups_) {
+ if (g.button.pressed()) {
+ checked_group_btn_ = &g.button;
+ set_group(g.id);
+@@ -389,7 +389,7 @@
+ }
+ }
+
+- foreach (terrain_group& g, terrain_groups_) {
++ wes_foreach (terrain_group& g, terrain_groups_) {
+ if (&g.button == checked_group_btn_) {
+ g.button.set_check(true);
+ } else {
+diff -ur wesnoth-1.10.3.orig/src/editor/map_context.cpp wesnoth-1.10.3/src/editor/map_context.cpp
+--- wesnoth-1.10.3.orig/src/editor/map_context.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/editor/map_context.cpp 2012-07-11 13:16:05.996600022 +0200
+@@ -146,7 +146,7 @@
+ if (!one_layer_only) {
+ terrain = map_.get_terrain_info(terrain).terrain_with_default_base();
+ }
+- foreach (const map_location& loc, locs) {
++ wes_foreach (const map_location& loc, locs) {
+ draw_terrain_actual(terrain, loc, one_layer_only);
+ }
+ }
+@@ -374,7 +374,7 @@
+
+ void map_context::clear_stack(action_stack& stack)
+ {
+- foreach (editor_action* a, stack) {
++ wes_foreach (editor_action* a, stack) {
+ delete a;
+ }
+ stack.clear();
+diff -ur wesnoth-1.10.3.orig/src/editor/map_fragment.cpp wesnoth-1.10.3/src/editor/map_fragment.cpp
+--- wesnoth-1.10.3.orig/src/editor/map_fragment.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/editor/map_fragment.cpp 2012-07-11 13:16:05.996600022 +0200
+@@ -44,7 +44,7 @@
+
+ void map_fragment::add_tiles(const gamemap& map, const std::set<map_location>& locs)
+ {
+- foreach (const map_location& loc, locs) {
++ wes_foreach (const map_location& loc, locs) {
+ add_tile(map, loc);
+ }
+ }
+@@ -57,7 +57,7 @@
+ std::set<map_location> map_fragment::get_offset_area(const map_location& loc) const
+ {
+ std::set<map_location> result;
+- foreach (const tile_info& i, items_) {
++ wes_foreach (const tile_info& i, items_) {
+ result.insert(i.offset.vector_sum(loc));
+ }
+ return result;
+@@ -65,14 +65,14 @@
+
+ void map_fragment::paste_into(gamemap& map, const map_location& loc) const
+ {
+- foreach (const tile_info& i, items_) {
++ wes_foreach (const tile_info& i, items_) {
+ map.set_terrain(i.offset.vector_sum(loc), i.terrain);
+ }
+ }
+
+ void map_fragment::shift(const map_location& offset)
+ {
+- foreach (tile_info& ti, items_) {
++ wes_foreach (tile_info& ti, items_) {
+ ti.offset.vector_sum_assign(offset);
+ }
+ }
+@@ -80,7 +80,7 @@
+ map_location map_fragment::center_of_mass() const
+ {
+ map_location sum(0, 0);
+- foreach (const tile_info& ti, items_) {
++ wes_foreach (const tile_info& ti, items_) {
+ sum.vector_sum_assign(ti.offset);
+ }
+ sum.x /= static_cast<int>(items_.size());
+@@ -92,7 +92,7 @@
+ {
+ shift(center_of_mass().vector_negation());
+ area_.clear();
+- foreach (tile_info& ti, items_) {
++ wes_foreach (tile_info& ti, items_) {
+ area_.insert(ti.offset);
+ }
+ }
+@@ -100,7 +100,7 @@
+ void map_fragment::rotate_60_cw()
+ {
+ area_.clear();
+- foreach (tile_info& ti, items_) {
++ wes_foreach (tile_info& ti, items_) {
+ map_location l(0,0);
+ int x = ti.offset.x;
+ int y = ti.offset.y;
+@@ -120,7 +120,7 @@
+ void map_fragment::rotate_60_ccw()
+ {
+ area_.clear();
+- foreach (tile_info& ti, items_) {
++ wes_foreach (tile_info& ti, items_) {
+ map_location l(0,0);
+ int x = ti.offset.x;
+ int y = ti.offset.y;
+@@ -139,7 +139,7 @@
+
+ void map_fragment::flip_horizontal()
+ {
+- foreach (tile_info& ti, items_) {
++ wes_foreach (tile_info& ti, items_) {
+ ti.offset.x = -ti.offset.x;
+ }
+ center_by_mass();
+@@ -147,7 +147,7 @@
+
+ void map_fragment::flip_vertical()
+ {
+- foreach (tile_info& ti, items_) {
++ wes_foreach (tile_info& ti, items_) {
+ ti.offset.y = -ti.offset.y;
+ if (ti.offset.x % 2) {
+ ti.offset.y--;
+@@ -166,11 +166,11 @@
+ {
+ std::stringstream ss;
+ ss << "MF: ";
+- foreach (const tile_info& ti, items_) {
++ wes_foreach (const tile_info& ti, items_) {
+ ss << "(" << ti.offset << ")";
+ }
+ ss << " -- ";
+- foreach (const map_location& loc, area_) {
++ wes_foreach (const map_location& loc, area_) {
+ ss << "(" << loc << ")";
+ }
+ return ss.str();
+diff -ur wesnoth-1.10.3.orig/src/filesystem.cpp wesnoth-1.10.3/src/filesystem.cpp
+--- wesnoth-1.10.3.orig/src/filesystem.cpp 2012-07-11 13:14:31.079936703 +0200
++++ wesnoth-1.10.3/src/filesystem.cpp 2012-07-11 13:16:06.239933349 +0200
+@@ -995,7 +995,7 @@
+ cleanup();
+ init_binary_paths();
+
+- foreach (const config &bp, cfg.child_range("binary_path"))
++ wes_foreach (const config &bp, cfg.child_range("binary_path"))
+ {
+ std::string path = bp["path"].str();
+ if (path.find("..") != std::string::npos) {
+@@ -1042,7 +1042,7 @@
+
+ init_binary_paths();
+
+- foreach (const std::string &path, binary_paths)
++ wes_foreach (const std::string &path, binary_paths)
+ {
+ res.push_back(get_user_data_dir() + "/" + path + type + "/");
+
+@@ -1083,7 +1083,7 @@
+ return std::string();
+ }
+
+- foreach (const std::string &path, get_binary_paths(type))
++ wes_foreach (const std::string &path, get_binary_paths(type))
+ {
+ const std::string file = path + filename;
+ DBG_FS << " checking '" << path << "'\n";
+@@ -1111,7 +1111,7 @@
+ return std::string();
+ }
+
+- foreach (const std::string &path, get_binary_paths(type))
++ wes_foreach (const std::string &path, get_binary_paths(type))
+ {
+ const std::string file = path + filename;
+ DBG_FS << " checking '" << path << "'\n";
+@@ -1276,7 +1276,7 @@
+ p4 << drive;
+ #endif
+
+- foreach (const std::string &s, components)
++ wes_foreach (const std::string &s, components)
+ {
+ p4 << '/' << s;
+ }
+diff -ur wesnoth-1.10.3.orig/src/filesystem.cpp.orig wesnoth-1.10.3/src/filesystem.cpp.orig
+--- wesnoth-1.10.3.orig/src/filesystem.cpp.orig 2012-05-05 19:39:03.000000000 +0200
++++ wesnoth-1.10.3/src/filesystem.cpp.orig 2012-07-11 13:16:06.239933349 +0200
+@@ -1010,7 +1010,7 @@
+ cleanup();
+ init_binary_paths();
+
+- foreach (const config &bp, cfg.child_range("binary_path"))
++ wes_foreach (const config &bp, cfg.child_range("binary_path"))
+ {
+ std::string path = bp["path"].str();
+ if (path.find("..") != std::string::npos) {
+@@ -1057,7 +1057,7 @@
+
+ init_binary_paths();
+
+- foreach (const std::string &path, binary_paths)
++ wes_foreach (const std::string &path, binary_paths)
+ {
+ res.push_back(get_user_data_dir() + "/" + path + type + "/");
+
+@@ -1098,7 +1098,7 @@
+ return std::string();
+ }
+
+- foreach (const std::string &path, get_binary_paths(type))
++ wes_foreach (const std::string &path, get_binary_paths(type))
+ {
+ const std::string file = path + filename;
+ DBG_FS << " checking '" << path << "'\n";
+@@ -1126,7 +1126,7 @@
+ return std::string();
+ }
+
+- foreach (const std::string &path, get_binary_paths(type))
++ wes_foreach (const std::string &path, get_binary_paths(type))
+ {
+ const std::string file = path + filename;
+ DBG_FS << " checking '" << path << "'\n";
+@@ -1291,7 +1291,7 @@
+ p4 << drive;
+ #endif
+
+- foreach (const std::string &s, components)
++ wes_foreach (const std::string &s, components)
+ {
+ p4 << '/' << s;
+ }
+diff -ur wesnoth-1.10.3.orig/src/font.cpp wesnoth-1.10.3/src/font.cpp
+--- wesnoth-1.10.3.orig/src/font.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/font.cpp 2012-07-11 13:16:05.976600023 +0200
+@@ -355,10 +355,10 @@
+ #endif
+
+ #if CAIRO_HAS_WIN32_FONT
+- foreach(const std::string& path, get_binary_paths("fonts")) {
++ wes_foreach(const std::string& path, get_binary_paths("fonts")) {
+ std::vector<std::string> files;
+ get_files_in_dir(path, &files, NULL, ENTIRE_FILE_PATH);
+- foreach(const std::string& file, files)
++ wes_foreach(const std::string& file, files)
+ if(file.substr(file.length() - 4) == ".ttf" || file.substr(file.length() - 4) == ".ttc")
+ AddFontResource(file.c_str());
+ }
+@@ -372,10 +372,10 @@
+ #endif
+
+ #if CAIRO_HAS_WIN32_FONT
+- foreach(const std::string& path, get_binary_paths("fonts")) {
++ wes_foreach(const std::string& path, get_binary_paths("fonts")) {
+ std::vector<std::string> files;
+ get_files_in_dir(path, &files, NULL, ENTIRE_FILE_PATH);
+- foreach(const std::string& file, files)
++ wes_foreach(const std::string& file, files)
+ if(file.substr(file.length() - 4) == ".ttf" || file.substr(file.length() - 4) == ".ttc")
+ RemoveFontResource(file.c_str());
+ }
+@@ -425,7 +425,7 @@
+ const subset_id subset = font_names.size();
+ font_names.push_back(itor->name);
+
+- foreach (const subset_descriptor::range &cp_range, itor->present_codepoints) {
++ wes_foreach (const subset_descriptor::range &cp_range, itor->present_codepoints) {
+ char_blocks.insert(cp_range.first, cp_range.second, subset);
+ }
+ }
+@@ -582,7 +582,7 @@
+ w_ = 0;
+ h_ = 0;
+
+- foreach (text_chunk const &chunk, chunks_)
++ wes_foreach (text_chunk const &chunk, chunks_)
+ {
+ TTF_Font* ttfont = get_font(font_id(chunk.subset, font_size_));
+ if(ttfont == NULL)
+@@ -628,7 +628,7 @@
+ if(width() > max_text_line_width)
+ return surfs_;
+
+- foreach (text_chunk const &chunk, chunks_)
++ wes_foreach (text_chunk const &chunk, chunks_)
+ {
+ TTF_Font* ttfont = get_font(font_id(chunk.subset, font_size_));
+ if (ttfont == NULL)
+@@ -1261,7 +1261,7 @@
+ return false;
+
+ std::set<std::string> known_fonts;
+- foreach (const config &font, fonts_config.child_range("font")) {
++ wes_foreach (const config &font, fonts_config.child_range("font")) {
+ known_fonts.insert(font["name"]);
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/foreach.hpp wesnoth-1.10.3/src/foreach.hpp
+--- wesnoth-1.10.3.orig/src/foreach.hpp 2011-09-26 18:50:56.000000000 +0200
++++ wesnoth-1.10.3/src/foreach.hpp 2012-07-11 13:16:05.986600025 +0200
+@@ -1,9 +1,9 @@
+ #include <boost/foreach.hpp>
+
+ #ifdef __CDT_PARSER__
+- #define foreach(a, b) for(a : b)
++ #define wes_foreach(a, b) for(a : b)
+ #else
+- #define foreach BOOST_FOREACH
++ #define wes_foreach BOOST_FOREACH
+ #endif
+
+ #endif
+diff -ur wesnoth-1.10.3.orig/src/formula.cpp wesnoth-1.10.3/src/formula.cpp
+--- wesnoth-1.10.3.orig/src/formula.cpp 2010-11-21 02:56:29.000000000 +0100
++++ wesnoth-1.10.3/src/formula.cpp 2012-07-11 13:16:05.969933358 +0200
+@@ -117,7 +117,7 @@
+ std::stringstream s;
+ s << '[';
+ bool first_item = true;
+- foreach(expression_ptr a , items_) {
++ wes_foreach(expression_ptr a , items_) {
+ if (!first_item) {
+ s << ',';
+ } else {
+@@ -468,7 +468,7 @@
+ std::stringstream s;
+ s << "{where:(";
+ s << body_->str();
+- foreach (const expr_table::value_type &a, *clauses_) {
++ wes_foreach (const expr_table::value_type &a, *clauses_) {
+ s << ", [" << a.first << "] -> ["<< a.second->str()<<"]";
+ }
+ s << ")}";
+diff -ur wesnoth-1.10.3.orig/src/formula_function.cpp wesnoth-1.10.3/src/formula_function.cpp
+--- wesnoth-1.10.3.orig/src/formula_function.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/formula_function.cpp 2012-07-11 13:16:06.029933357 +0200
+@@ -46,7 +46,7 @@
+ s << get_name();
+ s << '(';
+ bool first_arg = true;
+- foreach(expression_ptr a , args()) {
++ wes_foreach(expression_ptr a , args()) {
+ if (!first_arg) {
+ s << ',';
+ } else {
+@@ -451,7 +451,7 @@
+
+ std::string result;
+
+- foreach(expression_ptr arg, args()) {
++ wes_foreach(expression_ptr arg, args()) {
+ result += arg->evaluate(variables, fdb).string_cast();
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/game_config.cpp wesnoth-1.10.3/src/game_config.cpp
+--- wesnoth-1.10.3.orig/src/game_config.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/game_config.cpp 2012-07-11 13:16:05.963266693 +0200
+@@ -259,7 +259,7 @@
+ }
+
+ server_list.clear();
+- foreach (const config &server, v.child_range("server"))
++ wes_foreach (const config &server, v.child_range("server"))
+ {
+ server_info sinf;
+ sinf.name = server["name"].str();
+@@ -270,7 +270,7 @@
+
+ void add_color_info(const config &v)
+ {
+- foreach (const config &teamC, v.child_range("color_range"))
++ wes_foreach (const config &teamC, v.child_range("color_range"))
+ {
+ const config::attribute_value *a1 = teamC.get("id"),
+ *a2 = teamC.get("rgb");
+@@ -304,9 +304,9 @@
+ DBG_NG << str.str() << '\n';
+ }
+
+- foreach (const config &cp, v.child_range("color_palette"))
++ wes_foreach (const config &cp, v.child_range("color_palette"))
+ {
+- foreach (const config::attribute &rgb, cp.attribute_range())
++ wes_foreach (const config::attribute &rgb, cp.attribute_range())
+ {
+ std::vector<Uint32> temp;
+ if(!string2rgb(rgb.second, temp)) {
+diff -ur wesnoth-1.10.3.orig/src/game_controller_abstract.cpp wesnoth-1.10.3/src/game_controller_abstract.cpp
+--- wesnoth-1.10.3.orig/src/game_controller_abstract.cpp 2011-10-13 20:25:06.000000000 +0200
++++ wesnoth-1.10.3/src/game_controller_abstract.cpp 2012-07-11 13:16:05.959933359 +0200
+@@ -80,7 +80,7 @@
+ language_def locale;
+ if(cmdline_opts_.language) {
+ std::vector<language_def> langs = get_languages();
+- foreach(const language_def & def, langs) {
++ wes_foreach(const language_def & def, langs) {
+ if(def.localename == *cmdline_opts_.language) {
+ locale = def;
+ break;
+diff -ur wesnoth-1.10.3.orig/src/game_controller.cpp wesnoth-1.10.3/src/game_controller.cpp
+--- wesnoth-1.10.3.orig/src/game_controller.cpp 2012-01-22 00:20:08.000000000 +0100
++++ wesnoth-1.10.3/src/game_controller.cpp 2012-07-11 13:16:05.949933359 +0200
+@@ -478,7 +478,7 @@
+ }
+
+ int side_num = 1;
+- foreach (config &s, level.child_range("side"))
++ wes_foreach (config &s, level.child_range("side"))
+ {
+ std::map<int,std::string>::const_iterator type = side_types.find(side_num),
+ controller = side_controllers.find(side_num),
+@@ -507,7 +507,7 @@
+ faction_excepts.clear();
+ }
+ unsigned j = 0;
+- foreach (const config &faction, era_cfg.child_range("multiplayer_side"))
++ wes_foreach (const config &faction, era_cfg.child_range("multiplayer_side"))
+ {
+ if (faction["random_faction"].to_bool()) continue;
+ const std::string &faction_id = faction["id"];
+@@ -673,7 +673,7 @@
+ }
+
+ if(state_.classification().campaign_type == "multiplayer") {
+- foreach (config &side, state_.snapshot.child_range("side"))
++ wes_foreach (config &side, state_.snapshot.child_range("side"))
+ {
+ if (side["controller"] == "network")
+ side["controller"] = "human";
+@@ -683,10 +683,10 @@
+ }
+
+ if (load.cancel_orders()) {
+- foreach (config &side, state_.snapshot.child_range("side"))
++ wes_foreach (config &side, state_.snapshot.child_range("side"))
+ {
+ if (side["controller"] != "human") continue;
+- foreach (config &unit, side.child_range("unit"))
++ wes_foreach (config &unit, side.child_range("unit"))
+ {
+ unit["goto_x"] = -999;
+ unit["goto_y"] = -999;
+@@ -710,7 +710,7 @@
+
+ void game_controller::mark_completed_campaigns(std::vector<config> &campaigns)
+ {
+- foreach (config &campaign, campaigns) {
++ wes_foreach (config &campaign, campaigns) {
+ campaign["completed"] = preferences::is_campaign_completed(campaign["id"]);
+ }
+ }
+@@ -1218,7 +1218,7 @@
+ game_config_.splice_children(core_terrain_rules, "terrain_graphics");
+
+ config& hashes = game_config_.add_child("multiplayer_hashes");
+- foreach (const config &ch, game_config_.child_range("multiplayer")) {
++ wes_foreach (const config &ch, game_config_.child_range("multiplayer")) {
+ hashes[ch["id"]] = ch.hash();
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/game.cpp wesnoth-1.10.3/src/game.cpp
+--- wesnoth-1.10.3.orig/src/game.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/game.cpp 2012-07-11 13:16:06.029933357 +0200
+@@ -218,7 +218,7 @@
+ int read = 0;
+
+ // use static preproc_define::read_pair(config) to make a object
+- foreach ( const config::any_child &value, cfg.all_children_range() ) {
++ wes_foreach ( const config::any_child &value, cfg.all_children_range() ) {
+ const preproc_map::value_type def = preproc_define::read_pair( value.cfg );
+ input_macros[def.first] = def.second;
+ ++read;
+@@ -245,7 +245,7 @@
+ if ( cmdline_opts.preprocess_defines ) {
+
+ // add the specified defines
+- foreach ( const std::string &define, *cmdline_opts.preprocess_defines ) {
++ wes_foreach ( const std::string &define, *cmdline_opts.preprocess_defines ) {
+ if (define.empty()){
+ std::cerr << "empty define supplied\n";
+ continue;
+@@ -452,7 +452,7 @@
+ const config &cfg = game->game_config().child("titlescreen_music");
+ if (cfg) {
+ sound::play_music_repeatedly(game_config::title_music);
+- foreach (const config &i, cfg.child_range("music")) {
++ wes_foreach (const config &i, cfg.child_range("music")) {
+ sound::play_music_config(i);
+ }
+ sound::commit_music_changes();
+diff -ur wesnoth-1.10.3.orig/src/game_display.cpp wesnoth-1.10.3/src/game_display.cpp
+--- wesnoth-1.10.3.orig/src/game_display.cpp 2012-04-23 01:53:28.000000000 +0200
++++ wesnoth-1.10.3/src/game_display.cpp 2012-07-11 13:16:05.989933357 +0200
+@@ -297,7 +297,7 @@
+ halo::unrender(invalidated_);
+ display::draw_invalidated();
+
+- foreach(unit* temp_unit, fake_units_) {
++ wes_foreach(unit* temp_unit, fake_units_) {
+ 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()
+@@ -305,7 +305,7 @@
+ temp_unit->redraw_unit();
+ }
+
+- foreach (const map_location& loc, invalidated_) {
++ wes_foreach (const map_location& loc, invalidated_) {
+ unit_map::iterator u_it = units_.find(loc);
+ exclusive_unit_draw_requests_t::iterator request = exclusive_unit_draw_requests_.find(loc);
+ if (u_it != units_.end()
+@@ -451,7 +451,7 @@
+
+ // We display the unit the mouse is over if it is over a unit,
+ // otherwise we display the unit that is selected.
+- foreach (const std::string &name, reports::report_list()) {
++ wes_foreach (const std::string &name, reports::report_list()) {
+ draw_report(name);
+ }
+ invalidateGameStatus_ = false;
+@@ -744,7 +744,7 @@
+ void game_display::highlight_another_reach(const pathfind::paths &paths_list)
+ {
+ // Fold endpoints of routes into reachability map.
+- foreach (const pathfind::paths::step &dest, paths_list.destinations) {
++ wes_foreach (const pathfind::paths::step &dest, paths_list.destinations) {
+ reach_map_[dest.curr]++;
+ }
+ reach_map_changed_ = true;
+@@ -897,17 +897,17 @@
+ void game_display::invalidate_animations()
+ {
+ display::invalidate_animations();
+- foreach (unit& u, units_) {
++ wes_foreach (unit& u, units_) {
+ u.refresh();
+ }
+- foreach(unit* temp_unit, fake_units_) {
++ wes_foreach(unit* temp_unit, fake_units_) {
+ temp_unit->refresh();
+ }
+ std::vector<unit*> unit_list;
+- foreach (unit &u, units_) {
++ wes_foreach (unit &u, units_) {
+ unit_list.push_back(&u);
+ }
+- foreach (unit *u, fake_units_) {
++ wes_foreach (unit *u, fake_units_) {
+ unit_list.push_back(u);
+ }
+ bool new_inval;
+@@ -1079,7 +1079,7 @@
+ {
+ const team& curr_team = teams_[playing_team()];
+ const team& prev_team = teams_[playing_team()-1 < teams_.size() ? playing_team()-1 : teams_.size()-1];
+- foreach (const game_display::overlay_map::value_type i, overlays_) {
++ wes_foreach (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) !=
+@@ -1485,7 +1485,7 @@
+ }
+ }
+
+- foreach (const chat_message &cm, chat_messages_) {
++ wes_foreach (const chat_message &cm, chat_messages_) {
+ font::move_floating_label(cm.speaker_handle, 0, - movement);
+ font::move_floating_label(cm.handle, 0, - movement);
+ }
+diff -ur wesnoth-1.10.3.orig/src/game_events.cpp wesnoth-1.10.3/src/game_events.cpp
+--- wesnoth-1.10.3.orig/src/game_events.cpp 2012-05-12 00:37:33.000000000 +0200
++++ wesnoth-1.10.3/src/game_events.cpp 2012-07-11 13:16:06.023266690 +0200
+@@ -341,7 +341,7 @@
+ std::vector<std::pair<int,int> > counts = (*u).has_attribute("count")
+ ? utils::parse_ranges((*u)["count"]) : default_counts;
+ int match_count = 0;
+- foreach (const unit &i, *resources::units)
++ wes_foreach (const unit &i, *resources::units)
+ {
+ if(i.hitpoints() > 0 && unit_matches_filter(i, *u)) {
+ ++match_count;
+@@ -396,7 +396,7 @@
+ const vconfig::child_list& variables = cond.get_children("variable");
+ backwards_compat = backwards_compat && variables.empty();
+
+- foreach (const vconfig &values, variables)
++ wes_foreach (const vconfig &values, variables)
+ {
+ const std::string name = values["name"];
+ config::attribute_value value = resources::state_of_game->get_variable_const(name);
+@@ -589,7 +589,7 @@
+ const std::vector<game_events::event_handler>& handlers,
+ const std::string& msg) {
+
+- foreach(const game_events::event_handler& h, handlers){
++ wes_foreach(const game_events::event_handler& h, handlers){
+ const config& cfg = h.get_config();
+ ss << "name=" << cfg["name"] << ", with id=" << cfg["id"] << "; ";
+ }
+@@ -603,7 +603,7 @@
+ std::stringstream ss;
+ log_handler(ss, active_, "active");
+ log_handler(ss, insert_buffer_, "insert buffered");
+- foreach(const std::string& h, remove_buffer_){
++ wes_foreach(const std::string& h, remove_buffer_){
+ ss << "id=" << h << "; ";
+ }
+ DBG_EH << "remove buffered handlers are now " << ss.str() << "\n";
+@@ -631,7 +631,7 @@
+ const config & cfg = new_handler.get_config();
+ std::string id = cfg["id"];
+ if(!id.empty()) {
+- foreach( game_events::event_handler const & eh, active_) {
++ wes_foreach( game_events::event_handler const & eh, active_) {
+ config const & temp_config( eh.get_config());
+ if(id == temp_config["id"]) {
+ DBG_EH << "ignoring event handler for name=" << cfg["name"] <<
+@@ -698,12 +698,12 @@
+ return;
+
+ // Commit any event removals
+- foreach(std::string const & i , remove_buffer_ ){
++ wes_foreach(std::string const & i , remove_buffer_ ){
+ remove_event_handler( i ); }
+ remove_buffer_.clear();
+
+ // Commit any spawned events-within-events
+- foreach( game_events::event_handler const & i , insert_buffer_ ){
++ wes_foreach( game_events::event_handler const & i , insert_buffer_ ){
+ add_event_handler( i ); }
+ insert_buffer_.clear();
+
+@@ -735,7 +735,7 @@
+ std::vector<int> sides = game_events::get_sides_vector(cfg);
+ size_t index;
+
+- foreach (const int &side_num, sides)
++ wes_foreach (const int &side_num, sides)
+ {
+ index = side_num - 1;
+ team &t = (*resources::teams)[index];
+@@ -744,7 +744,7 @@
+ filter.restrict_size(game_config::max_loop);
+ filter.get_locations(locs, true);
+
+- foreach (map_location const &loc, locs)
++ wes_foreach (map_location const &loc, locs)
+ {
+ if (remove) {
+ t.clear_shroud(loc);
+@@ -774,7 +774,7 @@
+ const bool remove = utils::string_bool(cfg["remove"], false);
+ if (remove) {
+ const std::vector<std::string> ids = utils::split(cfg["id"]);
+- foreach(const std::string &id, ids) {
++ wes_foreach(const std::string &id, ids) {
+ resources::tunnels->remove(id);
+ }
+ } else if (cfg.get_children("source").empty() ||
+@@ -941,7 +941,7 @@
+ WML_HANDLER_FUNCTION(modify_ai, /*event_info*/, cfg)
+ {
+ std::vector<int> sides = game_events::get_sides_vector(cfg);
+- foreach (const int &side_num, sides)
++ wes_foreach (const int &side_num, sides)
+ {
+ ai::manager::modify_active_ai_for_side(side_num,cfg.get_parsed_config());
+ }
+@@ -967,7 +967,7 @@
+ std::vector<int> sides = game_events::get_sides_vector(cfg);
+ size_t team_index;
+
+- foreach (const int &side_num, sides)
++ wes_foreach (const int &side_num, sides)
+ {
+ team_index = side_num - 1;
+ LOG_NG << "modifying side: " << side_num << "\n";
+@@ -1212,7 +1212,7 @@
+
+ size_t longest_path = 0;
+
+- foreach(const vconfig& config, unit_cfgs) {
++ wes_foreach(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"];
+@@ -1461,7 +1461,7 @@
+
+ variable_info vi(array_name, true, variable_info::TYPE_ARRAY);
+ bool first = true;
+- foreach (const config &cfg, vi.as_array())
++ wes_foreach (const config &cfg, vi.as_array())
+ {
+ std::string current_string = cfg[key_name];
+ if (remove_empty && current_string.empty()) continue;
+@@ -1589,7 +1589,7 @@
+ dest.vars->merge_with(data);
+ }
+ } else if(mode == "insert" || dest.explicit_index) {
+- foreach (const config &child, data.child_range(dest.key))
++ wes_foreach (const config &child, data.child_range(dest.key))
+ {
+ dest.vars->add_child_at(dest.key, child, dest.index++);
+ }
+@@ -1619,7 +1619,7 @@
+ item["type"] = *ti;
+ }
+ unit_map::iterator itor;
+- foreach (unit &u, *resources::units) {
++ wes_foreach (unit &u, *resources::units) {
+ if (game_events::unit_matches_filter(u, filter)) {
+ u.set_role(cfg["role"]);
+ found = true;
+@@ -1632,7 +1632,7 @@
+ std::set<std::string> player_ids;
+ std::vector<std::string> sides = utils::split(cfg["side"]);
+ const bool has_any_sides = !sides.empty();
+- foreach(std::string const& side_str, sides) {
++ wes_foreach(std::string const& side_str, sides) {
+ size_t side_num = lexical_cast_default<size_t>(side_str,0);
+ if(side_num > 0 && side_num <= resources::teams->size()) {
+ player_ids.insert((resources::teams->begin() + (side_num - 1))->save_id());
+@@ -1699,7 +1699,7 @@
+ game_map->set_terrain(loc, new_t);
+ screen_needs_rebuild = true;
+
+- foreach (const t_translation::t_terrain &ut, game_map->underlying_union_terrain(loc)) {
++ wes_foreach (const t_translation::t_terrain &ut, game_map->underlying_union_terrain(loc)) {
+ preferences::encountered_terrains().insert(ut);
+ }
+ }
+@@ -1820,7 +1820,7 @@
+ const map_location cfg_loc = cfg_to_loc(cfg);
+
+ //TODO fendrin: comment this monster
+- foreach (unit_map::const_unit_iterator leader, leaders) {
++ wes_foreach (unit_map::const_unit_iterator leader, leaders) {
+ DBG_NG << "...considering " + leader->id() + " as the recalling leader...\n";
+ map_location loc = cfg_loc;
+ if ( (leader_filter.null() || leader->matches_filter(leader_filter, leader->get_location())) &&
+@@ -1879,7 +1879,7 @@
+
+ map_location loc;
+ if(!filter.null()) {
+- foreach (const unit &u, *resources::units) {
++ wes_foreach (const unit &u, *resources::units) {
+ if (game_events::unit_matches_filter(u, filter)) {
+ loc = u.get_location();
+ break;
+@@ -1926,7 +1926,7 @@
+ }
+ }
+
+- foreach (const vconfig &cmd, cfg.get_children(command_type)) {
++ wes_foreach (const vconfig &cmd, cfg.get_children(command_type)) {
+ handle_event_commands(event_info, cmd);
+ }
+ }
+@@ -2029,13 +2029,13 @@
+ std::vector<unit *> dead_men_walking;
+ // unit_map::iterator uit(resources::units->begin()), uend(resources::units->end());
+ // for(;uit!=uend; ++uit){
+- foreach(unit & u, *resources::units){
++ wes_foreach(unit & u, *resources::units){
+ if(game_events::unit_matches_filter(u, cfg)){
+ dead_men_walking.push_back(&u);
+ }
+ }
+
+- foreach(unit * un, dead_men_walking) {
++ wes_foreach(unit * un, dead_men_walking) {
+ map_location loc(un->get_location());
+ bool fire_event = false;
+ game_events::entity_location death_loc(*un);
+@@ -2429,7 +2429,7 @@
+
+ if (clear_shroud_bool) {
+ side_filter filter(cfg);
+- foreach(const int side, filter.get_teams()){
++ wes_foreach(const int side, filter.get_teams()){
+ clear_shroud(side);
+ }
+ screen.recalculate_minimap();
+@@ -2466,7 +2466,7 @@
+ const vconfig healers_filter = cfg.child("filter_second");
+ std::vector<unit*> healers;
+ if (!healers_filter.null()) {
+- foreach (unit& u, *units) {
++ wes_foreach (unit& u, *units) {
+ if (game_events::unit_matches_filter(u, healers_filter) && u.has_ability_type("heals")) {
+ healers.push_back(&u);
+ }
+@@ -2835,7 +2835,7 @@
+ return;
+ }
+
+- foreach (const vconfig &cmd, option_events[option_chosen]) {
++ wes_foreach (const vconfig &cmd, option_events[option_chosen]) {
+ handle_event_commands(event_info, cmd);
+ }
+ }
+@@ -2858,7 +2858,7 @@
+ if(remove) {
+ const std::vector<std::string> id_list =
+ utils::split(ids, ',', utils::STRIP_SPACES | utils::REMOVE_EMPTY);
+- foreach(const std::string& id, id_list) {
++ wes_foreach(const std::string& id, id_list) {
+ resources::tod_manager->remove_time_area(id);
+ LOG_NG << "event WML removed time_area '" << id << "'\n";
+ }
+@@ -2997,7 +2997,7 @@
+ if(is_empty_command) {
+ mref->command.add_child("allow_undo");
+ }
+- foreach(game_events::event_handler& hand, event_handlers) {
++ wes_foreach(game_events::event_handler& hand, event_handlers) {
+ if(hand.is_menu_item() && hand.matches_name(mref->name)) {
+ LOG_NG << "changing command for " << mref->name << " to:\n" << *wcc.second;
+ hand = game_events::event_handler(mref->command, true);
+@@ -3029,14 +3029,14 @@
+ vconfig filters(handler.get_config());
+
+
+- foreach (const vconfig &condition, filters.get_children("filter_condition"))
++ wes_foreach (const vconfig &condition, filters.get_children("filter_condition"))
+ {
+ if (!game_events::conditional_passed(condition)) {
+ return false;
+ }
+ }
+
+- foreach (const vconfig &f, filters.get_children("filter"))
++ wes_foreach (const vconfig &f, filters.get_children("filter"))
+ {
+ if (unit1 == units->end() || !game_events::unit_matches_filter(*unit1, f)) {
+ return false;
+@@ -3046,7 +3046,7 @@
+ }
+ }
+
+- foreach (const vconfig &f, filters.get_children("filter_side"))
++ wes_foreach (const vconfig &f, filters.get_children("filter_side"))
+ {
+ side_filter ssf(f);
+ const int current_side = resources::controller->current_side();
+@@ -3055,7 +3055,7 @@
+
+ vconfig::child_list special_filters = filters.get_children("filter_attack");
+ bool special_matches = special_filters.empty();
+- foreach (const vconfig &f, special_filters)
++ wes_foreach (const vconfig &f, special_filters)
+ {
+ if (unit1 != units->end() && game_events::matches_special_filter(ev.data.child("first"), f)) {
+ special_matches = true;
+@@ -3068,7 +3068,7 @@
+ return false;
+ }
+
+- foreach (const vconfig &f, filters.get_children("filter_second"))
++ wes_foreach (const vconfig &f, filters.get_children("filter_second"))
+ {
+ if (unit2 == units->end() || !game_events::unit_matches_filter(*unit2, f)) {
+ return false;
+@@ -3080,7 +3080,7 @@
+
+ special_filters = filters.get_children("filter_second_attack");
+ special_matches = special_filters.empty();
+- foreach (const vconfig &f, special_filters)
++ wes_foreach (const vconfig &f, special_filters)
+ {
+ if (unit2 != units->end() && game_events::matches_special_filter(ev.data.child("second"), f)) {
+ special_matches = true;
+@@ -3275,17 +3275,17 @@
+ : variable_manager()
+ {
+ assert(!manager_running);
+- foreach (const config &ev, cfg.child_range("event")) {
++ wes_foreach (const config &ev, cfg.child_range("event")) {
+ event_handlers.add_event_handler(game_events::event_handler(ev));
+ }
+- foreach (const std::string &id, utils::split(cfg["unit_wml_ids"])) {
++ wes_foreach (const std::string &id, utils::split(cfg["unit_wml_ids"])) {
+ unit_wml_ids.insert(id);
+ }
+
+ resources::lua_kernel = new LuaKernel(cfg);
+ manager_running = true;
+
+- foreach (static_wml_action_map::value_type &action, static_wml_actions) {
++ wes_foreach (static_wml_action_map::value_type &action, static_wml_actions) {
+ resources::lua_kernel->set_wml_action(action.first, action.second);
+ }
+
+@@ -3298,7 +3298,7 @@
+ }
+ int wmi_count = 0;
+ typedef std::pair<std::string, wml_menu_item *> item;
+- foreach (const item &itor, resources::state_of_game->wml_menu_items) {
++ wes_foreach (const item &itor, resources::state_of_game->wml_menu_items) {
+ if (!itor.second->command.empty()) {
+ event_handlers.add_event_handler(game_events::event_handler(itor.second->command, true));
+ }
+@@ -3312,7 +3312,7 @@
+ void write_events(config& cfg)
+ {
+ assert(manager_running);
+- foreach (const game_events::event_handler &eh, event_handlers) {
++ wes_foreach (const game_events::event_handler &eh, event_handlers) {
+ if (eh.disabled() || eh.is_menu_item()) continue;
+ cfg.add_child("event", eh.get_config());
+ }
+@@ -3385,7 +3385,7 @@
+ if(std::find(unit_wml_ids.begin(),unit_wml_ids.end(),type) != unit_wml_ids.end()) return;
+ unit_wml_ids.insert(type);
+ }
+- foreach (const config &new_ev, cfgs) {
++ wes_foreach (const config &new_ev, cfgs) {
+ if(type.empty() && new_ev["id"].empty())
+ {
+ WRN_NG << "attempt to add an [event] with empty id=, ignoring \n";
+@@ -3427,7 +3427,7 @@
+
+ if(!lg::debug.dont_log("event_handler")) {
+ std::stringstream ss;
+- foreach(const game_events::queued_event& ev, events_queue) {
++ wes_foreach(const game_events::queued_event& ev, events_queue) {
+ ss << "name=" << ev.name << "; ";
+ }
+ DBG_EH << "processing queued events: " << ss.str() << "\n";
+@@ -3454,7 +3454,7 @@
+
+ bool init_event_vars = true;
+
+- foreach(game_events::event_handler& handler, event_handlers) {
++ wes_foreach(game_events::event_handler& handler, event_handlers) {
+ if(!handler.matches_name(event_name))
+ continue;
+ // Set the variables for the event
+diff -ur wesnoth-1.10.3.orig/src/game_preferences.cpp wesnoth-1.10.3/src/game_preferences.cpp
+--- wesnoth-1.10.3.orig/src/game_preferences.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/game_preferences.cpp 2012-07-11 13:16:05.963266693 +0200
+@@ -112,9 +112,9 @@
+ message = foobar
+ [/line]
+ */
+- foreach (const config::any_child &h, history.all_children_range())
++ wes_foreach (const config::any_child &h, history.all_children_range())
+ {
+- foreach (const config &l, h.cfg.child_range("line")) {
++ wes_foreach (const config &l, h.cfg.child_range("line")) {
+ history_map[h.key].push_back(l["message"]);
+ }
+ }
+@@ -142,10 +142,10 @@
+ */
+ config history;
+ typedef std::pair<std::string, std::vector<std::string> > hack;
+- foreach(const hack& history_id, history_map) {
++ wes_foreach(const hack& history_id, history_map) {
+
+ config history_id_cfg; // [history_id]
+- foreach(const std::string& line, history_id.second) {
++ wes_foreach(const std::string& line, history_id.second) {
+ config cfg; // [line]
+
+ cfg["message"] = line;
+@@ -314,7 +314,7 @@
+ 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());
+- foreach (const config &server, get_prefs()->child_range("server")) {
++ wes_foreach (const config &server, get_prefs()->child_range("server")) {
+ game_config::server_info sinf;
+ sinf.name = server["name"].str();
+ sinf.address = server["address"].str();
+@@ -945,8 +945,8 @@
+ }
+
+ void encounter_recallable_units(std::vector<team>& teams){
+- foreach(const team& t, teams) {
+- foreach(const unit& u, t.recall_list()) {
++ wes_foreach(const team& t, teams) {
++ wes_foreach(const unit& u, t.recall_list()) {
+ encountered_units_set.insert(u.type_id());
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/game_preferences_display.cpp wesnoth-1.10.3/src/game_preferences_display.cpp
+--- wesnoth-1.10.3.orig/src/game_preferences_display.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/game_preferences_display.cpp 2012-07-11 13:16:06.029933357 +0200
+@@ -1071,7 +1071,7 @@
+ void preferences_dialog::set_advanced_menu()
+ {
+ std::vector<std::string> advanced_items;
+- foreach (const config &adv, adv_preferences_cfg_)
++ wes_foreach (const config &adv, adv_preferences_cfg_)
+ {
+ std::ostringstream str;
+ std::string field = preferences::get(adv["field"]);
+@@ -1096,7 +1096,7 @@
+ {
+ adv_preferences_cfg_.clear();
+
+- foreach(const config& adv, game_cfg_.child_range("advanced_preference")) {
++ wes_foreach(const config& adv, game_cfg_.child_range("advanced_preference")) {
+ adv_preferences_cfg_.push_back(adv);
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/gamestatus.cpp wesnoth-1.10.3/src/gamestatus.cpp
+--- wesnoth-1.10.3.orig/src/gamestatus.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gamestatus.cpp 2012-07-11 13:16:05.973266690 +0200
+@@ -178,9 +178,9 @@
+ tags.push_back("side");
+ tags.push_back("player"); //merge [player] tags for backwards compatibility of saves
+
+- foreach (const std::string& side_tag, tags)
++ wes_foreach (const std::string& side_tag, tags)
+ {
+- foreach (config &carryover_side, source->child_range(side_tag))
++ wes_foreach (config &carryover_side, source->child_range(side_tag))
+ {
+ config *scenario_side = NULL;
+
+@@ -226,13 +226,13 @@
+ (*scenario_side)["color"] = carryover_side["color"];
+
+ //add recallable units
+- foreach (const config &u, carryover_side.child_range("unit")) {
++ wes_foreach (const config &u, carryover_side.child_range("unit")) {
+ scenario_side->add_child("unit", u);
+ }
+ }
+ }
+ } else {
+- foreach(const config &snapshot_side, source->child_range("side")) {
++ wes_foreach(const config &snapshot_side, source->child_range("side")) {
+ //take all side tags and add them as players (assuming they only contain carryover information)
+ cfg.add_child("player", snapshot_side);
+ }
+@@ -306,7 +306,7 @@
+ //See also playcampaign::play_game, where after finishing the scenario the replay
+ //will be saved.
+ if(!starting_pos.empty()) {
+- foreach (const config &p, cfg.child_range("player")) {
++ wes_foreach (const config &p, cfg.child_range("player")) {
+ config& cfg_player = starting_pos.add_child("player");
+ cfg_player.merge_with(p);
+ }
+@@ -400,7 +400,7 @@
+ std::string leader;
+ std::string leader_image;
+
+- //foreach (const config &p, cfg_save.child_range("player"))
++ //wes_foreach (const config &p, cfg_save.child_range("player"))
+ //{
+ // if (utils::string_bool(p["canrecruit"], false)) {
+ // leader = p["save_id"];
+@@ -413,7 +413,7 @@
+ //{
+ if (const config &snapshot = *(has_snapshot ? &cfg_snapshot : &cfg_replay_start))
+ {
+- foreach (const config &side, snapshot.child_range("side"))
++ wes_foreach (const config &side, snapshot.child_range("side"))
+ {
+ if (side["controller"] != "human") {
+ continue;
+@@ -430,7 +430,7 @@
+ break;
+ }
+
+- foreach (const config &u, side.child_range("unit"))
++ wes_foreach (const config &u, side.child_range("unit"))
+ {
+ if (u["canrecruit"].to_bool()) {
+ leader = u["id"].str();
+@@ -794,7 +794,7 @@
+ // can be recruited for the player, add them.
+ if (!player_cfg_) return;
+ if (const config::attribute_value *v = player_cfg_->get("previous_recruits")) {
+- foreach (const std::string &rec, utils::split(*v)) {
++ wes_foreach (const std::string &rec, utils::split(*v)) {
+ DBG_NG_TC << "adding previous recruit: " << rec << '\n';
+ t_->add_recruit(rec);
+ }
+@@ -857,7 +857,7 @@
+ if (!side_cfg_["no_leader"].to_bool() && side_cfg_["controller"] != "null") {
+ handle_leader(side_cfg_);
+ }
+- foreach (const config &l, side_cfg_.child_range("leader")) {
++ wes_foreach (const config &l, side_cfg_.child_range("leader")) {
+ handle_leader(l);
+ }
+ }
+@@ -871,13 +871,13 @@
+ //only relevant in start-of-scenario saves, that's why !shapshot
+ //units that are in '[scenario][side]' are 'first'
+ //for create-or-recall semantics to work: for each unit with non-empty id, unconditionally put OTHER, later, units with same id directly to recall list, not including them in unit_configs_
+- foreach(const config &u, (*player_cfg_).child_range("unit")) {
++ wes_foreach(const config &u, (*player_cfg_).child_range("unit")) {
+ handle_unit(u,"player_cfg");
+ }
+
+ } else {
+ //units in [side]
+- foreach (const config &su, side_cfg_.child_range("unit")) {
++ wes_foreach (const config &su, side_cfg_.child_range("unit")) {
+ handle_unit(su, "side_cfg");
+ }
+ }
+@@ -902,7 +902,7 @@
+ "allow_changes", "faction_name", "user_description", "faction" };
+
+ log_step("place units");
+- foreach (const config *u, unit_configs_) {
++ wes_foreach (const config *u, unit_configs_) {
+ unit_creator uc(*t_,map_.starting_position(side_));
+ uc
+ .allow_add_to_recall(true)
+@@ -913,7 +913,7 @@
+ .allow_show(false);
+
+ config cfg = *u;
+- foreach (const char *attr, side_attrs) {
++ wes_foreach (const char *attr, side_attrs) {
+ cfg.remove_attribute(attr);
+ }
+ uc.add_unit(cfg);
+@@ -953,7 +953,7 @@
+ void game_state::set_menu_items(const config::const_child_itors &menu_items)
+ {
+ clear_wmi(wml_menu_items);
+- foreach (const config &item, menu_items)
++ wes_foreach (const config &item, menu_items)
+ {
+ std::string id = item["id"];
+ wml_menu_item*& mref = wml_menu_items[id];
+diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/canvas.cpp wesnoth-1.10.3/src/gui/auxiliary/canvas.cpp
+--- wesnoth-1.10.3.orig/src/gui/auxiliary/canvas.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/auxiliary/canvas.cpp 2012-07-11 13:16:05.936600025 +0200
+@@ -1455,7 +1455,7 @@
+ log_scope2(log_gui_parse, "Canvas: parsing config.");
+ shapes_.clear();
+
+- foreach(const config::any_child& shape, cfg.all_children_range()) {
++ wes_foreach(const config::any_child& shape, cfg.all_children_range()) {
+ const std::string &type = shape.key;
+ const config &data = shape.cfg;
+
+@@ -1474,7 +1474,7 @@
+ } else if(type == "pre_commit") {
+
+ /* note this should get split if more preprocessing is used. */
+- foreach(const config::any_child& function,
++ wes_foreach(const config::any_child& function,
+ data.all_children_range()) {
+
+ if(function.key == "blur") {
+diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/event/handler.cpp wesnoth-1.10.3/src/gui/auxiliary/event/handler.cpp
+--- wesnoth-1.10.3.orig/src/gui/auxiliary/event/handler.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/auxiliary/event/handler.cpp 2012-07-11 13:16:05.933266691 +0200
+@@ -429,7 +429,7 @@
+ }
+
+ /***** Set proper state for the other dispatchers. *****/
+- foreach(tdispatcher* dispatcher, dispatchers_) {
++ wes_foreach(tdispatcher* dispatcher, dispatchers_) {
+ dynamic_cast<twidget&>(*dispatcher).set_dirty();
+ }
+
+@@ -448,7 +448,7 @@
+
+ void thandler::activate()
+ {
+- foreach(tdispatcher* dispatcher, dispatchers_) {
++ wes_foreach(tdispatcher* dispatcher, dispatchers_) {
+ dispatcher->fire(SDL_ACTIVATE
+ , dynamic_cast<twidget&>(*dispatcher)
+ , NULL);
+@@ -472,7 +472,7 @@
+ *
+ * For now we use a hack, but would be nice to rewrite it for 1.9/1.11.
+ */
+- foreach(tdispatcher* dispatcher, dispatchers_) {
++ wes_foreach(tdispatcher* dispatcher, dispatchers_) {
+ if(!first) {
+ /*
+ * This leaves glitches on window borders if the window beneath it
+@@ -503,7 +503,7 @@
+ {
+ DBG_GUI_E << "Firing: " << SDL_VIDEO_RESIZE << ".\n";
+
+- foreach(tdispatcher* dispatcher, dispatchers_) {
++ wes_foreach(tdispatcher* dispatcher, dispatchers_) {
+ dispatcher->fire(SDL_VIDEO_RESIZE
+ , dynamic_cast<twidget&>(*dispatcher)
+ , new_size);
+diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/notifier.hpp wesnoth-1.10.3/src/gui/auxiliary/notifier.hpp
+--- wesnoth-1.10.3.orig/src/gui/auxiliary/notifier.hpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/auxiliary/notifier.hpp 2012-07-11 13:16:05.933266691 +0200
+@@ -47,7 +47,7 @@
+ ~tnotifier()
+ {
+ typedef std::pair<tnotifiee<tfunctor>* const, tfunctor> thack;
+- foreach(thack& item, notifiees_) {
++ wes_foreach(thack& item, notifiees_) {
+ assert(item.first);
+ assert((*item.first).notifier_ == this);
+
+diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/tips.cpp wesnoth-1.10.3/src/gui/auxiliary/tips.cpp
+--- wesnoth-1.10.3.orig/src/gui/auxiliary/tips.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/auxiliary/tips.cpp 2012-07-11 13:16:05.936600025 +0200
+@@ -39,7 +39,7 @@
+ {
+ std::vector<ttip> result;
+
+- foreach(const config &tip, cfg.child_range("tip")) {
++ wes_foreach(const config &tip, cfg.child_range("tip")) {
+ result.push_back(ttip(tip["text"]
+ , tip["source"]
+ , tip["encountered_units"]));
+@@ -54,11 +54,11 @@
+
+ const std::set<std::string>& units = preferences::encountered_units();
+
+- foreach(const ttip& tip, tips) {
++ wes_foreach(const ttip& tip, tips) {
+ if(tip.unit_filter_.empty()) {
+ result.push_back(tip);
+ } else {
+- foreach(const std::string& unit, tip.unit_filter_) {
++ wes_foreach(const std::string& unit, tip.unit_filter_) {
+ if(units.find(unit) != units.end()) {
+ result.push_back(tip);
+ break;
+diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/widget_definition.hpp wesnoth-1.10.3/src/gui/auxiliary/widget_definition.hpp
+--- wesnoth-1.10.3.orig/src/gui/auxiliary/widget_definition.hpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/auxiliary/widget_definition.hpp 2012-07-11 13:16:05.936600025 +0200
+@@ -98,7 +98,7 @@
+ void load_resolutions(const config &cfg)
+ {
+ config::const_child_itors itors = cfg.child_range("resolution");
+- foreach(const config &resolution, itors) {
++ wes_foreach(const config &resolution, itors) {
+ resolutions.push_back(new T(resolution));
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/helper.cpp wesnoth-1.10.3/src/gui/auxiliary/window_builder/helper.cpp
+--- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/helper.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/helper.cpp 2012-07-11 13:16:05.933266691 +0200
+@@ -60,7 +60,7 @@
+ unsigned get_border(const std::vector<std::string>& border)
+ {
+ unsigned result = 0;
+- foreach (const std::string& s, border) {
++ wes_foreach (const std::string& s, border) {
+ if (s == "all") {
+ return tgrid::BORDER_ALL;
+ } else if (s == "top") {
+diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/horizontal_listbox.cpp wesnoth-1.10.3/src/gui/auxiliary/window_builder/horizontal_listbox.cpp
+--- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/horizontal_listbox.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/horizontal_listbox.cpp 2012-07-11 13:16:05.933266691 +0200
+@@ -53,12 +53,12 @@
+ const config &data = cfg.child("list_data");
+ if (!data) return;
+
+- foreach(const config &row, data.child_range("row")) {
++ wes_foreach(const config &row, data.child_range("row")) {
+ unsigned col = 0;
+
+- foreach(const config &c, row.child_range("column")) {
++ wes_foreach(const config &c, row.child_range("column")) {
+ list_data.push_back(string_map());
+- foreach (const config::attribute &i, c.attribute_range()) {
++ wes_foreach (const config::attribute &i, c.attribute_range()) {
+ list_data.back()[i.first] = i.second;
+ }
+ ++col;
+diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/listbox.cpp wesnoth-1.10.3/src/gui/auxiliary/window_builder/listbox.cpp
+--- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/listbox.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/listbox.cpp 2012-07-11 13:16:05.933266691 +0200
+@@ -66,12 +66,12 @@
+ return;
+ }
+
+- foreach(const config& row, data.child_range("row")) {
++ wes_foreach(const config& row, data.child_range("row")) {
+ unsigned col = 0;
+
+- foreach(const config& c, row.child_range("column")) {
++ wes_foreach(const config& c, row.child_range("column")) {
+ list_data.push_back(string_map());
+- foreach(const config::attribute& i, c.attribute_range()) {
++ wes_foreach(const config::attribute& i, c.attribute_range()) {
+ list_data.back()[i.first] = i.second;
+ }
+ ++col;
+diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/multi_page.cpp wesnoth-1.10.3/src/gui/auxiliary/window_builder/multi_page.cpp
+--- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/multi_page.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/multi_page.cpp 2012-07-11 13:16:05.933266691 +0200
+@@ -46,12 +46,12 @@
+ return;
+ }
+
+- foreach(const config &row, d.child_range("row")) {
++ wes_foreach(const config &row, d.child_range("row")) {
+ unsigned col = 0;
+
+- foreach(const config &column, row.child_range("column")) {
++ wes_foreach(const config &column, row.child_range("column")) {
+ data.push_back(string_map());
+- foreach(const config::attribute &i, column.attribute_range()) {
++ wes_foreach(const config::attribute &i, column.attribute_range()) {
+ data.back()[i.first] = i.second;
+ }
+ ++col;
+diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/slider.cpp wesnoth-1.10.3/src/gui/auxiliary/window_builder/slider.cpp
+--- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/slider.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/slider.cpp 2012-07-11 13:16:05.933266691 +0200
+@@ -44,7 +44,7 @@
+ return;
+ }
+
+- foreach(const config& label, labels.child_range("value")) {
++ wes_foreach(const config& label, labels.child_range("value")) {
+ value_labels_.push_back(label["label"]);
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/stacked_widget.cpp wesnoth-1.10.3/src/gui/auxiliary/window_builder/stacked_widget.cpp
+--- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/stacked_widget.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/stacked_widget.cpp 2012-07-11 13:16:05.933266691 +0200
+@@ -35,7 +35,7 @@
+ {
+ const config &s = cfg.child("stack");
+ VALIDATE(s, _("No stack defined."));
+- foreach(const config &layer, s.child_range("layer")) {
++ wes_foreach(const config &layer, s.child_range("layer")) {
+ stack.push_back(new tbuilder_grid(layer));
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/tree_view.cpp wesnoth-1.10.3/src/gui/auxiliary/window_builder/tree_view.cpp
+--- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/tree_view.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/tree_view.cpp 2012-07-11 13:16:05.933266691 +0200
+@@ -39,7 +39,7 @@
+ , nodes()
+ {
+
+- foreach(const config &node, cfg.child_range("node")) {
++ wes_foreach(const config &node, cfg.child_range("node")) {
+ nodes.push_back(tnode(node));
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder.cpp wesnoth-1.10.3/src/gui/auxiliary/window_builder.cpp
+--- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/auxiliary/window_builder.cpp 2012-07-11 13:16:05.936600025 +0200
+@@ -67,7 +67,7 @@
+ std::string
+ , boost::function<tbuilder_widget_ptr(config)> >
+ thack;
+- foreach(const thack& item, builder_widget_lookup()) {
++ wes_foreach(const thack& item, builder_widget_lookup()) {
+ if(item.first == "window" || item.first == "tooltip") {
+ continue;
+ }
+@@ -153,7 +153,7 @@
+ , definition->helptip);
+ assert(window);
+
+- foreach(const twindow_builder::tresolution::tlinked_group& lg,
++ wes_foreach(const twindow_builder::tresolution::tlinked_group& lg,
+ definition->linked_groups) {
+
+ if(window->has_linked_size_group(lg.id)) {
+@@ -238,7 +238,7 @@
+
+ config::const_child_itors cfgs = cfg.child_range("resolution");
+ VALIDATE(cfgs.first != cfgs.second, _("No resolution defined."));
+- foreach (const config &i, cfgs) {
++ wes_foreach (const config &i, cfgs) {
+ resolutions.push_back(tresolution(i));
+ }
+
+@@ -386,7 +386,7 @@
+ definition = "default";
+ }
+
+- foreach (const config &lg, cfg.child_range("linked_group")) {
++ wes_foreach (const config &lg, cfg.child_range("linked_group")) {
+ tlinked_group linked_group;
+ linked_group.id = lg["id"].str();
+ linked_group.fixed_width = lg["fixed_width"].to_bool();
+@@ -501,13 +501,13 @@
+ */
+ log_scope2(log_gui_parse, "Window builder: parsing a grid");
+
+- foreach (const config &row, cfg.child_range("row"))
++ wes_foreach (const config &row, cfg.child_range("row"))
+ {
+ unsigned col = 0;
+
+ row_grow_factor.push_back(row["grow_factor"]);
+
+- foreach (const config &c, row.child_range("column"))
++ wes_foreach (const config &c, row.child_range("column"))
+ {
+ flags.push_back(implementation::read_flags(c));
+ border_size.push_back(c["border_size"]);
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/addon/description.cpp wesnoth-1.10.3/src/gui/dialogs/addon/description.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/addon/description.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/addon/description.cpp 2012-07-11 13:16:05.923266694 +0200
+@@ -17,7 +17,7 @@
+ namespace {
+ std::string langcode_to_string(const std::string& lcode)
+ {
+- foreach(const language_def& ld, get_languages()) {
++ wes_foreach(const language_def& ld, get_languages()) {
+ if(ld.localename == lcode || ld.localename.substr(0, 2) == lcode) {
+ return ld.language;
+ }
+@@ -90,7 +90,7 @@
+
+ std::string languages;
+
+- foreach(const std::string& lc, addon.translations) {
++ wes_foreach(const std::string& lc, addon.translations) {
+ const std::string& langlabel = langcode_to_string(lc);
+ if(!langlabel.empty()) {
+ if(!languages.empty()) {
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/addon/uninstall_list.cpp wesnoth-1.10.3/src/gui/dialogs/addon/uninstall_list.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/addon/uninstall_list.cpp 2011-12-12 02:29:49.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/addon/uninstall_list.cpp 2012-07-11 13:16:05.923266694 +0200
+@@ -50,7 +50,7 @@
+ this->names_.clear();
+ this->selections_.clear();
+
+- foreach(const std::string& id, this->ids_) {
++ wes_foreach(const std::string& id, this->ids_) {
+ this->names_.push_back(make_addon_name(id));
+ this->selections_[id] = false;
+
+@@ -87,7 +87,7 @@
+ std::vector<std::string> retv;
+
+ typedef std::map<std::string, bool> selections_map_type;
+- foreach(const selections_map_type::value_type& entry, this->selections_) {
++ wes_foreach(const selections_map_type::value_type& entry, this->selections_) {
+ if(entry.second) {
+ retv.push_back(entry.first);
+ }
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/addon_list.cpp wesnoth-1.10.3/src/gui/dialogs/addon_list.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/addon_list.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/addon_list.cpp 2012-07-11 13:16:05.926600026 +0200
+@@ -70,7 +70,7 @@
+ * @todo do we really want to keep the length limit for the various
+ * items?
+ */
+- foreach(const config &c, cfg_.child_range("campaign")) {
++ wes_foreach(const config &c, cfg_.child_range("campaign")) {
+ std::map<std::string, string_map> data;
+ string_map item;
+
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/campaign_difficulty.cpp wesnoth-1.10.3/src/gui/dialogs/campaign_difficulty.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/campaign_difficulty.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/campaign_difficulty.cpp 2012-07-11 13:16:05.929933358 +0200
+@@ -65,7 +65,7 @@
+ tcampaign_difficulty::tcampaign_difficulty(const std::vector<std::string>& items)
+ : index_(-1), items_()
+ {
+- foreach(const std::string& it, items) {
++ wes_foreach(const std::string& it, items) {
+ items_.push_back(tlegacy_menu_item(it));
+ }
+ }
+@@ -77,7 +77,7 @@
+
+ std::map<std::string, string_map> data;
+
+- foreach(const tlegacy_menu_item& item, items_) {
++ wes_foreach(const tlegacy_menu_item& item, items_) {
+ if(item.is_default()) {
+ index_ = list.get_item_count();
+ }
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/campaign_selection.cpp wesnoth-1.10.3/src/gui/dialogs/campaign_selection.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/campaign_selection.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/campaign_selection.cpp 2012-07-11 13:16:05.929933358 +0200
+@@ -140,7 +140,7 @@
+ &window, "campaign_details", false);
+
+ unsigned id = 0;
+- foreach(const config &campaign, campaigns_) {
++ wes_foreach(const config &campaign, campaigns_) {
+
+ /*** Add tree item ***/
+ tree_group_field["label"] = campaign["icon"];
+@@ -206,7 +206,7 @@
+ tmulti_page& multi_page = find_widget<tmulti_page>(
+ &window, "campaign_details", false);
+
+- foreach (const config &c, campaigns_) {
++ wes_foreach (const config &c, campaigns_) {
+
+ /*** Add list item ***/
+ string_map list_item;
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/chat_log.cpp wesnoth-1.10.3/src/gui/dialogs/chat_log.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/chat_log.cpp 2012-02-18 14:40:19.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/chat_log.cpp 2012-07-11 13:16:05.926600026 +0200
+@@ -113,7 +113,7 @@
+ std::stringstream str;
+ LOG_CHAT_LOG << "entering tchat_log::model::add_row_to_chat_message_list\n";
+ if (first<last) {
+- foreach (const chat_msg &t, make_pair(chat_log_history.begin()+first,chat_log_history.begin()+last))
++ wes_foreach (const chat_msg &t, make_pair(chat_log_history.begin()+first,chat_log_history.begin()+last))
+ {
+ std::string prefix("/me");
+ bool me = false;
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/data_manage.cpp wesnoth-1.10.3/src/gui/dialogs/data_manage.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/data_manage.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/data_manage.cpp 2012-07-11 13:16:05.929933358 +0200
+@@ -101,7 +101,7 @@
+ tlistbox& list = find_widget<tlistbox>(&window, "persist_list", false);
+ list.clear();
+
+- foreach(const savegame::save_info game, games) {
++ wes_foreach(const savegame::save_info game, games) {
+ std::map<std::string, string_map> data;
+ string_map item;
+
+@@ -142,7 +142,7 @@
+ find_widget<tlabel>(*it, "filename", false);
+
+ bool found = false;
+- foreach (const std::string& word, words){
++ wes_foreach (const std::string& word, words){
+ found = std::search(filename_label.label().str().begin()
+ , filename_label.label().str().end()
+ , word.begin(), word.end()
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/debug_clock.cpp wesnoth-1.10.3/src/gui/dialogs/debug_clock.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/debug_clock.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/debug_clock.cpp 2012-07-11 13:16:05.923266694 +0200
+@@ -153,7 +153,7 @@
+ }
+
+ if(clock_) {
+- foreach(tcanvas& canvas, clock_->canvas()) {
++ wes_foreach(tcanvas& canvas, clock_->canvas()) {
+ canvas.set_variable("hour", variant(hour_stamp));
+ canvas.set_variable("minute", variant(minute_stamp));
+ canvas.set_variable("second", variant(second_stamp));
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/dialog.cpp wesnoth-1.10.3/src/gui/dialogs/dialog.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/dialog.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/dialog.cpp 2012-07-11 13:16:05.926600026 +0200
+@@ -26,7 +26,7 @@
+
+ tdialog::~tdialog()
+ {
+- foreach(tfield_* field, fields_) {
++ wes_foreach(tfield_* field, fields_) {
+ delete field;
+ }
+ }
+@@ -193,7 +193,7 @@
+
+ void tdialog::init_fields(twindow& window)
+ {
+- foreach(tfield_* field, fields_) {
++ wes_foreach(tfield_* field, fields_) {
+ field->attach_to_window(window);
+ field->widget_init(window);
+ }
+@@ -207,7 +207,7 @@
+
+ void tdialog::finalize_fields(twindow& window, const bool save_fields)
+ {
+- foreach(tfield_* field, fields_) {
++ wes_foreach(tfield_* field, fields_) {
+ if(save_fields) {
+ field->widget_finalize(window);
+ }
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/formula_debugger.cpp wesnoth-1.10.3/src/gui/dialogs/formula_debugger.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/formula_debugger.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/formula_debugger.cpp 2012-07-11 13:16:05.923266694 +0200
+@@ -73,7 +73,7 @@
+ std::stringstream stack_text;
+ std::string indent = " ";
+ int c = 0;
+- foreach (const game_logic::debug_info &i, fdb_.get_call_stack()) {
++ wes_foreach (const game_logic::debug_info &i, fdb_.get_call_stack()) {
+ for(int d = 0; d < c; ++d) {
+ stack_text << indent;
+ }
+@@ -92,7 +92,7 @@
+ &window, "execution", false, true);
+
+ std::stringstream execution_text;
+- foreach (const game_logic::debug_info &i, fdb_.get_execution_trace()) {
++ wes_foreach (const game_logic::debug_info &i, fdb_.get_execution_trace()) {
+ for(int d = 0; d < i.level(); ++d) {
+ execution_text << indent;
+ }
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/game_load.cpp wesnoth-1.10.3/src/gui/dialogs/game_load.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/game_load.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/game_load.cpp 2012-07-11 13:16:05.933266691 +0200
+@@ -151,7 +151,7 @@
+ tlistbox& list = find_widget<tlistbox>(&window, "savegame_list", false);
+ list.clear();
+
+- foreach(const savegame::save_info game, games) {
++ wes_foreach(const savegame::save_info game, games) {
+ std::map<std::string, string_map> data;
+ string_map item;
+
+@@ -193,7 +193,7 @@
+ find_widget<tlabel>(*it, "filename", false);
+
+ bool found = false;
+- foreach (const std::string& word, words){
++ wes_foreach (const std::string& word, words){
+ found = std::search(filename_label.label().str().begin()
+ , filename_label.label().str().end()
+ , word.begin(), word.end()
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/gamestate_inspector.cpp wesnoth-1.10.3/src/gui/dialogs/gamestate_inspector.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/gamestate_inspector.cpp 2012-05-12 18:30:08.000000000 +0200
++++ wesnoth-1.10.3/src/gui/dialogs/gamestate_inspector.cpp 2012-07-11 13:16:05.933266691 +0200
+@@ -189,11 +189,11 @@
+ ? resources::state_of_game->get_variables()
+ : config();
+
+- foreach( const config::attribute &a, vars.attribute_range()) {
++ wes_foreach( const config::attribute &a, vars.attribute_range()) {
+ model_.add_row_to_stuff_list(a.first,a.first);
+ }
+
+- foreach( const config::any_child &c, vars.all_children_range()) {
++ wes_foreach( const config::any_child &c, vars.all_children_range()) {
+ model_.add_row_to_stuff_list("["+c.key+"]","["+c.key+"]");
+ }
+
+@@ -214,7 +214,7 @@
+ ? resources::state_of_game->get_variables()
+ : config();
+
+- foreach( const config::attribute &a, vars.attribute_range()) {
++ wes_foreach( const config::attribute &a, vars.attribute_range()) {
+ if (selected==i) {
+ model_.set_inspect_window_text(a.second);
+ return;
+@@ -222,7 +222,7 @@
+ i++;
+ }
+
+- foreach( const config::any_child &c, vars.all_children_range()) {
++ wes_foreach( const config::any_child &c, vars.all_children_range()) {
+ if (selected==i) {
+ model_.set_inspect_window_text(c.cfg.debug());
+ return;
+@@ -268,7 +268,7 @@
+ << '/' << i->max_experience() << " xp; "
+ << i->hitpoints() << '/' << i->max_hitpoints()
+ << " hp; ";
+- foreach (const std::string &str, i->get_traits_list()) {
++ wes_foreach (const std::string &str, i->get_traits_list()) {
+ s << str <<" ";
+ }
+
+@@ -371,9 +371,9 @@
+ : std::vector<unit>();
+
+ std::stringstream s;
+- foreach (const unit &u, recall_list) {
++ wes_foreach (const unit &u, recall_list) {
+ s << "id=["<<u.id() << "] "<<u.type_id() << "; L"<<u.level()<<"; " << u.experience() <<"/" << u.max_experience()<< " xp "<< std::endl;
+- foreach (const std::string &str, u.get_traits_list() ) {
++ wes_foreach (const std::string &str, u.get_traits_list() ) {
+ s << "\t" << str<< std::endl;
+ }
+ s << std::endl << std::endl;
+@@ -388,7 +388,7 @@
+ : std::vector<unit>();
+
+ config c;
+- foreach (const unit &u, recall_list) {
++ wes_foreach (const unit &u, recall_list) {
+ config c_unit;
+ u.write(c_unit);
+ c.add_child("unit",c_unit);
+@@ -423,7 +423,7 @@
+ << i->max_experience() << " xp; "
+ << i->hitpoints() << '/'
+ << i->max_hitpoints()<<" hp.\n";
+- foreach (const std::string &str, i->get_traits_list() ) {
++ wes_foreach (const std::string &str, i->get_traits_list() ) {
+ s << "\t" << str<< std::endl;
+ }
+ s << std::endl << std::endl;
+@@ -457,7 +457,7 @@
+ boost::shared_ptr<single_mode_controller>(new variable_mode_controller("variables",model_)));
+ sm_controllers_.push_back(
+ boost::shared_ptr<single_mode_controller>(new unit_mode_controller("units",model_)));
+- //foreach team
++ //wes_foreach team
+ int sides = resources::teams
+ ? static_cast<int>((*resources::teams).size())
+ : 0;
+@@ -481,7 +481,7 @@
+ void show_stuff_types_list()
+ {
+ model_.clear_stuff_types_list();
+- foreach (boost::shared_ptr<single_mode_controller> sm_controller, sm_controllers_ ) {
++ wes_foreach (boost::shared_ptr<single_mode_controller> sm_controller, sm_controllers_ ) {
+ model_.add_row_to_stuff_types_list(sm_controller->name(),sm_controller->name());
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/language_selection.cpp wesnoth-1.10.3/src/gui/dialogs/language_selection.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/language_selection.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/language_selection.cpp 2012-07-11 13:16:05.933266691 +0200
+@@ -65,7 +65,7 @@
+
+ const std::vector<language_def>& languages = get_languages();
+ const language_def& current_language = get_language();
+- foreach(const language_def& lang, languages) {
++ wes_foreach(const language_def& lang, languages) {
+ string_map item;
+ item.insert(std::make_pair("label", lang.language));
+
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/lobby/lobby_data.cpp wesnoth-1.10.3/src/gui/dialogs/lobby/lobby_data.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/lobby/lobby_data.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/lobby/lobby_data.cpp 2012-07-11 13:16:05.923266694 +0200
+@@ -89,7 +89,7 @@
+ void room_info::process_room_members(const config& data)
+ {
+ members_.clear();
+- foreach (const config& m, data.child_range("member")) {
++ wes_foreach (const config& m, data.child_range("member")) {
+ members_.insert(m["name"]);
+ }
+ }
+@@ -254,7 +254,7 @@
+ if (const config& hashes = game_config.child("multiplayer_hashes")) {
+ std::string hash = game["hash"];
+ bool hash_found = false;
+- foreach (const config::attribute &i, hashes.attribute_range()) {
++ wes_foreach (const config::attribute &i, hashes.attribute_range()) {
+ if (i.first == game["mp_scenario"] && i.second == hash) {
+ hash_found = true;
+ break;
+@@ -357,7 +357,7 @@
+
+ game_filter_stack::~game_filter_stack()
+ {
+- foreach (game_filter_base* f, filters_) {
++ wes_foreach (game_filter_base* f, filters_) {
+ delete f;
+ }
+ }
+@@ -369,7 +369,7 @@
+
+ void game_filter_stack::clear()
+ {
+- foreach (game_filter_base* f, filters_) {
++ wes_foreach (game_filter_base* f, filters_) {
+ delete f;
+ }
+ filters_.clear();
+@@ -377,7 +377,7 @@
+
+ bool game_filter_and_stack::match(const game_info &game) const
+ {
+- foreach (game_filter_base* f, filters_) {
++ wes_foreach (game_filter_base* f, filters_) {
+ if (!f->match(game)) return false;
+ }
+ return true;
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/lobby/lobby_info.cpp wesnoth-1.10.3/src/gui/dialogs/lobby/lobby_info.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/lobby/lobby_info.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/lobby/lobby_info.cpp 2012-07-11 13:16:05.923266694 +0200
+@@ -66,7 +66,7 @@
+
+ void lobby_info::delete_games()
+ {
+- foreach (const game_info_map::value_type& v, games_by_id_) {
++ wes_foreach (const game_info_map::value_type& v, games_by_id_) {
+ delete v.second;
+ }
+ }
+@@ -76,7 +76,7 @@
+ std::string dump_games_map(const lobby_info::game_info_map& games)
+ {
+ std::stringstream ss;
+- foreach (const lobby_info::game_info_map::value_type& v, games) {
++ wes_foreach (const lobby_info::game_info_map::value_type& v, games) {
+ const game_info& game = *v.second;
+ ss << "G" << game.id << "(" << game.name << ") " << game.display_status_string() << " ";
+ }
+@@ -87,7 +87,7 @@
+ std::string dump_games_config(const config& gamelist)
+ {
+ std::stringstream ss;
+- foreach (const config& c, gamelist.child_range("game")) {
++ wes_foreach (const config& c, gamelist.child_range("game")) {
+ ss << "g" << c["id"] << "(" << c["name"] << ") " << c[config::diff_track_attribute] << " ";
+ }
+ ss << "\n";
+@@ -103,7 +103,7 @@
+ gamelist_initialized_ = true;
+ delete_games();
+ games_by_id_.clear();
+- foreach (const config& c, gamelist_.child("gamelist").child_range("game")) {
++ wes_foreach (const config& c, gamelist_.child("gamelist").child_range("game")) {
+ game_info* game = new game_info(c, game_config_);
+ games_by_id_[game->id] = game;
+ }
+@@ -180,10 +180,10 @@
+ {
+ SCOPE_LB;
+ users_.clear();
+- foreach (const config& c, gamelist_.child_range("user")) {
++ wes_foreach (const config& c, gamelist_.child_range("user")) {
+ users_.push_back(user_info(c));
+ }
+- foreach (user_info& ui, users_) {
++ wes_foreach (user_info& ui, users_) {
+ if (ui.game_id != 0) {
+ game_info* g = get_game_by_id(ui.game_id);
+ if (g == NULL) {
+@@ -235,7 +235,7 @@
+
+ room_info* lobby_info::get_room(const std::string &name)
+ {
+- foreach (room_info& r, rooms_) {
++ wes_foreach (room_info& r, rooms_) {
+ if (r.name() == name) return &r;
+ }
+ return NULL;
+@@ -243,7 +243,7 @@
+
+ const room_info* lobby_info::get_room(const std::string &name) const
+ {
+- foreach (const room_info& r, rooms_) {
++ wes_foreach (const room_info& r, rooms_) {
+ if (r.name() == name) return &r;
+ }
+ return NULL;
+@@ -301,7 +301,7 @@
+ games_filtered_.clear();
+ games_visibility_.clear();
+ games_.clear();
+- foreach (const game_info_map::value_type& v, games_by_id_) {
++ wes_foreach (const game_info_map::value_type& v, games_by_id_) {
+ games_.push_back(v.second);
+ }
+ }
+@@ -310,7 +310,7 @@
+ {
+ games_filtered_.clear();
+ games_visibility_.clear();
+- foreach (game_info* g, games_) {
++ wes_foreach (game_info* g, games_) {
+ game_info& gi = *g;
+ bool show = game_filter_.match(gi);
+ if (game_filter_invert_) {
+@@ -325,7 +325,7 @@
+
+ void lobby_info::update_user_statuses(int game_id, const room_info *room)
+ {
+- foreach (user_info& user, users_) {
++ wes_foreach (user_info& user, users_) {
+ user.update_state(game_id, room);
+ }
+ }
+@@ -365,7 +365,7 @@
+ void lobby_info::sort_users(bool by_name, bool by_relation)
+ {
+ users_sorted_.clear();
+- foreach (user_info& u, users_) {
++ wes_foreach (user_info& u, users_) {
+ users_sorted_.push_back(&u);
+ }
+ if (by_name) {
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/lobby_main.cpp wesnoth-1.10.3/src/gui/dialogs/lobby_main.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/lobby_main.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/lobby_main.cpp 2012-07-11 13:16:05.929933358 +0200
+@@ -499,14 +499,14 @@
+ void modify_grid_with_data(tgrid* grid, const std::map<std::string, string_map>& map)
+ {
+ typedef std::map<std::string, string_map> strstrmap;
+- foreach (const strstrmap::value_type v, map) {
++ wes_foreach (const strstrmap::value_type v, map) {
+ const std::string& key = v.first;
+ const string_map& strmap = v.second;
+ twidget* w = grid->find(key, false);
+ if (w == NULL) continue;
+ tcontrol* c = dynamic_cast<tcontrol*>(w);
+ if (c == NULL) continue;
+- foreach (const string_map::value_type& vv, strmap) {
++ wes_foreach (const string_map::value_type& vv, strmap) {
+ if (vv.first == "label") {
+ c->set_label(vv.second);
+ } else if (vv.first == "tooltip") {
+@@ -816,7 +816,7 @@
+ player_list_.other_games.tree->clear();
+ player_list_.other_rooms.tree->clear();
+
+- foreach (user_info* userptr, lobby_info_.users_sorted())
++ wes_foreach (user_info* userptr, lobby_info_.users_sorted())
+ {
+ user_info& user = *userptr;
+ tsub_player_list* target_list(NULL);
+@@ -1093,7 +1093,7 @@
+
+ tlobby_chat_window* tlobby_main::search_create_window(const std::string& name, bool whisper, bool open_new)
+ {
+- foreach (tlobby_chat_window& t, open_windows_) {
++ wes_foreach (tlobby_chat_window& t, open_windows_) {
+ if (t.name == name && t.whisper == whisper) return &t;
+ }
+ if (open_new) {
+@@ -1477,7 +1477,7 @@
+ //TODO: this should really open a nice join room dialog instead
+ std::stringstream ss;
+ ss << "Rooms:";
+- foreach (const config& r, rooms.child_range("room")) {
++ wes_foreach (const config& r, rooms.child_range("room")) {
+ ss << " " << r["name"];
+ }
+ add_active_window_message("server", ss.str());
+@@ -1667,7 +1667,7 @@
+ const std::vector<user_info>& match_infos = lobby_info_.users();
+ std::vector<std::string> matches;
+
+- foreach(const user_info& ui, match_infos) {
++ wes_foreach(const user_info& ui, match_infos) {
+ if(ui.name != preferences::login()) {
+ matches.push_back(ui.name);
+ }
+@@ -1694,7 +1694,7 @@
+ {
+ lobby_info_.clear_game_filter();
+
+- foreach (const std::string& s, utils::split(filter_text_->get_value(), ' ')) {
++ wes_foreach (const std::string& s, utils::split(filter_text_->get_value(), ' ')) {
+ lobby_info_.add_game_filter(new game_filter_general_string_part(s));
+ }
+ //TODO: make changing friend/ignore lists trigger a refresh
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/message.cpp wesnoth-1.10.3/src/gui/dialogs/message.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/message.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/message.cpp 2012-07-11 13:16:05.926600026 +0200
+@@ -97,7 +97,7 @@
+
+ void tmessage::post_show(twindow& /*window*/)
+ {
+- foreach(tbutton_status& button_status, buttons_) {
++ wes_foreach(tbutton_status& button_status, buttons_) {
+ button_status.button = NULL;
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/mp_change_control.cpp wesnoth-1.10.3/src/gui/dialogs/mp_change_control.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/mp_change_control.cpp 2011-05-19 20:16:27.000000000 +0200
++++ wesnoth-1.10.3/src/gui/dialogs/mp_change_control.cpp 2012-07-11 13:16:05.926600026 +0200
+@@ -184,7 +184,7 @@
+
+ int i = 0; // because we need to know which row contains the controlling player
+
+- foreach (const std::string &nick, nicks)
++ wes_foreach (const std::string &nick, nicks)
+ {
+ if (side_number_ <= static_cast<int>(resources::teams->size()) &&
+ resources::teams->at(side_number_-1).current_player() == nick)
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/mp_connect.cpp wesnoth-1.10.3/src/gui/dialogs/mp_connect.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/mp_connect.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/mp_connect.cpp 2012-07-11 13:16:05.926600026 +0200
+@@ -90,7 +90,7 @@
+ const std::vector<game_config::server_info>&
+ pref_servers = preferences::server_list();
+
+- foreach(const game_config::server_info& server, pref_servers) {
++ wes_foreach(const game_config::server_info& server, pref_servers) {
+
+ std::map<std::string, string_map> data;
+ string_map item;
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/mp_create_game.cpp wesnoth-1.10.3/src/gui/dialogs/mp_create_game.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/mp_create_game.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/mp_create_game.cpp 2012-07-11 13:16:05.926600026 +0200
+@@ -101,7 +101,7 @@
+ std::vector<std::string> maps;
+ get_files_in_dir(get_user_data_dir() + "/editor/maps", &maps, NULL, FILE_NAME_ONLY);
+
+- foreach(const std::string& map, maps) {
++ wes_foreach(const std::string& map, maps) {
+ std::map<std::string, t_string> item;
+ item.insert(std::make_pair("label", map));
+ list->add_row(item);
+@@ -110,7 +110,7 @@
+
+ // Standard maps
+ int i = 0;
+- foreach (const config &map, cfg_.child_range("multiplayer"))
++ wes_foreach (const config &map, cfg_.child_range("multiplayer"))
+ {
+ if (map["allow_new_game"].to_bool(true)) {
+ string_map item;
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/simple_item_selector.cpp wesnoth-1.10.3/src/gui/dialogs/simple_item_selector.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/simple_item_selector.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/simple_item_selector.cpp 2012-07-11 13:16:05.929933358 +0200
+@@ -79,7 +79,7 @@
+ tlistbox& list = find_widget<tlistbox>(&window, "listbox", false);
+ window.keyboard_capture(&list);
+
+- foreach(const tsimple_item_selector::item_type& it, items_) {
++ wes_foreach(const tsimple_item_selector::item_type& it, items_) {
+ std::map<std::string, string_map> data;
+ string_map column;
+
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/title_screen.cpp wesnoth-1.10.3/src/gui/dialogs/title_screen.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/title_screen.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/title_screen.cpp 2012-07-11 13:16:05.929933358 +0200
+@@ -306,7 +306,7 @@
+ WRN_CF << "There are not tips of day available.\n";
+ }
+
+- foreach(const ttip& tip, tips) {
++ wes_foreach(const ttip& tip, tips) {
+
+ string_map widget;
+ std::map<std::string, string_map> page;
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/unit_attack.cpp wesnoth-1.10.3/src/gui/dialogs/unit_attack.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/unit_attack.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/unit_attack.cpp 2012-07-11 13:16:05.926600026 +0200
+@@ -106,7 +106,7 @@
+ const config empty;
+ attack_type no_weapon(empty);
+
+- foreach(const battle_context& weapon, weapons) {
++ wes_foreach(const battle_context& weapon, weapons) {
+ const battle_context_unit_stats& attacker =
+ weapon.get_attacker_stats();
+
+diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/unit_create.cpp wesnoth-1.10.3/src/gui/dialogs/unit_create.cpp
+--- wesnoth-1.10.3.orig/src/gui/dialogs/unit_create.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/dialogs/unit_create.cpp 2012-07-11 13:16:05.929933358 +0200
+@@ -109,7 +109,7 @@
+
+ std::vector< std::string > type_labels, race_labels;
+
+- foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
++ wes_foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
+ {
+ unit_types.find(i.first, unit_type::HELP_INDEX);
+
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/control.cpp wesnoth-1.10.3/src/gui/widgets/control.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/control.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/control.cpp 2012-07-11 13:16:05.943266694 +0200
+@@ -211,7 +211,7 @@
+ void tcontrol::place(const tpoint& origin, const tpoint& size)
+ {
+ // resize canvasses
+- foreach(tcanvas& canvas, canvas_) {
++ wes_foreach(tcanvas& canvas, canvas_) {
+ canvas.set_width(size.x);
+ canvas.set_height(size.y);
+ }
+@@ -297,7 +297,7 @@
+ const int max_height = get_text_maximum_height();
+
+ // set label in canvases
+- foreach(tcanvas& canvas, canvas_) {
++ wes_foreach(tcanvas& canvas, canvas_) {
+ canvas.set_variable("text", variant(label_));
+ canvas.set_variable("text_markup", variant(use_markup_));
+ canvas.set_variable("text_alignment"
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/debug.cpp wesnoth-1.10.3/src/gui/widgets/debug.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/debug.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/debug.cpp 2012-07-11 13:16:05.943266694 +0200
+@@ -122,7 +122,7 @@
+
+ std::vector<std::string> params = utils::split(level);
+
+- foreach(const std::string& param, params) {
++ wes_foreach(const std::string& param, params) {
+ if(param == "all") {
+ level_ = ALL;
+ // No need to look further eventhought invalid items are now
+@@ -149,7 +149,7 @@
+
+ std::vector<std::string> params = utils::split(domain);
+
+- foreach(const std::string& param, params) {
++ wes_foreach(const std::string& param, params) {
+ if(param == "all") {
+ domain_ = ALL;
+ // No need to look further eventhought invalid items are now
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/generator.cpp wesnoth-1.10.3/src/gui/widgets/generator.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/generator.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/generator.cpp 2012-07-11 13:16:05.943266694 +0200
+@@ -678,7 +678,7 @@
+ assert(!callback);
+
+ typedef std::pair<std::string, string_map> hack;
+- foreach(const hack& item, data) {
++ wes_foreach(const hack& item, data) {
+ if(item.first.empty()) {
+ for(unsigned row = 0; row < grid->get_rows(); ++row) {
+ for(unsigned col = 0; col < grid->get_cols(); ++col) {
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/generator_private.hpp wesnoth-1.10.3/src/gui/widgets/generator_private.hpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/generator_private.hpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/generator_private.hpp 2012-07-11 13:16:05.939933360 +0200
+@@ -584,7 +584,7 @@
+ /** Inherited from tgenerator_. */
+ void clear()
+ {
+- foreach(titem* item, items_) {
++ wes_foreach(titem* item, items_) {
+ delete item;
+ }
+ selected_item_count_ = 0;
+@@ -750,7 +750,7 @@
+ /** Inherited from tgenerator_. */
+ void layout_init(const bool full_initialization)
+ {
+- foreach(titem* item, items_) {
++ wes_foreach(titem* item, items_) {
+ if(item->grid.get_visible() != twidget::INVISIBLE && item->shown) {
+ item->grid.layout_init(full_initialization);
+ }
+@@ -804,7 +804,7 @@
+ {
+ assert(this->get_visible() == twidget::VISIBLE);
+
+- foreach(titem* item, items_) {
++ wes_foreach(titem* item, items_) {
+ if(item->grid.get_visible() == twidget::VISIBLE && item->shown) {
+ item->grid.draw_children(frame_buffer);
+ }
+@@ -815,7 +815,7 @@
+ void child_populate_dirty_list(twindow& caller,
+ const std::vector<twidget*>& call_stack)
+ {
+- foreach(titem* item, items_) {
++ wes_foreach(titem* item, items_) {
+ std::vector<twidget*> child_call_stack = call_stack;
+ item->grid.populate_dirty_list(caller, child_call_stack);
+ }
+@@ -838,7 +838,7 @@
+ /** Inherited from widget. */
+ bool disable_click_dismiss() const
+ {
+- foreach(titem* item, items_) {
++ wes_foreach(titem* item, items_) {
+ if(item->grid.disable_click_dismiss()) {
+ return true;
+ }
+@@ -974,7 +974,7 @@
+ void (*callback)(twidget*))
+ {
+ int i = index;
+- foreach(const T& item_data, data) {
++ wes_foreach(const T& item_data, data) {
+ create_item(i, list_builder, item_data, callback);
+ if(i != -1) {
+ ++i;
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/grid.cpp wesnoth-1.10.3/src/gui/widgets/grid.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/grid.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/grid.cpp 2012-07-11 13:16:05.939933360 +0200
+@@ -48,7 +48,7 @@
+ {
+ // Delete the children in this destructor since resizing a vector copies the
+ // children and thus frees the child prematurely.
+- foreach(tchild& child, children_) {
++ wes_foreach(tchild& child, children_) {
+ delete child.widget();
+ }
+ }
+@@ -99,7 +99,7 @@
+ {
+ assert(widget);
+
+- foreach(tchild& child, children_) {
++ wes_foreach(tchild& child, children_) {
+ if(child.id() != id) {
+
+ if(recurse) {
+@@ -145,7 +145,7 @@
+
+ void tgrid::remove_child(const std::string& id, const bool find_all)
+ {
+- foreach(tchild& child, children_) {
++ wes_foreach(tchild& child, children_) {
+
+ if(child.id() == id) {
+ delete child.widget();
+@@ -160,7 +160,7 @@
+
+ void tgrid::set_active(const bool active)
+ {
+- foreach(tchild& child, children_) {
++ wes_foreach(tchild& child, children_) {
+
+ twidget* widget = child.widget();
+ if(!widget) {
+@@ -186,7 +186,7 @@
+ twidget::layout_init(full_initialization);
+
+ // Clear child caches.
+- foreach(tchild& child, children_) {
++ wes_foreach(tchild& child, children_) {
+
+ child.layout_init(full_initialization);
+
+@@ -426,7 +426,7 @@
+
+ bool tgrid::can_wrap() const
+ {
+- foreach(const tchild& child, children_) {
++ wes_foreach(const tchild& child, children_) {
+ if(child.can_wrap()) {
+ return true;
+ }
+@@ -485,7 +485,7 @@
+
+ if(w_size == 0) {
+ // If all sizes are 0 reset them to 1
+- foreach(unsigned& val, col_grow_factor_) {
++ wes_foreach(unsigned& val, col_grow_factor_) {
+ val = 1;
+ }
+ w_size = cols_;
+@@ -516,7 +516,7 @@
+
+ if(h_size == 0) {
+ // If all sizes are 0 reset them to 1
+- foreach(unsigned& val, row_grow_factor_) {
++ wes_foreach(unsigned& val, row_grow_factor_) {
+ val = 1;
+ }
+ h_size = rows_;
+@@ -551,7 +551,7 @@
+ // Inherited.
+ twidget::set_origin(origin);
+
+- foreach(tchild& child, children_) {
++ wes_foreach(tchild& child, children_) {
+
+ twidget* widget = child.widget();
+ assert(widget);
+@@ -567,7 +567,7 @@
+ // Inherited.
+ twidget::set_visible_area(area);
+
+- foreach(tchild& child, children_) {
++ wes_foreach(tchild& child, children_) {
+
+ twidget* widget = child.widget();
+ assert(widget);
+@@ -578,7 +578,7 @@
+
+ void tgrid::layout_children()
+ {
+- foreach(tchild& child, children_) {
++ wes_foreach(tchild& child, children_) {
+ assert(child.widget());
+ child.widget()->layout_children();
+ }
+@@ -589,7 +589,7 @@
+ {
+ assert(!call_stack.empty() && call_stack.back() == this);
+
+- foreach(tchild& child, children_) {
++ wes_foreach(tchild& child, children_) {
+
+ assert(child.widget());
+
+@@ -627,7 +627,7 @@
+
+ bool tgrid::has_widget(const twidget* widget) const
+ {
+- foreach(const tchild& child, children_) {
++ wes_foreach(const tchild& child, children_) {
+ if(child.widget() == widget) {
+ return true;
+ }
+@@ -641,7 +641,7 @@
+ return false;
+ }
+
+- foreach(const tchild& child, children_) {
++ wes_foreach(const tchild& child, children_) {
+ const twidget* widget = child.widget();
+ assert(widget);
+
+@@ -936,7 +936,7 @@
+ assert(get_visible() == twidget::VISIBLE);
+ set_dirty(false);
+
+- foreach(tchild& child, children_) {
++ wes_foreach(tchild& child, children_) {
+
+ twidget* widget = child.widget();
+ assert(widget);
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/grid_private.hpp wesnoth-1.10.3/src/gui/widgets/grid_private.hpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/grid_private.hpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/grid_private.hpp 2012-07-11 13:16:05.939933360 +0200
+@@ -56,7 +56,7 @@
+ const tpoint& coordinate, const bool must_be_active)
+ {
+ typedef typename tconst_duplicator<W, tgrid::tchild>::type hack;
+- foreach(hack& child, grid.children_) {
++ wes_foreach(hack& child, grid.children_) {
+
+ W* widget = child.widget();
+ if(!widget) {
+@@ -91,7 +91,7 @@
+ }
+
+ typedef typename tconst_duplicator<W, tgrid::tchild>::type hack;
+- foreach(hack& child, grid.children_) {
++ wes_foreach(hack& child, grid.children_) {
+
+ widget = child.widget();
+ if(!widget) {
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/list.cpp wesnoth-1.10.3/src/gui/widgets/list.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/list.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/list.cpp 2012-07-11 13:16:05.939933360 +0200
+@@ -137,7 +137,7 @@
+
+ void tlist::append_rows(const std::vector<string_map>& items)
+ {
+- foreach(const string_map& item, items) {
++ wes_foreach(const string_map& item, items) {
+ add_row(item);
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/progress_bar.cpp wesnoth-1.10.3/src/gui/widgets/progress_bar.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/progress_bar.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/progress_bar.cpp 2012-07-11 13:16:05.943266694 +0200
+@@ -38,7 +38,7 @@
+ if(percentage_ != percentage) {
+ percentage_ = percentage;
+
+- foreach(tcanvas& c, canvas()) {
++ wes_foreach(tcanvas& c, canvas()) {
+ c.set_variable("percentage", variant(percentage));
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/scrollbar_container.cpp wesnoth-1.10.3/src/gui/widgets/scrollbar_container.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/scrollbar_container.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/scrollbar_container.cpp 2012-07-11 13:16:05.946600027 +0200
+@@ -692,7 +692,7 @@
+
+ /***** Setup the scrollbar buttons *****/
+ typedef std::pair<std::string, tscrollbar_::tscroll> hack;
+- foreach(const hack& item, scroll_lookup()) {
++ wes_foreach(const hack& item, scroll_lookup()) {
+
+ // Vertical.
+ tclickable_* button = find_widget<tclickable_>(
+@@ -838,7 +838,7 @@
+ {
+ if(true) { /** @todo scrollbar visibility. */
+ /***** set scroll up button status *****/
+- foreach(const std::string& name, button_up_names) {
++ wes_foreach(const std::string& name, button_up_names) {
+ tcontrol* button = find_widget<tcontrol>(
+ vertical_scrollbar_grid_, name, false, false);
+
+@@ -848,7 +848,7 @@
+ }
+
+ /***** set scroll down status *****/
+- foreach(const std::string& name, button_down_names) {
++ wes_foreach(const std::string& name, button_down_names) {
+ tcontrol* button = find_widget<tcontrol>(
+ vertical_scrollbar_grid_, name, false, false);
+
+@@ -864,7 +864,7 @@
+
+ if(true) { /** @todo scrollbar visibility. */
+ /***** Set scroll left button status *****/
+- foreach(const std::string& name, button_up_names) {
++ wes_foreach(const std::string& name, button_up_names) {
+ tcontrol* button = find_widget<tcontrol>(
+ horizontal_scrollbar_grid_, name, false, false);
+
+@@ -874,7 +874,7 @@
+ }
+
+ /***** Set scroll right button status *****/
+- foreach(const std::string& name, button_down_names) {
++ wes_foreach(const std::string& name, button_down_names) {
+ tcontrol* button = find_widget<tcontrol>(
+ horizontal_scrollbar_grid_, name, false, false);
+
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/scrollbar.cpp wesnoth-1.10.3/src/gui/widgets/scrollbar.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/scrollbar.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/scrollbar.cpp 2012-07-11 13:16:05.946600027 +0200
+@@ -132,7 +132,7 @@
+
+ void tscrollbar_::update_canvas() {
+
+- foreach(tcanvas& tmp, canvas()) {
++ wes_foreach(tcanvas& tmp, canvas()) {
+ tmp.set_variable("positioner_offset", variant(positioner_offset_));
+ tmp.set_variable("positioner_length", variant(positioner_length_));
+ }
+@@ -287,7 +287,7 @@
+ void tscrollbar_::load_config_extra()
+ {
+ // These values won't change so set them here.
+- foreach(tcanvas& tmp, canvas()) {
++ wes_foreach(tcanvas& tmp, canvas()) {
+ tmp.set_variable("offset_before", variant(offset_before()));
+ tmp.set_variable("offset_after", variant(offset_after()));
+ }
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/settings.cpp wesnoth-1.10.3/src/gui/widgets/settings.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/settings.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/settings.cpp 2012-07-11 13:16:05.946600027 +0200
+@@ -283,12 +283,12 @@
+ , const config&
+ , const char *key)> > thack;
+
+- foreach(thack& widget_type, registred_widget_type()) {
++ wes_foreach(thack& widget_type, registred_widget_type()) {
+ widget_type.second(*this, widget_type.first, cfg, NULL);
+ }
+
+ /***** Window types *****/
+- foreach (const config &w, cfg.child_range("window")) {
++ wes_foreach (const config &w, cfg.child_range("window")) {
+ std::pair<std::string, twindow_builder> child;
+ child.first = child.second.read(w);
+ window_types.insert(child);
+@@ -423,7 +423,7 @@
+ const std::string& definition_type
+ , const std::vector<tcontrol_definition_ptr>& definitions)
+ {
+- foreach(const tcontrol_definition_ptr& def, definitions) {
++ wes_foreach(const tcontrol_definition_ptr& def, definitions) {
+
+ // We assume all definitions are unique if not we would leak memory.
+ assert(control_definition[definition_type].find(def->id)
+@@ -497,7 +497,7 @@
+ ERR_GUI_P << e.message;
+ }
+ // Parse guis
+- foreach (const config &g, cfg.child_range("gui")) {
++ wes_foreach (const config &g, cfg.child_range("gui")) {
+ std::pair<std::string, tgui_definition> child;
+ child.first = child.second.read(g);
+ guis.insert(child);
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/settings.hpp wesnoth-1.10.3/src/gui/widgets/settings.hpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/settings.hpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/settings.hpp 2012-07-11 13:16:05.946600027 +0200
+@@ -124,7 +124,7 @@
+ {
+ std::vector<tcontrol_definition_ptr> definitions;
+
+- foreach(const config& definition
++ wes_foreach(const config& definition
+ , cfg.child_range(key ? key : definition_type + "_definition")) {
+
+ definitions.push_back(new T(definition));
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/slider.cpp wesnoth-1.10.3/src/gui/widgets/slider.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/slider.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/slider.cpp 2012-07-11 13:16:05.943266694 +0200
+@@ -232,7 +232,7 @@
+ // Inherited.
+ tscrollbar_::update_canvas();
+
+- foreach(tcanvas& tmp, canvas()) {
++ wes_foreach(tcanvas& tmp, canvas()) {
+ tmp.set_variable("text", variant(get_value_label()));
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/stacked_widget.cpp wesnoth-1.10.3/src/gui/widgets/stacked_widget.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/stacked_widget.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/stacked_widget.cpp 2012-07-11 13:16:05.939933360 +0200
+@@ -83,7 +83,7 @@
+ {
+ assert(generator_);
+ string_map empty_data;
+- foreach(const tbuilder_grid_const_ptr& builder, widget_builder) {
++ wes_foreach(const tbuilder_grid_const_ptr& builder, widget_builder) {
+ generator_->create_item(-1, builder, empty_data, NULL);
+ }
+ swap_grid(NULL, &grid(), generator_, "_content_grid");
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/text_box.cpp wesnoth-1.10.3/src/gui/widgets/text_box.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/text_box.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/text_box.cpp 2012-07-11 13:16:05.939933360 +0200
+@@ -162,7 +162,7 @@
+ const int max_width = get_text_maximum_width();
+ const int max_height = get_text_maximum_height();
+
+- foreach(tcanvas& tmp, canvas()) {
++ wes_foreach(tcanvas& tmp, canvas()) {
+
+ tmp.set_variable("text", variant(get_value()));
+ tmp.set_variable("text_x_offset", variant(text_x_offset_));
+@@ -260,7 +260,7 @@
+
+ // Since this variable doesn't change set it here instead of in
+ // update_canvas().
+- foreach(tcanvas& tmp, canvas()) {
++ wes_foreach(tcanvas& tmp, canvas()) {
+ tmp.set_variable("text_font_height", variant(text_height_));
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/toggle_button.cpp wesnoth-1.10.3/src/gui/widgets/toggle_button.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/toggle_button.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/toggle_button.cpp 2012-07-11 13:16:05.939933360 +0200
+@@ -89,7 +89,7 @@
+
+ // set icon in canvases
+ std::vector<tcanvas>& canvases = tcontrol::canvas();
+- foreach(tcanvas& canvas, canvases) {
++ wes_foreach(tcanvas& canvas, canvases) {
+ canvas.set_variable("icon", variant(icon_name_));
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/toggle_panel.cpp wesnoth-1.10.3/src/gui/widgets/toggle_panel.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/toggle_panel.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/toggle_panel.cpp 2012-07-11 13:16:05.943266694 +0200
+@@ -72,7 +72,7 @@
+ {
+ // typedef boost problem work around.
+ typedef std::pair<std::string, string_map> hack ;
+- foreach(const hack& item, data) {
++ wes_foreach(const hack& item, data) {
+ tcontrol* control = dynamic_cast<tcontrol*>(find(item.first, false));
+ if(control) {
+ control->set_members(item.second);
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/tree_view_node.cpp wesnoth-1.10.3/src/gui/widgets/tree_view_node.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/tree_view_node.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/tree_view_node.cpp 2012-07-11 13:16:05.946600027 +0200
+@@ -48,7 +48,7 @@
+ grid_.set_parent(this);
+ set_parent(&parent_tree_view);
+ if(id != "root") {
+- foreach(const tnode_definition& node_definition, node_definitions_) {
++ wes_foreach(const tnode_definition& node_definition, node_definitions_) {
+ if(node_definition.id == id) {
+ node_definition.builder->build(&grid_);
+ init_grid(&grid_, data);
+@@ -217,7 +217,7 @@
+ int height_reduction = 0;
+
+ if(!is_folded()) {
+- foreach(const ttree_view_node& node, children_) {
++ wes_foreach(const ttree_view_node& node, children_) {
+ height_reduction += node.get_current_size().y;
+ }
+ }
+@@ -301,7 +301,7 @@
+ return;
+ }
+
+- foreach(ttree_view_node& node, children_) {
++ wes_foreach(ttree_view_node& node, children_) {
+ std::vector<twidget*> child_call_stack = call_stack;
+ node.impl_populate_dirty_list(caller, child_call_stack);
+ }
+@@ -456,7 +456,7 @@
+ }
+
+ DBG_GUI_L << LOG_HEADER << " set children.\n";
+- foreach(ttree_view_node& node, children_) {
++ wes_foreach(ttree_view_node& node, children_) {
+ origin.y += node.place(indention_step_size, origin, width);
+ }
+
+@@ -478,7 +478,7 @@
+ return;
+ }
+
+- foreach(ttree_view_node& node, children_) {
++ wes_foreach(ttree_view_node& node, children_) {
+ node.set_visible_area(area);
+ }
+ }
+@@ -491,7 +491,7 @@
+ return;
+ }
+
+- foreach(ttree_view_node& node, children_) {
++ wes_foreach(ttree_view_node& node, children_) {
+ node.impl_draw_children(frame_buffer);
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/gui/widgets/window.cpp wesnoth-1.10.3/src/gui/widgets/window.cpp
+--- wesnoth-1.10.3.orig/src/gui/widgets/window.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/gui/widgets/window.cpp 2012-07-11 13:16:05.949933359 +0200
+@@ -716,7 +716,7 @@
+ return;
+ }
+
+- foreach(std::vector<twidget*>& item, dirty_list_) {
++ wes_foreach(std::vector<twidget*>& item, dirty_list_) {
+
+ assert(!item.empty());
+
+@@ -1047,12 +1047,12 @@
+ {
+ // evaluate the group sizes
+ typedef std::pair<const std::string, tlinked_size> hack;
+- foreach(hack& linked_size, linked_size_) {
++ wes_foreach(hack& linked_size, linked_size_) {
+
+ tpoint max_size(0, 0);
+
+ // Determine the maximum size.
+- foreach(twidget* widget, linked_size.second.widgets) {
++ wes_foreach(twidget* widget, linked_size.second.widgets) {
+
+ const tpoint size = widget->get_best_size();
+
+@@ -1065,7 +1065,7 @@
+ }
+
+ // Set the maximum size.
+- foreach(twidget* widget, linked_size.second.widgets) {
++ wes_foreach(twidget* widget, linked_size.second.widgets) {
+
+ tpoint size = widget->get_best_size();
+
+diff -ur wesnoth-1.10.3.orig/src/help.cpp wesnoth-1.10.3/src/help.cpp
+--- wesnoth-1.10.3.orig/src/help.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/help.cpp 2012-07-11 13:16:06.236600016 +0200
+@@ -793,7 +793,7 @@
+ // opening the help browser in the default manner.
+ config hidden_toplevel;
+ std::stringstream ss;
+- foreach (const config §ion, help_config->child_range("section"))
++ wes_foreach (const config §ion, help_config->child_range("section"))
+ {
+ const std::string id = section["id"];
+ if (find_section(toplevel, id) == NULL) {
+@@ -810,7 +810,7 @@
+ }
+ hidden_toplevel["sections"] = ss.str();
+ ss.str("");
+- foreach (const config &topic, help_config->child_range("topic"))
++ wes_foreach (const config &topic, help_config->child_range("topic"))
+ {
+ const std::string id = topic["id"];
+ if (find_topic(toplevel, id) == NULL) {
+@@ -861,7 +861,7 @@
+ }
+ }
+
+- foreach (const config §ion, cfg.child_range("section"))
++ wes_foreach (const config §ion, cfg.child_range("section"))
+ {
+ const std::vector<std::string> sections_refd
+ = utils::quoted_split(section["sections"]);
+@@ -885,7 +885,7 @@
+ }
+ }
+
+- foreach (const config §ion, cfg.child_range("section"))
++ wes_foreach (const config §ion, cfg.child_range("section"))
+ {
+ const std::vector<std::string> topics_refd
+ = utils::quoted_split(section["topics"]);
+@@ -1103,7 +1103,7 @@
+ std::map<t_string, std::string> special_description;
+ std::map<t_string, std::set<std::string, string_less> > special_units;
+
+- foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
++ wes_foreach (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
+@@ -1171,7 +1171,7 @@
+ // 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.
+- foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
++ wes_foreach (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) {
+@@ -1244,7 +1244,7 @@
+ const config& era = game_cfg->child("era");
+ if (era) {
+ std::vector<std::string> faction_links;
+- foreach (const config &f, era.child_range("multiplayer_side")) {
++ wes_foreach (const config &f, era.child_range("multiplayer_side")) {
+ const std::string& id = f["id"];
+ if (id == "Random")
+ continue;
+@@ -1260,7 +1260,7 @@
+ text << "<header>text='" << _("Leaders:") << "'</header>" << "\n";
+ const std::vector<std::string> leaders =
+ make_unit_links_list( utils::split(f["leader"]), true );
+- foreach (const std::string &link, leaders) {
++ wes_foreach (const std::string &link, leaders) {
+ text << link << "\n";
+ }
+
+@@ -1269,7 +1269,7 @@
+ text << "<header>text='" << _("Recruits:") << "'</header>" << "\n";
+ const std::vector<std::string> recruits =
+ make_unit_links_list( utils::split(f["recruit"]), true );
+- foreach (const std::string &link, recruits) {
++ wes_foreach (const std::string &link, recruits) {
+ text << link << "\n";
+ }
+
+@@ -1291,7 +1291,7 @@
+ text << "<header>text='" << _("Factions:") << "'</header>" << "\n";
+
+ std::sort(faction_links.begin(), faction_links.end());
+- foreach (const std::string &link, faction_links) {
++ wes_foreach (const std::string &link, faction_links) {
+ text << link << "\n";
+ }
+
+@@ -1366,7 +1366,7 @@
+ reverse ? type_.advances_from() : type_.advances_to();
+ bool first = true;
+
+- foreach (const std::string &adv, adv_units)
++ wes_foreach (const std::string &adv, adv_units)
+ {
+ const unit_type *type = unit_types.find(adv);
+ if (!type || type->hide_help()) continue;
+@@ -1676,7 +1676,7 @@
+ std::vector<std::string> make_unit_links_list(const std::vector<std::string>& type_id_list, bool ordered)
+ {
+ std::vector<std::string> links_list;
+- foreach (const std::string &type_id, type_id_list) {
++ wes_foreach (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);
+@@ -1693,7 +1693,7 @@
+ std::set<std::string, string_less> races;
+ std::set<std::string, string_less> visible_races;
+
+- foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
++ wes_foreach (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);
+@@ -1736,7 +1736,7 @@
+ std::set<std::string, string_less> race_units;
+ std::set<std::string, string_less> race_topics;
+
+- foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
++ wes_foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
+ {
+ const unit_type &type = i.second;
+
+@@ -1768,7 +1768,7 @@
+ race_name = r->plural_name();
+ race_description = r->description();
+ // if (description.empty()) description = _("No description Available");
+- foreach (const config &additional_topic, r->additional_topics())
++ wes_foreach (const config &additional_topic, r->additional_topics())
+ {
+ std::string id = additional_topic["id"];
+ std::string title = additional_topic["title"];
+diff -ur wesnoth-1.10.3.orig/src/hotkeys.cpp wesnoth-1.10.3/src/hotkeys.cpp
+--- wesnoth-1.10.3.orig/src/hotkeys.cpp 2012-03-31 20:47:10.000000000 +0200
++++ wesnoth-1.10.3/src/hotkeys.cpp 2012-07-11 13:16:06.003266691 +0200
+@@ -609,7 +609,7 @@
+
+ void load_hotkeys(const config& cfg)
+ {
+- foreach (const config &hk, cfg.child_range(hotkey_tag_name))
++ wes_foreach (const config &hk, cfg.child_range(hotkey_tag_name))
+ {
+ hotkey_item& h = get_hotkey(hk["command"]);
+ if(h.get_id() != HOTKEY_NULL) {
+diff -ur wesnoth-1.10.3.orig/src/image.cpp wesnoth-1.10.3/src/image.cpp
+--- wesnoth-1.10.3.orig/src/image.cpp 2012-01-21 20:23:47.000000000 +0100
++++ wesnoth-1.10.3/src/image.cpp 2012-07-11 13:16:06.006600025 +0200
+@@ -376,7 +376,7 @@
+ std::string trackpath = get_binary_file_location("", "l10n-track");
+ std::string contents = read_file(trackpath);
+ std::vector<std::string> lines = utils::split(contents, '\n');
+- foreach (const std::string &line, lines) {
++ wes_foreach (const std::string &line, lines) {
+ size_t p1 = line.find(fsep);
+ if (p1 == std::string::npos)
+ continue;
+@@ -423,7 +423,7 @@
+ // add en_US with lowest priority, since the message above will
+ // not have it when translated.
+ langs.push_back("en_US");
+- foreach (const std::string &lang, langs) {
++ wes_foreach (const std::string &lang, langs) {
+ std::string loc_file = dir + "l10n" + "/" + lang + "/" + loc_base;
+ if (file_exists(loc_file) && localized_file_uptodate(loc_file)) {
+ return loc_file;
+diff -ur wesnoth-1.10.3.orig/src/image_modifications.cpp wesnoth-1.10.3/src/image_modifications.cpp
+--- wesnoth-1.10.3.orig/src/image_modifications.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/image_modifications.cpp 2012-07-11 13:16:05.979933358 +0200
+@@ -99,7 +99,7 @@
+ {
+ modification_queue mods;
+
+- foreach(const std::string& encoded_mod,
++ wes_foreach(const std::string& encoded_mod,
+ utils::parenthetical_split(encoded_mods, '~')) {
+ modification* mod = decode_modification(encoded_mod);
+
+diff -ur wesnoth-1.10.3.orig/src/language.cpp wesnoth-1.10.3/src/language.cpp
+--- wesnoth-1.10.3.orig/src/language.cpp 2012-03-03 19:55:59.000000000 +0100
++++ wesnoth-1.10.3/src/language.cpp 2012-07-11 13:16:06.026600024 +0200
+@@ -101,7 +101,7 @@
+ known_languages.push_back(
+ language_def("", t_string(N_("System default language"), "wesnoth"), "ltr", "", "A"));
+
+- foreach (const config &lang, cfg.child_range("locale"))
++ wes_foreach (const config &lang, cfg.child_range("locale"))
+ {
+ known_languages.push_back(
+ language_def(lang["locale"], lang["name"], lang["dir"],
+@@ -226,9 +226,9 @@
+ std::cerr << "No [language] block found\n";
+ return false;
+ }
+- foreach (const config &lang, languages_) {
++ wes_foreach (const config &lang, languages_) {
+ DBG_G << "[language]\n";
+- foreach (const config::attribute &j, lang.attribute_range()) {
++ wes_foreach (const config::attribute &j, lang.attribute_range()) {
+ DBG_G << j.first << "=\"" << j.second << "\"\n";
+ strings_[j.first] = j.second;
+ }
+@@ -283,7 +283,7 @@
+
+ void init_textdomains(const config& cfg)
+ {
+- foreach (const config &t, cfg.child_range("textdomain"))
++ wes_foreach (const config &t, cfg.child_range("textdomain"))
+ {
+ const std::string &name = t["name"];
+ const std::string &path = t["path"];
+@@ -307,7 +307,7 @@
+ bool init_strings(const config& cfg)
+ {
+ languages_.clear();
+- foreach(const config &l, cfg.child_range("language")) {
++ wes_foreach(const config &l, cfg.child_range("language")) {
+ languages_.push_back(l);
+ }
+ return load_strings(true);
+diff -ur wesnoth-1.10.3.orig/src/log.cpp wesnoth-1.10.3/src/log.cpp
+--- wesnoth-1.10.3.orig/src/log.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/log.cpp 2012-07-11 13:16:05.979933358 +0200
+@@ -88,11 +88,11 @@
+ {
+ std::string::size_type s = name.size();
+ if (name == "all") {
+- foreach (logd &l, *domains) {
++ wes_foreach (logd &l, *domains) {
+ l.second = severity;
+ }
+ } else if (s > 2 && name.compare(s - 2, 2, "/*") == 0) {
+- foreach (logd &l, *domains) {
++ wes_foreach (logd &l, *domains) {
+ if (l.first.compare(0, s - 1, name, 0, s - 1) == 0)
+ l.second = severity;
+ }
+@@ -108,7 +108,7 @@
+ std::string list_logdomains(const std::string& filter)
+ {
+ std::ostringstream res;
+- foreach (logd &l, *domains) {
++ wes_foreach (logd &l, *domains) {
+ if(l.first.find(filter) != std::string::npos)
+ res << l.first << "\n";
+ }
+diff -ur wesnoth-1.10.3.orig/src/lua/ltablib.c wesnoth-1.10.3/src/lua/ltablib.c
+--- wesnoth-1.10.3.orig/src/lua/ltablib.c 2010-08-01 18:39:39.000000000 +0200
++++ wesnoth-1.10.3/src/lua/ltablib.c 2012-07-11 13:16:05.949933359 +0200
+@@ -19,7 +19,7 @@
+ #define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n))
+
+
+-static int foreachi (lua_State *L) {
++static int wes_foreachi (lua_State *L) {
+ int i;
+ int n = aux_getn(L, 1);
+ luaL_checktype(L, 2, LUA_TFUNCTION);
+@@ -36,7 +36,7 @@
+ }
+
+
+-static int foreach (lua_State *L) {
++static int wes_foreach (lua_State *L) {
+ luaL_checktype(L, 1, LUA_TTABLE);
+ luaL_checktype(L, 2, LUA_TFUNCTION);
+ lua_pushnil(L); /* first key */
+@@ -268,8 +268,8 @@
+
+ static const luaL_Reg tab_funcs[] = {
+ {"concat", tconcat},
+- {"foreach", foreach},
+- {"foreachi", foreachi},
++ {"wes_foreach", wes_foreach},
++ {"wes_foreachi", wes_foreachi},
+ {"getn", getn},
+ {"maxn", maxn},
+ {"insert", tinsert},
+diff -ur wesnoth-1.10.3.orig/src/mapgen.cpp wesnoth-1.10.3/src/mapgen.cpp
+--- wesnoth-1.10.3.orig/src/mapgen.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/mapgen.cpp 2012-07-11 13:16:05.983266692 +0200
+@@ -777,7 +777,7 @@
+
+ std::vector<terrain_height_mapper> height_conversion;
+
+- foreach (const config &h, cfg.child_range("height")) {
++ wes_foreach (const config &h, cfg.child_range("height")) {
+ height_conversion.push_back(terrain_height_mapper(h));
+ }
+
+@@ -912,7 +912,7 @@
+ LOG_NG << (SDL_GetTicks() - ticks) << "\n"; ticks = SDL_GetTicks();
+
+ std::vector<terrain_converter> converters;
+- foreach (const config &cv, cfg.child_range("convert")) {
++ wes_foreach (const config &cv, cfg.child_range("convert")) {
+ converters.push_back(terrain_converter(cv));
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/map_label.cpp wesnoth-1.10.3/src/map_label.cpp
+--- wesnoth-1.10.3.orig/src/map_label.cpp 2012-01-07 13:11:02.000000000 +0100
++++ wesnoth-1.10.3/src/map_label.cpp 2012-07-11 13:16:05.953266691 +0200
+@@ -59,7 +59,7 @@
+ {
+ clear_all();
+
+- foreach (const config &i, cfg.child_range("label"))
++ wes_foreach (const config &i, cfg.child_range("label"))
+ {
+ const map_location loc(i, resources::state_of_game);
+ terrain_label *label = new terrain_label(*this, i);
+@@ -222,7 +222,7 @@
+
+ void map_labels::clear_all()
+ {
+- foreach (team_label_map::value_type &m, labels_)
++ wes_foreach (team_label_map::value_type &m, labels_)
+ {
+ clear_map(m.second, true);
+ }
+@@ -231,9 +231,9 @@
+
+ void map_labels::recalculate_labels()
+ {
+- foreach (team_label_map::value_type &m, labels_)
++ wes_foreach (team_label_map::value_type &m, labels_)
+ {
+- foreach (label_map::value_type &l, m.second)
++ wes_foreach (label_map::value_type &l, m.second)
+ {
+ l.second->recalculate();
+ }
+@@ -249,9 +249,9 @@
+
+ void map_labels::recalculate_shroud()
+ {
+- foreach (team_label_map::value_type &m, labels_)
++ wes_foreach (team_label_map::value_type &m, labels_)
+ {
+- foreach (label_map::value_type &l, m.second)
++ wes_foreach (label_map::value_type &l, m.second)
+ {
+ l.second->calculate_shroud();
+ }
+diff -ur wesnoth-1.10.3.orig/src/menu_events.cpp wesnoth-1.10.3/src/menu_events.cpp
+--- wesnoth-1.10.3.orig/src/menu_events.cpp 2012-05-11 23:38:28.000000000 +0200
++++ wesnoth-1.10.3/src/menu_events.cpp 2012-07-11 13:16:05.956600024 +0200
+@@ -863,7 +863,7 @@
+
+
+ DBG_WB <<"menu_handler::recall: Contents of wb-modified recall list:\n";
+- foreach(const unit* unit, recall_list_team)
++ wes_foreach(const unit* unit, recall_list_team)
+ {
+ DBG_WB << unit->name() << " [" << unit->id() <<"]\n";
+ }
+@@ -896,7 +896,7 @@
+ options.push_back(heading.str());
+ options_to_filter.push_back(options.back());
+
+- foreach (const unit* u, recall_list_team)
++ wes_foreach (const unit* u, recall_list_team)
+ {
+ std::stringstream option, option_to_filter;
+ std::string name = u->name();
+@@ -933,7 +933,7 @@
+ option_to_filter << u->type_name() << " " << name << " " << u->level();
+
+ option << COLUMN_SEPARATOR;
+- foreach (const t_string& trait, u->trait_names()) {
++ wes_foreach (const t_string& trait, u->trait_names()) {
+ option << trait << '\n';
+ option_to_filter << " " << trait;
+ }
+@@ -1540,7 +1540,7 @@
+ _("Type");
+ options.push_back(heading);
+
+- foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
++ wes_foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
+ {
+ std::stringstream row;
+
+@@ -2047,7 +2047,7 @@
+ std::vector<std::string> get_commands_list() const
+ {
+ std::vector<std::string> res;
+- foreach(typename command_map::value_type i, command_map_) {
++ wes_foreach(typename command_map::value_type i, command_map_) {
+ res.push_back(i.first);
+ }
+ return res;
+@@ -2638,7 +2638,7 @@
+
+ if (const config &alias_list = preferences::get_alias())
+ {
+- foreach (const config::attribute &a, alias_list.attribute_range()) {
++ wes_foreach (const config::attribute &a, alias_list.attribute_range()) {
+ register_alias(a.second, a.first);
+ }
+ }
+@@ -3241,7 +3241,7 @@
+ tile->rebuild_cache(tod_id, &tile_logs);
+
+ int order = 1;
+- foreach(const terrain_builder::tile::log_details det, tile_logs) {
++ wes_foreach(const terrain_builder::tile::log_details det, tile_logs) {
+ const terrain_builder::tile::rule_image_rand& ri = *det.first;
+ const terrain_builder::rule_image_variant& variant = *det.second;
+
+@@ -3356,7 +3356,7 @@
+ void console_handler::do_choose_level() {
+ std::vector<std::string> options;
+ int next = 0, nb = 0;
+- foreach (const config &sc, menu_handler_.game_config_.child_range("scenario"))
++ wes_foreach (const config &sc, menu_handler_.game_config_.child_range("scenario"))
+ {
+ const std::string &id = sc["id"];
+ options.push_back(id);
+@@ -3367,7 +3367,7 @@
+ // find scenarios of multiplayer campaigns
+ // (assumes that scenarios are ordered properly in the game_config)
+ std::string& scenario = menu_handler_.gamestate_.mp_settings().mp_scenario;
+- foreach (const config &mp, menu_handler_.game_config_.child_range("multiplayer"))
++ wes_foreach (const config &mp, menu_handler_.game_config_.child_range("multiplayer"))
+ {
+ if (mp["id"] == scenario)
+ {
+@@ -3596,7 +3596,7 @@
+ }
+ }*/
+ void console_handler::do_discover() {
+- foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types()) {
++ wes_foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types()) {
+ preferences::encountered_units().insert(i.second.id());
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/mouse_events.cpp wesnoth-1.10.3/src/mouse_events.cpp
+--- wesnoth-1.10.3.orig/src/mouse_events.cpp 2012-05-12 19:07:34.000000000 +0200
++++ wesnoth-1.10.3/src/mouse_events.cpp 2012-07-11 13:16:05.999933356 +0200
+@@ -1040,7 +1040,7 @@
+
+ map_location adj[6];
+ get_adjacent_tiles(loc, adj);
+- foreach (const map_location &aloc, adj) {
++ wes_foreach (const map_location &aloc, adj) {
+ unit_map::const_iterator i = find_unit(aloc);
+ if (i != units_.end() && uteam.is_enemy(i->side()))
+ res.insert(aloc);
+@@ -1055,7 +1055,7 @@
+
+ map_location adj[6];
+ get_adjacent_tiles(u->get_location(), adj);
+- foreach (const map_location &loc, adj)
++ wes_foreach (const map_location &loc, adj)
+ {
+ if (!map_.on_board(loc)) continue;
+ unit_map::const_iterator i = units_.find(loc);
+diff -ur wesnoth-1.10.3.orig/src/multiplayer_connect.cpp wesnoth-1.10.3/src/multiplayer_connect.cpp
+--- wesnoth-1.10.3.orig/src/multiplayer_connect.cpp 2012-01-07 17:23:59.000000000 +0100
++++ wesnoth-1.10.3/src/multiplayer_connect.cpp 2012-07-11 13:16:05.966600026 +0200
+@@ -189,7 +189,7 @@
+ // Hack: if there is a unit which can recruit, use it as a leader.
+ // Necessary to display leader information when loading saves.
+ std::string leader_type;
+- foreach (const config &side_unit, cfg.child_range("unit"))
++ wes_foreach (const config &side_unit, cfg.child_range("unit"))
+ {
+ if (side_unit["canrecruit"].to_bool()) {
+ leader_type = side_unit["type"].str();
+@@ -539,7 +539,7 @@
+ std::vector<ai::description*> &ais_list = parent_->ai_algorithms_;
+ std::vector<std::string> ais;
+ int i = 0;
+- foreach (const ai::description *desc, ais_list){
++ wes_foreach (const ai::description *desc, ais_list){
+ ais.push_back(desc->text);
+ if (desc->id==ai_algorithm_){
+ sel = i;
+@@ -557,7 +557,7 @@
+ void connect::side::update_faction_combo()
+ {
+ std::vector<std::string> factions;
+- foreach (const config *faction, parent_->era_sides_)
++ wes_foreach (const config *faction, parent_->era_sides_)
+ {
+ const std::string& name = (*faction)["name"];
+ const std::string& icon = (*faction)["image"];
+@@ -724,7 +724,7 @@
+ static char const *attrs[] = { "side", "controller", "id",
+ "team_name", "user_team_name", "color", "colour", "gold",
+ "income", "allow_changes" };
+- foreach (const char *attr, attrs) {
++ wes_foreach (const char *attr, attrs) {
+ trimmed.remove_attribute(attr);
+ }
+
+@@ -827,8 +827,8 @@
+ {
+ std::map<std::string, config> children;
+
+- foreach(const std::string& children_to_swap, get_children_to_swap())
+- foreach(const config& child, cfg_.child_range(children_to_swap))
++ wes_foreach(const std::string& children_to_swap, get_children_to_swap())
++ wes_foreach(const config& child, cfg_.child_range(children_to_swap))
+ children.insert(std::pair<std::string, config>(children_to_swap, child));
+
+ return children;
+@@ -836,12 +836,12 @@
+
+ void connect::side::set_side_children(std::map<std::string, config> children)
+ {
+- foreach(const std::string& children_to_remove, get_children_to_swap())
++ wes_foreach(const std::string& children_to_remove, get_children_to_swap())
+ cfg_.clear_children(children_to_remove);
+
+ std::pair<std::string, config> child_map;
+
+- foreach(child_map, children)
++ wes_foreach(child_map, children)
+ cfg_.add_child(child_map.first, child_map.second);
+ }
+
+@@ -920,7 +920,7 @@
+ // Builds the list of sides eligible for choice (nonrandom factions)
+ std::vector<int> nonrandom_sides;
+ int num = -1;
+- foreach (const config *i, parent_->era_sides_)
++ wes_foreach (const config *i, parent_->era_sides_)
+ {
+ ++num;
+ if (!(*i)["random_faction"].to_bool()) {
+@@ -1524,7 +1524,7 @@
+ player_types_.push_back(_("Computer Player"));
+ player_types_.push_back(_("Empty"));
+
+- foreach (const config *faction, era_sides_) {
++ wes_foreach (const config *faction, era_sides_) {
+ player_factions_.push_back((*faction)["name"]);
+ }
+
+@@ -1539,7 +1539,7 @@
+ // Teams
+ if(params_.use_map_settings) {
+ int side_num = 1;
+- foreach (config &side, sides)
++ wes_foreach (config &side, sides)
+ {
+ config::attribute_value &team_name = side["team_name"];
+ config::attribute_value &user_team_name = side["user_team_name"];
+@@ -1566,7 +1566,7 @@
+ } else {
+ std::vector<std::string> map_team_names;
+ int _side_num = 1;
+- foreach (config &side, sides)
++ wes_foreach (config &side, sides)
+ {
+ const std::string side_num = lexical_cast<std::string>(_side_num);
+ config::attribute_value &team_name = side["team_name"];
+@@ -1599,7 +1599,7 @@
+
+ // Populates "sides_" from the level configuration
+ int index = 0;
+- foreach (const config &s, sides) {
++ wes_foreach (const config &s, sides) {
+ sides_.push_back(side(*this, s, index++));
+ }
+ int offset=0;
+@@ -1683,7 +1683,7 @@
+ else
+ {
+ era_sides_.clear();
+- foreach (const config &e, era_cfg.child_range("multiplayer_side")) {
++ wes_foreach (const config &e, era_cfg.child_range("multiplayer_side")) {
+ era_sides_.push_back(&e);
+ }
+ level_.add_child("era", era_cfg);
+@@ -1789,7 +1789,7 @@
+ * 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
+ */
+- foreach(const side& s, sides_) {
++ wes_foreach(const side& s, sides_) {
+ if(s.get_controller() != CNTR_EMPTY) {
+ if(s.allow_player()) {
+ return true;
+diff -ur wesnoth-1.10.3.orig/src/multiplayer.cpp wesnoth-1.10.3/src/multiplayer.cpp
+--- wesnoth-1.10.3.orig/src/multiplayer.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/multiplayer.cpp 2012-07-11 13:16:05.993266689 +0200
+@@ -573,7 +573,7 @@
+ while (true) {
+ const config &cfg = game_config.child("lobby_music");
+ if (cfg) {
+- foreach (const config &i, cfg.child_range("music")) {
++ wes_foreach (const config &i, cfg.child_range("music")) {
+ sound::play_music_config(i);
+ }
+ sound::commit_music_changes();
+diff -ur wesnoth-1.10.3.orig/src/multiplayer_create.cpp wesnoth-1.10.3/src/multiplayer_create.cpp
+--- wesnoth-1.10.3.orig/src/multiplayer_create.cpp 2012-05-03 06:03:41.000000000 +0200
++++ wesnoth-1.10.3/src/multiplayer_create.cpp 2012-07-11 13:16:05.969933358 +0200
+@@ -127,7 +127,7 @@
+
+ // Standard maps
+ i = 0;
+- foreach (const config &j, cfg.child_range("multiplayer"))
++ wes_foreach (const config &j, cfg.child_range("multiplayer"))
+ {
+ if (j["allow_new_game"].to_bool(true))
+ {
+@@ -217,7 +217,7 @@
+
+ // The possible eras to play
+ std::vector<std::string> eras;
+- foreach (const config &er, cfg.child_range("era")) {
++ wes_foreach (const config &er, cfg.child_range("era")) {
+ eras.push_back(er["name"]);
+ }
+ if(eras.empty()) {
+@@ -547,7 +547,7 @@
+ }
+
+ int nsides = 0;
+- foreach (const config &k, parameters_.scenario_data.child_range("side")) {
++ wes_foreach (const config &k, parameters_.scenario_data.child_range("side")) {
+ if (k["allow_player"].to_bool(true)) ++nsides;
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/multiplayer_lobby.cpp wesnoth-1.10.3/src/multiplayer_lobby.cpp
+--- wesnoth-1.10.3.orig/src/multiplayer_lobby.cpp 2011-11-16 04:42:09.000000000 +0100
++++ wesnoth-1.10.3/src/multiplayer_lobby.cpp 2012-07-11 13:16:06.026600024 +0200
+@@ -424,7 +424,7 @@
+
+ games_.clear();
+
+- foreach (const config &game, cfg.child("gamelist").child_range("game"))
++ wes_foreach (const config &game, cfg.child("gamelist").child_range("game"))
+ {
+ bool verified = true;
+ games_.push_back(game_item());
+@@ -502,7 +502,7 @@
+ if (map_hashes_ && !games_.back().reloaded) {
+ std::string hash = game["hash"];
+ bool hash_found = false;
+- foreach (const config::attribute &i, map_hashes_.attribute_range()) {
++ wes_foreach (const config::attribute &i, map_hashes_.attribute_range()) {
+ if (i.first == game["mp_scenario"] && i.second == hash) {
+ hash_found = true;
+ break;
+@@ -639,7 +639,7 @@
+
+ if(preferences::fi_friends_in_game()) {
+ bool found_friend = false;
+- foreach(const config &user, cfg.child_range("user")) {
++ wes_foreach(const config &user, cfg.child_range("user")) {
+ if(preferences::is_friend(user["name"]) && user["game_id"] == i.id) {
+ found_friend = true;
+ break;
+@@ -650,7 +650,7 @@
+
+ if(!preferences::fi_text().empty()) {
+ bool found_match = true;
+- foreach(const std::string& search_string, utils::split(preferences::fi_text(), ' ', utils::STRIP_SPACES)) {
++ wes_foreach(const std::string& search_string, utils::split(preferences::fi_text(), ' ', utils::STRIP_SPACES)) {
+ if(std::search(i.map_info.begin(), i.map_info.end(), search_string.begin(), search_string.end(), chars_equal_insensitive) == i.map_info.end() &&
+ std::search(i.name.begin(), i.name.end(), search_string.begin(), search_string.end(), chars_equal_insensitive) == i.name.end()) {
+ found_match = false;
+diff -ur wesnoth-1.10.3.orig/src/multiplayer_ui.cpp wesnoth-1.10.3/src/multiplayer_ui.cpp
+--- wesnoth-1.10.3.orig/src/multiplayer_ui.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/multiplayer_ui.cpp 2012-07-11 13:16:05.979933358 +0200
+@@ -163,9 +163,9 @@
+ state.starting_pos.child_range("side");
+ config::const_child_itors level_sides = level.child_range("side");
+
+- foreach (config &side, saved_sides)
++ wes_foreach (config &side, saved_sides)
+ {
+- foreach (const config &lside, level_sides)
++ wes_foreach (const config &lside, level_sides)
+ {
+ if (side["side"] == lside["side"] &&
+ (side["current_player"] != lside["current_player"] ||
+@@ -599,7 +599,7 @@
+ if (const config &ms = c.child("members")) {
+ std::stringstream ss;
+ ss << "Room " << c["room"].str() << " members: ";
+- foreach (const config& m, ms.child_range("member")) {
++ wes_foreach (const config& m, ms.child_range("member")) {
+ ss << m["name"] << " ";
+ }
+ chat_.add_message(time(NULL), "server", ss.str());
+@@ -608,7 +608,7 @@
+ if (const config &rs = c.child("rooms")) {
+ std::stringstream ss;
+ ss << "Rooms: ";
+- foreach (const config& r, rs.child_range("room")) {
++ wes_foreach (const config& r, rs.child_range("room")) {
+ ss << r["name"].str() << "(" << r["size"].str() << ") ";
+ }
+ chat_.add_message(time(NULL), "server", ss.str());
+@@ -706,7 +706,7 @@
+ {
+ std::list<user_info> u_list;
+
+- foreach (const config &user, gamelist_.child_range("user"))
++ wes_foreach (const config &user, gamelist_.child_range("user"))
+ {
+ user_info u_elem;
+ u_elem.name = user["name"].str();
+@@ -848,12 +848,12 @@
+ }
+
+ int res = -1, index = 0, best_score = 0;
+- foreach (const config *faction, fl)
++ wes_foreach (const config *faction, fl)
+ {
+ int faction_score = 0;
+ std::vector<std::string> recruit = utils::split((*faction)[search_field]);
+- foreach (const std::string &search, find) {
+- foreach (const std::string &r, recruit) {
++ wes_foreach (const std::string &search, find) {
++ wes_foreach (const std::string &r, recruit) {
+ if (r == search) {
+ ++faction_score;
+ break;
+diff -ur wesnoth-1.10.3.orig/src/multiplayer_wait.cpp wesnoth-1.10.3/src/multiplayer_wait.cpp
+--- wesnoth-1.10.3.orig/src/multiplayer_wait.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/multiplayer_wait.cpp 2012-07-11 13:16:05.973266690 +0200
+@@ -222,7 +222,7 @@
+ //available side.
+ const config *side_choice = NULL;
+ int side_num = -1, nb_sides = 0;
+- foreach (const config &sd, level_.child_range("side"))
++ wes_foreach (const config &sd, level_.child_range("side"))
+ {
+ if (sd["controller"] == "reserved" && sd["current_player"] == preferences::login())
+ {
+@@ -275,7 +275,7 @@
+ color = game_config::color_info(color_str).index() - 1;
+
+ std::vector<const config *> leader_sides;
+- foreach (const config &side, possible_sides) {
++ wes_foreach (const config &side, possible_sides) {
+ leader_sides.push_back(&side);
+ }
+
+@@ -287,7 +287,7 @@
+ }
+
+ std::vector<std::string> choices;
+- foreach (const config *s, leader_sides)
++ wes_foreach (const config *s, leader_sides)
+ {
+ const config &side = *s;
+ const std::string &name = side["name"];
+@@ -442,7 +442,7 @@
+ std::vector<std::string> details;
+ std::vector<std::string> playerlist;
+
+- foreach (const config &sd, level_.child_range("side"))
++ wes_foreach (const config &sd, level_.child_range("side"))
+ {
+ if (!sd["allow_player"].to_bool(true)) {
+ continue;
+@@ -458,7 +458,7 @@
+ // Hack: if there is a unit which can recruit, use it as a
+ // leader. Necessary to display leader information when loading
+ // saves.
+- foreach (const config &side_unit, sd.child_range("unit"))
++ wes_foreach (const config &side_unit, sd.child_range("unit"))
+ {
+ if (side_unit["canrecruit"].to_bool()) {
+ leader_type = side_unit["type"].str();
+diff -ur wesnoth-1.10.3.orig/src/pathfind/pathfind.cpp wesnoth-1.10.3/src/pathfind/pathfind.cpp
+--- wesnoth-1.10.3.orig/src/pathfind/pathfind.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/pathfind/pathfind.cpp 2012-07-11 13:16:05.983266692 +0200
+@@ -59,7 +59,7 @@
+ std::set<map_location> tiles_checking;
+ tiles_checking.swap(pending_tiles_to_check);
+ //Iterate over all the hexes we need to check
+- foreach (const map_location &loc, tiles_checking)
++ wes_foreach (const map_location &loc, tiles_checking)
+ {
+ //If this area is not a castle but should, skip it.
+ if (vacancy == pathfind::VACANT_CASTLE && !map.is_castle(loc)) continue;
+@@ -76,7 +76,7 @@
+ if (units.find(loc) == units.end() && !pass_check_and_unreachable) return loc;
+ map_location adjs[6];
+ get_adjacent_tiles(loc,adjs);
+- foreach (const map_location &loc, adjs)
++ wes_foreach (const map_location &loc, adjs)
+ {
+ if (!map.on_board(loc)) continue;
+ // Add the tile to be checked if it hasn't already been and
+diff -ur wesnoth-1.10.3.orig/src/pathfind/teleport.cpp wesnoth-1.10.3/src/pathfind/teleport.cpp
+--- wesnoth-1.10.3.orig/src/pathfind/teleport.cpp 2011-10-10 04:43:29.000000000 +0200
++++ wesnoth-1.10.3/src/pathfind/teleport.cpp 2012-07-11 13:16:05.983266692 +0200
+@@ -108,16 +108,16 @@
+ , targets_()
+ {
+
+- foreach(const teleport_group& group, groups) {
++ wes_foreach(const teleport_group& group, groups) {
+
+ teleport_pair locations;
+ group.get_teleport_pair(locations, u, ignore_units);
+ if (!see_all && !group.always_visible() && viewing_team.is_enemy(u.side())) {
+ teleport_pair filter_locs;
+- foreach(const map_location &loc, locations.first)
++ wes_foreach(const map_location &loc, locations.first)
+ if(!viewing_team.fogged(loc))
+ filter_locs.first.insert(loc);
+- foreach(const map_location &loc, locations.second)
++ wes_foreach(const map_location &loc, locations.second)
+ if(!viewing_team.fogged(loc))
+ filter_locs.second.insert(loc);
+ locations.first.swap(filter_locs.first);
+diff -ur wesnoth-1.10.3.orig/src/persist_manager.cpp wesnoth-1.10.3/src/persist_manager.cpp
+--- wesnoth-1.10.3.orig/src/persist_manager.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/persist_manager.cpp 2012-07-11 13:16:06.036600021 +0200
+@@ -36,7 +36,7 @@
+ bool persist_manager::start_transaction() {
+ if (in_transaction_) return false;
+ bool result = true;
+- foreach (context_map::reference ctx, contexts_){
++ wes_foreach (context_map::reference ctx, contexts_){
+ result &= ctx.second->start_transaction();
+ }
+ in_transaction_ = true;
+@@ -46,7 +46,7 @@
+ bool persist_manager::end_transaction() {
+ if (!in_transaction_) return false;
+ bool result = true;
+- foreach (context_map::reference ctx, contexts_){
++ wes_foreach (context_map::reference ctx, contexts_){
+ result &= ctx.second->end_transaction();
+ }
+ in_transaction_ = !result;
+@@ -56,7 +56,7 @@
+ bool persist_manager::cancel_transaction() {
+ if (!in_transaction_) return false;
+ bool result = true;
+- foreach (context_map::reference ctx, contexts_){
++ wes_foreach (context_map::reference ctx, contexts_){
+ result &= ctx.second->cancel_transaction();
+ }
+ in_transaction_ = false;
+diff -ur wesnoth-1.10.3.orig/src/playcampaign.cpp wesnoth-1.10.3/src/playcampaign.cpp
+--- wesnoth-1.10.3.orig/src/playcampaign.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/playcampaign.cpp 2012-07-11 13:16:06.033266689 +0200
+@@ -260,7 +260,7 @@
+ controller_map controllers;
+
+ if(io_type == IO_SERVER) {
+- foreach (config &side, const_cast<config *>(scenario)->child_range("side"))
++ wes_foreach (config &side, const_cast<config *>(scenario)->child_range("side"))
+ {
+ if (side["current_player"] == preferences::login()) {
+ side["controller"] = preferences::client_type();
+@@ -280,7 +280,7 @@
+ scenario = &starting_pos;
+ }
+
+- foreach (config &side, starting_pos.child_range("side"))
++ wes_foreach (config &side, starting_pos.child_range("side"))
+ {
+ if (side["current_player"] == preferences::login()) {
+ side["controller"] = preferences::client_type();
+@@ -474,7 +474,7 @@
+
+ if(io_type == IO_SERVER && scenario != NULL) {
+ // Tweaks sides to adapt controllers and descriptions.
+- foreach (config &side, starting_pos.child_range("side"))
++ wes_foreach (config &side, starting_pos.child_range("side"))
+ {
+ std::string id = side["save_id"];
+ if(id.empty()) {
+@@ -547,7 +547,7 @@
+ next_cfg.add_child("replay_start", gamestate.starting_pos);
+ //move side information from gamestate into the config that is sent to the other clients
+ next_cfg.clear_children("side");
+- foreach (config& side, gamestate.starting_pos.child_range("side"))
++ wes_foreach (config& side, gamestate.starting_pos.child_range("side"))
+ next_cfg.add_child("side", side);
+
+ network::send_data(cfg, 0);
+diff -ur wesnoth-1.10.3.orig/src/play_controller.cpp wesnoth-1.10.3/src/play_controller.cpp
+--- wesnoth-1.10.3.orig/src/play_controller.cpp 2012-01-18 01:43:13.000000000 +0100
++++ wesnoth-1.10.3/src/play_controller.cpp 2012-07-11 13:16:05.973266690 +0200
+@@ -173,7 +173,7 @@
+ place_sides_in_preferred_locations();
+ }
+
+- foreach (const config &t, level_.child_range("time_area")) {
++ wes_foreach (const config &t, level_.child_range("time_area")) {
+ tod_manager_.add_time_area(t);
+ }
+
+@@ -192,7 +192,7 @@
+ std::vector<team_builder_ptr> team_builders;
+
+ int team_num = 0;
+- foreach (const config &side, level_.child_range("side"))
++ wes_foreach (const config &side, level_.child_range("side"))
+ {
+ std::string save_id = get_unique_saveid(side, seen_save_ids);
+ seen_save_ids.insert(save_id);
+@@ -212,7 +212,7 @@
+ team_builders.push_back(tb_ptr);
+ }
+
+- foreach (team_builder_ptr tb_ptr, team_builders)
++ wes_foreach (team_builder_ptr tb_ptr, team_builders)
+ {
+ gamestate_.build_team_stage_two(tb_ptr);
+ }
+@@ -337,7 +337,7 @@
+ int num_pos = map_.num_valid_starting_positions();
+
+ int side_num = 1;
+- foreach (const config &side, level_.child_range("side"))
++ wes_foreach (const config &side, level_.child_range("side"))
+ {
+ for(int p = 1; p <= num_pos; ++p) {
+ const map_location& pos = map_.starting_position(p);
+@@ -703,7 +703,7 @@
+ }
+
+ // Write terrain_graphics data in snapshot, too
+- foreach (const config &tg, level_.child_range("terrain_graphics")) {
++ wes_foreach (const config &tg, level_.child_range("terrain_graphics")) {
+ cfg.add_child("terrain_graphics", tg);
+ }
+
+@@ -914,7 +914,7 @@
+ switch(mode) {
+ case gui::TEXTBOX_SEARCH:
+ {
+- foreach (const unit &u, units_){
++ wes_foreach (const unit &u, units_){
+ const map_location& loc = u.get_location();
+ if(!gui_->fogged(loc) &&
+ !(teams_[gui_->viewing_team()].is_enemy(u.side()) && u.invisible(loc)))
+@@ -931,13 +931,13 @@
+ }
+ case gui::TEXTBOX_MESSAGE:
+ {
+- foreach(const team& t, teams_) {
++ wes_foreach(const team& t, teams_) {
+ if(!t.is_empty())
+ dictionary.insert(t.current_player());
+ }
+
+ // Add observers
+- foreach(const std::string& o, gui_->observers()){
++ wes_foreach(const std::string& o, gui_->observers()){
+ dictionary.insert(o);
+ }
+ //Exclude own nick from tab-completion.
+@@ -1341,7 +1341,7 @@
+
+ if (non_interactive()) {
+ std::cout << "winner: ";
+- foreach (unsigned l, seen_leaders) {
++ wes_foreach (unsigned l, seen_leaders) {
+ std::string ai = ai::manager::get_active_ai_identifier_for_side(l);
+ if (ai.empty()) ai = "default ai";
+ std::cout << l << " (using " << ai << ") ";
+diff -ur wesnoth-1.10.3.orig/src/playmp_controller.cpp wesnoth-1.10.3/src/playmp_controller.cpp
+--- wesnoth-1.10.3.orig/src/playmp_controller.cpp 2012-01-18 01:18:09.000000000 +0100
++++ wesnoth-1.10.3/src/playmp_controller.cpp 2012-07-11 13:16:06.029933357 +0200
+@@ -326,7 +326,7 @@
+ // stay stuck in linger state when the *next* scenario is over.
+ gamestate_.classification().completion = "running";
+ // End all unit moves
+- foreach (unit &u, units_) {
++ wes_foreach (unit &u, units_) {
+ u.set_user_end_turn(true);
+ }
+ //current_team().set_countdown_time(0);
+diff -ur wesnoth-1.10.3.orig/src/playsingle_controller.cpp wesnoth-1.10.3/src/playsingle_controller.cpp
+--- wesnoth-1.10.3.orig/src/playsingle_controller.cpp 2012-05-17 22:19:01.000000000 +0200
++++ wesnoth-1.10.3/src/playsingle_controller.cpp 2012-07-11 13:16:05.983266692 +0200
+@@ -324,7 +324,7 @@
+ LOG_NG << "in playsingle_controller::play_scenario()...\n";
+
+ // Start music.
+- foreach (const config &m, level_.child_range("music")) {
++ wes_foreach (const config &m, level_.child_range("music")) {
+ sound::play_music_config(m);
+ }
+ sound::commit_music_changes();
+@@ -336,7 +336,7 @@
+
+ // Read sound sources
+ assert(soundsources_manager_ != NULL);
+- foreach (const config &s, level_.child_range("sound_source")) {
++ wes_foreach (const config &s, level_.child_range("sound_source")) {
+ soundsource::sourcespec spec(s);
+ soundsources_manager_->add(spec);
+ }
+@@ -906,14 +906,14 @@
+ new_side["previous_recruits"] = can_recruit_str;
+ LOG_NG << "stored side in snapshot:\n" << new_side["save_id"] << std::endl;
+ //add the units of the recall list
+- foreach(const unit& u, i->recall_list()) {
++ wes_foreach(const unit& u, i->recall_list()) {
+ config& new_unit = new_side.add_child("unit");
+ u.write(new_unit);
+ }
+ }
+ }
+ //add any players from starting_pos that do not have a team in the current scenario
+- foreach (const config &player_cfg, gamestate_.starting_pos.child_range("player")) {
++ wes_foreach (const config &player_cfg, gamestate_.starting_pos.child_range("player")) {
+ if (side_ids.count(player_cfg["save_id"]) == 0) {
+ LOG_NG << "stored inactive side in snapshot:\n" << player_cfg["save_id"] << std::endl;
+ gamestate_.snapshot.add_child("side", player_cfg);
+@@ -938,7 +938,7 @@
+ }
+
+ int persistent_teams = 0;
+- foreach (const team &t, teams_) {
++ wes_foreach (const team &t, teams_) {
+ if (t.persistent()) ++persistent_teams;
+ }
+
+@@ -953,7 +953,7 @@
+ int turns_left = std::max<int>(0, tod_manager_.number_of_turns() - turn());
+ int finishing_bonus = (end_level.gold_bonus && turns_left > -1) ?
+ finishing_bonus_per_turn * turns_left : 0;
+- foreach (const team &t, teams_)
++ wes_foreach (const team &t, teams_)
+ {
+ if (!t.persistent()) continue;
+ int carryover_gold = div100rounded((t.gold() + finishing_bonus) * end_level.carryover_percentage);
+diff -ur wesnoth-1.10.3.orig/src/playturn.cpp wesnoth-1.10.3/src/playturn.cpp
+--- wesnoth-1.10.3.orig/src/playturn.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/playturn.cpp 2012-07-11 13:16:05.979933358 +0200
+@@ -124,11 +124,11 @@
+ preferences::message_bell());
+ }
+
+- foreach (const config &ob, cfg.child_range("observer")) {
++ wes_foreach (const config &ob, cfg.child_range("observer")) {
+ resources::screen->add_observer(ob["name"]);
+ }
+
+- foreach (const config &ob, cfg.child_range("observer_quit")) {
++ wes_foreach (const config &ob, cfg.child_range("observer_quit")) {
+ resources::screen->remove_observer(ob["name"]);
+ }
+
+@@ -147,7 +147,7 @@
+ const config& change = cfg.child_or_empty("change_controller");
+ const std::string& side_drop = cfg["side_drop"].str();
+
+- foreach (const config &t, turns)
++ wes_foreach (const config &t, turns)
+ {
+ handle_turn(turn_end, t, skip_replay, backlog);
+ }
+@@ -240,7 +240,7 @@
+ options.push_back(_("Abort game"));
+
+ //get all observers in as options to transfer control
+- foreach (const std::string &ob, resources::screen->observers())
++ wes_foreach (const std::string &ob, resources::screen->observers())
+ {
+ t_vars["player"] = ob;
+ options.push_back(vgettext("Replace with $player", t_vars));
+@@ -248,7 +248,7 @@
+ }
+
+ //get all allies in as options to transfer control
+- foreach (team &t, *resources::teams)
++ wes_foreach (team &t, *resources::teams)
+ {
+ if (!t.is_enemy(side) && !t.is_human() && !t.is_ai() && !t.is_empty()
+ && t.current_player() != tm.current_player())
+diff -ur wesnoth-1.10.3.orig/src/preferences_display.cpp wesnoth-1.10.3/src/preferences_display.cpp
+--- wesnoth-1.10.3.orig/src/preferences_display.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/preferences_display.cpp 2012-07-11 13:16:05.989933357 +0200
+@@ -82,7 +82,7 @@
+ bpp = video.modePossible(resolution.first, resolution.second,
+ DefaultBPP, video_flags, true);
+
+- foreach (const res_t &res, res_list)
++ wes_foreach (const res_t &res, res_list)
+ {
+ if (bpp != 0) break;
+ std::cerr << "Video mode " << resolution.first << 'x'
+diff -ur wesnoth-1.10.3.orig/src/replay_controller.cpp wesnoth-1.10.3/src/replay_controller.cpp
+--- wesnoth-1.10.3.orig/src/replay_controller.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/replay_controller.cpp 2012-07-11 13:16:06.236600015 +0200
+@@ -417,7 +417,7 @@
+ finish_side_turn();
+
+ // This is necessary for replays in order to show possible movements.
+- foreach (unit &u, units_) {
++ wes_foreach (unit &u, units_) {
+ if (u.side() != player_number_) {
+ u.new_turn();
+ }
+diff -ur wesnoth-1.10.3.orig/src/replay.cpp wesnoth-1.10.3/src/replay.cpp
+--- wesnoth-1.10.3.orig/src/replay.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/replay.cpp 2012-07-11 13:16:06.013266690 +0200
+@@ -67,7 +67,7 @@
+ << nunits << " according to data source. " << units.size() << " locally\n";
+
+ std::set<map_location> locs;
+- foreach (const config &u, cfg.child_range("unit"))
++ wes_foreach (const config &u, cfg.child_range("unit"))
+ {
+ const map_location loc(u, resources::state_of_game);
+ locs.insert(loc);
+@@ -88,7 +88,7 @@
+ errbuf.clear();
+ }
+
+- foreach (const config &un, cfg.child_range("unit"))
++ wes_foreach (const config &un, cfg.child_range("unit"))
+ {
+ const map_location loc(un, resources::state_of_game);
+ const unit_map::const_iterator u = units.find(loc);
+@@ -560,7 +560,7 @@
+ const map_location &src = steps.front();
+ const map_location &dst = steps.back();
+
+- foreach (const async_cmd &ac, async_cmds)
++ wes_foreach (const async_cmd &ac, async_cmds)
+ {
+ if (config &async_child = ac.cfg->child("rename")) {
+ map_location aloc(async_child, resources::state_of_game);
+@@ -576,7 +576,7 @@
+ // A unit is being un-recruited or un-recalled.
+ // Remove unsynced commands that would act on that unit.
+ map_location src(*chld, resources::state_of_game);
+- foreach (const async_cmd &ac, async_cmds)
++ wes_foreach (const async_cmd &ac, async_cmds)
+ {
+ if (config &async_child = ac.cfg->child("rename"))
+ {
+@@ -680,7 +680,7 @@
+
+ void replay::add_config(const config& cfg, MARK_SENT mark)
+ {
+- foreach (const config &cmd, cfg.child_range("command"))
++ wes_foreach (const config &cmd, cfg.child_range("command"))
+ {
+ config &cfg = cfg_.add_child("command", cmd);
+ if (cfg.child("speak"))
+@@ -730,7 +730,7 @@
+ if(! game_config::mp_debug) {
+ return;
+ }
+- foreach (const config &ch, cfg.child_range("checksum"))
++ wes_foreach (const config &ch, cfg.child_range("checksum"))
+ {
+ map_location loc(ch, resources::state_of_game);
+ unit_map::const_iterator u = resources::units->find(loc);
+@@ -1151,7 +1151,7 @@
+ }
+ else if (const config &child = cfg->child("fire_event"))
+ {
+- foreach (const config &v, child.child_range("set_variable")) {
++ wes_foreach (const config &v, child.child_range("set_variable")) {
+ resources::state_of_game->set_variable(v["name"], v["value"]);
+ }
+ const std::string &event = child["raise"];
+diff -ur wesnoth-1.10.3.orig/src/reports.cpp wesnoth-1.10.3/src/reports.cpp
+--- wesnoth-1.10.3.orig/src/reports.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/reports.cpp 2012-07-11 13:16:05.966600026 +0200
+@@ -260,7 +260,7 @@
+ if (!u) return report();
+ config res;
+ typedef std::pair<std::string, std::string> pair_string;
+- foreach(const pair_string &ps, u->amla_icons()) {
++ wes_foreach(const pair_string &ps, u->amla_icons()) {
+ add_image(res, ps.first, ps.second);
+ }
+ return res;
+@@ -395,7 +395,7 @@
+
+ bool att_def_diff = false;
+ map_location displayed_unit_hex = resources::screen->displayed_unit_hex();
+- foreach (const utils::string_map::value_type &resist, u->get_base_resistances())
++ wes_foreach (const utils::string_map::value_type &resist, u->get_base_resistances())
+ {
+ std::ostringstream line;
+ line << gettext(resist.first.c_str()) << ": ";
+@@ -415,7 +415,7 @@
+ if (att_def_diff)
+ tooltip << _("(Att / Def)");
+ tooltip << '\n';
+- foreach (const std::string &line, resistances_table) {
++ wes_foreach (const std::string &line, resistances_table) {
+ tooltip << line;
+ }
+ return text_report(str.str(), tooltip.str());
+@@ -458,7 +458,7 @@
+ if (!u) return report();
+ config res;
+ typedef std::pair<std::string, std::string> pair_string;
+- foreach (const pair_string &ps, u->advancement_icons()) {
++ wes_foreach (const pair_string &ps, u->advancement_icons()) {
+ add_image(res, ps.first, ps.second);
+ }
+ return res;
+@@ -497,7 +497,7 @@
+ bool revert = false;
+ if (underlyings.size() != 1 || underlyings.front() != terrain)
+ {
+- foreach (const t_translation::t_terrain &t, underlyings)
++ wes_foreach (const t_translation::t_terrain &t, underlyings)
+ {
+ if (t == t_translation::MINUS) {
+ revert = true;
+@@ -641,7 +641,7 @@
+ std::set<std::string> seen_types;
+ const team &unit_team = (*resources::teams)[u->side() - 1];
+ const team &viewing_team = (*resources::teams)[resources::screen->viewing_team()];
+- foreach(const unit &enemy, *resources::units)
++ wes_foreach(const unit &enemy, *resources::units)
+ {
+ if (!unit_team.is_enemy(enemy.side()))
+ continue;
+@@ -662,7 +662,7 @@
+ damage_multiplier += tod_bonus;
+
+ typedef std::pair<int, std::set<std::string> > resist_units;
+- foreach (const resist_units &resist, resistances) {
++ wes_foreach (const resist_units &resist, resistances) {
+ int damage = round_damage(base_damage, damage_multiplier * resist.first, damage_divisor);
+ tooltip << "<b>" << damage << "</b> "
+ << "<i>(" << utils::signed_percent(resist.first-100) << ")</i> : "
+@@ -755,7 +755,7 @@
+ }
+ }
+
+- foreach(const battle_context& weapon, weapons) {
++ wes_foreach(const battle_context& weapon, weapons) {
+
+ // Predict the battle outcome.
+ combatant attacker_combatant(weapon.get_attacker_stats());
+@@ -869,7 +869,7 @@
+ map_location displayed_unit_hex = resources::screen->displayed_unit_hex();
+ config res;
+
+- foreach (const attack_type &at, u->attacks())
++ wes_foreach (const attack_type &at, u->attacks())
+ {
+ attack_info(at, res, u, displayed_unit_hex);
+ }
+@@ -1023,7 +1023,7 @@
+ str << td.villages << '/';
+ if (viewing_team.uses_shroud()) {
+ int unshrouded_villages = 0;
+- foreach (const map_location &loc, resources::game_map->villages()) {
++ wes_foreach (const map_location &loc, resources::game_map->villages()) {
+ if (!viewing_team.shrouded(loc))
+ ++unshrouded_villages;
+ }
+@@ -1178,7 +1178,7 @@
+
+ std::ostringstream str;
+ str << _("Observers:") << '\n';
+- foreach (const std::string &obs, observers) {
++ wes_foreach (const std::string &obs, observers) {
+ str << obs << '\n';
+ }
+ return image_report(game_config::images::observer, str.str());
+@@ -1250,7 +1250,7 @@
+
+ void reports::reset_generators()
+ {
+- foreach (dynamic_report_generators::value_type &rg, dynamic_generators) {
++ wes_foreach (dynamic_report_generators::value_type &rg, dynamic_generators) {
+ delete rg.second;
+ }
+ dynamic_generators.clear();
+@@ -1283,10 +1283,10 @@
+ const std::set<std::string> &reports::report_list()
+ {
+ if (!all_reports.empty()) return all_reports;
+- foreach (const static_report_generators::value_type &v, static_generators) {
++ wes_foreach (const static_report_generators::value_type &v, static_generators) {
+ all_reports.insert(v.first);
+ }
+- foreach (const dynamic_report_generators::value_type &v, dynamic_generators) {
++ wes_foreach (const dynamic_report_generators::value_type &v, dynamic_generators) {
+ all_reports.insert(v.first);
+ }
+ return all_reports;
+diff -ur wesnoth-1.10.3.orig/src/savegame.cpp wesnoth-1.10.3/src/savegame.cpp
+--- wesnoth-1.10.3.orig/src/savegame.cpp 2012-03-21 02:45:39.000000000 +0100
++++ wesnoth-1.10.3/src/savegame.cpp 2012-07-11 13:16:06.009933358 +0200
+@@ -913,7 +913,7 @@
+ bool shrouded = false;
+
+ const config& snapshot = has_snapshot ? gamestate_.snapshot : gamestate_.starting_pos;
+- foreach (const config &side, snapshot.child_range("side"))
++ wes_foreach (const config &side, snapshot.child_range("side"))
+ {
+ if (side["controller"] != "human") {
+ continue;
+@@ -922,7 +922,7 @@
+ shrouded = true;
+ }
+
+- foreach (const config &u, side.child_range("unit"))
++ wes_foreach (const config &u, side.child_range("unit"))
+ {
+ if (u["canrecruit"].to_bool()) {
+ leader = u["id"].str();
+@@ -960,7 +960,7 @@
+ // if there is no scenario information in the starting pos, add the (persistent) sides from the snapshot
+ // else do nothing, as persistence information was already added at the end of the previous scenario
+ if (gamestate().starting_pos["id"].empty()) {
+- foreach(const config &snapshot_side, gamestate().snapshot.child_range("side")) {
++ wes_foreach(const config &snapshot_side, gamestate().snapshot.child_range("side")) {
+ //add all side tags (assuming they only contain carryover information)
+ gamestate().starting_pos.add_child("side", snapshot_side);
+ }
+diff -ur wesnoth-1.10.3.orig/src/scripting/lua.cpp wesnoth-1.10.3/src/scripting/lua.cpp
+--- wesnoth-1.10.3.orig/src/scripting/lua.cpp 2012-01-17 15:57:24.000000000 +0100
++++ wesnoth-1.10.3/src/scripting/lua.cpp 2012-07-11 13:16:06.036600021 +0200
+@@ -87,7 +87,7 @@
+ void extract_preload_scripts(config const &game_config)
+ {
+ preload_scripts.clear();
+- foreach (config const &cfg, game_config.child_range("lua")) {
++ wes_foreach (config const &cfg, game_config.child_range("lua")) {
+ preload_scripts.push_back(cfg);
+ }
+ preload_config = game_config.child("game_config");
+@@ -254,7 +254,7 @@
+ return;
+
+ int k = 1;
+- foreach (const config::any_child &ch, cfg.all_children_range())
++ wes_foreach (const config::any_child &ch, cfg.all_children_range())
+ {
+ lua_createtable(L, 2, 0);
+ lua_pushstring(L, ch.key.c_str());
+@@ -264,7 +264,7 @@
+ lua_rawseti(L, -2, 2);
+ lua_rawseti(L, -2, k++);
+ }
+- foreach (const config::attribute &attr, cfg.attribute_range())
++ wes_foreach (const config::attribute &attr, cfg.attribute_range())
+ {
+ luaW_pushscalar(L, attr.second);
+ lua_setfield(L, -2, attr.first.c_str());
+@@ -534,7 +534,7 @@
+ {
+ if (ptr) return ptr;
+ if (side) {
+- foreach (unit &u, (*resources::teams)[side - 1].recall_list()) {
++ wes_foreach (unit &u, (*resources::teams)[side - 1].recall_list()) {
+ if (u.underlying_id() == uid) return &u;
+ }
+ return NULL;
+@@ -710,7 +710,7 @@
+ if (shallow_literal || strcmp(m, "__shallow_parsed") == 0)
+ {
+ lua_newtable(L);
+- foreach (const config::attribute &a, v->get_config().attribute_range()) {
++ wes_foreach (const config::attribute &a, v->get_config().attribute_range()) {
+ if (shallow_literal)
+ luaW_pushscalar(L, a.second);
+ else
+@@ -813,7 +813,7 @@
+ const std::vector<std::string>& vector = accessor; \
+ lua_createtable(L, vector.size(), 0); \
+ int i = 1; \
+- foreach (const std::string& s, vector) { \
++ wes_foreach (const std::string& s, vector) { \
+ lua_pushstring(L, s.c_str()); \
+ lua_rawseti(L, -2, i); \
+ ++i; \
+@@ -1292,9 +1292,9 @@
+ lua_rawget(L, LUA_REGISTRYINDEX);
+ lua_newtable(L);
+ int i = 1, s = 1;
+- foreach (team &t, *resources::teams)
++ wes_foreach (team &t, *resources::teams)
+ {
+- foreach (unit &u, t.recall_list())
++ wes_foreach (unit &u, t.recall_list())
+ {
+ if (!filter.null()) {
+ scoped_recall_unit auto_store("this_unit",
+@@ -1560,7 +1560,7 @@
+ std::set<std::string> const &recruits = t.recruits();
+ lua_createtable(L, recruits.size(), 0);
+ int i = 1;
+- foreach (std::string const &r, t.recruits()) {
++ wes_foreach (std::string const &r, t.recruits()) {
+ lua_pushstring(L, r.c_str());
+ lua_rawseti(L, -2, i++);
+ }
+@@ -3130,7 +3130,7 @@
+
+ lua_createtable(L, res.size(), 0);
+ int i = 1;
+- foreach (map_location const &loc, res)
++ wes_foreach (map_location const &loc, res)
+ {
+ lua_createtable(L, 2, 0);
+ lua_pushinteger(L, loc.x + 1);
+@@ -3227,7 +3227,7 @@
+ lua_rawget(L, LUA_REGISTRYINDEX);
+ lua_createtable(L, sides.size(), 0);
+ unsigned index = 1;
+- foreach(int side, sides) {
++ wes_foreach(int side, sides) {
+ // Create a full userdata containing a pointer to the team.
+ team** t = static_cast<team**>(lua_newuserdata(L, sizeof(team*)));
+ *t = &((*resources::teams)[side - 1]);
+@@ -3247,7 +3247,7 @@
+ static int intf_get_traits(lua_State* L)
+ {
+ lua_newtable(L);
+- foreach(const config& trait, unit_types.traits()) {
++ wes_foreach(const config& trait, unit_types.traits()) {
+ const std::string& id = trait["id"];
+ //It seems the engine does nowhere check the id field for emptyness or duplicates
+ //(also not later on).
+@@ -3767,7 +3767,7 @@
+ , static_cast<void *>(const_cast<char *>(&gettypeKey)));
+ lua_rawget(L, LUA_REGISTRYINDEX);
+ lua_newtable(L);
+- foreach (const unit_type_data::unit_type_map::value_type &ut, unit_types.types())
++ wes_foreach (const unit_type_data::unit_type_map::value_type &ut, unit_types.types())
+ {
+ lua_createtable(L, 0, 1);
+ lua_pushstring(L, ut.first.c_str());
+@@ -3786,7 +3786,7 @@
+ lua_rawget(L, LUA_REGISTRYINDEX);
+ const race_map& races = unit_types.races();
+ lua_createtable(L, 0, races.size());
+- foreach(const race_map::value_type &race, races)
++ wes_foreach(const race_map::value_type &race, races)
+ {
+ lua_createtable(L, 0, 1);
+ char const* id = race.first.c_str();
+@@ -3801,10 +3801,10 @@
+
+ // Execute the preload scripts.
+ game_config::load_config(preload_config);
+- foreach (const config &cfg, preload_scripts) {
++ wes_foreach (const config &cfg, preload_scripts) {
+ execute(cfg["code"].str().c_str(), 0, 0);
+ }
+- foreach (const config &cfg, level_.child_range("lua")) {
++ wes_foreach (const config &cfg, level_.child_range("lua")) {
+ execute(cfg["code"].str().c_str(), 0, 0);
+ }
+
+@@ -3822,7 +3822,7 @@
+
+ static bool is_handled_file_tag(const std::string &s)
+ {
+- foreach (char const *t, handled_file_tags) {
++ wes_foreach (char const *t, handled_file_tags) {
+ if (s == t) return true;
+ }
+ return false;
+@@ -3841,7 +3841,7 @@
+
+ lua_newtable(L);
+ int k = 1;
+- foreach (const config::any_child &v, level_.all_children_range())
++ wes_foreach (const config::any_child &v, level_.all_children_range())
+ {
+ if (is_handled_file_tag(v.key)) continue;
+ lua_createtable(L, 2, 0);
+@@ -3861,7 +3861,7 @@
+ */
+ void LuaKernel::save_game(config &cfg)
+ {
+- foreach (const config &v, level_.child_range("lua")) {
++ wes_foreach (const config &v, level_.child_range("lua")) {
+ cfg.add_child("lua", v);
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/serialization/parser.cpp wesnoth-1.10.3/src/serialization/parser.cpp
+--- wesnoth-1.10.3.orig/src/serialization/parser.cpp 2012-05-06 14:08:37.000000000 +0200
++++ wesnoth-1.10.3/src/serialization/parser.cpp 2012-07-11 13:16:06.009933358 +0200
+@@ -343,7 +343,7 @@
+ {
+ i18n_symbols["pos"] = ::lineno_string(lineno);
+ std::string result = _(error_string);
+- foreach(utils::string_map::value_type& var, i18n_symbols)
++ wes_foreach(utils::string_map::value_type& var, i18n_symbols)
+ boost::algorithm::replace_all(result, std::string("$") + var.first, std::string(var.second));
+ return result;
+ }
+@@ -503,11 +503,11 @@
+ if (tab > max_recursion_levels)
+ throw config::error("Too many recursion levels in config write");
+
+- foreach (const config::attribute &i, cfg.attribute_range()) {
++ wes_foreach (const config::attribute &i, cfg.attribute_range()) {
+ write_key_val(out, i.first, i.second, tab, textdomain);
+ }
+
+- foreach (const config::any_child &item, cfg.all_children_range())
++ wes_foreach (const config::any_child &item, cfg.all_children_range())
+ {
+ write_open_child(out, item.key, tab);
+ write_internal(item.cfg, out, textdomain, tab + 1);
+diff -ur wesnoth-1.10.3.orig/src/serialization/preprocessor.cpp wesnoth-1.10.3/src/serialization/preprocessor.cpp
+--- wesnoth-1.10.3.orig/src/serialization/preprocessor.cpp 2012-04-23 20:55:21.000000000 +0200
++++ wesnoth-1.10.3/src/serialization/preprocessor.cpp 2012-07-11 13:16:06.009933358 +0200
+@@ -64,7 +64,7 @@
+ int n = 0;
+ s >> std::hex >> n;
+
+- foreach(const t_file_number_map::value_type& p, file_number_map){
++ wes_foreach(const t_file_number_map::value_type& p, file_number_map){
+ if(p.second == n)
+ return p.first;
+ }
+@@ -142,7 +142,7 @@
+ writer.write_key_val("linenum", lexical_cast<std::string>(linenum));
+ writer.write_key_val("location", get_location(location));
+
+- foreach (const std::string &arg, arguments)
++ wes_foreach (const std::string &arg, arguments)
+ write_argument(writer, arg);
+
+ writer.close_child(key);
+@@ -160,7 +160,7 @@
+ linenum = cfg["linenum"];
+ location = cfg["location"].str();
+
+- foreach (const config &arg, cfg.child_range("argument"))
++ wes_foreach (const config &arg, cfg.child_range("argument"))
+ read_argument(arg);
+ }
+
+@@ -1157,14 +1157,14 @@
+ get_files_in_dir(res_name, &files, &dirs, ENTIRE_FILE_PATH, SKIP_MEDIA_DIR, DO_REORDER);
+
+ // subdirectories
+- foreach(const std::string& dir, dirs)
++ wes_foreach(const std::string& dir, dirs)
+ {
+ LOG_PREPROC<<"processing sub-dir: "<<dir<<'\n';
+ preprocess_resource(dir,defines_map,write_cfg,write_plain_cfg,target_directory);
+ }
+
+ // files in current directory
+- foreach(const std::string& file, files)
++ wes_foreach(const std::string& file, files)
+ {
+ preprocess_resource(file,defines_map,write_cfg,write_plain_cfg,target_directory);
+ }
+diff -ur wesnoth-1.10.3.orig/src/serialization/schema_validator.cpp wesnoth-1.10.3/src/serialization/schema_validator.cpp
+--- wesnoth-1.10.3.orig/src/serialization/schema_validator.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/serialization/schema_validator.cpp 2012-07-11 13:16:06.009933358 +0200
+@@ -143,14 +143,14 @@
+ } catch(config::error&) {
+ return false;
+ }
+- foreach (const config &g, cfg.child_range("wml_schema")) {
+- foreach (const config &schema, g.child_range("tag")) {
++ wes_foreach (const config &g, cfg.child_range("wml_schema")) {
++ wes_foreach (const config &schema, g.child_range("tag")) {
+ if (schema["name"].str() == "root"){
+ //@NOTE Don't know, maybe merging of roots needed.
+ root_ = class_tag (schema);
+ }
+ }
+- foreach (const config &type, g.child_range("type")) {
++ wes_foreach (const config &type, g.child_range("type")) {
+ try{
+ types_[type["name"].str()] = boost::regex( type["value"].str());
+ }
+diff -ur wesnoth-1.10.3.orig/src/server/ban.cpp wesnoth-1.10.3/src/server/ban.cpp
+--- wesnoth-1.10.3.orig/src/server/ban.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/server/ban.cpp 2012-07-11 13:16:06.016600022 +0200
+@@ -260,7 +260,7 @@
+ scoped_istream ban_file = istream_file(filename_);
+ read_gz(cfg, *ban_file);
+
+- foreach (const config &b, cfg.child_range("ban"))
++ wes_foreach (const config &b, cfg.child_range("ban"))
+ {
+ try {
+ banned_ptr new_ban(new banned(b));
+@@ -276,7 +276,7 @@
+ // load deleted too
+ if (const config &cfg_del = cfg.child("deleted"))
+ {
+- foreach (const config &b, cfg_del.child_range("ban"))
++ wes_foreach (const config &b, cfg_del.child_range("ban"))
+ {
+ try {
+ banned_ptr new_ban(new banned(b));
+@@ -680,7 +680,7 @@
+ void ban_manager::load_config(const config& cfg)
+ {
+ ban_times_.clear();
+- foreach (const config &bt, cfg.child_range("ban_time")) {
++ wes_foreach (const config &bt, cfg.child_range("ban_time")) {
+ time_t duration = 0;
+ if (parse_time(bt["time"], &duration)) {
+ ban_times_.insert(default_ban_times::value_type(bt["name"], duration));
+diff -ur wesnoth-1.10.3.orig/src/server/room_manager.cpp wesnoth-1.10.3/src/server/room_manager.cpp
+--- wesnoth-1.10.3.orig/src/server/room_manager.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/server/room_manager.cpp 2012-07-11 13:16:06.019933355 +0200
+@@ -58,7 +58,7 @@
+ // this assumes the server is shutting down, so there's no need to
+ // send the actual room-quit messages to clients
+ write_rooms();
+- foreach (t_rooms_by_name_::value_type i, rooms_by_name_) {
++ wes_foreach (t_rooms_by_name_::value_type i, rooms_by_name_) {
+ delete i.second;
+ }
+ }
+@@ -97,7 +97,7 @@
+ read(cfg, *file);
+ }
+
+- foreach (const config &c, cfg.child_range("room")) {
++ wes_foreach (const config &c, cfg.child_range("room")) {
+ room* r(new room(c));
+ if (room_exists(r->name())) {
+ ERR_LOBBY << "Duplicate room ignored in stored rooms: "
+@@ -122,7 +122,7 @@
+ if (filename_.empty()) return;
+ LOG_LOBBY << "Writing rooms to " << filename_ << "\n";
+ config cfg;
+- foreach (const t_rooms_by_name_::value_type& v, rooms_by_name_) {
++ wes_foreach (const t_rooms_by_name_::value_type& v, rooms_by_name_) {
+ const room& r = *v.second;
+ if (r.persistent()) {
+ config& c = cfg.add_child("room");
+@@ -211,7 +211,7 @@
+
+ void room_manager::enter_lobby(const wesnothd::game &game)
+ {
+- foreach (network::connection player, game.all_game_users()) {
++ wes_foreach (network::connection player, game.all_game_users()) {
+ enter_lobby(player);
+ }
+ }
+@@ -225,7 +225,7 @@
+ store_player_rooms(player);
+ t_rooms_by_player_::iterator i = rooms_by_player_.find(player);
+ if (i != rooms_by_player_.end()) {
+- foreach (room* r, i->second) {
++ wes_foreach (room* r, i->second) {
+ r->remove_player(player);
+ }
+ }
+@@ -244,7 +244,7 @@
+ lobby_->remove_player(player);
+ t_rooms_by_player_::iterator i = rooms_by_player_.find(player);
+ if (i != rooms_by_player_.end()) {
+- foreach (room* r, i->second) {
++ wes_foreach (room* r, i->second) {
+ r->remove_player(player);
+ }
+ }
+@@ -315,7 +315,7 @@
+ t_player_stored_rooms_::iterator it =
+ player_stored_rooms_.insert(std::make_pair(player, std::set<std::string>())).first;
+ std::set<std::string>& store = it->second;
+- foreach (room* r, i->second) {
++ wes_foreach (room* r, i->second) {
+ store.insert(r->name());
+ }
+ }
+@@ -337,7 +337,7 @@
+ simple_wml::document doc;
+ simple_wml::node& join_msg = doc.root().add_child("room_join");
+ join_msg.set_attr_dup("player", user->second.name().c_str());
+- foreach (const std::string& room_name, it->second) {
++ wes_foreach (const std::string& room_name, it->second) {
+ room* r = get_create_room(room_name, user->first);
+ if (r == NULL) {
+ LOG_LOBBY << "Player " << user->second.name() << " unable to rejoin room " << room_name << "\n";
+@@ -528,7 +528,7 @@
+ void room_manager::fill_room_list(simple_wml::node& root)
+ {
+ simple_wml::node& rooms = root.add_child("rooms");
+- foreach (const t_rooms_by_name_::value_type& tr, rooms_by_name_) {
++ wes_foreach (const t_rooms_by_name_::value_type& tr, rooms_by_name_) {
+ const room& r = *tr.second;
+ simple_wml::node& room = rooms.add_child("room");
+ room.set_attr_dup("name", r.name().c_str());
+@@ -539,7 +539,7 @@
+ void room_manager::fill_member_list(const room* room, simple_wml::node& root)
+ {
+ simple_wml::node& members = root.add_child("members");
+- foreach (network::connection m, room->members()) {
++ wes_foreach (network::connection m, room->members()) {
+ simple_wml::node& member = members.add_child("member");
+ player_map::const_iterator mi = all_players_.find(m);
+ if (mi != all_players_.end()) {
+diff -ur wesnoth-1.10.3.orig/src/server/server.cpp wesnoth-1.10.3/src/server/server.cpp
+--- wesnoth-1.10.3.orig/src/server/server.cpp 2012-01-22 14:50:25.000000000 +0100
++++ wesnoth-1.10.3/src/server/server.cpp 2012-07-11 13:16:06.016600022 +0200
+@@ -556,15 +556,15 @@
+ }
+
+ redirected_versions_.clear();
+- foreach (const config &redirect, cfg_.child_range("redirect")) {
+- foreach (const std::string &version, utils::split(redirect["version"])) {
++ wes_foreach (const config &redirect, cfg_.child_range("redirect")) {
++ wes_foreach (const std::string &version, utils::split(redirect["version"])) {
+ redirected_versions_[version] = redirect;
+ }
+ }
+
+ proxy_versions_.clear();
+- foreach (const config &proxy, cfg_.child_range("proxy")) {
+- foreach (const std::string &version, utils::split(proxy["version"])) {
++ wes_foreach (const config &proxy, cfg_.child_range("proxy")) {
++ wes_foreach (const std::string &version, utils::split(proxy["version"])) {
+ proxy_versions_[version] = proxy;
+ }
+ }
+@@ -704,7 +704,7 @@
+ simple_wml::document ping( strstr.str().c_str(),
+ simple_wml::INIT_COMPRESSED );
+ simple_wml::string_span s = ping.output_compressed();
+- foreach (network::connection sock, ghost_players_) {
++ wes_foreach (network::connection sock, ghost_players_) {
+ if (!lg::debug.dont_log(log_server)) {
+ wesnothd::player_map::const_iterator i = players_.find(sock);
+ if (i != players_.end()) {
+@@ -720,7 +720,7 @@
+ // Only a single thread should be accessing this
+ // Erase before we copy - speeds inserts
+ ghost_players_.clear();
+- foreach (const wesnothd::player_map::value_type v, players_) {
++ wes_foreach (const wesnothd::player_map::value_type v, players_) {
+ ghost_players_.insert(v.first);
+ }
+ last_ping_ = now;
+diff -ur wesnoth-1.10.3.orig/src/side_filter.cpp wesnoth-1.10.3/src/side_filter.cpp
+--- wesnoth-1.10.3.orig/src/side_filter.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/side_filter.cpp 2012-07-11 13:16:06.019933355 +0200
+@@ -61,7 +61,7 @@
+ {
+ //@todo: replace with better implementation
+ std::vector<int> result;
+- foreach (const team &t, *resources::teams) {
++ wes_foreach (const team &t, *resources::teams) {
+ if (match(t)) {
+ result.push_back(t.side());
+ }
+@@ -109,7 +109,7 @@
+ else {
+ const std::vector<std::string>& these_team_names = utils::split(this_team_name);
+ bool search_futile = true;
+- foreach(const std::string& this_single_team_name, these_team_names) {
++ wes_foreach(const std::string& this_single_team_name, these_team_names) {
+ if(this_single_team_name == that_team_name) {
+ search_futile = false;
+ break;
+@@ -123,7 +123,7 @@
+ if(cfg_.has_child("has_unit")) {
+ const vconfig& unit_filter = cfg_.child("has_unit");
+ bool found = false;
+- foreach (unit &u, *resources::units) {
++ wes_foreach (unit &u, *resources::units) {
+ if (u.side() != t.side()) {
+ continue;
+ }
+@@ -134,7 +134,7 @@
+ }
+ if(!found && unit_filter["search_recall_list"].to_bool(false)) {
+ const std::vector<unit>& recall_list = t.recall_list();
+- foreach(const unit& u, recall_list) {
++ wes_foreach(const unit& u, recall_list) {
+ scoped_recall_unit this_unit("this_unit", t.save_id(), &u - &recall_list[0]);
+ if(u.matches_filter(unit_filter, u.get_location(), flat_)) {
+ found = true;
+@@ -152,7 +152,7 @@
+ side_filter s_filter(enemy_of);
+ const std::vector<int>& teams = s_filter.get_teams();
+ if(teams.empty()) return false;
+- foreach(const int side, teams) {
++ wes_foreach(const int side, teams) {
+ if(!(*resources::teams)[side - 1].is_enemy(t.side()))
+ return false;
+ }
+@@ -163,7 +163,7 @@
+ side_filter s_filter(allied_with);
+ const std::vector<int>& teams = s_filter.get_teams();
+ if(teams.empty()) return false;
+- foreach(const int side, teams) {
++ wes_foreach(const int side, teams) {
+ if((*resources::teams)[side - 1].is_enemy(t.side()))
+ return false;
+ }
+diff -ur wesnoth-1.10.3.orig/src/sound.cpp wesnoth-1.10.3/src/sound.cpp
+--- wesnoth-1.10.3.orig/src/sound.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/sound.cpp 2012-07-11 13:16:06.006600025 +0200
+@@ -596,7 +596,7 @@
+ return;
+
+ // If current track no longer on playlist, change it.
+- foreach (const music_track &m, current_track_list) {
++ wes_foreach (const music_track &m, current_track_list) {
+ if (current_track == m)
+ return;
+ }
+@@ -614,7 +614,7 @@
+ {
+ // First entry clears playlist, others append to it.
+ bool append = false;
+- foreach (music_track &m, current_track_list) {
++ wes_foreach (music_track &m, current_track_list) {
+ m.write(snapshot, append);
+ append = true;
+ }
+diff -ur wesnoth-1.10.3.orig/src/statistics.cpp wesnoth-1.10.3/src/statistics.cpp
+--- wesnoth-1.10.3.orig/src/statistics.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/statistics.cpp 2012-07-11 13:16:06.013266690 +0200
+@@ -57,7 +57,7 @@
+ team_stats(),
+ scenario_name(cfg["scenario"])
+ {
+- foreach (const config &team, cfg.child_range("team")) {
++ wes_foreach (const config &team, cfg.child_range("team")) {
+ team_stats[team["save_id"]] = stats(team);
+ }
+ }
+@@ -121,7 +121,7 @@
+ static stats::str_int_map read_str_int_map(const config& cfg)
+ {
+ stats::str_int_map m;
+- foreach (const config::attribute &i, cfg.attribute_range()) {
++ wes_foreach (const config::attribute &i, cfg.attribute_range()) {
+ m[i.first] = i.second;
+ }
+
+@@ -159,7 +159,7 @@
+ static stats::battle_result_map read_battle_result_map(const config& cfg)
+ {
+ stats::battle_result_map m;
+- foreach (const config &i, cfg.child_range("sequence"))
++ wes_foreach (const config &i, cfg.child_range("sequence"))
+ {
+ config item = i;
+ int key = item["_num"];
+@@ -612,7 +612,7 @@
+ fresh_stats();
+ mid_scenario = cfg["mid_scenario"].to_bool();
+
+- foreach (const config &s, cfg.child_range("scenario")) {
++ wes_foreach (const config &s, cfg.child_range("scenario")) {
+ master_stats.push_back(scenario_stats(s));
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/storyscreen/controller.cpp wesnoth-1.10.3/src/storyscreen/controller.cpp
+--- wesnoth-1.10.3.orig/src/storyscreen/controller.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/storyscreen/controller.cpp 2012-07-11 13:16:06.236600015 +0200
+@@ -138,7 +138,7 @@
+ // caching the scaled backgrounds can take over a decent amount of memory.
+ #ifndef LOW_MEM
+ std::vector< render_pointer_type > uis_;
+- foreach(part_pointer_type p, parts_) {
++ wes_foreach(part_pointer_type p, parts_) {
+ ASSERT_LOG( p != NULL, "Ouch: hit NULL storyscreen part in collection" );
+ render_pointer_type const rpt(new part_ui(*p, disp_, next_button, back_button, play_button));
+ uis_.push_back(rpt);
+diff -ur wesnoth-1.10.3.orig/src/storyscreen/render.cpp wesnoth-1.10.3/src/storyscreen/render.cpp
+--- wesnoth-1.10.3.orig/src/storyscreen/render.cpp 2012-02-16 21:15:27.000000000 +0100
++++ wesnoth-1.10.3/src/storyscreen/render.cpp 2012-07-11 13:16:06.036600021 +0200
+@@ -167,7 +167,7 @@
+ void part_ui::prepare_floating_images()
+ {
+ // Build floating image surfaces
+- foreach(const floating_image& fi, p_.get_floating_images()) {
++ wes_foreach(const floating_image& fi, p_.get_floating_images()) {
+ imgs_.push_back( fi.get_render_input(scale_factor_, base_rect_) );
+ }
+ }
+@@ -190,7 +190,7 @@
+ last_key_ = true;
+
+ size_t fi_n = 0;
+- foreach(floating_image::render_input& ri, imgs_) {
++ wes_foreach(floating_image::render_input& ri, imgs_) {
+ const floating_image& fi = p_.get_floating_images()[fi_n];
+
+ if(!ri.image.null()) {
+diff -ur wesnoth-1.10.3.orig/src/team.cpp wesnoth-1.10.3/src/team.cpp
+--- wesnoth-1.10.3.orig/src/team.cpp 2012-04-07 19:02:33.000000000 +0200
++++ wesnoth-1.10.3/src/team.cpp 2012-07-11 13:16:05.953266691 +0200
+@@ -318,7 +318,7 @@
+ // Was it correct?
+
+ // Load in the villages the side controls at the start
+- foreach (const config &v, cfg.child_range("village"))
++ wes_foreach (const config &v, cfg.child_range("village"))
+ {
+ map_location loc(v, resources::state_of_game);
+ if (map.is_village(loc)) {
+@@ -397,7 +397,7 @@
+ return info_.minimum_recruit_price;
+ }else{
+ int min = 20;
+- foreach(std::string recruit, info_.can_recruit){
++ wes_foreach(std::string recruit, info_.can_recruit){
+ const unit_type *ut = unit_types.find(recruit);
+ if(!ut)
+ continue;
+@@ -605,7 +605,7 @@
+ return true;
+ }
+
+- foreach (const team &t, *teams) {
++ wes_foreach (const team &t, *teams) {
+ if (t.is_human())
+ return false;
+ }
+diff -ur wesnoth-1.10.3.orig/src/terrain.cpp wesnoth-1.10.3/src/terrain.cpp
+--- wesnoth-1.10.3.orig/src/terrain.cpp 2012-02-08 02:47:55.000000000 +0100
++++ wesnoth-1.10.3/src/terrain.cpp 2012-07-11 13:16:05.949933359 +0200
+@@ -284,7 +284,7 @@
+ t_translation::t_list& terrain_list,
+ std::map<t_translation::t_terrain, terrain_type>& letter_to_terrain)
+ {
+- foreach (const config &t, cfgs)
++ wes_foreach (const config &t, cfgs)
+ {
+ terrain_type terrain(t);
+ DBG_G << "create_terrain_maps: " << terrain.number() << " "
+@@ -301,9 +301,9 @@
+ std::vector<std::string> eg2 = utils::split(terrain.editor_group());
+ std::set<std::string> egs;
+ bool clean_merge = true;
+- foreach(std::string& t, eg1)
++ wes_foreach(std::string& t, eg1)
+ clean_merge &= egs.insert(t).second;
+- foreach(std::string& t, eg2)
++ wes_foreach(std::string& t, eg2)
+ clean_merge &= egs.insert(t).second;
+
+ std::string joined = utils::join(egs);
+diff -ur wesnoth-1.10.3.orig/src/terrain_filter.cpp wesnoth-1.10.3/src/terrain_filter.cpp
+--- wesnoth-1.10.3.orig/src/terrain_filter.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/terrain_filter.cpp 2012-07-11 13:16:05.979933358 +0200
+@@ -129,7 +129,7 @@
+ }
+ } else {
+ bool found = false;
+- foreach (const config &cfg, vi.as_array()) {
++ wes_foreach (const config &cfg, vi.as_array()) {
+ if (map_location(cfg, NULL) == loc) {
+ found = true;
+ break;
+@@ -358,7 +358,7 @@
+ }
+ } else {
+ std::set<map_location> findin_locs;
+- foreach (const config &cfg, vi.as_array()) {
++ wes_foreach (const config &cfg, vi.as_array()) {
+ map_location test_loc(cfg, NULL);
+ if (xy_set.count(test_loc)) {
+ findin_locs.insert(test_loc);
+diff -ur wesnoth-1.10.3.orig/src/tests/gui/test_gui2.cpp wesnoth-1.10.3/src/tests/gui/test_gui2.cpp
+--- wesnoth-1.10.3.orig/src/tests/gui/test_gui2.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/tests/gui/test_gui2.cpp 2012-07-11 13:16:05.963266693 +0200
+@@ -139,7 +139,7 @@
+ template<class T>
+ void test_resolutions(const tresolution_list& resolutions)
+ {
+- foreach(const tresolution& resolution, resolutions) {
++ wes_foreach(const tresolution& resolution, resolutions) {
+ video().make_test_fake(resolution.first, resolution.second);
+
+ boost::scoped_ptr<gui2::tdialog> dlg(twrapper<T>::create());
+@@ -178,7 +178,7 @@
+ {
+ bool interact = false;
+ for(int i = 0; i < 2; ++i) {
+- foreach(const tresolution& resolution, resolutions) {
++ wes_foreach(const tresolution& resolution, resolutions) {
+ video().make_test_fake(resolution.first, resolution.second);
+
+ boost::scoped_ptr<gui2::tpopup> dlg(twrapper<T>::create());
+@@ -225,7 +225,7 @@
+ void test_tip_resolutions(const tresolution_list& resolutions
+ , const std::string& id)
+ {
+- foreach(const tresolution& resolution, resolutions) {
++ wes_foreach(const tresolution& resolution, resolutions) {
+ video().make_test_fake(resolution.first, resolution.second);
+
+ std::vector<std::string>& list =
+@@ -416,7 +416,7 @@
+
+ // Test size() instead of empty() to get the number of offenders
+ BOOST_CHECK_EQUAL(list.size(), 0);
+- foreach(const std::string& id, list) {
++ wes_foreach(const std::string& id, list) {
+ std::cerr << "Window '" << id << "' registered but not tested.\n";
+ }
+ }
+@@ -638,7 +638,7 @@
+ BOOST_REQUIRE_MESSAGE(result, "Failed to create a dialog.");
+
+ std::vector<map_generator*> map_generators;
+- foreach (const config &i, main_config.child_range("multiplayer")) {
++ wes_foreach (const config &i, main_config.child_range("multiplayer")) {
+ if(i["map_generation"] == "default") {
+ const config &generator_cfg = i.child("generator");
+ if (generator_cfg) {
+@@ -694,7 +694,7 @@
+ BOOST_REQUIRE_MESSAGE(cfg, "No editor time-of-day defined");
+
+ std::vector<time_of_day> tods;
+- foreach (const config &i, cfg.child_range("time")) {
++ wes_foreach (const config &i, cfg.child_range("time")) {
+ tods.push_back(time_of_day(i));
+ }
+ return new gui2::teditor_settings(NULL, tods);
+diff -ur wesnoth-1.10.3.orig/src/theme.cpp wesnoth-1.10.3/src/theme.cpp
+--- wesnoth-1.10.3.orig/src/theme.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/theme.cpp 2012-07-11 13:16:06.013266690 +0200
+@@ -162,7 +162,7 @@
+ {
+ std::vector<config> res_cfgs_;
+ // resolve all the partialresolutions
+- foreach (const config &part, top_cfg.child_range("partialresolution"))
++ wes_foreach (const config &part, top_cfg.child_range("partialresolution"))
+ {
+ // follow the inheritance hierarchy and push all the nodes on the stack
+ std::vector<const config*> parent_stack(1, &part);
+@@ -182,11 +182,11 @@
+ while (!parent_stack.empty()) {
+ //override attributes
+ res_cfgs_.back().merge_attributes(*parent_stack.back());
+- foreach (const config &rm, parent_stack.back()->child_range("remove")) {
++ wes_foreach (const config &rm, parent_stack.back()->child_range("remove")) {
+ find_ref(rm["id"], res_cfgs_.back(), true);
+ }
+
+- foreach (const config &chg, parent_stack.back()->child_range("change"))
++ wes_foreach (const config &chg, parent_stack.back()->child_range("change"))
+ {
+ config &target = find_ref(chg["id"], res_cfgs_.back());
+ target.merge_attributes(chg);
+@@ -195,7 +195,7 @@
+ // cannot add [status] sub-elements, but who cares
+ if (const config &c = parent_stack.back()->child("add"))
+ {
+- foreach (const config::any_child &j, c.all_children_range()) {
++ wes_foreach (const config::any_child &j, c.all_children_range()) {
+ res_cfgs_.back().add_child(j.key, j.cfg);
+ }
+ }
+@@ -204,7 +204,7 @@
+ }
+ }
+ // Add all the resolutions
+- foreach (const config &res, top_cfg.child_range("resolution")) {
++ wes_foreach (const config &res, top_cfg.child_range("resolution")) {
+ dst_cfg.add_child("resolution", res);
+ }
+ // Add all the resolved resolutions
+@@ -217,7 +217,7 @@
+ static void do_resolve_rects(const config& cfg, config& resolved_config, config* resol_cfg = NULL) {
+
+ // recursively resolve children
+- foreach (const config::any_child &value, cfg.all_children_range()) {
++ wes_foreach (const config::any_child &value, cfg.all_children_range()) {
+ config &childcfg = resolved_config.add_child(value.key);
+ do_resolve_rects(value.cfg, childcfg,
+ value.key == "resolution" ? &childcfg : resol_cfg);
+@@ -549,7 +549,7 @@
+
+ int current_rating = 1000000;
+ const config *current = NULL;
+- foreach (const config &i, cfg_.child_range("resolution"))
++ wes_foreach (const config &i, cfg_.child_range("resolution"))
+ {
+ int width = i["width"];
+ int height = i["height"];
+@@ -611,7 +611,7 @@
+
+ if (const config &status_cfg = cfg.child("status"))
+ {
+- foreach (const config::any_child &i, status_cfg.all_children_range()) {
++ wes_foreach (const config::any_child &i, status_cfg.all_children_range()) {
+ status_.insert(std::pair<std::string, status_item>(i.key, status_item(i.cfg)));
+ }
+ if (const config &unit_image_cfg = status_cfg.child("unit_image")) {
+@@ -621,19 +621,19 @@
+ }
+ }
+
+- foreach (const config &p, cfg.child_range("panel")) {
++ wes_foreach (const config &p, cfg.child_range("panel")) {
+ panel new_panel(p);
+ set_object_location(new_panel, p["rect"], p["ref"]);
+ panels_.push_back(new_panel);
+ }
+
+- foreach (const config &lb, cfg.child_range("label")) {
++ wes_foreach (const config &lb, cfg.child_range("label")) {
+ label new_label(lb);
+ set_object_location(new_label, lb["rect"], lb["ref"]);
+ labels_.push_back(new_label);
+ }
+
+- foreach (const config &m, cfg.child_range("menu"))
++ wes_foreach (const config &m, cfg.child_range("menu"))
+ {
+ menu new_menu(m);
+ DBG_DP << "adding menu: " << (new_menu.is_context() ? "is context" : "not context") << "\n";
+@@ -699,7 +699,7 @@
+ }
+
+ // Change existing theme objects.
+- foreach (const config &c, cfg.child_range("change"))
++ wes_foreach (const config &c, cfg.child_range("change"))
+ {
+ std::string id = c["id"];
+ std::string ref_id = c["ref"];
+@@ -709,12 +709,12 @@
+ }
+
+ // Add new theme objects.
+- foreach (const config &c, cfg.child_range("add")) {
++ wes_foreach (const config &c, cfg.child_range("add")) {
+ add_object(c);
+ }
+
+ // Remove existent theme objects.
+- foreach (const config &c, cfg.child_range("remove")) {
++ wes_foreach (const config &c, cfg.child_range("remove")) {
+ remove_object(c["id"]);
+ }
+
+@@ -758,7 +758,7 @@
+ if (!cfg)
+ return;
+
+- foreach (const config &thm, cfg->child_range("theme"))
++ wes_foreach (const config &thm, cfg->child_range("theme"))
+ {
+ std::string thm_name = thm["name"];
+ if (!thm["hidden"].to_bool(false))
+@@ -778,7 +778,7 @@
+
+ const theme::menu *theme::get_menu_item(const std::string &key) const
+ {
+- foreach (const theme::menu &m, menus_) {
++ wes_foreach (const theme::menu &m, menus_) {
+ if (m.get_id() == key) return &m;
+ }
+ return NULL;
+diff -ur wesnoth-1.10.3.orig/src/time_of_day.cpp wesnoth-1.10.3/src/time_of_day.cpp
+--- wesnoth-1.10.3.orig/src/time_of_day.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/time_of_day.cpp 2012-07-11 13:16:05.983266692 +0200
+@@ -62,7 +62,7 @@
+
+ void time_of_day::parse_times(const config& cfg, std::vector<time_of_day>& normal_times)
+ {
+- foreach (const config &t, cfg.child_range("time")) {
++ wes_foreach (const config &t, cfg.child_range("time")) {
+ normal_times.push_back(time_of_day(t));
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/tod_manager.cpp wesnoth-1.10.3/src/tod_manager.cpp
+--- wesnoth-1.10.3.orig/src/tod_manager.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/tod_manager.cpp 2012-07-11 13:16:05.996600022 +0200
+@@ -279,7 +279,7 @@
+ void tod_manager::set_new_current_times(const int new_current_turn_number)
+ {
+ currentTime_ = calculate_current_time(times_.size(), new_current_turn_number, currentTime_);
+- foreach(area_time_of_day& area, areas_) {
++ wes_foreach(area_time_of_day& area, areas_) {
+ area.currentTime = calculate_current_time(
+ area.times.size(),
+ new_current_turn_number,
+diff -ur wesnoth-1.10.3.orig/src/tools/exploder_cutter.cpp wesnoth-1.10.3/src/tools/exploder_cutter.cpp
+--- wesnoth-1.10.3.orig/src/tools/exploder_cutter.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/tools/exploder_cutter.cpp 2012-07-11 13:16:05.963266693 +0200
+@@ -48,7 +48,7 @@
+
+ void cutter::load_masks(const config& conf)
+ {
+- foreach (const config &m, conf.child_range("mask"))
++ wes_foreach (const config &m, conf.child_range("mask"))
+ {
+ const std::string name = m["name"];
+ const std::string image = get_mask_dir() + "/" + std::string(m["image"]);
+@@ -94,7 +94,7 @@
+ {
+ surface_map res;
+
+- foreach (const config &part, conf.child_range("part")) {
++ wes_foreach (const config &part, conf.child_range("part")) {
+ add_sub_image(surf, res, &part);
+ }
+
+diff -ur wesnoth-1.10.3.orig/src/tools/schema/tag.cpp wesnoth-1.10.3/src/tools/schema/tag.cpp
+--- wesnoth-1.10.3.orig/src/tools/schema/tag.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/tools/schema/tag.cpp 2012-07-11 13:16:05.963266693 +0200
+@@ -81,15 +81,15 @@
+ if (cfg.has_attribute("super")){
+ super_ = cfg["super"].str();
+ }
+- foreach (const config &child, cfg.child_range("tag")) {
++ wes_foreach (const config &child, cfg.child_range("tag")) {
+ class_tag child_tag (child);
+ add_tag(child_tag);
+ }
+- foreach (const config &child, cfg.child_range("key")) {
++ wes_foreach (const config &child, cfg.child_range("key")) {
+ class_key child_key (child);
+ add_key(child_key);
+ }
+- foreach (const config &link, cfg.child_range("link")) {
++ wes_foreach (const config &link, cfg.child_range("link")) {
+ std::string link_name = link["name"].str();
+ add_link(link_name);
+ }
+diff -ur wesnoth-1.10.3.orig/src/tooltips.cpp wesnoth-1.10.3/src/tooltips.cpp
+--- wesnoth-1.10.3.orig/src/tooltips.cpp 2012-03-18 15:57:27.000000000 +0100
++++ wesnoth-1.10.3/src/tooltips.cpp 2012-07-11 13:16:05.973266690 +0200
+@@ -172,7 +172,7 @@
+
+ bool click(int mousex, int mousey)
+ {
+- foreach(tooltip tip, tips) {
++ wes_foreach(tooltip tip, tips) {
+ if(!tip.action.empty() && point_in_rect(mousex, mousey, tip.rect)) {
+ display* disp = resources::screen;
+ help::show_help(*disp, tip.action);
+diff -ur wesnoth-1.10.3.orig/src/unit_abilities.cpp wesnoth-1.10.3/src/unit_abilities.cpp
+--- wesnoth-1.10.3.orig/src/unit_abilities.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/unit_abilities.cpp 2012-07-11 13:16:06.239933349 +0200
+@@ -124,7 +124,7 @@
+ {
+ if (const config &abilities = cfg_.child("abilities"))
+ {
+- foreach (const config &i, abilities.child_range(ability)) {
++ wes_foreach (const config &i, abilities.child_range(ability)) {
+ if (ability_active(ability, i, loc) &&
+ ability_affects_self(ability, i, loc))
+ return true;
+@@ -141,7 +141,7 @@
+ const config &adj_abilities = it->cfg_.child("abilities");
+ if (!adj_abilities)
+ continue;
+- foreach (const config &j, adj_abilities.child_range(ability)) {
++ wes_foreach (const config &j, adj_abilities.child_range(ability)) {
+ if (unit_abilities::affects_side(j, teams_manager::get_teams(), side(), it->side()) &&
+ it->ability_active(ability, j, adjacent[i]) &&
+ ability_affects_adjacent(ability, j, i, loc))
+@@ -158,7 +158,7 @@
+
+ if (const config &abilities = cfg_.child("abilities"))
+ {
+- foreach (const config &i, abilities.child_range(ability)) {
++ wes_foreach (const config &i, abilities.child_range(ability)) {
+ if (ability_active(ability, i, loc) &&
+ ability_affects_self(ability, i, loc))
+ res.cfgs.push_back(std::pair<const config *, map_location>(&i, loc));
+@@ -175,7 +175,7 @@
+ const config &adj_abilities = it->cfg_.child("abilities");
+ if (!adj_abilities)
+ continue;
+- foreach (const config &j, adj_abilities.child_range(ability)) {
++ wes_foreach (const config &j, adj_abilities.child_range(ability)) {
+ if (unit_abilities::affects_side(j, teams_manager::get_teams(), side(), it->side()) &&
+ it->ability_active(ability, j, adjacent[i]) &&
+ ability_affects_adjacent(ability, j, i, loc))
+@@ -193,7 +193,7 @@
+
+ const config &abilities = cfg_.child("abilities");
+ if (!abilities) return res;
+- foreach (const config::any_child &ab, abilities.all_children_range()) {
++ wes_foreach (const config::any_child &ab, abilities.all_children_range()) {
+ std::string const &id = ab.cfg["id"];
+ if (!id.empty())
+ res.push_back(id);
+@@ -208,7 +208,7 @@
+ const config &abilities = cfg_.child("abilities");
+ if (!abilities) return res;
+
+- foreach (const config::any_child &ab, abilities.all_children_range())
++ wes_foreach (const config::any_child &ab, abilities.all_children_range())
+ {
+ if (force_active || ability_active(ab.key, ab.cfg, loc_))
+ {
+@@ -265,9 +265,9 @@
+ get_adjacent_tiles(loc,adjacent);
+ const unit_map& units = *resources::units;
+
+- foreach (const config &i, cfg.child_range("filter_adjacent"))
++ wes_foreach (const config &i, cfg.child_range("filter_adjacent"))
+ {
+- foreach (const std::string &j, utils::split(i["adjacent"]))
++ wes_foreach (const std::string &j, utils::split(i["adjacent"]))
+ {
+ map_location::DIRECTION index =
+ map_location::parse_direction(j);
+@@ -282,9 +282,9 @@
+ }
+ }
+
+- foreach (const config &i, cfg.child_range("filter_adjacent_location"))
++ wes_foreach (const config &i, cfg.child_range("filter_adjacent_location"))
+ {
+- foreach (const std::string &j, utils::split(i["adjacent"]))
++ wes_foreach (const std::string &j, utils::split(i["adjacent"]))
+ {
+ map_location::DIRECTION index = map_location::parse_direction(j);
+ if (index == map_location::NDIRECTIONS) {
+@@ -310,7 +310,7 @@
+
+ assert(dir >=0 && dir <= 5);
+ static const std::string adjacent_names[6] = {"n","ne","se","s","sw","nw"};
+- foreach (const config &i, cfg.child_range("affect_adjacent"))
++ wes_foreach (const config &i, cfg.child_range("affect_adjacent"))
+ {
+ std::vector<std::string> dirs = utils::split(i["adjacent"]);
+ if(std::find(dirs.begin(),dirs.end(),adjacent_names[dir]) != dirs.end()) {
+@@ -366,7 +366,7 @@
+ int flat = 0;
+ int stack = 0;
+ typedef std::pair<const config *, map_location> pt;
+- foreach (pt const &p, cfgs)
++ wes_foreach (pt const &p, cfgs)
+ {
+ int value = (*p.first)[key].to_int(def);
+ if ((*p.first)["cumulative"].to_bool()) {
+@@ -398,7 +398,7 @@
+ int flat = 0;
+ int stack = 0;
+ typedef std::pair<const config *, map_location> pt;
+- foreach (pt const &p, cfgs)
++ wes_foreach (pt const &p, cfgs)
+ {
+ int value = (*p.first)[key].to_int(def);
+ if ((*p.first)["cumulative"].to_bool()) {
+@@ -448,7 +448,7 @@
+ namespace {
+ bool get_special_children(std::vector<const config*>& result, const config& parent,
+ const std::string& id, bool just_peeking=false) {
+- foreach (const config::any_child &sp, parent.all_children_range())
++ wes_foreach (const config::any_child &sp, parent.all_children_range())
+ {
+ if (sp.key == id || sp.cfg["id"] == id) {
+ if(just_peeking) {
+@@ -495,7 +495,7 @@
+ unit_ability_list res;
+ if (const config &specials = cfg_.child("specials"))
+ {
+- foreach (const config &i, specials.child_range(special)) {
++ wes_foreach (const config &i, specials.child_range(special)) {
+ if (special_active(i, true))
+ res.cfgs.push_back(std::pair<const config *, map_location>
+ (&i, attacker_ ? aloc_ : dloc_));
+@@ -504,7 +504,7 @@
+ if (!other_attack_) return res;
+ if (const config &specials = other_attack_->cfg_.child("specials"))
+ {
+- foreach (const config &i, specials.child_range(special)) {
++ wes_foreach (const config &i, specials.child_range(special)) {
+ if (other_attack_->special_active(i, false))
+ res.cfgs.push_back(std::pair<const config *, map_location>
+ (&i, attacker_ ? dloc_ : aloc_));
+@@ -519,7 +519,7 @@
+ const config &specials = cfg_.child("specials");
+ if (!specials) return res;
+
+- foreach (const config::any_child &sp, specials.all_children_range())
++ wes_foreach (const config::any_child &sp, specials.all_children_range())
+ {
+ if (force || special_active(sp.cfg, true)) {
+ const t_string &name = sp.cfg["name"];
+@@ -544,7 +544,7 @@
+ const config &specials = cfg_.child("specials");
+ if (!specials) return res;
+
+- foreach (const config::any_child &sp, specials.all_children_range())
++ wes_foreach (const config::any_child &sp, specials.all_children_range())
+ {
+ char const *s = force || special_active(sp.cfg, true) ?
+ "name" : "name_inactive";
+@@ -679,9 +679,9 @@
+ get_adjacent_tiles(dloc_,adjacent);
+ }
+
+- foreach (const config &i, cfg.child_range("filter_adjacent"))
++ wes_foreach (const config &i, cfg.child_range("filter_adjacent"))
+ {
+- foreach (const std::string &j, utils::split(i["adjacent"]))
++ wes_foreach (const std::string &j, utils::split(i["adjacent"]))
+ {
+ map_location::DIRECTION index =
+ map_location::parse_direction(j);
+@@ -694,9 +694,9 @@
+ }
+ }
+
+- foreach (const config &i, cfg.child_range("filter_adjacent_location"))
++ wes_foreach (const config &i, cfg.child_range("filter_adjacent_location"))
+ {
+- foreach (const std::string &j, utils::split(i["adjacent"]))
++ wes_foreach (const std::string &j, utils::split(i["adjacent"]))
+ {
+ map_location::DIRECTION index =
+ map_location::parse_direction(j);
+diff -ur wesnoth-1.10.3.orig/src/unit_animation.cpp wesnoth-1.10.3/src/unit_animation.cpp
+--- wesnoth-1.10.3.orig/src/unit_animation.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/unit_animation.cpp 2012-07-11 13:16:05.969933358 +0200
+@@ -78,7 +78,7 @@
+ config merge() const
+ {
+ config result = attributes;
+- foreach (const config::all_children_iterator &i, children)
++ wes_foreach (const config::all_children_iterator &i, children)
+ result.add_child(i->key, i->cfg);
+ return result;
+ }
+@@ -99,7 +99,7 @@
+ animation_cursor(const config &cfg, animation_cursor *p):
+ itors(cfg.all_children_range()), branches(p->branches), parent(p)
+ {
+- foreach (animation_branch &ab, branches)
++ wes_foreach (animation_branch &ab, branches)
+ ab.attributes.merge_attributes(cfg);
+ }
+ };
+@@ -122,7 +122,7 @@
+ if (ac.itors.first->key != "if")
+ {
+ // Append current config object to all the branches in scope.
+- foreach (animation_branch &ab, ac.branches) {
++ wes_foreach (animation_branch &ab, ac.branches) {
+ ab.children.push_back(ac.itors.first);
+ }
+ ++ac.itors.first;
+@@ -154,7 +154,7 @@
+ static animation_branches prepare_animation(const config &cfg, const std::string &animation_tag)
+ {
+ animation_branches expanded_animations;
+- foreach (const config &anim, cfg.child_range(animation_tag)) {
++ wes_foreach (const config &anim, cfg.child_range(animation_tag)) {
+ prepare_single_animation(anim, expanded_animations);
+ }
+ return expanded_animations;
+@@ -207,7 +207,7 @@
+ overlaped_hex_()
+ {
+ // if(!cfg["debug"].empty()) printf("DEBUG WML: FINAL\n%s\n\n",cfg.debug().c_str());
+- foreach (const config::any_child &fr, cfg.all_children_range())
++ wes_foreach (const config::any_child &fr, cfg.all_children_range())
+ {
+ if (fr.key == frame_string) continue;
+ if (fr.key.find("_frame", fr.key.size() - 6) == std::string::npos) continue;
+@@ -221,11 +221,11 @@
+ const map_location::DIRECTION d = map_location::parse_direction(*i);
+ directions_.push_back(d);
+ }
+- foreach (const config &filter, cfg.child_range("filter")) {
++ wes_foreach (const config &filter, cfg.child_range("filter")) {
+ unit_filter_.push_back(filter);
+ }
+
+- foreach (const config &filter, cfg.child_range("filter_second")) {
++ wes_foreach (const config &filter, cfg.child_range("filter_second")) {
+ secondary_unit_filter_.push_back(filter);
+ }
+
+@@ -253,10 +253,10 @@
+ for(value2=value2_str.begin() ; value2 != value2_str.end() ; ++value2) {
+ value2_.push_back(atoi(value2->c_str()));
+ }
+- foreach (const config &filter, cfg.child_range("filter_attack")) {
++ wes_foreach (const config &filter, cfg.child_range("filter_attack")) {
+ primary_attack_filter_.push_back(filter);
+ }
+- foreach (const config &filter, cfg.child_range("filter_second_attack")) {
++ wes_foreach (const config &filter, cfg.child_range("filter_second_attack")) {
+ secondary_attack_filter_.push_back(filter);
+ }
+ play_offscreen_ = cfg["offscreen"].to_bool(true);
+@@ -487,7 +487,7 @@
+ display::tdrawing_layer layer = display::LAYER_UNIT_DEFAULT,
+ bool offscreen = true)
+ {
+- foreach (const animation_branch &ab, prepare_animation(cfg, tag_name))
++ wes_foreach (const animation_branch &ab, prepare_animation(cfg, tag_name))
+ {
+ config anim = ab.merge();
+ anim["apply_to"] = apply_to;
+@@ -503,7 +503,7 @@
+
+ void unit_animation::add_anims( std::vector<unit_animation> & animations, const config & cfg)
+ {
+- foreach (const animation_branch &ab, prepare_animation(cfg, "animation")) {
++ wes_foreach (const animation_branch &ab, prepare_animation(cfg, "animation")) {
+ animations.push_back(unit_animation(ab.merge()));
+ }
+
+@@ -519,7 +519,7 @@
+ add_simple_anim(animations, cfg, "levelin_anim", "levelin");
+ add_simple_anim(animations, cfg, "levelout_anim", "levelout");
+
+- foreach (const animation_branch &ab, prepare_animation(cfg, "standing_anim"))
++ wes_foreach (const animation_branch &ab, prepare_animation(cfg, "standing_anim"))
+ {
+ config anim = ab.merge();
+ anim["apply_to"] = "default";
+@@ -528,7 +528,7 @@
+ if (anim["offscreen"].empty()) anim["offscreen"] = false;
+ animations.push_back(unit_animation(anim));
+ }
+- foreach (const animation_branch &ab, prepare_animation(cfg, "standing_anim"))
++ wes_foreach (const animation_branch &ab, prepare_animation(cfg, "standing_anim"))
+ {
+ config anim = ab.merge();
+ anim["apply_to"] = "standing";
+@@ -537,7 +537,7 @@
+ if (anim["offscreen"].empty()) anim["offscreen"] = false;
+ animations.push_back(unit_animation(anim));
+ }
+- foreach (const animation_branch &ab, prepare_animation(cfg, "healing_anim"))
++ wes_foreach (const animation_branch &ab, prepare_animation(cfg, "healing_anim"))
+ {
+ config anim = ab.merge();
+ anim["apply_to"] = "healing";
+@@ -546,7 +546,7 @@
+ animations.push_back(unit_animation(anim));
+ }
+
+- foreach (const animation_branch &ab, prepare_animation(cfg, "healed_anim"))
++ wes_foreach (const animation_branch &ab, prepare_animation(cfg, "healed_anim"))
+ {
+ config anim = ab.merge();
+ anim["apply_to"] = "healed";
+@@ -558,7 +558,7 @@
+ animations.back().sub_anims_["_healed_sound"].add_frame(1,frame_builder().sound("heal.wav"),true);
+ }
+
+- foreach (const animation_branch &ab, prepare_animation(cfg, "poison_anim"))
++ wes_foreach (const animation_branch &ab, prepare_animation(cfg, "poison_anim"))
+ {
+ config anim = ab.merge();
+ anim["apply_to"] ="poisoned";
+@@ -572,7 +572,7 @@
+
+ add_simple_anim(animations, cfg, "pre_movement_anim", "pre_movement", display::LAYER_UNIT_MOVE_DEFAULT);
+
+- foreach (const animation_branch &ab, prepare_animation(cfg, "movement_anim"))
++ wes_foreach (const animation_branch &ab, prepare_animation(cfg, "movement_anim"))
+ {
+ config anim = ab.merge();
+ if (anim["offset"].empty()) {
+@@ -585,7 +585,7 @@
+
+ add_simple_anim(animations, cfg, "post_movement_anim", "post_movement", display::LAYER_UNIT_MOVE_DEFAULT);
+
+- foreach (const animation_branch &ab, prepare_animation(cfg, "defend"))
++ wes_foreach (const animation_branch &ab, prepare_animation(cfg, "defend"))
+ {
+ config anim = ab.merge();
+ anim["apply_to"] = "defend";
+@@ -607,7 +607,7 @@
+ else
+ {
+ std::vector<std::string> v = utils::split(anim["hits"]);
+- foreach (const std::string &hit_type, v)
++ wes_foreach (const std::string &hit_type, v)
+ {
+ config tmp = anim;
+ tmp["hits"] = hit_type;
+@@ -625,7 +625,7 @@
+ add_simple_anim(animations, cfg, "draw_weapon_anim", "draw_wepaon", display::LAYER_UNIT_MOVE_DEFAULT);
+ add_simple_anim(animations, cfg, "sheath_weapon_anim", "sheath_wepaon", display::LAYER_UNIT_MOVE_DEFAULT);
+
+- foreach (const animation_branch &ab, prepare_animation(cfg, "attack_anim"))
++ wes_foreach (const animation_branch &ab, prepare_animation(cfg, "attack_anim"))
+ {
+ config anim = ab.merge();
+ anim["apply_to"] = "attack";
+@@ -646,7 +646,7 @@
+ animations.push_back(unit_animation(anim));
+ }
+
+- foreach (const animation_branch &ab, prepare_animation(cfg, "death"))
++ wes_foreach (const animation_branch &ab, prepare_animation(cfg, "death"))
+ {
+ config anim = ab.merge();
+ anim["apply_to"] = "death";
+@@ -663,7 +663,7 @@
+
+ add_simple_anim(animations, cfg, "victory_anim", "victory");
+
+- foreach (const animation_branch &ab, prepare_animation(cfg, "extra_anim"))
++ wes_foreach (const animation_branch &ab, prepare_animation(cfg, "extra_anim"))
+ {
+ config anim = ab.merge();
+ anim["apply_to"] = anim["flag"];
+@@ -671,7 +671,7 @@
+ animations.push_back(unit_animation(anim));
+ }
+
+- foreach (const animation_branch &ab, prepare_animation(cfg, "teleport_anim"))
++ wes_foreach (const animation_branch &ab, prepare_animation(cfg, "teleport_anim"))
+ {
+ config anim = ab.merge();
+ if (anim["layer"].empty()) anim["layer"] = default_layer;
+@@ -742,14 +742,14 @@
+ config::const_child_itors range = cfg.child_range(frame_string+"frame");
+ starting_frame_time_=INT_MAX;
+ if(cfg[frame_string+"start_time"].empty() &&range.first != range.second) {
+- foreach (const config &frame, range) {
++ wes_foreach (const config &frame, range) {
+ starting_frame_time_ = std::min(starting_frame_time_, frame["begin"].to_int());
+ }
+ } else {
+ starting_frame_time_ = cfg[frame_string+"start_time"];
+ }
+
+- foreach (const config &frame, range)
++ wes_foreach (const config &frame, range)
+ {
+ unit_frame tmp_frame(frame);
+ add_frame(tmp_frame.duration(),tmp_frame,!tmp_frame.does_not_change());
+diff -ur wesnoth-1.10.3.orig/src/unit.cpp wesnoth-1.10.3/src/unit.cpp
+--- wesnoth-1.10.3.orig/src/unit.cpp 2012-04-06 18:38:23.000000000 +0200
++++ wesnoth-1.10.3/src/unit.cpp 2012-07-11 13:16:05.959933359 +0200
+@@ -288,7 +288,7 @@
+ filter_recall_ = filter_recall.get_config();
+
+ const vconfig::child_list& events = vcfg->get_children("event");
+- foreach(const vconfig& e, events) {
++ wes_foreach(const vconfig& e, events) {
+ events_.add_child("event", e.get_config());
+ }
+ }
+@@ -296,7 +296,7 @@
+ {
+ filter_recall_ = cfg.child_or_empty("filter_recall");
+
+- foreach(const config& unit_event, cfg.child_range("event")) {
++ wes_foreach(const config& unit_event, cfg.child_range("event")) {
+ events_.add_child("event", unit_event);
+ }
+ }
+@@ -375,7 +375,7 @@
+ formula_vars_ = new game_logic::map_formula_callable;
+
+ variant var;
+- foreach (const config::attribute &i, ai_vars.attribute_range()) {
++ wes_foreach (const config::attribute &i, ai_vars.attribute_range()) {
+ var.serialize_from_string(i.second);
+ formula_vars_->add(i.first, var);
+ }
+@@ -432,7 +432,7 @@
+
+ if (const config &status_flags = cfg.child("status"))
+ {
+- foreach (const config::attribute &st, status_flags.attribute_range()) {
++ wes_foreach (const config::attribute &st, status_flags.attribute_range()) {
+ if (st.first == "healable") {
+ ///@deprecated 1.9.2 'healable' instead of 'unhealable'
+ ERR_UT << "Usage of 'healable' is deprecated, use 'unhealable' instead, "
+@@ -449,7 +449,7 @@
+ }
+
+ // Remove animations from private cfg, they're not needed there now
+- foreach(const std::string& tag_name, unit_animation::all_tag_names()) {
++ wes_foreach(const std::string& tag_name, unit_animation::all_tag_names()) {
+ cfg_.clear_children(tag_name);
+ }
+
+@@ -518,7 +518,7 @@
+ "canrecruit", "extra_recruit", "x", "y", "placement",
+ // Useless attributes created when saving units to WML:
+ "flag_rgb", "language_name" };
+- foreach (const char *attr, internalized_attrs) {
++ wes_foreach (const char *attr, internalized_attrs) {
+ input_cfg.remove_attribute(attr);
+ cfg_.remove_attribute(attr);
+ }
+@@ -526,11 +526,11 @@
+ static char const *raw_attrs[] = { "description", "halo",
+ "profile", "small_profile", "upkeep", "usage", "ellipse",
+ "image", "image_icon", "random_traits", "generate_name" };
+- foreach (const char *attr, raw_attrs) {
++ wes_foreach (const char *attr, raw_attrs) {
+ input_cfg.remove_attribute(attr);
+ }
+
+- foreach (const config::attribute &attr, input_cfg.attribute_range()) {
++ wes_foreach (const config::attribute &attr, input_cfg.attribute_range()) {
+ if (attr.first == "do_not_list") continue;
+ WRN_UT << "Unknown attribute '" << attr.first << "' discarded.\n";
+ }
+@@ -715,12 +715,12 @@
+ config::const_child_itors current_traits = modifications_.child_range("trait");
+ std::vector<config> candidate_traits;
+
+- foreach (const config &t, type->possible_traits())
++ wes_foreach (const config &t, type->possible_traits())
+ {
+ // Skip the trait if the unit already has it.
+ const std::string &tid = t["id"];
+ bool already = false;
+- foreach (const config &mod, current_traits)
++ wes_foreach (const config &mod, current_traits)
+ {
+ if (mod["id"] == tid) {
+ already = true;
+@@ -767,7 +767,7 @@
+ {
+ std::vector<std::string> res;
+
+- foreach (const config &mod, modifications_.child_range("trait"))
++ wes_foreach (const config &mod, modifications_.child_range("trait"))
+ {
+ std::string const &id = mod["id"];
+ if (!id.empty())
+@@ -797,7 +797,7 @@
+ config new_cfg;
+ static char const *persistent_attrs[] = { "upkeep", "ellipse",
+ "image", "image_icon", "usage", "random_traits", "generate_name" };
+- foreach (const char *attr, persistent_attrs) {
++ wes_foreach (const char *attr, persistent_attrs) {
+ if (const config::attribute_value *v = old_cfg.get(attr)) {
+ new_cfg[attr] = *v;
+ }
+@@ -813,7 +813,7 @@
+ static char const *unit_type_attrs[] = { "movement", "movement_type",
+ "die_sound", "flies", "inherit", "variation_name",
+ "ignore_race_traits", "hide_help" };
+- foreach (const char *attr, unit_type_attrs) {
++ wes_foreach (const char *attr, unit_type_attrs) {
+ new_cfg.remove_attribute(attr);
+ }
+
+@@ -1020,7 +1020,7 @@
+ const std::vector<std::string> unit::advances_to_translated() const
+ {
+ std::vector<std::string> result;
+- foreach (std::string type_id, advances_to_)
++ wes_foreach (std::string type_id, advances_to_)
+ {
+ const unit_type *type = unit_types.find(type_id);
+ if (type)
+@@ -1120,7 +1120,7 @@
+ const std::map<std::string,std::string> unit::get_states() const
+ {
+ std::map<std::string, std::string> all_states;
+- foreach (std::string const &s, states_) {
++ wes_foreach (std::string const &s, states_) {
+ all_states[s] = "yes";
+ }
+ for (std::map<std::string, state_t>::const_iterator i = known_boolean_state_names_.begin(),
+@@ -1195,7 +1195,7 @@
+ {
+ if (const config &abil = cfg_.child("abilities"))
+ {
+- foreach (const config::any_child &ab, abil.all_children_range()) {
++ wes_foreach (const config::any_child &ab, abil.all_children_range()) {
+ if (ab.cfg["id"] == ability)
+ return true;
+ }
+@@ -2197,7 +2197,7 @@
+ if (const config &resistance = cfg_.child("resistance"))
+ {
+ utils::string_map res;
+- foreach (const config::attribute &i, resistance.attribute_range()) {
++ wes_foreach (const config::attribute &i, resistance.attribute_range()) {
+ res[i.first] = i.second;
+ }
+ return res;
+@@ -2222,7 +2222,7 @@
+ {
+ std::ostringstream tooltip;
+ const std::string &image = game_config::images::level;
+- foreach (const std::string &s, advances_to())
++ wes_foreach (const std::string &s, advances_to())
+ {
+ if (!s.empty())
+ tooltip << s << '\n';
+@@ -2230,7 +2230,7 @@
+ temp[image] = tooltip.str();
+ }
+
+- foreach (const config &adv, get_modification_advances())
++ wes_foreach (const config &adv, get_modification_advances())
+ {
+ const std::string &image = adv["image"];
+ if (image.empty()) continue;
+@@ -2248,7 +2248,7 @@
+ std::vector<std::pair<std::string,std::string> > temp;
+ std::pair<std::string,std::string> icon; //<image,tooltip>
+
+- foreach (const config &adv, get_modification_advances())
++ wes_foreach (const config &adv, get_modification_advances())
+ {
+ icon.first = adv["icon"].str();
+ icon.second = adv["description"].str();
+@@ -2265,7 +2265,7 @@
+ std::vector<config> unit::get_modification_advances() const
+ {
+ std::vector<config> res;
+- foreach (const config &adv, modification_advancements())
++ wes_foreach (const config &adv, modification_advancements())
+ {
+ if (adv["strict_amla"].to_bool() && !advances_to_.empty())
+ continue;
+@@ -2283,7 +2283,7 @@
+ std::unique_copy(temp.begin(), temp.end(), std::back_inserter(uniq));
+
+ bool requirements_done = true;
+- foreach (const std::string &s, uniq)
++ wes_foreach (const std::string &s, uniq)
+ {
+ int required_num = std::count(temp.begin(), temp.end(), s);
+ int mod_num = modification_count("advance", s);
+@@ -2302,7 +2302,7 @@
+ size_t unit::modification_count(const std::string& type, const std::string& id) const
+ {
+ size_t res = 0;
+- foreach (const config &item, modifications_.child_range(type)) {
++ wes_foreach (const config &item, modifications_.child_range(type)) {
+ if (item["id"] == id) {
+ ++res;
+ }
+@@ -2314,7 +2314,7 @@
+ /** Helper function for add_modifications */
+ static void mod_mdr_merge(config& dst, const config& mod, bool delta)
+ {
+- foreach (const config::attribute &i, mod.attribute_range()) {
++ wes_foreach (const config::attribute &i, mod.attribute_range()) {
+ int v = 0;
+ if (delta) v = dst[i.first];
+ dst[i.first] = v + i.second.to_int();
+@@ -2336,7 +2336,7 @@
+ }
+ config last_effect;
+ std::vector<t_string> effects_description;
+- foreach (const config &effect, mod.child_range("effect"))
++ wes_foreach (const config &effect, mod.child_range("effect"))
+ {
+ // See if the effect only applies to certain unit types
+ const std::string &type_filter = effect["unit_type"];
+@@ -2524,7 +2524,7 @@
+ config &def = cfg_.child_or_add("defense");
+ if (const config &ap = effect.child("defense")) {
+ bool replace = effect["replace"].to_bool();
+- foreach (const config::attribute &i, ap.attribute_range()) {
++ wes_foreach (const config::attribute &i, ap.attribute_range()) {
+ int v = i.second.to_int();
+ config::attribute_value &dst = def[i.first];
+ if (!replace) {
+@@ -2551,7 +2551,7 @@
+ config &ab = cfg_.child_or_add("abilities");
+ if (const config &ab_effect = effect.child("abilities")) {
+ config to_append;
+- foreach (const config::any_child &ab, ab_effect.all_children_range()) {
++ wes_foreach (const config::any_child &ab, ab_effect.all_children_range()) {
+ if(!has_ability_by_id(ab.cfg["id"])) {
+ to_append.add_child(ab.key, ab.cfg);
+ }
+@@ -2560,7 +2560,7 @@
+ }
+ } else if (apply_to == "remove_ability") {
+ if (const config &ab_effect = effect.child("abilities")) {
+- foreach (const config::any_child &ab, ab_effect.all_children_range()) {
++ wes_foreach (const config::any_child &ab, ab_effect.all_children_range()) {
+ remove_ability_by_id(ab.cfg["id"]);
+ }
+ }
+@@ -2749,7 +2749,7 @@
+
+ for(size_t i = 0; i != NumModificationTypes; ++i) {
+ const std::string& mod = ModificationTypes[i];
+- foreach (const config &m, modifications_.child_range(mod)) {
++ wes_foreach (const config &m, modifications_.child_range(mod)) {
+ log_scope("add mod");
+ add_modification(ModificationTypes[i], m, true);
+ }
+@@ -2779,7 +2779,7 @@
+ bool is_inv = !get_state(STATE_UNCOVERED) && get_ability_bool(hides,loc);
+ if(is_inv){
+ const std::vector<team>& teams = *resources::teams;
+- foreach (const unit &u, *resources::units)
++ wes_foreach (const unit &u, *resources::units)
+ {
+ const map_location &u_loc = u.get_location();
+ if (teams[side_-1].is_enemy(u.side()) && tiles_adjacent(loc, u_loc)) {
+@@ -2881,7 +2881,7 @@
+ int side_units(int side)
+ {
+ int res = 0;
+- foreach (const unit &u, *resources::units) {
++ wes_foreach (const unit &u, *resources::units) {
+ if (u.side() == side) ++res;
+ }
+ return res;
+@@ -2890,7 +2890,7 @@
+ int side_units_cost(int side)
+ {
+ int res = 0;
+- foreach (const unit &u, *resources::units) {
++ wes_foreach (const unit &u, *resources::units) {
+ if (u.side() == side) res += u.cost();
+ }
+ return res;
+@@ -2899,7 +2899,7 @@
+ int side_upkeep(int side)
+ {
+ int res = 0;
+- foreach (const unit &u, *resources::units) {
++ wes_foreach (const unit &u, *resources::units) {
+ if (u.side() == side) res += u.upkeep();
+ }
+ return res;
+@@ -3029,7 +3029,7 @@
+ const tportrait* unit::portrait(
+ const unsigned size, const tportrait::tside side) const
+ {
+- foreach(const tportrait& portrait, (type()->portraits())) {
++ wes_foreach(const tportrait& portrait, (type()->portraits())) {
+ if(portrait.size == size
+ && (side == portrait.side || portrait.side == tportrait::BOTH)) {
+
+@@ -3107,20 +3107,20 @@
+ "number",
+ ""};
+
+- foreach (const config &att, unit_config.child_range("attack"))
++ wes_foreach (const config &att, unit_config.child_range("attack"))
+ {
+ config& child = wcfg.add_child("attack");
+ for (int i = 0; !attack_keys[i].empty(); ++i) {
+ child[attack_keys[i]] = att[attack_keys[i]];
+ }
+- foreach (const config &spec, att.child_range("specials")) {
++ wes_foreach (const config &spec, att.child_range("specials")) {
+ config& child_spec = child.add_child("specials", spec);
+ child_spec.recursive_clear_value("description");
+ }
+
+ }
+
+- foreach (const config &abi, unit_config.child_range("abilities"))
++ wes_foreach (const config &abi, unit_config.child_range("abilities"))
+ {
+ config& child = wcfg.add_child("abilities", abi);
+ child.recursive_clear_value("description");
+@@ -3129,7 +3129,7 @@
+ child.recursive_clear_value("name_inactive");
+ }
+
+- foreach (const config &trait, unit_config.child_range("trait"))
++ wes_foreach (const config &trait, unit_config.child_range("trait"))
+ {
+ config& child = wcfg.add_child("trait", trait);
+ child.recursive_clear_value("description");
+@@ -3142,7 +3142,7 @@
+
+ for (int i = 0; !child_keys[i].empty(); ++i)
+ {
+- foreach (const config &c, unit_config.child_range(child_keys[i])) {
++ wes_foreach (const config &c, unit_config.child_range(child_keys[i])) {
+ wcfg.add_child(child_keys[i], c);
+ }
+ }
+diff -ur wesnoth-1.10.3.orig/src/unit_display.cpp wesnoth-1.10.3/src/unit_display.cpp
+--- wesnoth-1.10.3.orig/src/unit_display.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/unit_display.cpp 2012-07-11 13:16:05.953266691 +0200
+@@ -472,7 +472,7 @@
+ disp->display_unit_hex(healed_loc);
+ unit_animator animator;
+
+- foreach (unit *h, healers) {
++ wes_foreach (unit *h, healers) {
+ h->set_facing(h->get_location().get_relative_dir(healed_loc));
+ animator.add_animation(h, "healing", h->get_location(),
+ healed_loc, healing);
+diff -ur wesnoth-1.10.3.orig/src/unit_map.cpp wesnoth-1.10.3/src/unit_map.cpp
+--- wesnoth-1.10.3.orig/src/unit_map.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/unit_map.cpp 2012-07-11 13:16:05.986600025 +0200
+@@ -444,7 +444,7 @@
+ {
+ assert(u);
+
+- foreach(const unit_pod& item, ilist_) {
++ wes_foreach(const unit_pod& item, ilist_) {
+ if(item.unit == u) {
+ return true;
+ }
+diff -ur wesnoth-1.10.3.orig/src/unit_map.hpp wesnoth-1.10.3/src/unit_map.hpp
+--- wesnoth-1.10.3.orig/src/unit_map.hpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/unit_map.hpp 2012-07-11 13:16:05.986600025 +0200
+@@ -480,7 +480,7 @@
+ */
+ mutable t_ilist ilist_;
+
+- /// The last list item, a sentinel that allows BOOST::foreach to hoist end()
++ /// The last list item, a sentinel that allows BOOST::wes_foreach to hoist end()
+ t_ilist::iterator the_end_;
+
+ };
+diff -ur wesnoth-1.10.3.orig/src/unit_types.cpp wesnoth-1.10.3/src/unit_types.cpp
+--- wesnoth-1.10.3.orig/src/unit_types.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/unit_types.cpp 2012-07-11 13:16:06.019933355 +0200
+@@ -156,7 +156,7 @@
+ if (config &specials = cfg_.child("specials"))
+ {
+ config new_specials;
+- foreach (const config::any_child &vp, specials.all_children_range()) {
++ wes_foreach (const config::any_child &vp, specials.all_children_range()) {
+ std::vector<std::string>::const_iterator found_id =
+ std::find(dsl.begin(), dsl.end(), vp.cfg["id"]);
+ if (found_id == dsl.end()) {
+@@ -174,7 +174,7 @@
+ cfg_.clear_children("specials");
+ }
+ config &new_specials = cfg_.child_or_add("specials");
+- foreach (const config::any_child &value, set_specials.all_children_range()) {
++ wes_foreach (const config::any_child &value, set_specials.all_children_range()) {
+ new_specials.add_child(value.key, value.cfg);
+ }
+ }
+@@ -345,7 +345,7 @@
+
+ if (const config &resistance = cfg_.child("resistance"))
+ {
+- foreach (const config::attribute &i, resistance.attribute_range()) {
++ wes_foreach (const config::attribute &i, resistance.attribute_range()) {
+ res[i.first] = i.second;
+ }
+ }
+@@ -666,11 +666,11 @@
+ movementType_ = unit_movement_type(cfg);
+ alpha_ = ftofxp(1.0);
+
+- foreach (const config &t, traits)
++ wes_foreach (const config &t, traits)
+ {
+ possibleTraits_.add_child("trait", t);
+ }
+- foreach (config &var_cfg, cfg.child_range("variation"))
++ wes_foreach (config &var_cfg, cfg.child_range("variation"))
+ {
+ if (var_cfg["inherit"].to_bool()) {
+ config nvar_cfg(cfg);
+@@ -710,7 +710,7 @@
+ if (cfg["ignore_race_traits"].to_bool()) {
+ possibleTraits_.clear();
+ } else {
+- foreach (const config &t, race_->additional_traits())
++ wes_foreach (const config &t, race_->additional_traits())
+ {
+ if (alignment_ != NEUTRAL || t["id"] != "fearless")
+ possibleTraits_.add_child("trait", t);
+@@ -722,7 +722,7 @@
+ }
+
+ // Insert any traits that are just for this unit type
+- foreach (const config &trait, cfg.child_range("trait"))
++ wes_foreach (const config &trait, cfg.child_range("trait"))
+ {
+ possibleTraits_.add_child("trait", trait);
+ }
+@@ -750,7 +750,7 @@
+ game_config::add_color_info(cfg);
+
+
+- foreach (const config &portrait, cfg_.child_range("portrait")) {
++ wes_foreach (const config &portrait, cfg_.child_range("portrait")) {
+ portraits_.push_back(tportrait(portrait));
+ }
+
+@@ -807,7 +807,7 @@
+
+ if (const config &abil_cfg = cfg.child("abilities"))
+ {
+- foreach (const config::any_child &ab, abil_cfg.all_children_range()) {
++ wes_foreach (const config::any_child &ab, abil_cfg.all_children_range()) {
+ const config::attribute_value &name = ab.cfg["name"];
+ if (!name.empty()) {
+ abilities_.push_back(name.t_str());
+@@ -816,15 +816,15 @@
+ }
+ }
+
+- foreach (const config &adv, cfg.child_range("advancement"))
++ wes_foreach (const config &adv, cfg.child_range("advancement"))
+ {
+- foreach (const config &effect, adv.child_range("effect"))
++ wes_foreach (const config &effect, adv.child_range("effect"))
+ {
+ const config &abil_cfg = effect.child("abilities");
+ if (!abil_cfg || effect["apply_to"] != "new_ability") {
+ continue;
+ }
+- foreach (const config::any_child &ab, abil_cfg.all_children_range()) {
++ wes_foreach (const config::any_child &ab, abil_cfg.all_children_range()) {
+ const config::attribute_value &name = ab.cfg["name"];
+ if (!name.empty()) {
+ adv_abilities_.push_back(name.t_str());
+@@ -934,7 +934,7 @@
+ std::vector<attack_type> unit_type::attacks() const
+ {
+ std::vector<attack_type> res;
+- foreach (const config &att, cfg_.child_range("attack")) {
++ wes_foreach (const config &att, cfg_.child_range("attack")) {
+ res.push_back(attack_type(att));
+ }
+
+@@ -990,7 +990,7 @@
+ {
+ if (const config &abil = cfg_.child("abilities"))
+ {
+- foreach (const config::any_child &ab, abil.all_children_range()) {
++ wes_foreach (const config::any_child &ab, abil.all_children_range()) {
+ if (ab.cfg["id"] == ability)
+ return true;
+ }
+@@ -1005,7 +1005,7 @@
+ const config &abilities = cfg_.child("abilities");
+ if (!abilities) return res;
+
+- foreach (const config::any_child &ab, abilities.all_children_range()) {
++ wes_foreach (const config::any_child &ab, abilities.all_children_range()) {
+ const std::string &id = ab.cfg["id"];
+ if (!id.empty())
+ res.push_back(id);
+@@ -1077,7 +1077,7 @@
+ if (!ut)
+ return;
+
+- foreach(const std::string& adv, ut->advances_to()) {
++ wes_foreach(const std::string& adv, ut->advances_to()) {
+ if (tree.insert(adv).second) {
+ // insertion succeed, expand the new type
+ advancement_tree_internal(adv, tree);
+@@ -1098,9 +1098,9 @@
+ unit_types.build_all(unit_type::HELP_INDEX);
+
+ std::vector<std::string> adv_from;
+- foreach (const unit_type_data::unit_type_map::value_type &ut, unit_types.types())
++ wes_foreach (const unit_type_data::unit_type_map::value_type &ut, unit_types.types())
+ {
+- foreach(const std::string& adv, ut.second.advances_to()) {
++ wes_foreach(const std::string& adv, ut.second.advances_to()) {
+ if (adv == id_)
+ adv_from.push_back(ut.second.id());
+ }
+@@ -1127,7 +1127,7 @@
+ clear();
+ set_unit_config(cfg);
+
+- foreach (const config &mt, cfg.child_range("movetype"))
++ wes_foreach (const config &mt, cfg.child_range("movetype"))
+ {
+ const unit_movement_type move_type(mt);
+ movement_types_.insert(
+@@ -1135,14 +1135,14 @@
+ loadscreen::increment_progress();
+ }
+
+- foreach (const config &r, cfg.child_range("race"))
++ wes_foreach (const config &r, cfg.child_range("race"))
+ {
+ const unit_race race(r);
+ races_.insert(std::pair<std::string,unit_race>(race.id(),race));
+ loadscreen::increment_progress();
+ }
+
+- foreach (config &ut, cfg.child_range("unit_type"))
++ wes_foreach (config &ut, cfg.child_range("unit_type"))
+ {
+ std::string id = ut["id"];
+ if (const config &bu = ut.child("base_unit"))
+@@ -1195,7 +1195,7 @@
+
+ void unit_type_data::check_types(const std::vector<std::string>& types) const
+ {
+- foreach(const std::string& type, types) {
++ wes_foreach(const std::string& type, types) {
+ if(!find(type)) throw game::game_error("unknown unit type: " + type);
+ }
+ }
+@@ -1279,7 +1279,7 @@
+
+ std::vector<std::string> trees = utils::split(cfg["type_adv_tree"]);
+ hide_help_type_.back().insert(trees.begin(), trees.end());
+- foreach(const std::string& t_id, trees) {
++ wes_foreach(const std::string& t_id, trees) {
+ unit_type_map::iterator ut = types_.find(t_id);
+ if (ut != types_.end()) {
+ std::set<std::string> adv_tree = ut->second.advancement_tree();
+@@ -1310,7 +1310,7 @@
+ {
+ const config& cfg = to_unit.get_cfg();
+
+- foreach (const config &af, cfg.child_range("advancefrom"))
++ wes_foreach (const config &af, cfg.child_range("advancefrom"))
+ {
+ const std::string &from = af["unit"];
+ int xp = af["experience"];
+@@ -1349,12 +1349,12 @@
+ // status gets changed. In the unlikely event it gets changed
+ // multiple times, we want to try to do it in the same order
+ // that unit::apply_modifications does things.
+- foreach (const config &mod, possible_traits())
++ wes_foreach (const config &mod, possible_traits())
+ {
+ if (mod["availability"] != "musthave")
+ continue;
+
+- foreach (const config &effect, mod.child_range("effect"))
++ wes_foreach (const config &effect, mod.child_range("effect"))
+ {
+ // See if the effect only applies to
+ // certain unit types But don't worry
+diff -ur wesnoth-1.10.3.orig/src/variable.cpp wesnoth-1.10.3/src/variable.cpp
+--- wesnoth-1.10.3.orig/src/variable.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/variable.cpp 2012-07-11 13:16:06.026600024 +0200
+@@ -233,11 +233,11 @@
+ {
+ config res;
+
+- foreach (const config::attribute &i, cfg_->attribute_range()) {
++ wes_foreach (const config::attribute &i, cfg_->attribute_range()) {
+ res[i.first] = expand(i.first);
+ }
+
+- foreach (const config::any_child &child, cfg_->all_children_range())
++ wes_foreach (const config::any_child &child, cfg_->all_children_range())
+ {
+ if (child.key == "insert_tag") {
+ vconfig insert_cfg(child.cfg);
+@@ -283,7 +283,7 @@
+ {
+ vconfig::child_list res;
+
+- foreach (const config::any_child &child, cfg_->all_children_range())
++ wes_foreach (const config::any_child &child, cfg_->all_children_range())
+ {
+ if (child.key == key) {
+ res.push_back(vconfig(&child.cfg, cache_key_));
+@@ -319,7 +319,7 @@
+ if (const config &natural = cfg_->child(key)) {
+ return vconfig(&natural, cache_key_);
+ }
+- foreach (const config &ins, cfg_->child_range("insert_tag"))
++ wes_foreach (const config &ins, cfg_->child_range("insert_tag"))
+ {
+ vconfig insert_cfg(ins);
+ if(insert_cfg["name"] == key) {
+@@ -339,7 +339,7 @@
+ if (cfg_->child(key)) {
+ return true;
+ }
+- foreach (const config &ins, cfg_->child_range("insert_tag"))
++ wes_foreach (const config &ins, cfg_->child_range("insert_tag"))
+ {
+ vconfig insert_cfg(ins);
+ if(insert_cfg["name"] == key) {
+@@ -475,7 +475,7 @@
+
+ config &scoped_wml_variable::store(const config &var_value)
+ {
+- foreach (const config &i, repos->get_variables().child_range(var_name_)) {
++ wes_foreach (const config &i, repos->get_variables().child_range(var_name_)) {
+ previous_val_.add_child(var_name_, i);
+ }
+ repos->clear_variable_cfg(var_name_);
+@@ -489,7 +489,7 @@
+ {
+ if(activated_) {
+ repos->clear_variable_cfg(var_name_);
+- foreach (const config &i, previous_val_.child_range(var_name_)) {
++ wes_foreach (const config &i, previous_val_.child_range(var_name_)) {
+ repos->add_variable_cfg(var_name_, i);
+ }
+ LOG_NG << "scoped_wml_variable: var_name \"" << var_name_ << "\" has been reverted.\n";
+diff -ur wesnoth-1.10.3.orig/src/video.cpp wesnoth-1.10.3/src/video.cpp
+--- wesnoth-1.10.3.orig/src/video.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/video.cpp 2012-07-11 13:16:05.949933359 +0200
+@@ -105,7 +105,7 @@
+ {
+ events.clear();
+
+- foreach (SDL_Rect const &rect, update_rects) {
++ wes_foreach (SDL_Rect const &rect, update_rects) {
+ events.push_back(event(rect, true));
+ events.push_back(event(rect, false));
+ }
+@@ -354,7 +354,7 @@
+ int CVideo::bppForMode( int x, int y, int flags)
+ {
+ int test_values[3] = {getBpp(), 32, 16};
+- foreach(int &bpp, test_values) {
++ wes_foreach(int &bpp, test_values) {
+ if(modePossible(x, y, bpp, flags) > 0) {
+ return bpp;
+ }
+diff -ur wesnoth-1.10.3.orig/src/whiteboard/highlight_visitor.cpp wesnoth-1.10.3/src/whiteboard/highlight_visitor.cpp
+--- wesnoth-1.10.3.orig/src/whiteboard/highlight_visitor.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/whiteboard/highlight_visitor.cpp 2012-07-11 13:16:06.003266691 +0200
+@@ -147,7 +147,7 @@
+ {
+ //Highlight secondary highlights
+ mode_ = HIGHLIGHT_SECONDARY;
+- foreach(weak_action_ptr weak, secondary_highlights_)
++ wes_foreach(weak_action_ptr weak, secondary_highlights_)
+ {
+ if (action_ptr action = weak.lock())
+ {
+@@ -169,7 +169,7 @@
+
+ //unhighlight secondary highlights
+ mode_ = UNHIGHLIGHT_SECONDARY;
+- foreach(weak_action_ptr weak, secondary_highlights_)
++ wes_foreach(weak_action_ptr weak, secondary_highlights_)
+ {
+ if (action_ptr action = weak.lock())
+ {
+@@ -178,7 +178,7 @@
+ }
+
+ //unhide other units if needed
+- foreach(map_location hex, exclusive_display_hexes_)
++ wes_foreach(map_location hex, exclusive_display_hexes_)
+ {
+ resources::screen->remove_exclusive_draw(hex);
+ }
+diff -ur wesnoth-1.10.3.orig/src/whiteboard/manager.cpp wesnoth-1.10.3/src/whiteboard/manager.cpp
+--- wesnoth-1.10.3.orig/src/whiteboard/manager.cpp 2012-04-23 04:44:12.000000000 +0200
++++ wesnoth-1.10.3/src/whiteboard/manager.cpp 2012-07-11 13:16:06.003266691 +0200
+@@ -268,7 +268,7 @@
+ }
+
+ //Look for planned recruits that depend on this leader
+- foreach(action_const_ptr action, *viewer_actions())
++ wes_foreach(action_const_ptr action, *viewer_actions())
+ {
+ recruit_const_ptr recruit = boost::dynamic_pointer_cast<class recruit const>(action);
+ recall_const_ptr recall = boost::dynamic_pointer_cast<class recall const>(action);
+@@ -332,7 +332,7 @@
+
+ static void hide_all_plans()
+ {
+- foreach(team& t, *resources::teams)
++ wes_foreach(team& t, *resources::teams)
+ t.get_side_actions()->hide();
+ }
+
+@@ -344,7 +344,7 @@
+ hide_all_plans();
+ else //< normal circumstance
+ {
+- foreach(team& t, *resources::teams)
++ wes_foreach(team& t, *resources::teams)
+ {
+ //make sure only appropriate teams are hidden
+ if(!t.is_network_human())
+@@ -498,7 +498,7 @@
+ if (can_modify_game_state() && has_actions())
+ {
+ units_owning_moves_ = move_owners_finder().get_units_owning_moves();
+- foreach(size_t unit_id, units_owning_moves_)
++ wes_foreach(size_t unit_id, units_owning_moves_)
+ {
+ unit_map::iterator unit_iter = resources::units->find(unit_id);
+ assert(unit_iter.valid());
+@@ -509,7 +509,7 @@
+
+ void manager::post_draw()
+ {
+- foreach(size_t unit_id, units_owning_moves_)
++ wes_foreach(size_t unit_id, units_owning_moves_)
+ {
+ unit_map::iterator unit_iter = resources::units->find(unit_id);
+ if (unit_iter.valid()) {
+@@ -558,7 +558,7 @@
+
+ //Info about the action numbers to be displayed on screen.
+ side_actions::numbers_t numbers;
+- foreach(team& t, *resources::teams)
++ wes_foreach(team& t, *resources::teams)
+ {
+ side_actions& sa = *t.get_side_actions();
+ if(!sa.hidden())
+@@ -571,7 +571,7 @@
+
+ void manager::on_mouseover_change(const map_location& hex)
+ {
+- foreach(map_location const& hex, hidden_unit_hexes_)
++ wes_foreach(map_location const& hex, hidden_unit_hexes_)
+ resources::screen->remove_exclusive_draw(hex);
+ hidden_unit_hexes_.clear();
+
+@@ -636,7 +636,7 @@
+ LOG_WB << "Received wb data (" << count << ").\n";
+
+ team& team_from = resources::teams->at(wb_cfg["side"]-1);
+- foreach(side_actions::net_cmd const& cmd, wb_cfg.child_range("net_cmd"))
++ wes_foreach(side_actions::net_cmd const& cmd, wb_cfg.child_range("net_cmd"))
+ team_from.get_side_actions()->execute_net_cmd(cmd);
+ }
+ }
+@@ -1138,7 +1138,7 @@
+ options.push_back(_("HIDE ALL allies’ plans"));
+
+ //populate list of networked allies
+- foreach(team &t, *resources::teams)
++ wes_foreach(team &t, *resources::teams)
+ {
+ //Exclude enemies, AIs, and local players
+ if(t.is_enemy(v_side) || !t.is_network())
+@@ -1164,11 +1164,11 @@
+ switch(selection)
+ {
+ case 0:
+- foreach(team* t, allies)
++ wes_foreach(team* t, allies)
+ team_plans_hidden_[t->side()-1]=false;
+ break;
+ case 1:
+- foreach(team* t, allies)
++ wes_foreach(team* t, allies)
+ team_plans_hidden_[t->side()-1]=true;
+ break;
+ default:
+diff -ur wesnoth-1.10.3.orig/src/whiteboard/mapbuilder.cpp wesnoth-1.10.3/src/whiteboard/mapbuilder.cpp
+--- wesnoth-1.10.3.orig/src/whiteboard/mapbuilder.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/whiteboard/mapbuilder.cpp 2012-07-11 13:16:06.003266691 +0200
+@@ -51,14 +51,14 @@
+
+ void mapbuilder::pre_build()
+ {
+- foreach(team& t, *resources::teams)
++ wes_foreach(team& t, *resources::teams)
+ {
+ //Reset spent gold to zero, it'll be recalculated during the map building
+ t.get_side_actions()->reset_gold_spent();
+ }
+
+ int current_side = resources::controller->current_side();
+- foreach(unit& u, *resources::units)
++ wes_foreach(unit& u, *resources::units)
+ {
+ bool on_current_side = (u.side() == current_side);
+
+diff -ur wesnoth-1.10.3.orig/src/whiteboard/move.cpp wesnoth-1.10.3/src/whiteboard/move.cpp
+--- wesnoth-1.10.3.orig/src/whiteboard/move.cpp 2012-04-23 01:53:28.000000000 +0200
++++ wesnoth-1.10.3/src/whiteboard/move.cpp 2012-07-11 13:16:06.003266691 +0200
+@@ -108,10 +108,10 @@
+ if(!route_cfg)
+ throw action::ctor_err("move: Invalid route_");
+ route_->move_cost = route_cfg["move_cost"];
+- foreach(config const& loc_cfg, route_cfg.child_range("step")) {
++ wes_foreach(config const& loc_cfg, route_cfg.child_range("step")) {
+ route_->steps.push_back(map_location(loc_cfg["x"],loc_cfg["y"]));
+ }
+- foreach(config const& mark_cfg, route_cfg.child_range("mark")) {
++ wes_foreach(config const& mark_cfg, route_cfg.child_range("mark")) {
+ route_->marks[map_location(mark_cfg["x"],mark_cfg["y"])]
+ = pathfind::marked_route::mark(mark_cfg["turns"],mark_cfg["zoc"],mark_cfg["capture"],mark_cfg["invisible"]);
+ }
+@@ -470,7 +470,7 @@
+ //Serialize route_
+ config route_cfg;
+ route_cfg["move_cost"]=route_->move_cost;
+- foreach(map_location const& loc, route_->steps)
++ wes_foreach(map_location const& loc, route_->steps)
+ {
+ config loc_cfg;
+ loc_cfg["x"]=loc.x;
+@@ -478,7 +478,7 @@
+ route_cfg.add_child("step",loc_cfg);
+ }
+ typedef std::pair<map_location,pathfind::marked_route::mark> pair_loc_mark;
+- foreach(pair_loc_mark const& item, route_->marks)
++ wes_foreach(pair_loc_mark const& item, route_->marks)
+ {
+ config mark_cfg;
+ mark_cfg["x"]=item.first.x;
+diff -ur wesnoth-1.10.3.orig/src/whiteboard/recall.cpp wesnoth-1.10.3/src/whiteboard/recall.cpp
+--- wesnoth-1.10.3.orig/src/whiteboard/recall.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/whiteboard/recall.cpp 2012-07-11 13:16:06.003266691 +0200
+@@ -71,7 +71,7 @@
+ {
+ // Construct and validate temp_unit_
+ size_t underlying_id = cfg["temp_unit_"];
+- foreach(unit const& recall_unit, resources::teams->at(team_index()).recall_list())
++ wes_foreach(unit const& recall_unit, resources::teams->at(team_index()).recall_list())
+ {
+ if(recall_unit.underlying_id()==underlying_id)
+ {
+diff -ur wesnoth-1.10.3.orig/src/whiteboard/side_actions.cpp wesnoth-1.10.3/src/whiteboard/side_actions.cpp
+--- wesnoth-1.10.3.orig/src/whiteboard/side_actions.cpp 2012-04-23 01:18:06.000000000 +0200
++++ wesnoth-1.10.3/src/whiteboard/side_actions.cpp 2012-07-11 13:16:06.006600025 +0200
+@@ -48,13 +48,13 @@
+ {
+ s << "Content of side_actions:";
+ int turn = 1;
+- foreach(action_queue const& turn_queue, side_actions.actions())
++ wes_foreach(action_queue const& turn_queue, side_actions.actions())
+ {
+ s << "\n Turn " << turn;
+ ++turn;
+
+ int count = 1;
+- foreach(action_ptr const& action, turn_queue)
++ wes_foreach(action_ptr const& action, turn_queue)
+ {
+ s << "\n (" << count << ") " << action;
+ ++count;
+@@ -114,7 +114,7 @@
+ main_number = index;
+ }
+
+- foreach(weak_action_ptr action, highlighter->get_secondary_highlights())
++ wes_foreach(weak_action_ptr action, highlighter->get_secondary_highlights())
+ {
+ if (action.lock() == *it)
+ {
+@@ -199,7 +199,7 @@
+ size_t side_actions::size() const
+ {
+ size_t result = 0;
+- foreach(action_queue const& queue, actions_)
++ wes_foreach(action_queue const& queue, actions_)
+ result += queue.size();
+ return result;
+ }
+@@ -234,7 +234,7 @@
+ return;
+ }
+
+- foreach(action_ptr act, *this)
++ wes_foreach(action_ptr act, *this)
+ act->hide();
+ }
+ void side_actions::show()
+@@ -244,7 +244,7 @@
+
+ hidden_ = false;
+
+- foreach(action_ptr act, *this)
++ wes_foreach(action_ptr act, *this)
+ act->show();
+ }
+
+@@ -507,7 +507,7 @@
+ size_t side_actions::count_actions_of(unit const* unit)
+ {
+ size_t count = 0;
+- foreach(action_ptr action, *this)
++ wes_foreach(action_ptr action, *this)
+ {
+ if (action->get_unit() == unit)
+ {
+@@ -783,7 +783,7 @@
+ else if(type=="refresh")
+ {
+ safe_clear();
+- foreach(net_cmd const& sub_cmd, cmd.child_range("net_cmd"))
++ wes_foreach(net_cmd const& sub_cmd, cmd.child_range("net_cmd"))
+ execute_net_cmd(sub_cmd);
+ }
+ else
+@@ -890,7 +890,7 @@
+
+ //find units who still have plans for turn 0 (i.e. were too lazy to finish their jobs)
+ std::set<unit const*> lazy_units;
+- foreach(action_ptr const& act, iter_turn(0))
++ wes_foreach(action_ptr const& act, iter_turn(0))
+ {
+ unit const* u = act->get_unit();
+ if(u)
+@@ -913,7 +913,7 @@
+ }
+
+ //push any remaining first-turn plans into the second turn
+- foreach(action_ptr act, actions_.front())
++ wes_foreach(action_ptr act, actions_.front())
+ actions_[1].push_front(act);
+ actions_.front().clear();
+
+diff -ur wesnoth-1.10.3.orig/src/whiteboard/utility.cpp wesnoth-1.10.3/src/whiteboard/utility.cpp
+--- wesnoth-1.10.3.orig/src/whiteboard/utility.cpp 2012-01-07 03:35:17.000000000 +0100
++++ wesnoth-1.10.3/src/whiteboard/utility.cpp 2012-07-11 13:16:06.003266691 +0200
+@@ -60,7 +60,7 @@
+ {
+ assert(leader.can_recruit());
+ assert(resources::game_map->is_keep(leader.get_location()));
+- foreach(unit const& unit, *resources::units)
++ wes_foreach(unit const& unit, *resources::units)
+ {
+ if (unit.can_recruit() &&
+ resources::game_map->is_keep(unit.get_location()) &&
+@@ -83,7 +83,7 @@
+ if(!map.is_castle(hex))
+ return NULL;
+
+- foreach(unit& u, *resources::units)
++ wes_foreach(unit& u, *resources::units)
+ if(u.can_recruit()
+ && u.side() == static_cast<int>(team_index+1)
+ && can_recruit_on(map,u.get_location(),hex))
+@@ -124,7 +124,7 @@
+
+ int result = 0;
+ gamemap const& map = *resources::game_map;
+- foreach(map_location const& loc, std::make_pair(path.begin()+1,path.end()))
++ wes_foreach(map_location const& loc, std::make_pair(path.begin()+1,path.end()))
+ result += u.movement_cost(map[loc]);
+ return result;
+ }
+@@ -149,7 +149,7 @@
+
+ bool has_actions()
+ {
+- foreach(team& t, *resources::teams)
++ wes_foreach(team& t, *resources::teams)
+ if (!t.get_side_actions()->empty())
+ return true;
+
+diff -ur wesnoth-1.10.3.orig/src/whiteboard/validate_visitor.cpp wesnoth-1.10.3/src/whiteboard/validate_visitor.cpp
+--- wesnoth-1.10.3.orig/src/whiteboard/validate_visitor.cpp 2012-04-23 04:44:12.000000000 +0200
++++ wesnoth-1.10.3/src/whiteboard/validate_visitor.cpp 2012-07-11 13:16:06.006600025 +0200
+@@ -60,7 +60,7 @@
+ {
+ int side_actions_size_before = viewer_actions_.size();
+ LOG_WB << "Erasing " << actions_to_erase_.size() << " invalid actions.\n";
+- foreach(action_ptr action, actions_to_erase_)
++ wes_foreach(action_ptr action, actions_to_erase_)
+ {
+ viewer_actions_.remove_action(viewer_actions_.get_position_of(action), false);
+ }
+diff -ur wesnoth-1.10.3.orig/src/whiteboard/visitor.hpp wesnoth-1.10.3/src/whiteboard/visitor.hpp
+--- wesnoth-1.10.3.orig/src/whiteboard/visitor.hpp 2012-04-23 01:53:28.000000000 +0200
++++ wesnoth-1.10.3/src/whiteboard/visitor.hpp 2012-07-11 13:16:06.003266691 +0200
+@@ -81,7 +81,7 @@
+
+ //Determine how many turns' worth of plans there are
+ size_t max_turns = 0;
+- foreach(team& t, *resources::teams)
++ wes_foreach(team& t, *resources::teams)
+ max_turns = std::max(max_turns,t.get_side_actions()->num_turns());
+
+ size_t const current_team = resources::controller->current_side() - 1;
diff --git a/wesnoth.spec b/wesnoth.spec
index ec3e946..c6b357c 100644
--- a/wesnoth.spec
+++ b/wesnoth.spec
@@ -21,6 +21,7 @@ Source1: %{name}d.init
Source2: %{name}.tmpfiles
Patch0: %{name}-desktop.patch
Patch1: %{name}-locale_dir.patch
+Patch2: boost-1.50.patch
URL: http://www.wesnoth.org/
BuildRequires: SDL-devel >= 1.2.14-4
BuildRequires: SDL_image-devel >= 1.2
@@ -115,6 +116,7 @@ Edytor map i narzędzia do tłumaczeń.
%setup -q
%patch0 -p1
%patch1 -p1
+%patch2 -p1
# don't install locales in %{_datadir}/%{name}
%{__sed} -i 's,${DATADIR}/${LOCALEDIR},${LOCALEDIR},' CMakeLists.txt
More information about the pld-cvs-commit
mailing list