]> git.pld-linux.org Git - packages/wesnoth.git/blob - boost-1.50.patch
- release 3 (by relup.sh)
[packages/wesnoth.git] / boost-1.50.patch
1 diff -ur wesnoth-1.10.3.orig/doc/design/gui2/progress_bar.cpp wesnoth-1.10.3/doc/design/gui2/progress_bar.cpp
2 --- wesnoth-1.10.3.orig/doc/design/gui2/progress_bar.cpp        2010-04-12 21:26:09.000000000 +0200
3 +++ wesnoth-1.10.3/doc/design/gui2/progress_bar.cpp     2012-07-11 13:16:05.883266695 +0200
4 @@ -22,7 +22,7 @@
5         if(percentage_ != percentage) {
6                 percentage_ = percentage;
7  
8 -               foreach(tcanvas& c, canvas()) {
9 +               wes_foreach(tcanvas& c, canvas()) {
10                         c.set_variable("percentage", variant(percentage));
11                 }
12  
13 diff -ur wesnoth-1.10.3.orig/src/about.cpp wesnoth-1.10.3/src/about.cpp
14 --- wesnoth-1.10.3.orig/src/about.cpp   2012-01-16 05:58:33.000000000 +0100
15 +++ wesnoth-1.10.3/src/about.cpp        2012-07-11 13:16:06.019933355 +0200
16 @@ -52,7 +52,7 @@
17         }
18  
19         std::vector<std::string> lines = utils::split(c["text"], '\n');
20 -       foreach (std::string &line, lines)
21 +       wes_foreach (std::string &line, lines)
22         {
23                 if (line.size() > 1 && line[0] == '+')
24                         line = "+  " + line.substr(1);
25 @@ -67,7 +67,7 @@
26                 }
27         }
28  
29 -       foreach (const config &entry, c.child_range("entry")) {
30 +       wes_foreach (const config &entry, c.child_range("entry")) {
31                 res.push_back("-  "+ entry["name"].str());
32         }
33  }
34 @@ -80,7 +80,7 @@
35         config::child_itors about_entries = about_list.child_range("about");
36  
37         if (!campaign.empty()) {
38 -               foreach (const config &about, about_entries) {
39 +               wes_foreach (const config &about, about_entries) {
40                         // just finished a particular campaign
41                         if (campaign == about["id"]) {
42                                 add_lines(res, about);
43 @@ -88,7 +88,7 @@
44                 }
45         }
46  
47 -       foreach (const config &about, about_entries) {
48 +       wes_foreach (const config &about, about_entries) {
49                 add_lines(res, about);
50         }
51  
52 @@ -101,7 +101,7 @@
53         images.clear();
54         images_default = "";
55  
56 -       foreach (const config &about, cfg.child_range("about"))
57 +       wes_foreach (const config &about, cfg.child_range("about"))
58         {
59                 about_list.add_child("about", about);
60                 const std::string &im = about["images"];
61 @@ -114,7 +114,7 @@
62                 }
63         }
64  
65 -       foreach (const config &campaign, cfg.child_range("campaign"))
66 +       wes_foreach (const config &campaign, cfg.child_range("campaign"))
67         {
68                 config::const_child_itors abouts = campaign.child_range("about");
69                 if (abouts.first == abouts.second) continue;
70 @@ -126,7 +126,7 @@
71                 temp["id"] = id;
72                 std::string campaign_images;
73  
74 -               foreach (const config &about, abouts)
75 +               wes_foreach (const config &about, abouts)
76                 {
77                         const std::string &subtitle = about["title"];
78                         if (!subtitle.empty())
79 @@ -139,12 +139,12 @@
80                                 text << '\n';
81                         }
82  
83 -                       foreach (const std::string &line, utils::split(about["text"], '\n'))
84 +                       wes_foreach (const std::string &line, utils::split(about["text"], '\n'))
85                         {
86                                 text << "    " << line << '\n';
87                         }
88  
89 -                       foreach (const config &entry, about.child_range("entry"))
90 +                       wes_foreach (const config &entry, about.child_range("entry"))
91                         {
92                                 text << "    " << entry["name"] << '\n';
93                         }
94 diff -ur wesnoth-1.10.3.orig/src/actions.cpp wesnoth-1.10.3/src/actions.cpp
95 --- wesnoth-1.10.3.orig/src/actions.cpp 2012-04-07 19:02:33.000000000 +0200
96 +++ wesnoth-1.10.3/src/actions.cpp      2012-07-11 13:16:05.993266689 +0200
97 @@ -206,7 +206,7 @@
98         placements.push_back("map");
99         placements.push_back("recall");
100  
101 -       foreach(std::string place, placements) {
102 +       wes_foreach(std::string place, placements) {
103                 map_location loc;
104                 bool pass((place == "leader_passable") || (place == "map_passable"));
105  
106 @@ -417,7 +417,7 @@
107                                 leader_in_place= true;
108                         else continue;
109  
110 -                       foreach (const unit& recall_unit, recall_list)
111 +                       wes_foreach (const unit& recall_unit, recall_list)
112                         {
113                                 //Only units which match the leaders recall filter are valid.
114                                 scoped_recall_unit this_unit("this_unit", t.save_id(), &recall_unit - &recall_list[0]);
115 @@ -435,7 +435,7 @@
116         }
117  
118         if (!(recall_loc_is_castle && leader_in_place)) {
119 -               foreach (const unit &recall, recall_list)
120 +               wes_foreach (const unit &recall, recall_list)
121                 {
122                         result.push_back(&recall);
123                 }
124 @@ -546,7 +546,7 @@
125  
126                 bool can_recruit_unit = is_on_team_list;
127                 if (!can_recruit_unit) {
128 -                       foreach (const std::string &recruitable, leader->recruits()) {
129 +                       wes_foreach (const std::string &recruitable, leader->recruits()) {
130                                 if (recruitable == unit_type) {
131                                         can_recruit_unit = true;
132                                         break;
133 @@ -1925,7 +1925,7 @@
134  // Simple algorithm: no maximum number of patients per healer.
135  void reset_resting(unit_map& units, int side)
136  {
137 -       foreach (unit &u, units) {
138 +       wes_foreach (unit &u, units) {
139                 if (u.side() == side)
140                         u.set_resting(true);
141         }
142 @@ -1946,7 +1946,7 @@
143         std::list<unit_healing_struct> l;
144  
145         // We look for all allied units, then we see if our healer is near them.
146 -       foreach (unit &u, units) {
147 +       wes_foreach (unit &u, units) {
148  
149                 if (u.get_state("unhealable") || u.incapacitated())
150                         continue;
151 @@ -2307,7 +2307,7 @@
152                 }
153  
154                 pathfind::paths p(*resources::game_map, *resources::units, loc, *resources::teams, true, false, tm, 0, false, true);
155 -               foreach (const pathfind::paths::step &dest, p.destinations) {
156 +               wes_foreach (const pathfind::paths::step &dest, p.destinations) {
157                         clear_shroud_loc(tm, dest.curr, &cleared_locations);
158                 }
159  
160 @@ -2350,7 +2350,7 @@
161  
162         tm.refog();
163  
164 -       foreach (unit &u, *resources::units)
165 +       wes_foreach (unit &u, *resources::units)
166         {
167                 if (u.side() == side) {
168                         const unit_movement_resetter move_resetter(u);
169 @@ -2372,7 +2372,7 @@
170  
171         bool result = false;
172  
173 -       foreach (unit &u, *resources::units)
174 +       wes_foreach (unit &u, *resources::units)
175         {
176                 if (u.side() == side) {
177                         const unit_movement_resetter move_resetter(u);
178 @@ -2435,7 +2435,7 @@
179  
180         std::set<map_location> known_units;
181         if(check_shroud) {
182 -               foreach (const unit &u, units) {
183 +               wes_foreach (const unit &u, units) {
184                         if (!tm->fogged(u.get_location())) {
185                                 known_units.insert(u.get_location());
186                                 tm->see(u.side() - 1);
187 @@ -2860,7 +2860,7 @@
188         */
189  
190         std::set<map_location> known_units;
191 -       foreach (const unit &u, units) {
192 +       wes_foreach (const unit &u, units) {
193                 if (!tm.fogged(u.get_location())) {
194                         known_units.insert(u.get_location());
195                 }
196 diff -ur wesnoth-1.10.3.orig/src/addon/manager.cpp wesnoth-1.10.3/src/addon/manager.cpp
197 --- wesnoth-1.10.3.orig/src/addon/manager.cpp   2012-03-03 23:11:25.000000000 +0100
198 +++ wesnoth-1.10.3/src/addon/manager.cpp        2012-07-11 13:16:05.959933359 +0200
199 @@ -321,11 +321,11 @@
200  
201         make_directory(dir);
202  
203 -       foreach (const config &d, cfg.child_range("dir")) {
204 +       wes_foreach (const config &d, cfg.child_range("dir")) {
205                 unarchive_dir(dir, d);
206         }
207  
208 -       foreach (const config &f, cfg.child_range("file")) {
209 +       wes_foreach (const config &f, cfg.child_range("file")) {
210                 unarchive_file(dir, f);
211         }
212  }
213 @@ -701,7 +701,7 @@
214                 std::string missing = "";
215                 size_t count_missing = 0;
216  
217 -               foreach(const std::string& i, dependencies) {
218 +               wes_foreach(const std::string& i, dependencies) {
219                         if (std::find(installed.begin(), installed.end(), i) == installed.end()) {
220                                 missing += "\n" + i;
221                                 ++count_missing;
222 @@ -717,7 +717,7 @@
223                         std::vector< std::string > unsafe_matches;
224                         std::ostringstream unsafe_list;
225                         std::map<std::string, version_info> remote_version_map;
226 -                       foreach (const config &remote_addon, remote_addons_list)
227 +                       wes_foreach (const config &remote_addon, remote_addons_list)
228                         {
229                                 const std::string& name = remote_addon["name"];
230                                 if (std::find(dependencies.begin(), dependencies.end(), name) != dependencies.end()) {
231 @@ -837,7 +837,7 @@
232                                 if(!result) {
233                                         assert(failed_titles.empty() == false);
234                                         std::string failed_titles_list_fmt;
235 -                                       foreach(const std::string& entry, failed_titles) {
236 +                                       wes_foreach(const std::string& entry, failed_titles) {
237                                                 failed_titles_list_fmt += '\n';
238                                                 failed_titles_list_fmt += entry;
239                                         }
240 @@ -870,7 +870,7 @@
241                 std::vector<version_info> safe_local_versions;
242                 std::vector<version_info> unsafe_local_versions;
243                 std::map<std::string, version_info> remote_version_map;
244 -               foreach (const config &remote_addon, remote_addons_list)
245 +               wes_foreach (const config &remote_addon, remote_addons_list)
246                 {
247                         const std::string& name = remote_addon["name"];
248                         const std::string& version = remote_addon["version"];
249 @@ -1065,7 +1065,7 @@
250                 if(!result) {
251                         assert(failed_titles.empty() == false);
252                         std::string failed_titles_list_fmt;
253 -                       foreach(const std::string& entry, failed_titles) {
254 +                       wes_foreach(const std::string& entry, failed_titles) {
255                                 failed_titles_list_fmt += '\n';
256                                 failed_titles_list_fmt += entry;
257                         }
258 @@ -1090,7 +1090,7 @@
259                 const std::string& addon,
260                 const std::vector<std::string>& own_addons)
261         {
262 -               foreach(const std::string& current_own_addon, own_addons) {
263 +               wes_foreach(const std::string& current_own_addon, own_addons) {
264                         if(current_own_addon == addon) {
265                                 utils::string_map symbols;
266                                 symbols["addon"] = addon;
267 @@ -1171,7 +1171,7 @@
268  
269                         std::vector< addon_info > infos;
270  
271 -                       foreach(const config &c, addon_cfgs)
272 +                       wes_foreach(const config &c, addon_cfgs)
273                         {
274                                 const std::string& name = c["name"];
275                                 const std::string& downloads = c["downloads"].str();
276 @@ -1254,13 +1254,13 @@
277                                 infos.push_back(inf);
278                         }
279  
280 -                       foreach(const std::string& pub, publish_options) {
281 +                       wes_foreach(const std::string& pub, publish_options) {
282                                 static const std::string publish_icon = "icons/icon-addon-publish.png";
283                                 const std::string text = _("Publish add-on: ") + get_addon_name(pub);
284                                 options.push_back(IMAGE_PREFIX + publish_icon + COLUMN_SEPARATOR + font::GOOD_TEXT + text);
285                                 options_to_filter.push_back(text);
286                         }
287 -                       foreach(const std::string& del, delete_options) {
288 +                       wes_foreach(const std::string& del, delete_options) {
289                                 static const std::string delete_icon = "icons/icon-addon-delete.png";
290                                 const std::string text = _("Delete add-on: ") + get_addon_name(del);
291                                 options.push_back(IMAGE_PREFIX + delete_icon + COLUMN_SEPARATOR + font::BAD_TEXT + text);
292 @@ -1408,7 +1408,7 @@
293  
294                         remove_names.clear();
295  
296 -                       foreach(const std::string& id, remove_ids) {
297 +                       wes_foreach(const std::string& id, remove_ids) {
298                                 remove_names.push_back(get_addon_name(id));
299                         }
300  
301 @@ -1425,7 +1425,7 @@
302  
303                 std::vector<std::string> failed_names, skipped_names, succeeded_names;
304  
305 -               foreach(const std::string& id, remove_ids) {
306 +               wes_foreach(const std::string& id, remove_ids) {
307                         const std::string& name = get_addon_name(id);
308  
309                         if(have_addon_pbl_info(id) || have_addon_in_vcs_tree(id)) {
310 @@ -1531,12 +1531,12 @@
311         }
312         static const std::string parentd = get_addon_campaigns_dir();
313         std::vector<std::string> addon_info_files;
314 -       foreach(std::string const& dir, addons)
315 +       wes_foreach(std::string const& dir, addons)
316                 addon_info_files.push_back(parentd+"/"+dir+"/_info.cfg");
317  
318         size_t i = 0;
319  
320 -       foreach(std::string const& info_file, addon_info_files) {
321 +       wes_foreach(std::string const& info_file, addon_info_files) {
322                 assert(i < addons.size());
323  
324                 std::string const& addon = addons[i];
325 diff -ur wesnoth-1.10.3.orig/src/addon/validation.cpp wesnoth-1.10.3/src/addon/validation.cpp
326 --- wesnoth-1.10.3.orig/src/addon/validation.cpp        2012-01-07 03:35:17.000000000 +0100
327 +++ wesnoth-1.10.3/src/addon/validation.cpp     2012-07-11 13:16:05.959933359 +0200
328 @@ -44,10 +44,10 @@
329  
330  bool check_names_legal(const config& dir)
331  {
332 -       foreach (const config &path, dir.child_range("file")) {
333 +       wes_foreach (const config &path, dir.child_range("file")) {
334                 if (!addon_name_legal(path["name"])) return false;
335         }
336 -       foreach (const config &path, dir.child_range("dir")) {
337 +       wes_foreach (const config &path, dir.child_range("dir")) {
338                 if (!addon_name_legal(path["name"])) return false;
339                 if (!check_names_legal(path)) return false;
340         }
341 diff -ur wesnoth-1.10.3.orig/src/ai/composite/ai.cpp wesnoth-1.10.3/src/ai/composite/ai.cpp
342 --- wesnoth-1.10.3.orig/src/ai/composite/ai.cpp 2012-01-07 03:35:17.000000000 +0100
343 +++ wesnoth-1.10.3/src/ai/composite/ai.cpp      2012-07-11 13:16:05.909933359 +0200
344 @@ -60,7 +60,7 @@
345                 cfg_["id"]<<"]"<<std::endl;
346  
347         // init the composite ai stages
348 -       foreach(const config &cfg_element, cfg_.child_range("stage")){
349 +       wes_foreach(const config &cfg_element, cfg_.child_range("stage")){
350                 add_stage(cfg_element);
351         }
352  
353 @@ -115,7 +115,7 @@
354         std::vector< stage_ptr > stages;
355         create_stage(stages,cfg);
356         int j=0;
357 -       foreach (stage_ptr b, stages ){
358 +       wes_foreach (stage_ptr b, stages ){
359                 stages_.push_back(b);
360                 j++;
361         }
362 @@ -128,7 +128,7 @@
363         std::vector< goal_ptr > goals;
364         create_goal(goals,cfg);
365         int j=0;
366 -       foreach (goal_ptr b, goals ){
367 +       wes_foreach (goal_ptr b, goals ){
368                 get_goals().push_back(b);
369                 j++;
370         }
371 @@ -137,7 +137,7 @@
372  
373  
374  void ai_composite::play_turn(){
375 -       foreach(stage_ptr &s, stages_){
376 +       wes_foreach(stage_ptr &s, stages_){
377                 s->play_stage();
378         }
379  }
380 @@ -206,7 +206,7 @@
381         config cfg;
382  
383         //serialize the composite ai stages
384 -       foreach(const stage_ptr &s, stages_){
385 +       wes_foreach(const stage_ptr &s, stages_){
386                 cfg.add_child("stage",s->to_config());
387         }
388  
389 diff -ur wesnoth-1.10.3.orig/src/ai/composite/aspect.hpp wesnoth-1.10.3/src/ai/composite/aspect.hpp
390 --- wesnoth-1.10.3.orig/src/ai/composite/aspect.hpp     2012-01-07 03:35:17.000000000 +0100
391 +++ wesnoth-1.10.3/src/ai/composite/aspect.hpp  2012-07-11 13:16:05.909933359 +0200
392 @@ -265,7 +265,7 @@
393                 , facets_()
394                 , default_()
395         {
396 -               foreach (const config &cfg_element, this->cfg_.child_range("facet") ){
397 +               wes_foreach (const config &cfg_element, this->cfg_.child_range("facet") ){
398                         add_facet(-1,cfg_element);
399                 }
400  
401 @@ -291,7 +291,7 @@
402          {
403                 std::vector<aspect_ptr> facets_base;
404                 engine::parse_aspect_from_config(*this,cfg,this->get_id(),std::back_inserter(facets_base));
405 -               foreach (aspect_ptr a, facets_base ){
406 +               wes_foreach (aspect_ptr a, facets_base ){
407                         typename aspect_type<T>::typesafe_ptr b = boost::dynamic_pointer_cast< typesafe_aspect<T> > (a);
408                         facets.push_back(b);
409                 }
410 @@ -301,7 +301,7 @@
411         virtual void recalculate() const
412         {
413                 ///@todo 1.9 optimize in case of an aspect which returns variant
414 -               foreach (const typename aspect_type<T>::typesafe_ptr &f, make_pair(facets_.rbegin(),facets_.rend())) {
415 +               wes_foreach (const typename aspect_type<T>::typesafe_ptr &f, make_pair(facets_.rbegin(),facets_.rend())) {
416                         if (f->active()) {
417                                 this->value_ = boost::shared_ptr<T>(f->get_ptr());
418                                 this->valid_ = true;
419 @@ -316,7 +316,7 @@
420         virtual config to_config() const
421         {
422                 config cfg = aspect::to_config();
423 -               foreach (const typename aspect_type<T>::typesafe_ptr f, facets_) {
424 +               wes_foreach (const typename aspect_type<T>::typesafe_ptr f, facets_) {
425                         cfg.add_child("facet",f->to_config());
426                 }
427                 if (default_) {
428 @@ -334,7 +334,7 @@
429                 std::vector< aspect_ptr > facets;
430                 engine::parse_aspect_from_config(*this,cfg,this->get_id(),std::back_inserter(facets));
431                 int j=0;
432 -               foreach (aspect_ptr a, facets ){
433 +               wes_foreach (aspect_ptr a, facets ){
434                         typename aspect_type<T>::typesafe_ptr b = boost::dynamic_pointer_cast< typesafe_aspect<T> > (a);
435                         facets_.insert(facets_.begin()+pos+j,b);
436                         j++;
437 diff -ur wesnoth-1.10.3.orig/src/ai/composite/component.cpp wesnoth-1.10.3/src/ai/composite/component.cpp
438 --- wesnoth-1.10.3.orig/src/ai/composite/component.cpp  2012-01-07 03:35:17.000000000 +0100
439 +++ wesnoth-1.10.3/src/ai/composite/component.cpp       2012-07-11 13:16:05.909933359 +0200
440 @@ -125,7 +125,7 @@
441  std::vector<std::string> component::get_children_types()
442  {
443         std::vector<std::string> types;
444 -       foreach (property_handler_map::value_type &ph, property_handlers_) {
445 +       wes_foreach (property_handler_map::value_type &ph, property_handlers_) {
446                 types.push_back(ph.first);
447         }
448         return types;
449 @@ -241,9 +241,9 @@
450  
451         s << offset_str << type<<"["<<root->get_id() <<"] "<<root->get_engine()<<" "<<root->get_name()<< std::endl;
452  
453 -       foreach (std::string t, t_list) {
454 +       wes_foreach (std::string t, t_list) {
455                 std::vector<component*> c_list = root->get_children(t);
456 -               foreach (component *c, c_list) {
457 +               wes_foreach (component *c, c_list) {
458                         print_component(c,t,s,offset+1);
459                 }
460         }
461 diff -ur wesnoth-1.10.3.orig/src/ai/composite/goal.cpp wesnoth-1.10.3/src/ai/composite/goal.cpp
462 --- wesnoth-1.10.3.orig/src/ai/composite/goal.cpp       2012-01-07 03:35:17.000000000 +0100
463 +++ wesnoth-1.10.3/src/ai/composite/goal.cpp    2012-07-11 13:16:05.913266692 +0200
464 @@ -128,7 +128,7 @@
465         if (!criteria) return;
466  
467         //find the enemy leaders and explicit targets
468 -       foreach (const unit &u, *resources::units) {
469 +       wes_foreach (const unit &u, *resources::units) {
470                 if (u.matches_filter(vconfig(criteria), u.get_location())) {
471                         LOG_AI_GOAL << "found explicit target unit at ... " << u.get_location() << " with value: " << value() << "\n";
472                         *target_list = target(u.get_location(), value(), target::EXPLICIT);
473 @@ -173,7 +173,7 @@
474  
475         std::set<map_location> items;
476         filter_ptr_->get_locations(items);
477 -       foreach (const map_location &loc, items)
478 +       wes_foreach (const map_location &loc, items)
479         {
480                 LOG_AI_GOAL << "found explicit target location ... " << loc << " with value: " << value() << std::endl;
481                 *target_list = target(loc, value(), target::EXPLICIT);
482 @@ -252,7 +252,7 @@
483  
484         std::set<map_location> items;
485         if (protect_unit_) {
486 -               foreach (const unit &u, units)
487 +               wes_foreach (const unit &u, units)
488                 {
489                         if (protect_only_own_unit_ && u.side() != get_side()) {
490                                 continue;
491 @@ -268,9 +268,9 @@
492         }
493         DBG_AI_GOAL << "side " << get_side() << ": seaching for threats in "+goal_type+" goal" << std::endl;
494         // Look for directions to protect a specific location or specific unit.
495 -       foreach (const map_location &loc, items)
496 +       wes_foreach (const map_location &loc, items)
497         {
498 -               foreach (const unit &u, units)
499 +               wes_foreach (const unit &u, units)
500                 {
501                         int distance = distance_between(u.get_location(), loc);
502                         if (current_team().is_enemy(u.side()) && distance < radius_ &&
503 @@ -325,7 +325,7 @@
504         handler_->handle(c, true, l_obj);
505         std::vector < target > targets = *(l_obj->get());
506  
507 -       foreach (target tg, targets)
508 +       wes_foreach (target tg, targets)
509         {
510                 *target_list = tg;
511         }
512 diff -ur wesnoth-1.10.3.orig/src/ai/composite/property_handler.hpp wesnoth-1.10.3/src/ai/composite/property_handler.hpp
513 --- wesnoth-1.10.3.orig/src/ai/composite/property_handler.hpp   2012-01-07 03:35:17.000000000 +0100
514 +++ wesnoth-1.10.3/src/ai/composite/property_handler.hpp        2012-07-11 13:16:05.909933359 +0200
515 @@ -134,7 +134,7 @@
516         std::vector<component*> handle_get_children()
517         {
518                 std::vector<component*> children;
519 -               foreach (t_ptr v, values_) {
520 +               wes_foreach (t_ptr v, values_) {
521                         children.push_back(&*v);
522                 }
523                 return children;
524 @@ -149,7 +149,7 @@
525                 t_ptr_vector values;
526                 factory_(values,cfg);
527                 int j=0;
528 -               foreach (t_ptr b, values ){
529 +               wes_foreach (t_ptr b, values ){
530                         values_.insert(values_.begin()+pos+j,b);
531                         j++;
532                 }
533 @@ -200,7 +200,7 @@
534                 //* is a special case - 'delete all facets'
535                 if (child.id == "*") {
536                         bool b = false;
537 -                               foreach(typename aspect_map::value_type a, aspects_) {
538 +                               wes_foreach(typename aspect_map::value_type a, aspects_) {
539                                         b |= a.second->delete_all_facets();
540                                 }
541                         return b;
542 @@ -212,7 +212,7 @@
543         std::vector<component*> handle_get_children()
544         {
545                 std::vector<component*> children;
546 -               foreach(typename aspect_map::value_type a, aspects_) {
547 +               wes_foreach(typename aspect_map::value_type a, aspects_) {
548                         children.push_back(&*a.second);
549                 }
550                 return children;
551 diff -ur wesnoth-1.10.3.orig/src/ai/configuration.cpp wesnoth-1.10.3/src/ai/configuration.cpp
552 --- wesnoth-1.10.3.orig/src/ai/configuration.cpp        2012-01-07 03:35:17.000000000 +0100
553 +++ wesnoth-1.10.3/src/ai/configuration.cpp     2012-07-11 13:16:05.923266694 +0200
554 @@ -93,7 +93,7 @@
555         }
556  
557  
558 -       foreach (const config &ai_configuration, ais.child_range("ai")) {
559 +       wes_foreach (const config &ai_configuration, ais.child_range("ai")) {
560                 const std::string &id = ai_configuration["id"];
561                 if (id.empty()){
562  
563 @@ -118,7 +118,7 @@
564  void configuration::add_era_ai_from_config(const config &era)
565  {
566         era_ai_configurations_.clear();
567 -       foreach (const config &ai_configuration, era.child_range("ai")) {
568 +       wes_foreach (const config &ai_configuration, era.child_range("ai")) {
569                 const std::string &id = ai_configuration["id"];
570                 if (id.empty()){
571  
572 @@ -196,7 +196,7 @@
573         config aspect_config;
574         aspect_config["id"] = id;
575  
576 -       foreach (const config &aiparam, cfg.child_range("ai")) {
577 +       wes_foreach (const config &aiparam, cfg.child_range("ai")) {
578                 const config &_aspect = aiparam.find_child("aspect","id",id);
579                 if (_aspect) {
580                         aspect_config.append(_aspect);
581 @@ -216,7 +216,7 @@
582                 if (aspect_was_attribute) {
583                         facet_config["value"] = aiparam[id];
584                 } else {
585 -                       foreach (const config &value, aiparam.child_range(id)) {
586 +                       wes_foreach (const config &value, aiparam.child_range(id)) {
587                                 facet_config.add_child("value",value);
588                         }
589                 }
590 @@ -242,7 +242,7 @@
591  
592         //leave only the [ai] children
593         cfg = config();
594 -       foreach (const config &aiparam, original_cfg.child_range("ai")) {
595 +       wes_foreach (const config &aiparam, original_cfg.child_range("ai")) {
596                 cfg.add_child("ai",aiparam);
597         }
598  
599 @@ -264,7 +264,7 @@
600  
601         //find version
602         int version = 10600;
603 -       foreach (const config &aiparam, cfg.child_range("ai")) {
604 +       wes_foreach (const config &aiparam, cfg.child_range("ai")) {
605                 if (const config::attribute_value *a = aiparam.get("version")){
606                         int v = a->to_int(version);
607                         if (version<v) {
608 @@ -290,7 +290,7 @@
609         config parsed_cfg = config();
610  
611         LOG_AI_CONFIGURATION << "side "<< side <<": merging AI configurations"<< std::endl;
612 -       foreach (const config &aiparam, cfg.child_range("ai")) {
613 +       wes_foreach (const config &aiparam, cfg.child_range("ai")) {
614                 parsed_cfg.append(aiparam);
615         }
616  
617 @@ -302,7 +302,7 @@
618         parsed_cfg.merge_children_by_attribute("aspect","id");
619  
620         LOG_AI_CONFIGURATION << "side "<< side <<": removing duplicate [default] tags from aspects"<< std::endl;
621 -       foreach (config &aspect_cfg, parsed_cfg.child_range("aspect")) {
622 +       wes_foreach (config &aspect_cfg, parsed_cfg.child_range("aspect")) {
623                 if (!aspect_cfg.child("default")) {
624                         WRN_AI_CONFIGURATION << "side "<< side <<": aspect with id=["<<aspect_cfg["id"]<<"] lacks default config facet!" <<std::endl;
625                         continue;
626 @@ -341,7 +341,7 @@
627         if (cfg["ai_algorithm"]=="idle_ai") {
628                 is_idle_ai = true;
629         } else {
630 -               foreach (config &aiparam, cfg.child_range("ai")) {
631 +               wes_foreach (config &aiparam, cfg.child_range("ai")) {
632                         if (aiparam["ai_algorithm"]=="idle_ai") {
633                                 is_idle_ai = true;
634                                 break;
635 @@ -360,8 +360,8 @@
636  
637         config fallback_stage_cfg_ai;
638  
639 -       foreach (config &aiparam, cfg.child_range("ai")) {
640 -               foreach (const well_known_aspect &wka, well_known_aspects) {
641 +       wes_foreach (config &aiparam, cfg.child_range("ai")) {
642 +               wes_foreach (const well_known_aspect &wka, well_known_aspects) {
643                         if (wka.was_an_attribute_) {
644                                 aiparam.remove_attribute(wka.name_);
645                         } else {
646 @@ -370,7 +370,7 @@
647                 }
648  
649  
650 -               foreach (const config &aitarget, aiparam.child_range("target")) {
651 +               wes_foreach (const config &aitarget, aiparam.child_range("target")) {
652                         config aigoal;
653                         transfer_turns_and_time_of_day_data(aiparam,aigoal);
654  
655 @@ -388,14 +388,14 @@
656                 aiparam.clear_children("target");
657  
658  
659 -               foreach (config &ai_protect_unit, aiparam.child_range("protect_unit")) {
660 +               wes_foreach (config &ai_protect_unit, aiparam.child_range("protect_unit")) {
661                         transfer_turns_and_time_of_day_data(aiparam,ai_protect_unit);
662                         upgrade_protect_goal_config_from_1_07_02_to_1_07_03(side,ai_protect_unit,parsed_cfg,true);
663                 }
664                 aiparam.clear_children("protect_unit");
665  
666  
667 -               foreach (config &ai_protect_location, aiparam.child_range("protect_location")) {
668 +               wes_foreach (config &ai_protect_location, aiparam.child_range("protect_location")) {
669                         transfer_turns_and_time_of_day_data(aiparam,ai_protect_location);
670                         upgrade_protect_goal_config_from_1_07_02_to_1_07_03(side,ai_protect_location,parsed_cfg,false);
671                 }
672 @@ -423,19 +423,19 @@
673         fallback_stage_cfg_ai.clear_children("aspect");
674  
675         //move [stage]s to root of the config
676 -       foreach (const config &aistage, fallback_stage_cfg_ai.child_range("stage")) {
677 +       wes_foreach (const config &aistage, fallback_stage_cfg_ai.child_range("stage")) {
678                 parsed_cfg.add_child("stage",aistage);
679         }
680         fallback_stage_cfg_ai.clear_children("stage");
681  
682         //move [goal]s to root of the config
683 -       foreach (const config &aigoal, fallback_stage_cfg_ai.child_range("goal")) {
684 +       wes_foreach (const config &aigoal, fallback_stage_cfg_ai.child_range("goal")) {
685                 parsed_cfg.add_child("goal",aigoal);
686         }
687         fallback_stage_cfg_ai.clear_children("goal");
688  
689         //move [modify_ai]'s to root of the config
690 -       foreach (const config &aimodifyai, fallback_stage_cfg_ai.child_range("modify_ai")) {
691 +       wes_foreach (const config &aimodifyai, fallback_stage_cfg_ai.child_range("modify_ai")) {
692                 parsed_cfg.add_child("modify_ai",aimodifyai);
693         }
694         fallback_stage_cfg_ai.clear_children("modify_ai");
695 @@ -452,12 +452,12 @@
696  {
697         config cfg;
698  
699 -       foreach (const config &aiparam, ai_parameters) {
700 +       wes_foreach (const config &aiparam, ai_parameters) {
701                 cfg.add_child("ai",aiparam);
702         }
703  
704         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;
705 -       foreach (const well_known_aspect &wka, well_known_aspects) {
706 +       wes_foreach (const well_known_aspect &wka, well_known_aspects) {
707                 upgrade_aspect_config_from_1_07_02_to_1_07_03(side, cfg,parsed_cfg,wka.name_,wka.was_an_attribute_);
708         }
709  }
710 diff -ur wesnoth-1.10.3.orig/src/ai/contexts.cpp wesnoth-1.10.3/src/ai/contexts.cpp
711 --- wesnoth-1.10.3.orig/src/ai/contexts.cpp     2012-01-07 03:35:17.000000000 +0100
712 +++ wesnoth-1.10.3/src/ai/contexts.cpp  2012-07-11 13:16:05.919933361 +0200
713 @@ -223,19 +223,19 @@
714  
715  void readonly_context_impl::on_readonly_context_create() {
716         //init the composite ai engines
717 -       foreach(const config &cfg_element, cfg_.child_range("engine")){
718 +       wes_foreach(const config &cfg_element, cfg_.child_range("engine")){
719                 engine::parse_engine_from_config(*this,cfg_element,std::back_inserter(engines_));
720         }
721  
722         // init the composite ai aspects
723 -       foreach(const config &cfg_element, cfg_.child_range("aspect")){
724 +       wes_foreach(const config &cfg_element, cfg_.child_range("aspect")){
725                 std::vector<aspect_ptr> aspects;
726                 engine::parse_aspect_from_config(*this,cfg_element,cfg_element["id"],std::back_inserter(aspects));
727                 add_aspects(aspects);
728         }
729  
730         // init the composite ai goals
731 -       foreach(const config &cfg_element, cfg_.child_range("goal")){
732 +       wes_foreach(const config &cfg_element, cfg_.child_range("goal")){
733                 engine::parse_goal_from_config(*this,cfg_element,std::back_inserter(get_goals()));
734         }
735  }
736 @@ -255,13 +255,13 @@
737  config readonly_context_impl::to_readonly_context_config() const
738  {
739         config cfg;
740 -       foreach(const engine_ptr e, engines_) {
741 +       wes_foreach(const engine_ptr e, engines_) {
742                 cfg.add_child("engine",e->to_config());
743         }
744 -       foreach(const aspect_map::value_type a, aspects_) {
745 +       wes_foreach(const aspect_map::value_type a, aspects_) {
746                 cfg.add_child("aspect",a.second->to_config());
747         }
748 -       foreach(const goal_ptr g, goals_) {
749 +       wes_foreach(const goal_ptr g, goals_) {
750                 cfg.add_child("goal",g->to_config());
751         }
752         return cfg;
753 @@ -366,7 +366,7 @@
754         }
755  
756         for(std::map<map_location,pathfind::paths>::iterator m = res.begin(); m != res.end(); ++m) {
757 -               foreach (const pathfind::paths::step &dest, m->second.destinations)
758 +               wes_foreach (const pathfind::paths::step &dest, m->second.destinations)
759                 {
760                         const map_location& src = m->first;
761                         const map_location& dst = dest.curr;
762 @@ -406,7 +406,7 @@
763  
764  void readonly_context_impl::add_aspects(std::vector< aspect_ptr > &aspects )
765  {
766 -       foreach (aspect_ptr a, aspects) {
767 +       wes_foreach (aspect_ptr a, aspects) {
768                 const std::string id = a->get_id();
769                 known_aspect_map::iterator i = known_aspects_.find(id);
770                 if (i != known_aspects_.end()) {
771 @@ -1024,7 +1024,7 @@
772                         // The 0.5 power avoids underestimating too much the damage of a wounded unit.
773                         int hp = int(sqrt(double(un.hitpoints()) / un.max_hitpoints()) * 1000);
774                         int most_damage = 0;
775 -                       foreach (const attack_type &att, un.attacks())
776 +                       wes_foreach (const attack_type &att, un.attacks())
777                         {
778                                 int damage = att.damage() * att.num_attacks() * (100 + tod_modifier);
779                                 if (damage > most_damage) {
780 @@ -1112,7 +1112,7 @@
781         map_location const* best_occupied_keep = &map_location::null_location;
782         double move_left_at_best_occupied_keep = 0.0;
783  
784 -       foreach (const pathfind::paths::step &dest, leader_paths.destinations)
785 +       wes_foreach (const pathfind::paths::step &dest, leader_paths.destinations)
786         {
787                 const map_location &loc = dest.curr;
788                 if (keeps().find(loc)!=keeps().end()){
789 diff -ur wesnoth-1.10.3.orig/src/ai/default/ai.cpp wesnoth-1.10.3/src/ai/default/ai.cpp
790 --- wesnoth-1.10.3.orig/src/ai/default/ai.cpp   2012-01-07 03:35:17.000000000 +0100
791 +++ wesnoth-1.10.3/src/ai/default/ai.cpp        2012-07-11 13:16:05.909933359 +0200
792 @@ -144,7 +144,7 @@
793  
794  void ai_default_recruitment_stage::on_create() {
795         stage::on_create();
796 -       foreach (const config &c, cfg_.child_range("limit")) {
797 +       wes_foreach (const config &c, cfg_.child_range("limit")) {
798                 if (c.has_attribute("type") && c.has_attribute("max") ) {
799                         maximum_counts_.insert(std::make_pair(c["type"],lexical_cast_default<int>(c["max"],0)));
800                 }
801 @@ -193,7 +193,7 @@
802         bool found = false;
803         // Find an available unit that can be recruited,
804         // matches the desired usage type, and comes in under budget.
805 -       foreach (const std::string &name, current_team().recruits())
806 +       wes_foreach (const std::string &name, current_team().recruits())
807         {
808                 const unit_type *ut = unit_types.find(name);
809                 if (!ut) continue;
810 @@ -435,7 +435,7 @@
811  
812                         team &enemy_team = (*resources::teams)[j->side() - 1];
813                         const std::set<std::string> &recruits = enemy_team.recruits();
814 -                       foreach (const std::string &rec, recruits) {
815 +                       wes_foreach (const std::string &rec, recruits) {
816                                 get_combat_score_vs(ut,rec,score,weighting,0,0);
817                         }
818                         continue;
819 @@ -677,7 +677,7 @@
820                         double best_combat_score_of_advancement = 0;
821                         bool best_combat_score_of_advancement_found = false;
822                         int best_cost = recall_cost;
823 -                       foreach (const std::string &i, u.advances_to()) {
824 +                       wes_foreach (const std::string &i, u.advances_to()) {
825                                 const unit_type *ut = unit_types.find(i);
826                                 if (!ut) {
827                                         continue;
828 diff -ur wesnoth-1.10.3.orig/src/ai/formula/ai.cpp wesnoth-1.10.3/src/ai/formula/ai.cpp
829 --- wesnoth-1.10.3.orig/src/ai/formula/ai.cpp   2012-01-07 03:35:17.000000000 +0100
830 +++ wesnoth-1.10.3/src/ai/formula/ai.cpp        2012-07-11 13:16:05.919933361 +0200
831 @@ -548,7 +548,7 @@
832  variant villages_from_set(const Container& villages,
833                                           const std::set<map_location>* exclude=NULL) {
834         std::vector<variant> vars;
835 -       foreach(const map_location& loc, villages) {
836 +       wes_foreach(const map_location& loc, villages) {
837                 if(exclude && exclude->count(loc)) {
838                         continue;
839                 }
840 @@ -617,7 +617,7 @@
841         {
842                 const std::vector<std::string> &rp = get_recruitment_pattern();
843                 std::vector<variant> vars;
844 -               foreach (const std::string &i, rp) {
845 +               wes_foreach (const std::string &i, rp) {
846                         vars.push_back(variant(i));
847                 }
848                 return variant(&vars);
849 @@ -751,7 +751,7 @@
850                         std::vector<variant> v;
851                         tmp.push_back( v );
852                 }
853 -               foreach (const unit &u, units) {
854 +               wes_foreach (const unit &u, units) {
855                         tmp[u.side() - 1].push_back(variant(new unit_callable(u)));
856                 }
857                 for( size_t i = 0; i<tmp.size(); ++i)
858 @@ -924,7 +924,7 @@
859         //make sure we don't run out of refcount
860         vars_.add_ref();
861  
862 -       foreach (const config &func, cfg_.child_range("function"))
863 +       wes_foreach (const config &func, cfg_.child_range("function"))
864         {
865                 const t_string &name = func["name"];
866                 const t_string &inputs = func["inputs"];
867 @@ -947,7 +947,7 @@
868         if (const config &ai_vars = cfg_.child("vars"))
869         {
870                 variant var;
871 -               foreach (const config::attribute &i, ai_vars.attribute_range()) {
872 +               wes_foreach (const config::attribute &i, ai_vars.attribute_range()) {
873                         var.serialize_from_string(i.second);
874                         vars_.add(i.first, var);
875                 }
876 diff -ur wesnoth-1.10.3.orig/src/ai/formula/candidates.cpp wesnoth-1.10.3/src/ai/formula/candidates.cpp
877 --- wesnoth-1.10.3.orig/src/ai/formula/candidates.cpp   2012-01-07 03:35:17.000000000 +0100
878 +++ wesnoth-1.10.3/src/ai/formula/candidates.cpp        2012-07-11 13:16:05.919933361 +0200
879 @@ -32,7 +32,7 @@
880  void candidate_action_manager::load_config(const config& cfg, ai::formula_ai* ai, function_symbol_table* function_table)
881  {
882         // register candidate actions
883 -       foreach (const config &rc_action, cfg.child_range("register_candidate_action"))
884 +       wes_foreach (const config &rc_action, cfg.child_range("register_candidate_action"))
885         {
886                 candidate_action_ptr new_ca = load_candidate_action_from_config(rc_action,ai,function_table);
887  
888 @@ -67,7 +67,7 @@
889  {
890         evaluated_candidate_actions_.clear();
891  
892 -       foreach(candidate_action_ptr cm, candidate_actions_)
893 +       wes_foreach(candidate_action_ptr cm, candidate_actions_)
894         {
895                 cm->evaluate(ai, units);
896                 evaluated_candidate_actions_.insert(cm);
897 @@ -116,7 +116,7 @@
898         const config & filter_params = cfg.child("filter");
899  
900         if( filter_params ) {
901 -               foreach( const config::attribute filter_param, filter_params.attribute_range() )
902 +               wes_foreach( const config::attribute filter_param, filter_params.attribute_range() )
903                 {
904                         game_logic::const_formula_ptr filter_formula(
905                                         new game_logic::formula(filter_param.second, function_table));
906 diff -ur wesnoth-1.10.3.orig/src/ai/formula/function_table.cpp wesnoth-1.10.3/src/ai/formula/function_table.cpp
907 --- wesnoth-1.10.3.orig/src/ai/formula/function_table.cpp       2012-02-18 12:53:54.000000000 +0100
908 +++ wesnoth-1.10.3/src/ai/formula/function_table.cpp    2012-07-11 13:16:05.923266694 +0200
909 @@ -355,7 +355,7 @@
910                                 if( scores[current_side][i] > 98 )
911                                         continue;
912  
913 -                               foreach( int side , enemies) {
914 +                               wes_foreach( int side , enemies) {
915                                         int diff = scores[current_side][i] - scores[side][i];
916                                         if ( diff > enemy_tollerancy) {
917                                                 valid = false;
918 @@ -365,7 +365,7 @@
919                                 }
920  
921                                 if( valid ) {
922 -                                       foreach( int side , allies) {
923 +                                       wes_foreach( int side , allies) {
924                                                 if ( scores[current_side][i] - scores[side][i] > ally_tollerancy ) {
925                                                         valid = false;
926                                                         break;
927 @@ -563,7 +563,7 @@
928                      visited_locs.erase(starting_loc);
929  
930                  std::vector<variant> res;
931 -                foreach( const map_location& ml, visited_locs) {
932 +                wes_foreach( const map_location& ml, visited_locs) {
933                      res.push_back( variant(new location_callable( ml ) ) );
934                  }
935  
936 @@ -841,7 +841,7 @@
937                 ai::attack_analysis* analysis = convert_variant<ai::attack_analysis>(attack);
938                 //unit_map units_with_moves(*resources::units);
939                 //typedef std::pair<map_location, map_location> mv;
940 -               //foreach (const mv &m, analysis->movements) {
941 +               //wes_foreach (const mv &m, analysis->movements) {
942                 //      units_with_moves.move(m.first, m.second);
943                 //}
944  
945 @@ -1629,7 +1629,7 @@
946  
947                 std::vector<attack_type> attacks = attacker.attacks();
948  
949 -               foreach(const attack_type &attack, attacks) {
950 +               wes_foreach(const attack_type &attack, attacks) {
951                         const int dmg = round_damage(attack.damage(), defender.damage_from(attack), 100) * attack.num_attacks();
952                         if (attack.range() == "melee") {
953                                 highest_melee_damage = std::max(highest_melee_damage, dmg);
954 diff -ur wesnoth-1.10.3.orig/src/ai/manager.cpp wesnoth-1.10.3/src/ai/manager.cpp
955 --- wesnoth-1.10.3.orig/src/ai/manager.cpp      2012-01-07 03:35:17.000000000 +0100
956 +++ wesnoth-1.10.3/src/ai/manager.cpp   2012-07-11 13:16:05.913266692 +0200
957 @@ -89,7 +89,7 @@
958  
959         if (this->ai_) {
960                 ai_->on_create();
961 -               foreach (config &mod_ai, cfg_.child_range("modify_ai")) {
962 +               wes_foreach (config &mod_ai, cfg_.child_range("modify_ai")) {
963                         if (!mod_ai.has_attribute("side")) {
964                                 mod_ai["side"] = side;
965                         }
966 @@ -149,8 +149,8 @@
967                 cfg_.merge_children_by_attribute("aspect","id");
968         } else {
969                 // else run 'add_facet' command on each [aspect][facet]
970 -               foreach (const config &cfg_a, cfg.child_range("aspect")) {
971 -                       foreach (const config &cfg_f, cfg_a.child_range("facet")) {
972 +               wes_foreach (const config &cfg_a, cfg.child_range("aspect")) {
973 +                       wes_foreach (const config &cfg_f, cfg_a.child_range("facet")) {
974                                 readonly_context_->add_facet(cfg_a["id"],cfg_f);
975                         }
976                 }
977 diff -ur wesnoth-1.10.3.orig/src/ai/testing/aspect_attacks.cpp wesnoth-1.10.3/src/ai/testing/aspect_attacks.cpp
978 --- wesnoth-1.10.3.orig/src/ai/testing/aspect_attacks.cpp       2012-01-23 16:09:23.000000000 +0100
979 +++ wesnoth-1.10.3/src/ai/testing/aspect_attacks.cpp    2012-07-11 13:16:05.913266692 +0200
980 @@ -468,7 +468,7 @@
981                         // The 0.5 power avoids underestimating too much the damage of a wounded unit.
982                         int hp = int(sqrt(double(un.hitpoints()) / un.max_hitpoints()) * 1000);
983                         int most_damage = 0;
984 -                       foreach (const attack_type &att, un.attacks())
985 +                       wes_foreach (const attack_type &att, un.attacks())
986                         {
987                                 int damage = att.damage() * att.num_attacks() * (100 + tod_modifier);
988                                 if (damage > most_damage) {
989 @@ -572,7 +572,7 @@
990                         // The 0.5 power avoids underestimating too much the damage of a wounded unit.
991                         int hp = int(sqrt(double(un.hitpoints()) / un.max_hitpoints()) * 1000);
992                         int most_damage = 0;
993 -                       foreach (const attack_type &att, un.attacks())
994 +                       wes_foreach (const attack_type &att, un.attacks())
995                         {
996                                 int damage = att.damage() * att.num_attacks() * (100 + tod_modifier);
997                                 if (damage > most_damage) {
998 diff -ur wesnoth-1.10.3.orig/src/ai/testing/ca.cpp wesnoth-1.10.3/src/ai/testing/ca.cpp
999 --- wesnoth-1.10.3.orig/src/ai/testing/ca.cpp   2012-01-07 03:35:17.000000000 +0100
1000 +++ wesnoth-1.10.3/src/ai/testing/ca.cpp        2012-07-11 13:16:05.916600027 +0200
1001 @@ -306,7 +306,7 @@
1002         bool found = false;
1003         // Find an available unit that can be recruited,
1004         // matches the desired usage type, and comes in under budget.
1005 -       foreach (const std::string &name, current_team().recruits())
1006 +       wes_foreach (const std::string &name, current_team().recruits())
1007         {
1008                 const unit_type *ut = unit_types.find(name);
1009                 if (!ut) continue;
1010 @@ -686,7 +686,7 @@
1011         possible_moves.insert(std::pair<map_location,pathfind::paths>(leader->get_location(), leader_paths));
1012  
1013         map_location loc;
1014 -       foreach (const map_location &l, route.steps)
1015 +       wes_foreach (const map_location &l, route.steps)
1016         {
1017                 if (leader_paths.destinations.contains(l) &&
1018                     power_projection(l, get_enemy_dstsrc()) < leader->hitpoints() * max_risk)
1019 @@ -779,7 +779,7 @@
1020                 // The leader can't move to his keep, try to move to the closest location
1021                 // to the keep where there are no enemies in range.
1022                 int current_distance = distance_between(leader->get_location(), keep);
1023 -               foreach (const pathfind::paths::step &dest, leader_paths.destinations)
1024 +               wes_foreach (const pathfind::paths::step &dest, leader_paths.destinations)
1025                 {
1026                         if (!units_.find(dest.curr).valid()){
1027                                 const int new_distance = distance_between(dest.curr,keep);
1028 @@ -1728,12 +1728,12 @@
1029         }*/
1030         //int leader_adj_count = 0;
1031         std::vector<map_location> leaders_adj_v;
1032 -       foreach(unit_map::const_iterator leader, leaders){
1033 +       wes_foreach(unit_map::const_iterator leader, leaders){
1034                 map_location tmp_leader_adj[6];
1035                 get_adjacent_tiles(leader->get_location(), tmp_leader_adj);
1036 -               foreach(map_location &loc, tmp_leader_adj){
1037 +               wes_foreach(map_location &loc, tmp_leader_adj){
1038                         bool found = false;
1039 -                       foreach(map_location &new_loc, leaders_adj_v){
1040 +                       wes_foreach(map_location &new_loc, leaders_adj_v){
1041                                 if(new_loc == loc){
1042                                         found = true;
1043                                         break;
1044 @@ -1974,7 +1974,7 @@
1045         }
1046         std::vector<unit_map::unit_iterator> ai_leaders = resources::units->find_leaders(get_side());
1047         bool allied_leaders_available = false;
1048 -       foreach(team &tmp_team, *resources::teams){
1049 +       wes_foreach(team &tmp_team, *resources::teams){
1050                 if(!current_team().is_enemy(tmp_team.side())){
1051                         std::vector<unit_map::unit_iterator> allied_leaders = resources::units->find_leaders(get_side());
1052                         if (!allied_leaders.empty()){
1053 @@ -2001,7 +2001,7 @@
1054         calculate_moves(*resources::units, possible_moves, friends_srcdst, friends_dstsrc, false, true);
1055  
1056         //check for each ai leader if he should move away from his keep
1057 -       foreach(unit_map::unit_iterator &ai_leader, ai_leaders){
1058 +       wes_foreach(unit_map::unit_iterator &ai_leader, ai_leaders){
1059                 //only if leader is on a keep
1060                 if (!resources::game_map->is_keep(ai_leader->get_location())) {
1061                         continue;
1062 @@ -2059,7 +2059,7 @@
1063                 }
1064                 ai_leader->remove_movement_ai();
1065         }
1066 -       foreach(unit_map::unit_iterator &leader, ai_leaders){
1067 +       wes_foreach(unit_map::unit_iterator &leader, ai_leaders){
1068                 leader->remove_movement_ai();
1069         }
1070         //ERR_AI_TESTING_AI_DEFAULT << get_name() << ": evaluate - not yet implemented" << std::endl;
1071 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
1072 --- wesnoth-1.10.3.orig/src/ai/testing/ca_global_fallback.cpp   2012-01-07 03:35:17.000000000 +0100
1073 +++ wesnoth-1.10.3/src/ai/testing/ca_global_fallback.cpp        2012-07-11 13:16:05.913266692 +0200
1074 @@ -89,7 +89,7 @@
1075         LOG_AI << "start" << std::endl;
1076         const int ticks = SDL_GetTicks();
1077         double res_sum = 0;
1078 -       foreach( unit &u, *resources::units)
1079 +       wes_foreach( unit &u, *resources::units)
1080         {
1081                 if (u.side()!=get_side())
1082                 {
1083 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
1084 --- wesnoth-1.10.3.orig/src/ai/testing/ca_testing_recruitment.cpp       2012-01-07 03:35:17.000000000 +0100
1085 +++ wesnoth-1.10.3/src/ai/testing/ca_testing_recruitment.cpp    2012-07-11 13:16:05.916600027 +0200
1086 @@ -206,7 +206,7 @@
1087        int get_current_qty(const std::string &name) const
1088        {
1089           int counter = 0;
1090 -         foreach(unit &un, *resources::units){
1091 +         wes_foreach(unit &un, *resources::units){
1092              if(un.side() == side() && un.type_id() == name) // @todo: is type_id good?
1093              {
1094                 counter++;
1095 @@ -345,7 +345,7 @@
1096     const int hitpoints_const = 100;
1097     double score = 0;
1098     double total_weight = 0;
1099 -   foreach(const unit &enemy_unit, *resources::units)
1100 +   wes_foreach(const unit &enemy_unit, *resources::units)
1101     {
1102        if(enemy_unit.can_recruit() || !t.is_enemy(enemy_unit.side()))
1103        {
1104 @@ -358,13 +358,13 @@
1105  
1106        score += compare_unit_types(info, *enemy_info) * weight;
1107     }
1108 -   foreach(fake_team &enemy_team, fake_teams)
1109 +   wes_foreach(fake_team &enemy_team, fake_teams)
1110     {
1111        if(!t.is_enemy(enemy_team.side()))
1112        {
1113           continue;
1114        }
1115 -      foreach(const potential_recruit &enemy_unit,  enemy_team.extra_units())
1116 +      wes_foreach(const potential_recruit &enemy_unit,  enemy_team.extra_units())
1117        {
1118           const unit_type *enemy_info = enemy_unit.type();
1119           VALIDATE(enemy_info, "Unknown unit type : " + enemy_unit.id() + " while updating recruit quality.");
1120 @@ -386,7 +386,7 @@
1121  
1122  /*static void update_recruit_qualities(fake_team &t, std::vector<fake_team> &fake_teams)
1123  {
1124 -   foreach ( potential_recruit &recruit, t.recruit_list() )
1125 +   wes_foreach ( potential_recruit &recruit, t.recruit_list() )
1126     {
1127        double score = get_unit_quality(*recruit.type(),t,fake_teams);
1128        recruit.set_quality(score);
1129 @@ -425,11 +425,11 @@
1130         }
1131  
1132     std::map<std::string, int> current_units;
1133 -   foreach (const potential_recruit &i, t.extra_units())
1134 +   wes_foreach (const potential_recruit &i, t.extra_units())
1135     {
1136        current_units[(i.id())]++;
1137     }
1138 -   foreach (const unit &i, *resources::units)
1139 +   wes_foreach (const unit &i, *resources::units)
1140     {
1141         if (i.side()==t.side())
1142         {
1143 @@ -440,7 +440,7 @@
1144     double max_quality = recruit_list[0].quality();
1145     int max_cost = recruit_list[0].cost();
1146     std::vector<const potential_recruit*> sorted = std::vector<const potential_recruit*>();
1147 -   foreach(const potential_recruit &i, recruit_list)
1148 +   wes_foreach(const potential_recruit &i, recruit_list)
1149     {
1150        if(i.cost() > max_cost)
1151        {
1152 @@ -457,7 +457,7 @@
1153     potential_recruit_sorter sorter(max_cost, max_quality, quality_factor);
1154     std::sort(sorted.begin(), sorted.end(), sorter);
1155     int recruited = 0;
1156 -   foreach(const potential_recruit *i, sorted)
1157 +   wes_foreach(const potential_recruit *i, sorted)
1158     {
1159        if(recruited < max_units_to_recruit)
1160        {
1161 @@ -488,7 +488,7 @@
1162  static void ai_choose_recruits(fake_team &t, int max_units_to_recruit, double quality_factor, bool counter_recruit)
1163  {
1164         std::vector<potential_recruit> recruits = ai_choose_best_recruits(t, max_units_to_recruit, quality_factor, counter_recruit);
1165 -   foreach(potential_recruit &i, recruits) {
1166 +   wes_foreach(potential_recruit &i, recruits) {
1167        t.fake_recruit(i);
1168     }
1169  
1170 @@ -554,7 +554,7 @@
1171     //DBG_AI << "start of get_recruit_qualities" << std::endl;
1172     typedef std::map<const unit_type*, std::vector<double> > unit_map;
1173     unit_map enemies;
1174 -   foreach(unit &un, *resources::units){
1175 +   wes_foreach(unit &un, *resources::units){
1176            if(t.is_enemy(un.side()) && !un.can_recruit()){
1177                    enemies[un.type()].push_back(
1178                           static_cast<double>(un.hitpoints())
1179 @@ -562,10 +562,10 @@
1180            }
1181     }
1182     DBG_AI << "before extra_units of fake_teams: enemies.size() = " << enemies.size() << std::endl;
1183 -   foreach(fake_team &tmp_t, fake_teams)
1184 +   wes_foreach(fake_team &tmp_t, fake_teams)
1185     {
1186            if (t.is_enemy(tmp_t.side())) {
1187 -                  foreach(potential_recruit &rec, tmp_t.extra_units())
1188 +                  wes_foreach(potential_recruit &rec, tmp_t.extra_units())
1189                    {
1190                            enemies[rec.type()].push_back(1.0);
1191                    }
1192 @@ -573,10 +573,10 @@
1193     }
1194     DBG_AI << "after extra_units of fake_teams: enemies.size() = " << enemies.size() << std::endl;
1195  
1196 -   foreach(potential_recruit &rec, recruit_list) {
1197 +   wes_foreach(potential_recruit &rec, recruit_list) {
1198            double score = 0;
1199            double weighting = 0;
1200 -          foreach(unit_map::value_type &enemy, enemies) {
1201 +          wes_foreach(unit_map::value_type &enemy, enemies) {
1202                    double hitpoints_sum = std::accumulate(enemy.second.begin(),enemy.second.end(),0);
1203                    score += compare_unit_types(*rec.type(), *enemy.first) * hitpoints_sum;
1204                    weighting += hitpoints_sum;
1205 @@ -621,14 +621,14 @@
1206  {
1207     std::vector<defender_pair_type*> defenders;
1208     std::vector<enemy_pair_type*> enemies;
1209 -   foreach(unit &un, *resources::units)
1210 +   wes_foreach(unit &un, *resources::units)
1211     {
1212        if(t.is_enemy(un.side()))
1213        {
1214  //         const unit_type &enemy_type = *un.type();
1215           //enemy_pair_type *pair = new enemy_pair_type(new unit_data(un.id(), un.type()));
1216           enemy_pair_type *pair = new enemy_pair_type(un.type());
1217 -         foreach(unit &defender, *resources::units)
1218 +         wes_foreach(unit &defender, *resources::units)
1219           {
1220              if(!t.is_enemy(defender.side())){
1221                 //int score = compare_unit_types(*defender.type(), enemy_type);
1222 @@ -639,9 +639,9 @@
1223                 //}
1224              }
1225           }
1226 -         foreach(fake_team &tmp_t, fake_teams){
1227 +         wes_foreach(fake_team &tmp_t, fake_teams){
1228              if(!t.is_enemy(tmp_t.side())){
1229 -               foreach(potential_recruit &rec, tmp_t.extra_units()){
1230 +               wes_foreach(potential_recruit &rec, tmp_t.extra_units()){
1231           //         int score = compare_unit_types(*rec.type(), enemy_type);
1232           //         if(score >= 0){
1233                       //pair->add_defender(new unit_data(rec.id(), rec.type()));
1234 @@ -657,7 +657,7 @@
1235           //const unit_type &defender_type = *un.type();
1236           //defender_pair_type *pair = new defender_pair_type(new unit_data(un.id(), un.type()));
1237           defender_pair_type *pair = new defender_pair_type(un.type());
1238 -         foreach(unit &enemy, *resources::units)
1239 +         wes_foreach(unit &enemy, *resources::units)
1240           {
1241              //int score = compare_unit_types(defender_type, *enemy.type());
1242              //if(score >= 0)
1243 @@ -666,9 +666,9 @@
1244              pair->add_enemy(enemy.type());
1245              //}
1246           }
1247 -         foreach(fake_team &tmp_t, fake_teams){
1248 +         wes_foreach(fake_team &tmp_t, fake_teams){
1249              if(t.is_enemy(tmp_t.side())){
1250 -               foreach(potential_recruit &rec, tmp_t.extra_units()){
1251 +               wes_foreach(potential_recruit &rec, tmp_t.extra_units()){
1252                    //int score = compare_unit_types(defender_type, *rec.type());
1253                    //if(score >= 0){
1254                       //pair->add_enemy(new unit_data(rec.id(), rec.type()));
1255 @@ -680,14 +680,14 @@
1256           defenders.push_back(pair);
1257        }
1258     }
1259 -   foreach(fake_team &tmp_t, fake_teams)
1260 +   wes_foreach(fake_team &tmp_t, fake_teams)
1261     {
1262 -      foreach(potential_recruit &rec, tmp_t.extra_units()){
1263 +      wes_foreach(potential_recruit &rec, tmp_t.extra_units()){
1264           if(t.is_enemy(tmp_t.side())){
1265              //const unit_type &enemy_type = *rec.type();
1266              //enemy_pair_type *pair = new enemy_pair_type(new unit_data(rec.id(), rec.type()));
1267              enemy_pair_type *pair = new enemy_pair_type(rec.type());
1268 -            foreach(unit &defender, *resources::units){
1269 +            wes_foreach(unit &defender, *resources::units){
1270                 if(t.is_enemy(defender.side())){
1271                    continue;
1272                 }
1273 @@ -698,11 +698,11 @@
1274                 //}
1275              }
1276              //HIER
1277 -            foreach(fake_team &sub_t, fake_teams){
1278 +            wes_foreach(fake_team &sub_t, fake_teams){
1279                 if(t.is_enemy(sub_t.side())){
1280                    continue;
1281                 }
1282 -               foreach(potential_recruit &sub_rec, sub_t.extra_units()){
1283 +               wes_foreach(potential_recruit &sub_rec, sub_t.extra_units()){
1284                    //int score = compare_unit_types(*sub_rec.type(), enemy_type);
1285                    //if(score >= 0){
1286                       //pair->add_defender(new unit_data(sub_rec.id(), sub_rec.type()));
1287 @@ -715,7 +715,7 @@
1288              //const unit_type &defender_type = *rec.type();
1289              //defender_pair_type *pair = new defender_pair_type(new unit_data(rec.id(), rec.type()));
1290              defender_pair_type *pair = new defender_pair_type(rec.type());
1291 -            foreach(unit &enemy, *resources::units)
1292 +            wes_foreach(unit &enemy, *resources::units)
1293              {
1294                 if(!t.is_enemy(enemy.side())){
1295                    continue;
1296 @@ -726,11 +726,11 @@
1297                 pair->add_enemy(rec.type());
1298              //   }
1299              }
1300 -            foreach(fake_team &sub_t, fake_teams){
1301 +            wes_foreach(fake_team &sub_t, fake_teams){
1302                 if(!t.is_enemy(sub_t.side())){
1303                    continue;
1304                 }
1305 -               foreach(potential_recruit &sub_rec, sub_t.extra_units()){
1306 +               wes_foreach(potential_recruit &sub_rec, sub_t.extra_units()){
1307                 //   int score = compare_unit_types(defender_type, *sub_rec.type());
1308                 //   if(score >= 0){
1309                       //pair->add_enemy(new unit_data(sub_rec.id(), sub_rec.type()));
1310 @@ -744,17 +744,17 @@
1311     }
1312     double min_score = 0;
1313     double max_score = 0;
1314 -   foreach(enemy_pair_type *pair, enemies)
1315 +   wes_foreach(enemy_pair_type *pair, enemies)
1316     {
1317  //      if(pair->defenders.size() == 0)
1318  //      {
1319  //         pair->score = -10000;
1320  //      }else{
1321 -         //foreach(unit_data *defender, pair->defenders)
1322 -         foreach(unit_type *defender, pair->defenders)
1323 +         //wes_foreach(unit_data *defender, pair->defenders)
1324 +         wes_foreach(unit_type *defender, pair->defenders)
1325           {
1326              unsigned int defender_enemies = 0;
1327 -            foreach(defender_pair_type *defender_p, defenders)
1328 +            wes_foreach(defender_pair_type *defender_p, defenders)
1329              {
1330                 //if(defender->id == defender_p->defender->id){
1331                 if(defender->type_name()() == defender_p->defender->type_name()){
1332 @@ -778,7 +778,7 @@
1333     }
1334     double score = 0;
1335     score -= max_score - min_score;
1336 -   foreach(enemy_pair_type *pair, enemies)
1337 +   wes_foreach(enemy_pair_type *pair, enemies)
1338     {
1339        score += pair->score;
1340     }
1341 @@ -798,16 +798,16 @@
1342     typedef std::map<const unit_type*, std::vector<double> > unit_map;
1343     unit_map enemies;
1344     unit_map defenders;
1345 -   foreach(unit &un, *resources::units){
1346 +   wes_foreach(unit &un, *resources::units){
1347        if(t.is_enemy(un.side())){
1348           enemies[un.type()].push_back((double)un.hitpoints() / (double)un.max_hitpoints());
1349        }else{
1350           defenders[un.type()].push_back(un.hitpoints() / un.max_hitpoints());
1351        }
1352     }
1353 -   foreach(fake_team &tmp_t, fake_teams)
1354 +   wes_foreach(fake_team &tmp_t, fake_teams)
1355     {
1356 -      foreach(potential_recruit &rec, tmp_t.extra_units())
1357 +      wes_foreach(potential_recruit &rec, tmp_t.extra_units())
1358        {
1359           if(t.is_enemy(tmp_t.side())){
1360              enemies[rec.type()].push_back(1.0);
1361 @@ -817,13 +817,13 @@
1362        }
1363     }
1364     double result = 0;
1365 -   foreach(unit_map::value_type &defender, defenders)
1366 +   wes_foreach(unit_map::value_type &defender, defenders)
1367     {
1368        double defenders_score = 0;
1369 -      foreach(unit_map::value_type &enemy, enemies)
1370 +      wes_foreach(unit_map::value_type &enemy, enemies)
1371        {
1372           double hitpoints_sum = 0;
1373 -         foreach(double i, enemy.second)
1374 +         wes_foreach(double i, enemy.second)
1375           {
1376              hitpoints_sum += i;
1377           }
1378 @@ -831,7 +831,7 @@
1379  
1380        }
1381        double hitpoints_sum = 0;
1382 -      foreach(double i, defender.second)
1383 +      wes_foreach(double i, defender.second)
1384        {
1385           hitpoints_sum += i;
1386        }
1387 @@ -842,7 +842,7 @@
1388     return result;
1389  //   vector<defender_pair> defenders;
1390  //   vector<enemy_pair> enemies;
1391 -//   //foreach(unit &un, *resources::units)
1392 +//   //wes_foreach(unit &un, *resources::units)
1393  //   //{
1394  //   //   if(t.is_enemy(un.side()))
1395  //   //   {
1396 @@ -851,14 +851,14 @@
1397  //   //      defenders.push_back(un.id());
1398  //   //   }
1399  //   //}
1400 -//   foreach(unit &un, *resources::units)
1401 +//   wes_foreach(unit &un, *resources::units)
1402  //   {
1403  //      if(t.is_enemy(un.side()))
1404  //      {
1405  //         const unit_type &enemy_type = un.type();
1406  //         enemy_pair pair;
1407  //         pair.enemy = new unit_data(un.id(), enemy_type);
1408 -//         foreach(unit &defender, *resources::units)
1409 +//         wes_foreach(unit &defender, *resources::units)
1410  //         {
1411  //            int score = compare_unit_types(defender.type(), enemy_type);
1412  //            if(score >= 0)
1413 @@ -873,7 +873,7 @@
1414  //         const unit_type &defender_type = un.type();
1415  //         defender_pair pair;
1416  //         pair.defender = new unit_data(defender.id(), defender_type);
1417 -//         foreach(unit &enemy, *resources::units)
1418 +//         wes_foreach(unit &enemy, *resources::units)
1419  //         {
1420  //            int score = compare_unit_types(defender_type, enemy.type());
1421  //            if(score >= 0)
1422 @@ -885,10 +885,10 @@
1423  //         enemies.push_back(pair);
1424  //      }
1425  //   }
1426 -//   foreach(fake_team &tmp_t, fake_teams)
1427 +//   wes_foreach(fake_team &tmp_t, fake_teams)
1428  //   {
1429  //      if(t.is_enemy(tmp_t.side())){
1430 -//         foreach(potential_recruit &rec, tmp_t.extra_units())
1431 +//         wes_foreach(potential_recruit &rec, tmp_t.extra_units())
1432  //         {
1433  //
1434  //         }
1435 @@ -898,7 +898,7 @@
1436  //
1437  //   }
1438  //   //std::vector<unit> no_defense_enemies;
1439 -//   foreach(enemy_pair &pair, enemies)
1440 +//   wes_foreach(enemy_pair &pair, enemies)
1441  //   {
1442  //      if(pair.defenders.size() == 0)
1443  //      {
1444 @@ -906,11 +906,11 @@
1445  //
1446  //         pair.score = 0;
1447  //      }else{
1448 -//         foreach(unit_data &defender, pair.defenders)
1449 +//         wes_foreach(unit_data &defender, pair.defenders)
1450  //         {
1451  //            //unit_type &defender = defender_data.type;
1452  //            unsigned int defender_enemies = 0;
1453 -//            foreach(defender_pair &defender_p, defenders)
1454 +//            wes_foreach(defender_pair &defender_p, defenders)
1455  //            {
1456  //               if(defender.id == defender_p.defender.id){
1457  //                  defender_enemies = defender_p.enemies.size();
1458 @@ -924,7 +924,7 @@
1459  //   }
1460  //   //enemy_pair *worst_pair = &enemies[0];
1461  //   double total_score = 0;
1462 -//   foreach(enemy_pair &pair, enemies)
1463 +//   wes_foreach(enemy_pair &pair, enemies)
1464  //   {
1465  //      total_score += pair.score;
1466  //   }
1467 @@ -936,7 +936,7 @@
1468  //   //unit &worst_def_unit;
1469  //   vector<defender_pair> defenders;
1470  //   vector<enemy_pair> enemies;
1471 -//   /*foreach(unit &un, *resources::units)
1472 +//   /*wes_foreach(unit &un, *resources::units)
1473  //   {
1474  //      if(t.is_enemy(un.side()))
1475  //      {
1476 @@ -945,14 +945,14 @@
1477  //         defenders.push_back(un.id());
1478  //      }
1479  //   }*/
1480 -//   foreach(unit &un, *resources::units)
1481 +//   wes_foreach(unit &un, *resources::units)
1482  //   {
1483  //      if(t.is_enemy(un.side()))
1484  //      {
1485  //         const unit_type &enemy_type = un.type();
1486  //         enemy_pair pair;
1487  //         pair.enemy = un;
1488 -//         foreach(unit &defender, *resources::units)
1489 +//         wes_foreach(unit &defender, *resources::units)
1490  //         {
1491  //            int score = compare_unit_types(defender.type(), enemy_type);
1492  //            if(score >= 0)
1493 @@ -967,7 +967,7 @@
1494  //         const unit_type &defender_type = un.type();
1495  //         defender_pair pair;
1496  //         pair.defender = un;
1497 -//         foreach(unit &enemy, *resources::units)
1498 +//         wes_foreach(unit &enemy, *resources::units)
1499  //         {
1500  //            int score = compare_unit_types(defender_type, enemy.type());
1501  //            if(score >= 0)
1502 @@ -980,7 +980,7 @@
1503  //      }
1504  //   }
1505  //   //std::vector<unit> no_defense_enemies;
1506 -//   foreach(enemy_pair &pair, enemies)
1507 +//   wes_foreach(enemy_pair &pair, enemies)
1508  //   {
1509  //      if(pair.defenders.size() == 0)
1510  //      {
1511 @@ -988,10 +988,10 @@
1512  //         return pair.enemy;
1513  //         //pair.score = 0;
1514  //      }else{
1515 -//         foreach(unit &defender, pair.defenders)
1516 +//         wes_foreach(unit &defender, pair.defenders)
1517  //         {
1518  //            unsigned int defender_enemies = 0;
1519 -//            foreach(defender_pair &defender_p, defenders)
1520 +//            wes_foreach(defender_pair &defender_p, defenders)
1521  //            {
1522  //               if(defender.id() == defender_p.defender.id()){
1523  //                  defender_enemies = defender_p.enemies.size();
1524 @@ -1004,7 +1004,7 @@
1525  //      }
1526  //   }
1527  //   enemy_pair *worst_pair = &enemies[0];
1528 -//   foreach(enemy_pair &pair, enemies)
1529 +//   wes_foreach(enemy_pair &pair, enemies)
1530  //   {
1531  //      if(pair.score < worst_pair.score)
1532  //      {
1533 @@ -1039,16 +1039,16 @@
1534     for(int recruited_amount = 0; recruited_amount < max_units_to_recruit; recruited_amount++)
1535     {
1536  
1537 -      foreach(fake_team &t, fake_teams)
1538 +      wes_foreach(fake_team &t, fake_teams)
1539        {
1540           t.reset();
1541        }
1542  
1543        std::vector<potential_recruit> ai_recruit_list = ai_t->recruit_list();
1544  
1545 -      foreach(potential_recruit &recruit_type, ai_recruit_list)
1546 +      wes_foreach(potential_recruit &recruit_type, ai_recruit_list)
1547        {
1548 -         foreach(fake_team &t, fake_teams)
1549 +         wes_foreach(fake_team &t, fake_teams)
1550           {
1551              t.reset();
1552           }
1553 @@ -1063,7 +1063,7 @@
1554           }
1555           LOG_AI << "Pretend that we recruited: " << recruit_type.id() << std::endl;
1556           ai_t->fake_recruit(recruit_type);
1557 -         foreach(fake_team &t, fake_teams)
1558 +         wes_foreach(fake_team &t, fake_teams)
1559           {
1560              if(ai_t->side() == t.side())
1561              {
1562 diff -ur wesnoth-1.10.3.orig/src/ai/testing/stage_rca.cpp wesnoth-1.10.3/src/ai/testing/stage_rca.cpp
1563 --- wesnoth-1.10.3.orig/src/ai/testing/stage_rca.cpp    2012-01-07 03:35:17.000000000 +0100
1564 +++ wesnoth-1.10.3/src/ai/testing/stage_rca.cpp 2012-07-11 13:16:05.913266692 +0200
1565 @@ -49,7 +49,7 @@
1566  void candidate_action_evaluation_loop::on_create()
1567  {
1568         //init the candidate actions
1569 -       foreach(const config &cfg_element, cfg_.child_range("candidate_action")){
1570 +       wes_foreach(const config &cfg_element, cfg_.child_range("candidate_action")){
1571                 engine::parse_candidate_action_from_config(*this,cfg_element,back_inserter(candidate_actions_));
1572         }
1573  
1574 @@ -69,7 +69,7 @@
1575  config candidate_action_evaluation_loop::to_config() const
1576  {
1577         config cfg = stage::to_config();
1578 -       foreach(candidate_action_ptr ca, candidate_actions_){
1579 +       wes_foreach(candidate_action_ptr ca, candidate_actions_){
1580                 cfg.add_child("candidate_action",ca->to_config());
1581         }
1582         return cfg;
1583 @@ -88,7 +88,7 @@
1584  {
1585         LOG_AI_TESTING_RCA_DEFAULT << "Starting candidate action evaluation loop for side "<< get_side() << std::endl;
1586  
1587 -       foreach(candidate_action_ptr ca, candidate_actions_){
1588 +       wes_foreach(candidate_action_ptr ca, candidate_actions_){
1589                 ca->enable();
1590         }
1591  
1592 @@ -103,7 +103,7 @@
1593                 candidate_action_ptr best_ptr;
1594  
1595                 //Evaluation
1596 -               foreach(candidate_action_ptr ca_ptr, candidate_actions_){
1597 +               wes_foreach(candidate_action_ptr ca_ptr, candidate_actions_){
1598                         if (!ca_ptr->is_enabled()){
1599                                 DBG_AI_TESTING_RCA_DEFAULT << "Skipping disabled candidate action: "<< *ca_ptr << std::endl;
1600                                 continue;
1601 diff -ur wesnoth-1.10.3.orig/src/arrow.cpp wesnoth-1.10.3/src/arrow.cpp
1602 --- wesnoth-1.10.3.orig/src/arrow.cpp   2012-01-07 03:35:17.000000000 +0100
1603 +++ wesnoth-1.10.3/src/arrow.cpp        2012-07-11 13:16:06.023266690 +0200
1604 @@ -293,7 +293,7 @@
1605  {
1606         if(!SCREEN) return;
1607  
1608 -       foreach(map_location const& loc, path)
1609 +       wes_foreach(map_location const& loc, path)
1610         {
1611                 SCREEN->invalidate(loc);
1612         }
1613 diff -ur wesnoth-1.10.3.orig/src/builder.cpp wesnoth-1.10.3/src/builder.cpp
1614 --- wesnoth-1.10.3.orig/src/builder.cpp 2012-01-07 03:35:17.000000000 +0100
1615 +++ wesnoth-1.10.3/src/builder.cpp      2012-07-11 13:16:05.999933356 +0200
1616 @@ -65,12 +65,12 @@
1617                 sorted_images = true;
1618         }
1619  
1620 -       foreach(const rule_image_rand& ri, images){
1621 +       wes_foreach(const rule_image_rand& ri, images){
1622                 bool is_background = ri->is_background();
1623  
1624                 imagelist& img_list = is_background ? images_background : images_foreground;
1625  
1626 -               foreach(const rule_image_variant& variant, ri->variants){
1627 +               wes_foreach(const rule_image_variant& variant, ri->variants){
1628                         if(!variant.tods.empty() && variant.tods.find(tod) == variant.tods.end())
1629                                 continue;
1630  
1631 @@ -250,12 +250,12 @@
1632  
1633         tile& btile = tile_map_[loc];
1634  
1635 -       foreach(animated<image::locator>& a, btile.images_background) {
1636 +       wes_foreach(animated<image::locator>& a, btile.images_background) {
1637                 if(a.need_update())
1638                         changed = true;
1639                 a.update_last_draw_time();
1640         }
1641 -       foreach(animated<image::locator>& a, btile.images_foreground) {
1642 +       wes_foreach(animated<image::locator>& a, btile.images_foreground) {
1643                 if(a.need_update())
1644                         changed = true;
1645                 a.update_last_draw_time();
1646 @@ -326,7 +326,7 @@
1647         }
1648         std::vector<std::string> vars = utils::split(variations, ';', 0);
1649  
1650 -       foreach(const std::string& v, vars){
1651 +       wes_foreach(const std::string& v, vars){
1652                 res.push_back(base);
1653                 std::string::size_type pos = 0;
1654                 while ((pos = res.back().find("@V", pos)) != std::string::npos) {
1655 @@ -345,21 +345,21 @@
1656  
1657         // Parse images and animations data
1658         // If one is not valid, return false.
1659 -       foreach(terrain_constraint &constraint, rule.constraints)
1660 +       wes_foreach(terrain_constraint &constraint, rule.constraints)
1661         {
1662 -               foreach(rule_image& ri, constraint.images)
1663 +               wes_foreach(rule_image& ri, constraint.images)
1664                 {
1665 -                       foreach(rule_image_variant& variant, ri.variants)
1666 +                       wes_foreach(rule_image_variant& variant, ri.variants)
1667                         {
1668  
1669                                 std::vector<std::string> var_strings = get_variations(variant.image_string, variant.variations);
1670 -                               foreach(const std::string& var, var_strings)
1671 +                               wes_foreach(const std::string& var, var_strings)
1672                                 {
1673                                         /** @todo improve this, 99% of terrains are not animated. */
1674                                         std::vector<std::string> frames = utils::parenthetical_split(var,',');
1675                                         animated<image::locator> res;
1676  
1677 -                                       foreach(const std::string& frame, frames)
1678 +                                       wes_foreach(const std::string& frame, frames)
1679                                         {
1680                                                 const std::vector<std::string> items = utils::split(frame, ':');
1681                                                 const std::string& str = items.front();
1682 @@ -499,7 +499,7 @@
1683  void terrain_builder::replace_rotate_tokens(rule_image &image, int angle,
1684         const std::vector<std::string> &replacement)
1685  {
1686 -       foreach(rule_image_variant& variant, image.variants) {
1687 +       wes_foreach(rule_image_variant& variant, image.variants) {
1688                 replace_rotate_tokens(variant, angle, replacement);
1689         }
1690  }
1691 @@ -507,7 +507,7 @@
1692  void terrain_builder::replace_rotate_tokens(rule_imagelist &list, int angle,
1693         const std::vector<std::string> &replacement)
1694  {
1695 -       foreach (rule_image &img, list) {
1696 +       wes_foreach (rule_image &img, list) {
1697                 replace_rotate_tokens(img, angle, replacement);
1698         }
1699  }
1700 @@ -515,16 +515,16 @@
1701  void terrain_builder::replace_rotate_tokens(building_rule &rule, int angle,
1702         const std::vector<std::string> &replacement)
1703  {
1704 -       foreach (terrain_constraint &cons, rule.constraints)
1705 +       wes_foreach (terrain_constraint &cons, rule.constraints)
1706         {
1707                 // Transforms attributes
1708 -               foreach (std::string &flag, cons.set_flag) {
1709 +               wes_foreach (std::string &flag, cons.set_flag) {
1710                         replace_rotate_tokens(flag, angle, replacement);
1711                 }
1712 -               foreach (std::string &flag, cons.no_flag) {
1713 +               wes_foreach (std::string &flag, cons.no_flag) {
1714                         replace_rotate_tokens(flag, angle, replacement);
1715                 }
1716 -               foreach (std::string &flag, cons.has_flag) {
1717 +               wes_foreach (std::string &flag, cons.has_flag) {
1718                         replace_rotate_tokens(flag, angle, replacement);
1719                 }
1720                 replace_rotate_tokens(cons.images, angle, replacement);
1721 @@ -541,7 +541,7 @@
1722                 return;
1723         }
1724  
1725 -       foreach (terrain_constraint &cons, ret.constraints) {
1726 +       wes_foreach (terrain_constraint &cons, ret.constraints) {
1727                 rotate(cons, angle);
1728         }
1729  
1730 @@ -549,7 +549,7 @@
1731         int minx = INT_MAX;
1732         int miny = INT_MAX;
1733  
1734 -       foreach (const terrain_constraint &cons, ret.constraints) {
1735 +       wes_foreach (const terrain_constraint &cons, ret.constraints) {
1736                 minx = std::min<int>(cons.loc.x, minx);
1737                 miny = std::min<int>(2 * cons.loc.y + (cons.loc.x & 1), miny);
1738         }
1739 @@ -559,7 +559,7 @@
1740         if(!(miny & 1) && (minx & 1) && (minx > 0))
1741                 miny -= 2;
1742  
1743 -       foreach (terrain_constraint &cons, ret.constraints) {
1744 +       wes_foreach (terrain_constraint &cons, ret.constraints) {
1745                 cons.loc.legacy_sum_assign(map_location(-minx, -((miny - 1) / 2)));
1746         }
1747  
1748 @@ -581,7 +581,7 @@
1749  
1750  void terrain_builder::add_images_from_config(rule_imagelist& images, const config &cfg, bool global, int dx, int dy)
1751  {
1752 -       foreach (const config &img, cfg.child_range("image"))
1753 +       wes_foreach (const config &img, cfg.child_range("image"))
1754         {
1755                 int layer = img["layer"];
1756  
1757 @@ -606,7 +606,7 @@
1758                 images.push_back(rule_image(layer, basex - dx, basey - dy, global, center_x, center_y));
1759  
1760                 // Adds the other variants of the image
1761 -               foreach (const config &variant, img.child_range("variant"))
1762 +               wes_foreach (const config &variant, img.child_range("variant"))
1763                 {
1764                         const std::string &name = variant["name"];
1765                         const std::string &variations = img["variations"];
1766 @@ -631,7 +631,7 @@
1767                 const t_translation::t_match& type, const config& global_images)
1768  {
1769         terrain_constraint *cons = NULL;
1770 -       foreach (terrain_constraint &c, constraints) {
1771 +       wes_foreach (terrain_constraint &c, constraints) {
1772                 if (c.loc == loc) {
1773                         cons = &c;
1774                         break;
1775 @@ -769,7 +769,7 @@
1776         log_scope("terrain_builder::parse_config");
1777  
1778         // Parses the list of building rules (BRs)
1779 -       foreach (const config &br, cfg.child_range("terrain_graphics"))
1780 +       wes_foreach (const config &br, cfg.child_range("terrain_graphics"))
1781         {
1782                 building_rule pbr; // Parsed Building rule
1783                 pbr.local = local;
1784 @@ -788,7 +788,7 @@
1785                 parse_mapstring(br["map"], pbr, anchors, br);
1786  
1787                 // Parses the terrain constraints (TCs)
1788 -               foreach (const config &tc, br.child_range("tile"))
1789 +               wes_foreach (const config &tc, br.child_range("tile"))
1790                 {
1791                         // Adds the terrain constraint to the current built terrain's list
1792                         // of terrain constraints, if it does not exist.
1793 @@ -831,7 +831,7 @@
1794                 const std::vector<std::string> global_has_flag = utils::split(br["has_flag"]);
1795                 const std::vector<std::string> global_set_no_flag = utils::split(br["set_no_flag"]);
1796  
1797 -               foreach (terrain_constraint &constraint, pbr.constraints)
1798 +               wes_foreach (terrain_constraint &constraint, pbr.constraints)
1799                 {
1800                         constraint.set_flag.insert(constraint.set_flag.end(),
1801                                 global_set_flag.begin(), global_set_flag.end());
1802 @@ -925,7 +925,7 @@
1803                 }
1804         }
1805  
1806 -       foreach (const terrain_constraint &cons, rule.constraints)
1807 +       wes_foreach (const terrain_constraint &cons, rule.constraints)
1808         {
1809                 // Translated location
1810                 const map_location tloc = loc.legacy_sum(cons.loc);
1811 @@ -943,13 +943,13 @@
1812  
1813                 const std::set<std::string> &flags = tile_map_[tloc].flags;
1814  
1815 -               foreach (const std::string &s, cons.no_flag) {
1816 +               wes_foreach (const std::string &s, cons.no_flag) {
1817                         // If a flag listed in "no_flag" is present, the rule does not match
1818                         if (flags.find(s) != flags.end()) {
1819                                 return false;
1820                         }
1821                 }
1822 -               foreach (const std::string &s, cons.has_flag) {
1823 +               wes_foreach (const std::string &s, cons.has_flag) {
1824                         // If a flag listed in "has_flag" is not present, this rule does not match
1825                         if (flags.find(s) == flags.end()) {
1826                                 return false;
1827 @@ -964,7 +964,7 @@
1828  {
1829         unsigned int rand_seed = get_noise(loc, rule.get_hash());
1830  
1831 -       foreach (const terrain_constraint &constraint, rule.constraints)
1832 +       wes_foreach (const terrain_constraint &constraint, rule.constraints)
1833         {
1834                 const map_location tloc = loc.legacy_sum(constraint.loc);
1835                 if(!tile_map_.on_map(tloc)) {
1836 @@ -973,12 +973,12 @@
1837  
1838                 tile& btile = tile_map_[tloc];
1839  
1840 -               foreach (const rule_image &img, constraint.images) {
1841 +               wes_foreach (const rule_image &img, constraint.images) {
1842                         btile.images.push_back(tile::rule_image_rand(&img, rand_seed));
1843                 }
1844  
1845                 // Sets flags
1846 -               foreach (const std::string &flag, constraint.set_flag) {
1847 +               wes_foreach (const std::string &flag, constraint.set_flag) {
1848                         btile.flags.insert(flag);
1849                 }
1850  
1851 @@ -1001,9 +1001,9 @@
1852         if(hash_ != DUMMY_HASH)
1853                 return hash_;
1854  
1855 -       foreach(const terrain_constraint &constraint, constraints) {
1856 -               foreach(const rule_image& ri, constraint.images) {
1857 -                       foreach(const rule_image_variant& variant, ri.variants) {
1858 +       wes_foreach(const terrain_constraint &constraint, constraints) {
1859 +               wes_foreach(const rule_image& ri, constraint.images) {
1860 +                       wes_foreach(const rule_image_variant& variant, ri.variants) {
1861                                 // we will often hash the same string, but that seems fast enough
1862                                 hash_ += hash_str(variant.image_string);
1863                         }
1864 @@ -1031,7 +1031,7 @@
1865                 }
1866         }
1867  
1868 -       foreach (const building_rule &rule, building_rules_)
1869 +       wes_foreach (const building_rule &rule, building_rules_)
1870         {
1871                 // Find the constraint that contains the less terrain of all terrain rules.
1872                 // We will keep a track of the matching terrains of this constraint
1873 @@ -1040,7 +1040,7 @@
1874                 t_translation::t_list min_types;
1875                 const terrain_constraint *min_constraint = NULL;
1876  
1877 -               foreach (const terrain_constraint &constraint, rule.constraints)
1878 +               wes_foreach (const terrain_constraint &constraint, rule.constraints)
1879                 {
1880                         const t_translation::t_match& match = constraint.terrain_types_match;
1881                         t_translation::t_list matching_types;
1882 diff -ur wesnoth-1.10.3.orig/src/campaign_server/campaign_server.cpp wesnoth-1.10.3/src/campaign_server/campaign_server.cpp
1883 --- wesnoth-1.10.3.orig/src/campaign_server/campaign_server.cpp 2012-02-01 08:27:31.000000000 +0100
1884 +++ wesnoth-1.10.3/src/campaign_server/campaign_server.cpp      2012-07-11 13:16:06.013266690 +0200
1885 @@ -202,7 +202,7 @@
1886  
1887         void find_translations(const config& cfg, config& campaign)
1888         {
1889 -               foreach (const config &dir, cfg.child_range("dir"))
1890 +               wes_foreach (const config &dir, cfg.child_range("dir"))
1891                 {
1892                         if (dir["name"] == "LC_MESSAGES") {
1893                                 config &language = campaign.add_child("translation");
1894 @@ -249,7 +249,7 @@
1895                         LOG_CS << "Encoding all stored addons. Number of addons: "
1896                                 << std::distance(camps.first, camps.second) << '\n';
1897  
1898 -                       foreach (const config &cm, camps)
1899 +                       wes_foreach (const config &cm, camps)
1900                         {
1901                                 LOG_CS << "Encoding " << cm["name"] << '\n';
1902                                 std::string filename = cm["filename"], newfilename = filename + ".new";
1903 @@ -345,7 +345,7 @@
1904                                                 } catch(bad_lexical_cast) {}
1905  
1906                                                 std::string name = req["name"], lang = req["language"];
1907 -                                               foreach (const config &i, campaigns().child_range("campaign"))
1908 +                                               wes_foreach (const config &i, campaigns().child_range("campaign"))
1909                                                 {
1910                                                         if (!name.empty() && name != i["name"]) continue;
1911                                                         std::string tm = i["timestamp"];
1912 @@ -353,7 +353,7 @@
1913                                                         if (after_flag && (tm.empty() || lexical_cast_default<time_t>(tm, 0) <= after)) continue;
1914                                                         if (!lang.empty()) {
1915                                                                 bool found = false;
1916 -                                                               foreach (const config &j, i.child_range("translation")) {
1917 +                                                               wes_foreach (const config &j, i.child_range("translation")) {
1918                                                                         if (j["language"] == lang) {
1919                                                                                 found = true;
1920                                                                                 break;
1921 @@ -364,7 +364,7 @@
1922                                                         campaign_list.add_child("campaign", i);
1923                                                 }
1924  
1925 -                                               foreach (config &j, campaign_list.child_range("campaign")) {
1926 +                                               wes_foreach (config &j, campaign_list.child_range("campaign")) {
1927                                                         j["passphrase"] = t_string();
1928                                                         j["upload_ip"] = t_string();
1929                                                         j["email"] = t_string();
1930 @@ -402,7 +402,7 @@
1931                                                 std::string lc_name(name.size(), ' ');
1932                                                 std::transform(name.begin(), name.end(), lc_name.begin(), tolower);
1933                                                 config *campaign = NULL;
1934 -                                               foreach (config &c, campaigns().child_range("campaign")) {
1935 +                                               wes_foreach (config &c, campaigns().child_range("campaign")) {
1936                                                         if (utils::lowercase(c["name"]) == lc_name) {
1937                                                                 campaign = &c;
1938                                                                 break;
1939 diff -ur wesnoth-1.10.3.orig/src/cavegen.cpp wesnoth-1.10.3/src/cavegen.cpp
1940 --- wesnoth-1.10.3.orig/src/cavegen.cpp 2012-01-07 03:35:17.000000000 +0100
1941 +++ wesnoth-1.10.3/src/cavegen.cpp      2012-07-11 13:16:06.036600021 +0200
1942 @@ -147,7 +147,7 @@
1943  
1944  void cave_map_generator::generate_chambers()
1945  {
1946 -       foreach (const config &ch, cfg_.child_range("chamber"))
1947 +       wes_foreach (const config &ch, cfg_.child_range("chamber"))
1948         {
1949                 // If there is only a chance of the chamber appearing, deal with that here.
1950                 if (ch.has_attribute("chance") && (rand() % 100) < ch["chance"].to_int()) {
1951 @@ -195,7 +195,7 @@
1952  
1953                 chambers_.push_back(new_chamber);
1954  
1955 -               foreach (const config &p, ch.child_range("passage"))
1956 +               wes_foreach (const config &p, ch.child_range("passage"))
1957                 {
1958                         const std::string &dst = p["destination"];
1959  
1960 @@ -220,7 +220,7 @@
1961         if (c.items == NULL || c.locs.empty()) return;
1962  
1963         size_t index = 0;
1964 -       foreach (const config::any_child &it, c.items->all_children_range())
1965 +       wes_foreach (const config::any_child &it, c.items->all_children_range())
1966         {
1967                 config cfg = it.cfg;
1968                 config &filter = cfg.child("filter");
1969 diff -ur wesnoth-1.10.3.orig/src/commandline_options.cpp wesnoth-1.10.3/src/commandline_options.cpp
1970 --- wesnoth-1.10.3.orig/src/commandline_options.cpp     2012-01-22 00:20:08.000000000 +0100
1971 +++ wesnoth-1.10.3/src/commandline_options.cpp  2012-07-11 13:16:05.979933358 +0200
1972 @@ -374,7 +374,7 @@
1973  void commandline_options::parse_log_domains_(const std::string &domains_string, const int severity)
1974  {
1975         const std::vector<std::string> domains = utils::split(domains_string, ',');
1976 -       foreach (const std::string& domain, domains)
1977 +       wes_foreach (const std::string& domain, domains)
1978         {
1979                 if (!log)
1980                         log = std::vector<boost::tuple<int, std::string> >();
1981 @@ -396,7 +396,7 @@
1982  {
1983         std::vector<boost::tuple<unsigned int,std::string> > vec;
1984         boost::tuple<unsigned int,std::string> elem;
1985 -       foreach(const std::string &s, strings)
1986 +       wes_foreach(const std::string &s, strings)
1987         {
1988                 const std::vector<std::string> tokens = utils::split(s, separator);
1989                 if (tokens.size()!=2)
1990 @@ -415,7 +415,7 @@
1991  {
1992         std::vector<boost::tuple<unsigned int,std::string,std::string> > vec;
1993         boost::tuple<unsigned int,std::string,std::string> elem;
1994 -       foreach(const std::string &s, strings)
1995 +       wes_foreach(const std::string &s, strings)
1996         {
1997                 const std::vector<std::string> tokens = utils::split(s, separator);
1998                 if (tokens.size()!=3)
1999 diff -ur wesnoth-1.10.3.orig/src/config_cache.cpp wesnoth-1.10.3/src/config_cache.cpp
2000 --- wesnoth-1.10.3.orig/src/config_cache.cpp    2012-01-07 03:35:17.000000000 +0100
2001 +++ wesnoth-1.10.3/src/config_cache.cpp 2012-07-11 13:16:05.986600025 +0200
2002 @@ -113,7 +113,7 @@
2003                 config_writer writer(*stream, gzip, game_config::cache_compression_level);
2004  
2005                 // write all defines to stream
2006 -               foreach (const preproc_map::value_type &define, defines_map) {
2007 +               wes_foreach (const preproc_map::value_type &define, defines_map) {
2008                         define.second.write(writer, define.first);
2009                 }
2010         }
2011 @@ -262,7 +262,7 @@
2012  
2013                 // use static preproc_define::read_pair(config) to make a object
2014                 // and pass that object config_cache_transaction::insert_to_active method
2015 -               foreach (const config::any_child &value, cfg.all_children_range()) {
2016 +               wes_foreach (const config::any_child &value, cfg.all_children_range()) {
2017                         config_cache_transaction::instance().insert_to_active(
2018                                 preproc_define::read_pair(value.cfg));
2019                 }
2020 @@ -271,7 +271,7 @@
2021         void config_cache::read_defines_queue()
2022         {
2023                 const config_cache_transaction::filenames& files = config_cache_transaction::instance().get_define_files();
2024 -               foreach (const std::string &path, files) {
2025 +               wes_foreach (const std::string &path, files) {
2026                         read_defines_file(path);
2027                 }
2028         }
2029 @@ -394,7 +394,7 @@
2030                                         std::insert_iterator<preproc_map>(temp,temp.begin()),
2031                                         &compare_define);
2032  
2033 -                       foreach (const preproc_map::value_type &def, temp) {
2034 +                       wes_foreach (const preproc_map::value_type &def, temp) {
2035                                 insert_to_active(def);
2036                         }
2037  
2038 diff -ur wesnoth-1.10.3.orig/src/config.cpp wesnoth-1.10.3/src/config.cpp
2039 --- wesnoth-1.10.3.orig/src/config.cpp  2012-05-05 19:39:03.000000000 +0200
2040 +++ wesnoth-1.10.3/src/config.cpp       2012-07-11 13:16:05.986600025 +0200
2041 @@ -255,7 +255,7 @@
2042  {
2043         check_valid(cfg);
2044  
2045 -       foreach (const any_child &value, cfg.all_children_range()) {
2046 +       wes_foreach (const any_child &value, cfg.all_children_range()) {
2047                 add_child(value.key, value.cfg);
2048         }
2049  }
2050 @@ -263,7 +263,7 @@
2051  void config::append(const config &cfg)
2052  {
2053         append_children(cfg);
2054 -       foreach (const attribute &v, cfg.values) {
2055 +       wes_foreach (const attribute &v, cfg.values) {
2056                 values[v.first] = v.second;
2057         }
2058  }
2059 @@ -275,7 +275,7 @@
2060         if (child_count(key) < 2) return;
2061  
2062         config merged_children;
2063 -       foreach (const config &cfg, child_range(key)) {
2064 +       wes_foreach (const config &cfg, child_range(key)) {
2065                 merged_children.append(cfg);
2066         }
2067  
2068 @@ -291,7 +291,7 @@
2069  
2070         typedef std::map<std::string, config> config_map;
2071         config_map merged_children_map;
2072 -       foreach (const config &cfg, child_range(key)) {
2073 +       wes_foreach (const config &cfg, child_range(key)) {
2074                 const std::string &value = cfg[attribute];
2075                 config_map::iterator m = merged_children_map.find(value);
2076                 if ( m!=merged_children_map.end() ) {
2077 @@ -302,7 +302,7 @@
2078         }
2079  
2080         clear_children(key);
2081 -       foreach (const config_map::value_type &i, merged_children_map) {
2082 +       wes_foreach (const config_map::value_type &i, merged_children_map) {
2083                 add_child(key,i.second);
2084         }
2085  }
2086 @@ -459,7 +459,7 @@
2087         ordered_children.erase(std::remove_if(ordered_children.begin(),
2088                 ordered_children.end(), remove_ordered(i)), ordered_children.end());
2089  
2090 -       foreach (config *c, i->second) {
2091 +       wes_foreach (config *c, i->second) {
2092                 delete c;
2093         }
2094  
2095 @@ -495,7 +495,7 @@
2096  
2097         values.erase(key);
2098  
2099 -       foreach (const any_child &value, all_children_range()) {
2100 +       wes_foreach (const any_child &value, all_children_range()) {
2101                 const_cast<config *>(&value.cfg)->recursive_clear_value(key);
2102         }
2103  }
2104 @@ -506,7 +506,7 @@
2105         /* Find the position with the correct index and decrement all the
2106            indices in the ordering that are above this index. */
2107         unsigned found = 0;
2108 -       foreach (child_pos &p, ordered_children)
2109 +       wes_foreach (child_pos &p, ordered_children)
2110         {
2111                 if (p.pos != pos) continue;
2112                 if (p.index == index)
2113 @@ -590,7 +590,7 @@
2114         check_valid(cfg);
2115  
2116         assert(this != &cfg);
2117 -       foreach (const attribute &v, cfg.values) {
2118 +       wes_foreach (const attribute &v, cfg.values) {
2119                 values[v.first] = v.second;
2120         }
2121  }
2122 @@ -860,21 +860,21 @@
2123         if (track) values[diff_track_attribute] = "modified";
2124  
2125         if (const config &inserts = diff.child("insert")) {
2126 -               foreach (const attribute &v, inserts.attribute_range()) {
2127 +               wes_foreach (const attribute &v, inserts.attribute_range()) {
2128                         values[v.first] = v.second;
2129                 }
2130         }
2131  
2132         if (const config &deletes = diff.child("delete")) {
2133 -               foreach (const attribute &v, deletes.attribute_range()) {
2134 +               wes_foreach (const attribute &v, deletes.attribute_range()) {
2135                         values.erase(v.first);
2136                 }
2137         }
2138  
2139 -       foreach (const config &i, diff.child_range("change_child"))
2140 +       wes_foreach (const config &i, diff.child_range("change_child"))
2141         {
2142                 const size_t index = lexical_cast<size_t>(i["index"].str());
2143 -               foreach (const any_child &item, i.all_children_range())
2144 +               wes_foreach (const any_child &item, i.all_children_range())
2145                 {
2146                         if (item.key.empty()) {
2147                                 continue;
2148 @@ -889,19 +889,19 @@
2149                 }
2150         }
2151  
2152 -       foreach (const config &i, diff.child_range("insert_child"))
2153 +       wes_foreach (const config &i, diff.child_range("insert_child"))
2154         {
2155                 const size_t index = lexical_cast<size_t>(i["index"].str());
2156 -               foreach (const any_child &item, i.all_children_range()) {
2157 +               wes_foreach (const any_child &item, i.all_children_range()) {
2158                         config& inserted = add_child_at(item.key, item.cfg, index);
2159                         if (track) inserted[diff_track_attribute] = "new";
2160                 }
2161         }
2162  
2163 -       foreach (const config &i, diff.child_range("delete_child"))
2164 +       wes_foreach (const config &i, diff.child_range("delete_child"))
2165         {
2166                 const size_t index = lexical_cast<size_t>(i["index"].str());
2167 -               foreach (const any_child &item, i.all_children_range()) {
2168 +               wes_foreach (const any_child &item, i.all_children_range()) {
2169                         if (!track) {
2170                                 remove_child(item.key, index);
2171                         } else {
2172 @@ -918,18 +918,18 @@
2173  void config::clear_diff_track(const config& diff)
2174  {
2175         remove_attribute(diff_track_attribute);
2176 -       foreach (const config &i, diff.child_range("delete_child"))
2177 +       wes_foreach (const config &i, diff.child_range("delete_child"))
2178         {
2179                 const size_t index = lexical_cast<size_t>(i["index"].str());
2180 -               foreach (const any_child &item, i.all_children_range()) {
2181 +               wes_foreach (const any_child &item, i.all_children_range()) {
2182                         remove_child(item.key, index);
2183                 }
2184         }
2185  
2186 -       foreach (const config &i, diff.child_range("change_child"))
2187 +       wes_foreach (const config &i, diff.child_range("change_child"))
2188         {
2189                 const size_t index = lexical_cast<size_t>(i["index"].str());
2190 -               foreach (const any_child &item, i.all_children_range())
2191 +               wes_foreach (const any_child &item, i.all_children_range())
2192                 {
2193                         if (item.key.empty()) {
2194                                 continue;
2195 @@ -943,7 +943,7 @@
2196                         itor->second[index]->clear_diff_track(item.cfg);
2197                 }
2198         }
2199 -       foreach (const any_child &value, all_children_range()) {
2200 +       wes_foreach (const any_child &value, all_children_range()) {
2201                 const_cast<config *>(&value.cfg)->remove_attribute(diff_track_attribute);
2202         }
2203  }
2204 @@ -984,20 +984,20 @@
2205  {
2206         check_valid(filter);
2207  
2208 -       foreach (const attribute &i, filter.attribute_range())
2209 +       wes_foreach (const attribute &i, filter.attribute_range())
2210         {
2211                 const attribute_value *v = get(i.first);
2212                 if (!v || *v != i.second) return false;
2213         }
2214  
2215 -       foreach (const any_child &i, filter.all_children_range())
2216 +       wes_foreach (const any_child &i, filter.all_children_range())
2217         {
2218                 if (i.key == "not") {
2219                         if (matches(i.cfg)) return false;
2220                         continue;
2221                 }
2222                 bool found = false;
2223 -               foreach (const config &j, child_range(i.key)) {
2224 +               wes_foreach (const config &j, child_range(i.key)) {
2225                         if (j.matches(i.cfg)) {
2226                                 found = true;
2227                                 break;
2228 @@ -1021,11 +1021,11 @@
2229  {
2230         static int i = 0;
2231         i++;
2232 -       foreach (const config::attribute &val, cfg.attribute_range()) {
2233 +       wes_foreach (const config::attribute &val, cfg.attribute_range()) {
2234                 for (int j = 0; j < i-1; j++){ outstream << char(9); }
2235                 outstream << val.first << " = " << val.second << '\n';
2236         }
2237 -       foreach (const config::any_child &child, cfg.all_children_range())
2238 +       wes_foreach (const config::any_child &child, cfg.all_children_range())
2239         {
2240                 for (int j = 0; j < i - 1; ++j) outstream << char(9);
2241                 outstream << "[" << child.key << "]\n";
2242 @@ -1054,7 +1054,7 @@
2243         hash_str[hash_length] = 0;
2244  
2245         i = 0;
2246 -       foreach (const attribute &val, values)
2247 +       wes_foreach (const attribute &val, values)
2248         {
2249                 for (c = val.first.begin(); c != val.first.end(); ++c) {
2250                         hash_str[i] ^= *c;
2251 @@ -1067,10 +1067,10 @@
2252                 }
2253         }
2254  
2255 -       foreach (const any_child &ch, all_children_range())
2256 +       wes_foreach (const any_child &ch, all_children_range())
2257         {
2258                 std::string child_hash = ch.cfg.hash();
2259 -               foreach (char c, child_hash) {
2260 +               wes_foreach (char c, child_hash) {
2261                         hash_str[i] ^= c;
2262                         ++i;
2263                         if(i == hash_length) {
2264 diff -ur wesnoth-1.10.3.orig/src/controller_base.cpp wesnoth-1.10.3/src/controller_base.cpp
2265 --- wesnoth-1.10.3.orig/src/controller_base.cpp 2012-01-07 03:35:17.000000000 +0100
2266 +++ wesnoth-1.10.3/src/controller_base.cpp      2012-07-11 13:16:06.029933357 +0200
2267 @@ -144,7 +144,7 @@
2268         int dx = 0, dy = 0;
2269         int scroll_threshold = (preferences::mouse_scroll_enabled())
2270                 ? preferences::mouse_scroll_threshold() : 0;
2271 -       foreach (const theme::menu& m, get_display().get_theme().menus()) {
2272 +       wes_foreach (const theme::menu& m, get_display().get_theme().menus()) {
2273                 if (point_in_rect(mousex, mousey, m.get_location())) {
2274                         scroll_threshold = 0;
2275                 }
2276 diff -ur wesnoth-1.10.3.orig/src/dialogs.cpp wesnoth-1.10.3/src/dialogs.cpp
2277 --- wesnoth-1.10.3.orig/src/dialogs.cpp 2012-01-07 03:35:17.000000000 +0100
2278 +++ wesnoth-1.10.3/src/dialogs.cpp      2012-07-11 13:16:06.236600015 +0200
2279 @@ -95,7 +95,7 @@
2280         }
2281  
2282         bool always_display = false;
2283 -       foreach (const config &mod, u->get_modification_advances())
2284 +       wes_foreach (const config &mod, u->get_modification_advances())
2285         {
2286                 if (mod["always_display"].to_bool()) always_display = true;
2287                 sample_units.push_back(::get_advanced_unit(*u, u->type_id()));
2288 @@ -1009,7 +1009,7 @@
2289         }
2290  
2291         //FIXME: This probably must be move into a unit_type function
2292 -       foreach (const config &tr, t->possible_traits())
2293 +       wes_foreach (const config &tr, t->possible_traits())
2294         {
2295                 if (tr["availability"] != "musthave") continue;
2296                 std::string gender_string = (!t->genders().empty() && t->genders().front()== unit_race::FEMALE) ? "female_name" : "male_name";
2297 @@ -1038,7 +1038,7 @@
2298         // Check if AMLA color is needed
2299         // FIXME: not sure if it's fully accurate (but not very important for unit_type)
2300         // xp_color also need a simpler function for doing this
2301 -       foreach (const config &adv, t->modification_advancements())
2302 +       wes_foreach (const config &adv, t->modification_advancements())
2303         {
2304                 if (!adv["strict_amla"].to_bool() || !t->can_advance()) {
2305                         det.xp_color = "<170,0,255>"; // from unit::xp_color()
2306 diff -ur wesnoth-1.10.3.orig/src/display.cpp wesnoth-1.10.3/src/display.cpp
2307 --- wesnoth-1.10.3.orig/src/display.cpp 2012-04-23 01:53:28.000000000 +0200
2308 +++ wesnoth-1.10.3/src/display.cpp      2012-07-11 13:16:05.976600023 +0200
2309 @@ -629,7 +629,7 @@
2310         // now get the surfaces
2311         std::vector<surface> res;
2312  
2313 -       foreach(std::string& name, names) {
2314 +       wes_foreach(std::string& name, names) {
2315                 const surface surf(image::get_image(name, image_type));
2316                 if (surf)
2317                         res.push_back(surf);
2318 @@ -828,8 +828,8 @@
2319          * layergroup > location > layer > 'tblit' > surface
2320          */
2321  
2322 -       foreach(const tblit &blit, drawing_buffer_) {
2323 -               foreach(const surface& surf, blit.surf()) {
2324 +       wes_foreach(const tblit &blit, drawing_buffer_) {
2325 +               wes_foreach(const surface& surf, blit.surf()) {
2326                         // Note that dstrect can be changed by sdl_blit
2327                         // and so a new instance should be initialized
2328                         // to pass to each call to sdl_blit.
2329 @@ -1903,7 +1903,7 @@
2330         int ticks3 = SDL_GetTicks();
2331         LOG_DP << "invalidate and draw: " << (ticks3 - ticks2) << " and " << (ticks2 - ticks1) << "\n";
2332  
2333 -       foreach (boost::function<void(display&)> f, redraw_observers_) {
2334 +       wes_foreach (boost::function<void(display&)> f, redraw_observers_) {
2335                 f(*this);
2336         }
2337  
2338 @@ -1992,7 +1992,7 @@
2339         SDL_Rect clip_rect = get_clip_rect();
2340         surface screen = get_screen_surface();
2341         clip_rect_setter set_clip_rect(screen, &clip_rect);
2342 -       foreach (const map_location& loc, invalidated_) {
2343 +       wes_foreach (const map_location& loc, invalidated_) {
2344                 int xpos = get_location_x(loc);
2345                 int ypos = get_location_y(loc);
2346  
2347 @@ -2058,7 +2058,7 @@
2348         // Paint arrows
2349         arrows_map_t::const_iterator arrows_in_hex = arrows_map_.find(loc);
2350         if(arrows_in_hex != arrows_map_.end()) {
2351 -               foreach(arrow* const a, arrows_in_hex->second) {
2352 +               wes_foreach(arrow* const a, arrows_in_hex->second) {
2353                         a->draw_hex(loc);
2354                 }
2355         }
2356 @@ -2388,7 +2388,7 @@
2357         if(invalidateAll_)
2358                 return false;
2359         bool ret = false;
2360 -       foreach (const map_location& loc, locs) {
2361 +       wes_foreach (const map_location& loc, locs) {
2362  #ifdef _OPENMP
2363  #pragma omp critical(invalidated_)
2364  #endif //_OPENMP
2365 @@ -2438,7 +2438,7 @@
2366                 return false;
2367  
2368         bool result = false;
2369 -       foreach (const map_location &loc, hexes_under_rect(rect)) {
2370 +       wes_foreach (const map_location &loc, hexes_under_rect(rect)) {
2371                 result |= invalidate(loc);
2372         }
2373         return result;
2374 @@ -2450,7 +2450,7 @@
2375         animate_map_ = preferences::animate_map();
2376         if (!animate_map_) return;
2377  
2378 -       foreach (const map_location &loc, get_visible_hexes())
2379 +       wes_foreach (const map_location &loc, get_visible_hexes())
2380         {
2381                 if (shrouded(loc)) continue;
2382                 if (builder_->update_animation(loc)) {
2383 @@ -2464,7 +2464,7 @@
2384  void display::add_arrow(arrow& arrow)
2385  {
2386         const arrow_path_t & arrow_path = arrow.get_path();
2387 -       foreach (const map_location& loc, arrow_path)
2388 +       wes_foreach (const map_location& loc, arrow_path)
2389         {
2390                 arrows_map_[loc].push_back(&arrow);
2391         }
2392 @@ -2473,7 +2473,7 @@
2393  void display::remove_arrow(arrow& arrow)
2394  {
2395         const arrow_path_t & arrow_path = arrow.get_path();
2396 -       foreach (const map_location& loc, arrow_path)
2397 +       wes_foreach (const map_location& loc, arrow_path)
2398         {
2399                 arrows_map_[loc].remove(&arrow);
2400         }
2401 @@ -2482,12 +2482,12 @@
2402  void display::update_arrow(arrow & arrow)
2403  {
2404         const arrow_path_t & previous_path = arrow.get_previous_path();
2405 -       foreach (const map_location& loc, previous_path)
2406 +       wes_foreach (const map_location& loc, previous_path)
2407         {
2408                 arrows_map_[loc].remove(&arrow);
2409         }
2410         const arrow_path_t & arrow_path = arrow.get_path();
2411 -       foreach (const map_location& loc, arrow_path)
2412 +       wes_foreach (const map_location& loc, arrow_path)
2413         {
2414                 arrows_map_[loc].push_back(&arrow);
2415         }
2416 diff -ur wesnoth-1.10.3.orig/src/editor/action.cpp wesnoth-1.10.3/src/editor/action.cpp
2417 --- wesnoth-1.10.3.orig/src/editor/action.cpp   2012-01-07 03:35:17.000000000 +0100
2418 +++ wesnoth-1.10.3/src/editor/action.cpp        2012-07-11 13:16:05.993266689 +0200
2419 @@ -75,25 +75,25 @@
2420  editor_action_chain::editor_action_chain(const editor::editor_action_chain &other)
2421         : editor_action(), actions_()
2422  {
2423 -       foreach (editor_action* a, other.actions_) {
2424 +       wes_foreach (editor_action* a, other.actions_) {
2425                 actions_.push_back(a->clone());
2426         }
2427  }
2428  editor_action_chain& editor_action_chain::operator=(const editor_action_chain& other)
2429  {
2430         if (this == &other) return *this;
2431 -       foreach (editor_action* a, actions_) {
2432 +       wes_foreach (editor_action* a, actions_) {
2433                 delete a;
2434         }
2435         actions_.clear();
2436 -       foreach (editor_action* a, other.actions_) {
2437 +       wes_foreach (editor_action* a, other.actions_) {
2438                 actions_.push_back(a->clone());
2439         }
2440         return *this;
2441  }
2442  editor_action_chain::~editor_action_chain()
2443  {
2444 -       foreach (editor_action* a, actions_) {
2445 +       wes_foreach (editor_action* a, actions_) {
2446                 delete a;
2447         }
2448  }
2449 @@ -103,7 +103,7 @@
2450  }
2451  int editor_action_chain::action_count() const {
2452         int count = 0;
2453 -       foreach (const editor_action* a, actions_) {
2454 +       wes_foreach (const editor_action* a, actions_) {
2455                 if (a) {
2456                         count += a->action_count();
2457                 }
2458 @@ -133,7 +133,7 @@
2459  }
2460  editor_action_chain* editor_action_chain::perform(map_context& mc) const {
2461         util::unique_ptr<editor_action_chain> undo(new editor_action_chain());
2462 -       foreach (editor_action* a, actions_) {
2463 +       wes_foreach (editor_action* a, actions_) {
2464                 if (a != NULL) {
2465                         undo->append_action(a->perform(mc));
2466                 }
2467 @@ -143,7 +143,7 @@
2468  }
2469  void editor_action_chain::perform_without_undo(map_context& mc) const
2470  {
2471 -       foreach (editor_action* a, actions_) {
2472 +       wes_foreach (editor_action* a, actions_) {
2473                 if (a != NULL) {
2474                         a->perform_without_undo(mc);
2475                 }
2476 @@ -257,7 +257,7 @@
2477  }
2478  void editor_action_select::extend(const editor_map& map, const std::set<map_location>& locs)
2479  {
2480 -       foreach (const map_location& loc, locs) {
2481 +       wes_foreach (const map_location& loc, locs) {
2482                 LOG_ED << "Checking " << loc << "\n";
2483                 if (map.in_selection(loc)) {
2484                         LOG_ED << "Extending by " << loc << "\n";
2485 @@ -268,7 +268,7 @@
2486  editor_action* editor_action_select::perform(map_context& mc) const
2487  {
2488         std::set<map_location> undo_locs;
2489 -       foreach (const map_location& loc, area_) {
2490 +       wes_foreach (const map_location& loc, area_) {
2491                 if (!mc.get_map().in_selection(loc)) {
2492                         undo_locs.insert(loc);
2493                         mc.add_changed_location(loc);
2494 @@ -279,7 +279,7 @@
2495  }
2496  void editor_action_select::perform_without_undo(map_context& mc) const
2497  {
2498 -       foreach (const map_location& loc, area_) {
2499 +       wes_foreach (const map_location& loc, area_) {
2500                 mc.get_map().add_to_selection(loc);
2501                 mc.add_changed_location(loc);
2502         }
2503 @@ -291,7 +291,7 @@
2504  }
2505  void editor_action_deselect::extend(const editor_map& map, const std::set<map_location>& locs)
2506  {
2507 -       foreach (const map_location& loc, locs) {
2508 +       wes_foreach (const map_location& loc, locs) {
2509                 LOG_ED << "Checking " << loc << "\n";
2510                 if (!map.in_selection(loc)) {
2511                         LOG_ED << "Extending by " << loc << "\n";
2512 @@ -302,7 +302,7 @@
2513  editor_action* editor_action_deselect::perform(map_context& mc) const
2514  {
2515         std::set<map_location> undo_locs;
2516 -       foreach (const map_location& loc, area_) {
2517 +       wes_foreach (const map_location& loc, area_) {
2518                 if (mc.get_map().in_selection(loc)) {
2519                         undo_locs.insert(loc);
2520                         mc.add_changed_location(loc);
2521 @@ -313,7 +313,7 @@
2522  }
2523  void editor_action_deselect::perform_without_undo(map_context& mc) const
2524  {
2525 -       foreach (const map_location& loc, area_) {
2526 +       wes_foreach (const map_location& loc, area_) {
2527                 mc.get_map().remove_from_selection(loc);
2528                 mc.add_changed_location(loc);
2529         }
2530 diff -ur wesnoth-1.10.3.orig/src/editor/brush.cpp wesnoth-1.10.3/src/editor/brush.cpp
2531 --- wesnoth-1.10.3.orig/src/editor/brush.cpp    2012-01-07 03:35:17.000000000 +0100
2532 +++ wesnoth-1.10.3/src/editor/brush.cpp 2012-07-11 13:16:05.996600022 +0200
2533 @@ -74,11 +74,11 @@
2534         if (radius > 0) {
2535                 std::vector<map_location> in_radius;
2536                 get_tiles_in_radius(map_location(0, 0), radius, in_radius);
2537 -               foreach (map_location& loc, in_radius) {
2538 +               wes_foreach (map_location& loc, in_radius) {
2539                         add_relative_location(loc.x, loc.y);
2540                 }
2541         }
2542 -       foreach (const config &relative, cfg.child_range("relative"))
2543 +       wes_foreach (const config &relative, cfg.child_range("relative"))
2544         {
2545                 int x = relative["x"];
2546                 int y = relative["y"];
2547 @@ -97,7 +97,7 @@
2548  std::set<map_location> brush::project(const map_location& hotspot) const
2549  {
2550         std::set<map_location> result;
2551 -       foreach (const map_location& relative, relative_tiles_) {
2552 +       wes_foreach (const map_location& relative, relative_tiles_) {
2553                 result.insert(relative.vector_sum(hotspot));
2554         }
2555         return result;
2556 diff -ur wesnoth-1.10.3.orig/src/editor/editor_controller.cpp wesnoth-1.10.3/src/editor/editor_controller.cpp
2557 --- wesnoth-1.10.3.orig/src/editor/editor_controller.cpp        2012-01-07 03:35:17.000000000 +0100
2558 +++ wesnoth-1.10.3/src/editor/editor_controller.cpp     2012-07-11 13:16:05.996600022 +0200
2559 @@ -135,7 +135,7 @@
2560         image::set_color_adjustment(preferences::editor::tod_r(), preferences::editor::tod_g(), preferences::editor::tod_b());
2561         theme& theme = gui().get_theme();
2562         const theme::menu* default_tool_menu = NULL;
2563 -       foreach (const theme::menu& m, theme.menus()) {
2564 +       wes_foreach (const theme::menu& m, theme.menus()) {
2565                 if (m.get_id() == "draw_button_editor") {
2566                         default_tool_menu = &m;
2567                         break;
2568 @@ -173,7 +173,7 @@
2569  
2570  void editor_controller::init_brushes(const config& game_config)
2571  {
2572 -       foreach (const config &i, game_config.child_range("brush")) {
2573 +       wes_foreach (const config &i, game_config.child_range("brush")) {
2574                 brushes_.push_back(brush(i));
2575         }
2576         if (brushes_.empty()) {
2577 @@ -196,7 +196,7 @@
2578                 new mouse_action_starting_position(key_)));
2579         mouse_actions_.insert(std::make_pair(hotkey::HOTKEY_EDITOR_PASTE,
2580                 new mouse_action_paste(clipboard_, key_)));
2581 -       foreach (const theme::menu& menu, gui().get_theme().menus()) {
2582 +       wes_foreach (const theme::menu& menu, gui().get_theme().menus()) {
2583                 if (menu.items().size() == 1) {
2584                         hotkey::HOTKEY_COMMAND hk = hotkey::get_hotkey(menu.items().front()).get_id();
2585                         mouse_action_map::iterator i = mouse_actions_.find(hk);
2586 @@ -205,7 +205,7 @@
2587                         }
2588                 }
2589         }
2590 -       foreach (const config &c, game_config.child_range("editor_tool_hint")) {
2591 +       wes_foreach (const config &c, game_config.child_range("editor_tool_hint")) {
2592                 mouse_action_map::iterator i =
2593                         mouse_actions_.find(hotkey::get_hotkey(c["id"]).get_id());
2594                 if (i != mouse_actions_.end()) {
2595 @@ -216,7 +216,7 @@
2596  
2597  void editor_controller::init_map_generators(const config& game_config)
2598  {
2599 -       foreach (const config &i, game_config.child_range("multiplayer"))
2600 +       wes_foreach (const config &i, game_config.child_range("multiplayer"))
2601         {
2602                 if (i["map_generation"] == "default") {
2603                         const config &generator_cfg = i.child("generator");
2604 @@ -238,7 +238,7 @@
2605                 ERR_ED << "No editor time-of-day defined\n";
2606                 return;
2607         }
2608 -       foreach (const config &i, cfg.child_range("time")) {
2609 +       wes_foreach (const config &i, cfg.child_range("time")) {
2610                 tods_.push_back(time_of_day(i));
2611         }
2612  }
2613 @@ -250,7 +250,7 @@
2614                 ERR_ED << "No editor music defined\n";
2615                 return;
2616         }
2617 -       foreach (const config &i, cfg.child_range("music")) {
2618 +       wes_foreach (const config &i, cfg.child_range("music")) {
2619                 sound::play_music_config(i);
2620         }
2621         sound::commit_music_changes();
2622 @@ -265,13 +265,13 @@
2623  
2624  editor_controller::~editor_controller()
2625  {
2626 -       foreach (const mouse_action_map::value_type a, mouse_actions_) {
2627 +       wes_foreach (const mouse_action_map::value_type a, mouse_actions_) {
2628                 delete a.second;
2629         }
2630 -       foreach (map_generator* m, map_generators_) {
2631 +       wes_foreach (map_generator* m, map_generators_) {
2632                 delete m;
2633         }
2634 -       foreach (map_context* mc, map_contexts_) {
2635 +       wes_foreach (map_context* mc, map_contexts_) {
2636                 delete mc;
2637         }
2638  }
2639 @@ -303,7 +303,7 @@
2640  void editor_controller::quit_confirm(EXIT_STATUS mode)
2641  {
2642         std::vector<std::string> modified;
2643 -       foreach (map_context* mc, map_contexts_) {
2644 +       wes_foreach (map_context* mc, map_contexts_) {
2645                 if (mc->modified()) {
2646                         if (!mc->get_filename().empty()) {
2647                                 modified.push_back(mc->get_filename());
2648 @@ -319,7 +319,7 @@
2649                 message = _("Do you really want to quit? Changes in the map since the last save will be lost.");
2650         } else {
2651                 message = _("Do you really want to quit? The following maps were modified and all changes since the last save will be lost:");
2652 -               foreach (std::string& str, modified) {
2653 +               wes_foreach (std::string& str, modified) {
2654                         message += "\n" + str;
2655                 }
2656         }
2657 @@ -342,7 +342,7 @@
2658                 map_context* mc = new map_context(editor_map(game_config_, 44, 33, t_translation::GRASS_LAND));
2659                 add_map_context(mc);
2660         } else {
2661 -               foreach(const std::string& filename, saved_windows_) {
2662 +               wes_foreach(const std::string& filename, saved_windows_) {
2663                         map_context* mc = new map_context(game_config_, filename);
2664                         add_map_context(mc);
2665                 }
2666 @@ -796,7 +796,7 @@
2667                                 get_map_context().set_needs_terrain_rebuild(false);
2668                                 gui().invalidate_all();
2669                         } else {
2670 -                               foreach (const map_location& loc, changed_locs) {
2671 +                               wes_foreach (const map_location& loc, changed_locs) {
2672                                         gui().rebuild_terrain(loc);
2673                                 }
2674                                 gui().invalidate(changed_locs);
2675 @@ -1290,7 +1290,7 @@
2676  
2677  void editor_controller::redraw_toolbar()
2678  {
2679 -       foreach (mouse_action_map::value_type a, mouse_actions_) {
2680 +       wes_foreach (mouse_action_map::value_type a, mouse_actions_) {
2681                 if (a.second->toolbar_button() != NULL) {
2682                         SDL_Rect r = a.second->toolbar_button()->location(gui().screen_area());
2683                         SDL_Rect outline = create_rect(r.x - 2, r.y - 2, r.h + 4, r.w + 4);
2684 diff -ur wesnoth-1.10.3.orig/src/editor/editor_map.cpp wesnoth-1.10.3/src/editor/editor_map.cpp
2685 --- wesnoth-1.10.3.orig/src/editor/editor_map.cpp       2012-01-07 03:35:17.000000000 +0100
2686 +++ wesnoth-1.10.3/src/editor/editor_map.cpp    2012-07-11 13:16:05.993266689 +0200
2687 @@ -111,7 +111,7 @@
2688                         ++errors;
2689                 }
2690         }
2691 -       foreach (const map_location& loc, selection_) {
2692 +       wes_foreach (const map_location& loc, selection_) {
2693                 if (!on_board_with_border(loc)) {
2694                         ERR_ED << "Off-map tile in selection: " << loc << "\n";
2695                 }
2696 diff -ur wesnoth-1.10.3.orig/src/editor/editor_palettes.cpp wesnoth-1.10.3/src/editor/editor_palettes.cpp
2697 --- wesnoth-1.10.3.orig/src/editor/editor_palettes.cpp  2012-01-07 03:35:17.000000000 +0100
2698 +++ wesnoth-1.10.3/src/editor/editor_palettes.cpp       2012-07-11 13:16:05.996600022 +0200
2699 @@ -84,7 +84,7 @@
2700  
2701         // Get the available groups and add them to the structure
2702         std::set<std::string> group_names;
2703 -       foreach (const config &g, cfg.child_range("editor_group"))
2704 +       wes_foreach (const config &g, cfg.child_range("editor_group"))
2705         {
2706                 if (group_names.find(g["id"]) == group_names.end()) {
2707                         terrain_groups_.push_back(terrain_group(g, gui));
2708 @@ -97,14 +97,14 @@
2709                 }
2710         }
2711         std::map<std::string, terrain_group*> id_to_group;
2712 -       foreach (terrain_group& tg, terrain_groups_) {
2713 +       wes_foreach (terrain_group& tg, terrain_groups_) {
2714                 id_to_group.insert(std::make_pair(tg.id, &tg));
2715         }
2716         // The rest of the code assumes this is a valid pointer
2717         assert(checked_group_btn_ != 0);
2718  
2719         // add the groups for all terrains to the map
2720 -       foreach (const t_translation::t_terrain& t, terrains_) {
2721 +       wes_foreach (const t_translation::t_terrain& t, terrains_) {
2722                 const terrain_type& t_info = map().get_terrain_info(t);
2723                 DBG_ED << "Palette: processing terrain " << t_info.name()
2724                         << "(editor name: '" << t_info.editor_name() << "') "
2725 @@ -119,7 +119,7 @@
2726                 // add the terrain to the requested groups
2727                 const std::vector<std::string>& keys = utils::split(t_info.editor_group());
2728                 bool core = false;
2729 -               foreach (const std::string& k, keys) {
2730 +               wes_foreach (const std::string& k, keys) {
2731                         terrain_map_[k].push_back(t);
2732                         nmax_terrains_ = std::max(nmax_terrains_, terrain_map_[k].size());
2733                         std::map<std::string, terrain_group*>::iterator i = id_to_group.find(k);
2734 @@ -381,7 +381,7 @@
2735                 scroll_down();
2736         }
2737  
2738 -       foreach (terrain_group& g, terrain_groups_) {
2739 +       wes_foreach (terrain_group& g, terrain_groups_) {
2740                 if (g.button.pressed()) {
2741                         checked_group_btn_ = &g.button;
2742                         set_group(g.id);
2743 @@ -389,7 +389,7 @@
2744                 }
2745         }
2746  
2747 -       foreach (terrain_group& g, terrain_groups_) {
2748 +       wes_foreach (terrain_group& g, terrain_groups_) {
2749                 if (&g.button == checked_group_btn_) {
2750                         g.button.set_check(true);
2751                 } else {
2752 diff -ur wesnoth-1.10.3.orig/src/editor/map_context.cpp wesnoth-1.10.3/src/editor/map_context.cpp
2753 --- wesnoth-1.10.3.orig/src/editor/map_context.cpp      2012-01-07 03:35:17.000000000 +0100
2754 +++ wesnoth-1.10.3/src/editor/map_context.cpp   2012-07-11 13:16:05.996600022 +0200
2755 @@ -146,7 +146,7 @@
2756         if (!one_layer_only) {
2757                 terrain = map_.get_terrain_info(terrain).terrain_with_default_base();
2758         }
2759 -       foreach (const map_location& loc, locs) {
2760 +       wes_foreach (const map_location& loc, locs) {
2761                 draw_terrain_actual(terrain, loc, one_layer_only);
2762         }
2763  }
2764 @@ -374,7 +374,7 @@
2765  
2766  void map_context::clear_stack(action_stack& stack)
2767  {
2768 -       foreach (editor_action* a, stack) {
2769 +       wes_foreach (editor_action* a, stack) {
2770                 delete a;
2771         }
2772         stack.clear();
2773 diff -ur wesnoth-1.10.3.orig/src/editor/map_fragment.cpp wesnoth-1.10.3/src/editor/map_fragment.cpp
2774 --- wesnoth-1.10.3.orig/src/editor/map_fragment.cpp     2012-01-07 03:35:17.000000000 +0100
2775 +++ wesnoth-1.10.3/src/editor/map_fragment.cpp  2012-07-11 13:16:05.996600022 +0200
2776 @@ -44,7 +44,7 @@
2777  
2778  void map_fragment::add_tiles(const gamemap& map, const std::set<map_location>& locs)
2779  {
2780 -       foreach (const map_location& loc, locs) {
2781 +       wes_foreach (const map_location& loc, locs) {
2782                 add_tile(map, loc);
2783         }
2784  }
2785 @@ -57,7 +57,7 @@
2786  std::set<map_location> map_fragment::get_offset_area(const map_location& loc) const
2787  {
2788         std::set<map_location> result;
2789 -       foreach (const tile_info& i, items_) {
2790 +       wes_foreach (const tile_info& i, items_) {
2791                 result.insert(i.offset.vector_sum(loc));
2792         }
2793         return result;
2794 @@ -65,14 +65,14 @@
2795  
2796  void map_fragment::paste_into(gamemap& map, const map_location& loc) const
2797  {
2798 -       foreach (const tile_info& i, items_) {
2799 +       wes_foreach (const tile_info& i, items_) {
2800                 map.set_terrain(i.offset.vector_sum(loc), i.terrain);
2801         }
2802  }
2803  
2804  void map_fragment::shift(const map_location& offset)
2805  {
2806 -       foreach (tile_info& ti, items_) {
2807 +       wes_foreach (tile_info& ti, items_) {
2808                 ti.offset.vector_sum_assign(offset);
2809         }
2810  }
2811 @@ -80,7 +80,7 @@
2812  map_location map_fragment::center_of_mass() const
2813  {
2814         map_location sum(0, 0);
2815 -       foreach (const tile_info& ti, items_) {
2816 +       wes_foreach (const tile_info& ti, items_) {
2817                 sum.vector_sum_assign(ti.offset);
2818         }
2819         sum.x /= static_cast<int>(items_.size());
2820 @@ -92,7 +92,7 @@
2821  {
2822         shift(center_of_mass().vector_negation());
2823         area_.clear();
2824 -       foreach (tile_info& ti, items_) {
2825 +       wes_foreach (tile_info& ti, items_) {
2826                 area_.insert(ti.offset);
2827         }
2828  }
2829 @@ -100,7 +100,7 @@
2830  void map_fragment::rotate_60_cw()
2831  {
2832         area_.clear();
2833 -       foreach (tile_info& ti, items_) {
2834 +       wes_foreach (tile_info& ti, items_) {
2835                 map_location l(0,0);
2836                 int x = ti.offset.x;
2837                 int y = ti.offset.y;
2838 @@ -120,7 +120,7 @@
2839  void map_fragment::rotate_60_ccw()
2840  {
2841         area_.clear();
2842 -       foreach (tile_info& ti, items_) {
2843 +       wes_foreach (tile_info& ti, items_) {
2844                 map_location l(0,0);
2845                 int x = ti.offset.x;
2846                 int y = ti.offset.y;
2847 @@ -139,7 +139,7 @@
2848  
2849  void map_fragment::flip_horizontal()
2850  {
2851 -       foreach (tile_info& ti, items_) {
2852 +       wes_foreach (tile_info& ti, items_) {
2853                 ti.offset.x = -ti.offset.x;
2854         }
2855         center_by_mass();
2856 @@ -147,7 +147,7 @@
2857  
2858  void map_fragment::flip_vertical()
2859  {
2860 -       foreach (tile_info& ti, items_) {
2861 +       wes_foreach (tile_info& ti, items_) {
2862                 ti.offset.y = -ti.offset.y;
2863                 if (ti.offset.x % 2) {
2864                         ti.offset.y--;
2865 @@ -166,11 +166,11 @@
2866  {
2867         std::stringstream ss;
2868         ss << "MF: ";
2869 -       foreach (const tile_info& ti, items_) {
2870 +       wes_foreach (const tile_info& ti, items_) {
2871                 ss << "(" << ti.offset << ")";
2872         }
2873         ss << " -- ";
2874 -       foreach (const map_location& loc, area_) {
2875 +       wes_foreach (const map_location& loc, area_) {
2876                 ss << "(" << loc << ")";
2877         }
2878         return ss.str();
2879 diff -ur wesnoth-1.10.3.orig/src/filesystem.cpp wesnoth-1.10.3/src/filesystem.cpp
2880 --- wesnoth-1.10.3.orig/src/filesystem.cpp      2012-07-11 13:14:31.079936703 +0200
2881 +++ wesnoth-1.10.3/src/filesystem.cpp   2012-07-11 13:16:06.239933349 +0200
2882 @@ -995,7 +995,7 @@
2883         cleanup();
2884         init_binary_paths();
2885  
2886 -       foreach (const config &bp, cfg.child_range("binary_path"))
2887 +       wes_foreach (const config &bp, cfg.child_range("binary_path"))
2888         {
2889                 std::string path = bp["path"].str();
2890                 if (path.find("..") != std::string::npos) {
2891 @@ -1042,7 +1042,7 @@
2892  
2893         init_binary_paths();
2894  
2895 -       foreach (const std::string &path, binary_paths)
2896 +       wes_foreach (const std::string &path, binary_paths)
2897         {
2898                 res.push_back(get_user_data_dir() + "/" + path + type + "/");
2899  
2900 @@ -1083,7 +1083,7 @@
2901                 return std::string();
2902         }
2903  
2904 -       foreach (const std::string &path, get_binary_paths(type))
2905 +       wes_foreach (const std::string &path, get_binary_paths(type))
2906         {
2907                 const std::string file = path + filename;
2908                 DBG_FS << "  checking '" << path << "'\n";
2909 @@ -1111,7 +1111,7 @@
2910                 return std::string();
2911         }
2912  
2913 -       foreach (const std::string &path, get_binary_paths(type))
2914 +       wes_foreach (const std::string &path, get_binary_paths(type))
2915         {
2916                 const std::string file = path + filename;
2917                 DBG_FS << "  checking '" << path << "'\n";
2918 @@ -1276,7 +1276,7 @@
2919         p4 << drive;
2920  #endif
2921  
2922 -       foreach (const std::string &s, components)
2923 +       wes_foreach (const std::string &s, components)
2924         {
2925                 p4 << '/' << s;
2926         }
2927 diff -ur wesnoth-1.10.3.orig/src/filesystem.cpp.orig wesnoth-1.10.3/src/filesystem.cpp.orig
2928 --- wesnoth-1.10.3.orig/src/filesystem.cpp.orig 2012-05-05 19:39:03.000000000 +0200
2929 +++ wesnoth-1.10.3/src/filesystem.cpp.orig      2012-07-11 13:16:06.239933349 +0200
2930 @@ -1010,7 +1010,7 @@
2931         cleanup();
2932         init_binary_paths();
2933  
2934 -       foreach (const config &bp, cfg.child_range("binary_path"))
2935 +       wes_foreach (const config &bp, cfg.child_range("binary_path"))
2936         {
2937                 std::string path = bp["path"].str();
2938                 if (path.find("..") != std::string::npos) {
2939 @@ -1057,7 +1057,7 @@
2940  
2941         init_binary_paths();
2942  
2943 -       foreach (const std::string &path, binary_paths)
2944 +       wes_foreach (const std::string &path, binary_paths)
2945         {
2946                 res.push_back(get_user_data_dir() + "/" + path + type + "/");
2947  
2948 @@ -1098,7 +1098,7 @@
2949                 return std::string();
2950         }
2951  
2952 -       foreach (const std::string &path, get_binary_paths(type))
2953 +       wes_foreach (const std::string &path, get_binary_paths(type))
2954         {
2955                 const std::string file = path + filename;
2956                 DBG_FS << "  checking '" << path << "'\n";
2957 @@ -1126,7 +1126,7 @@
2958                 return std::string();
2959         }
2960  
2961 -       foreach (const std::string &path, get_binary_paths(type))
2962 +       wes_foreach (const std::string &path, get_binary_paths(type))
2963         {
2964                 const std::string file = path + filename;
2965                 DBG_FS << "  checking '" << path << "'\n";
2966 @@ -1291,7 +1291,7 @@
2967         p4 << drive;
2968  #endif
2969  
2970 -       foreach (const std::string &s, components)
2971 +       wes_foreach (const std::string &s, components)
2972         {
2973                 p4 << '/' << s;
2974         }
2975 diff -ur wesnoth-1.10.3.orig/src/font.cpp wesnoth-1.10.3/src/font.cpp
2976 --- wesnoth-1.10.3.orig/src/font.cpp    2012-01-07 03:35:17.000000000 +0100
2977 +++ wesnoth-1.10.3/src/font.cpp 2012-07-11 13:16:05.976600023 +0200
2978 @@ -355,10 +355,10 @@
2979  #endif
2980  
2981  #if CAIRO_HAS_WIN32_FONT
2982 -       foreach(const std::string& path, get_binary_paths("fonts")) {
2983 +       wes_foreach(const std::string& path, get_binary_paths("fonts")) {
2984                 std::vector<std::string> files;
2985                 get_files_in_dir(path, &files, NULL, ENTIRE_FILE_PATH);
2986 -               foreach(const std::string& file, files)
2987 +               wes_foreach(const std::string& file, files)
2988                         if(file.substr(file.length() - 4) == ".ttf" || file.substr(file.length() - 4) == ".ttc")
2989                                 AddFontResource(file.c_str());
2990         }
2991 @@ -372,10 +372,10 @@
2992  #endif
2993  
2994  #if CAIRO_HAS_WIN32_FONT
2995 -       foreach(const std::string& path, get_binary_paths("fonts")) {
2996 +       wes_foreach(const std::string& path, get_binary_paths("fonts")) {
2997                 std::vector<std::string> files;
2998                 get_files_in_dir(path, &files, NULL, ENTIRE_FILE_PATH);
2999 -               foreach(const std::string& file, files)
3000 +               wes_foreach(const std::string& file, files)
3001                         if(file.substr(file.length() - 4) == ".ttf" || file.substr(file.length() - 4) == ".ttc")
3002                                 RemoveFontResource(file.c_str());
3003         }
3004 @@ -425,7 +425,7 @@
3005                 const subset_id subset = font_names.size();
3006                 font_names.push_back(itor->name);
3007  
3008 -               foreach (const subset_descriptor::range &cp_range, itor->present_codepoints) {
3009 +               wes_foreach (const subset_descriptor::range &cp_range, itor->present_codepoints) {
3010                         char_blocks.insert(cp_range.first, cp_range.second, subset);
3011                 }
3012         }
3013 @@ -582,7 +582,7 @@
3014         w_ = 0;
3015         h_ = 0;
3016  
3017 -       foreach (text_chunk const &chunk, chunks_)
3018 +       wes_foreach (text_chunk const &chunk, chunks_)
3019         {
3020                 TTF_Font* ttfont = get_font(font_id(chunk.subset, font_size_));
3021                 if(ttfont == NULL)
3022 @@ -628,7 +628,7 @@
3023         if(width() > max_text_line_width)
3024                 return surfs_;
3025  
3026 -       foreach (text_chunk const &chunk, chunks_)
3027 +       wes_foreach (text_chunk const &chunk, chunks_)
3028         {
3029                 TTF_Font* ttfont = get_font(font_id(chunk.subset, font_size_));
3030                 if (ttfont == NULL)
3031 @@ -1261,7 +1261,7 @@
3032                 return false;
3033  
3034         std::set<std::string> known_fonts;
3035 -       foreach (const config &font, fonts_config.child_range("font")) {
3036 +       wes_foreach (const config &font, fonts_config.child_range("font")) {
3037                 known_fonts.insert(font["name"]);
3038         }
3039  
3040 diff -ur wesnoth-1.10.3.orig/src/foreach.hpp wesnoth-1.10.3/src/foreach.hpp
3041 --- wesnoth-1.10.3.orig/src/foreach.hpp 2011-09-26 18:50:56.000000000 +0200
3042 +++ wesnoth-1.10.3/src/foreach.hpp      2012-07-11 13:16:05.986600025 +0200
3043 @@ -1,9 +1,9 @@
3044  #include <boost/foreach.hpp>
3045  
3046  #ifdef __CDT_PARSER__
3047 -     #define foreach(a, b) for(a : b)
3048 +     #define wes_foreach(a, b) for(a : b)
3049  #else
3050 -     #define foreach BOOST_FOREACH
3051 +     #define wes_foreach BOOST_FOREACH
3052  #endif
3053  
3054  #endif
3055 diff -ur wesnoth-1.10.3.orig/src/formula.cpp wesnoth-1.10.3/src/formula.cpp
3056 --- wesnoth-1.10.3.orig/src/formula.cpp 2010-11-21 02:56:29.000000000 +0100
3057 +++ wesnoth-1.10.3/src/formula.cpp      2012-07-11 13:16:05.969933358 +0200
3058 @@ -117,7 +117,7 @@
3059                 std::stringstream s;
3060                 s << '[';
3061                 bool first_item = true;
3062 -               foreach(expression_ptr a , items_) {
3063 +               wes_foreach(expression_ptr a , items_) {
3064                         if (!first_item) {
3065                                 s << ',';
3066                         } else {
3067 @@ -468,7 +468,7 @@
3068                 std::stringstream s;
3069                 s << "{where:(";
3070                 s << body_->str();
3071 -               foreach (const expr_table::value_type &a, *clauses_) {
3072 +               wes_foreach (const expr_table::value_type &a, *clauses_) {
3073                         s << ", [" << a.first << "] -> ["<< a.second->str()<<"]";
3074                 }
3075                 s << ")}";
3076 diff -ur wesnoth-1.10.3.orig/src/formula_function.cpp wesnoth-1.10.3/src/formula_function.cpp
3077 --- wesnoth-1.10.3.orig/src/formula_function.cpp        2012-01-07 03:35:17.000000000 +0100
3078 +++ wesnoth-1.10.3/src/formula_function.cpp     2012-07-11 13:16:06.029933357 +0200
3079 @@ -46,7 +46,7 @@
3080         s << get_name();
3081         s << '(';
3082         bool first_arg = true;
3083 -       foreach(expression_ptr a , args()) {
3084 +       wes_foreach(expression_ptr a , args()) {
3085                 if (!first_arg) {
3086                         s << ',';
3087                 } else {
3088 @@ -451,7 +451,7 @@
3089  
3090                                 std::string result;
3091  
3092 -                               foreach(expression_ptr arg, args()) {
3093 +                               wes_foreach(expression_ptr arg, args()) {
3094                                                 result += arg->evaluate(variables, fdb).string_cast();
3095                                 }
3096  
3097 diff -ur wesnoth-1.10.3.orig/src/game_config.cpp wesnoth-1.10.3/src/game_config.cpp
3098 --- wesnoth-1.10.3.orig/src/game_config.cpp     2012-01-07 03:35:17.000000000 +0100
3099 +++ wesnoth-1.10.3/src/game_config.cpp  2012-07-11 13:16:05.963266693 +0200
3100 @@ -259,7 +259,7 @@
3101                 }
3102  
3103                 server_list.clear();
3104 -               foreach (const config &server, v.child_range("server"))
3105 +               wes_foreach (const config &server, v.child_range("server"))
3106                 {
3107                         server_info sinf;
3108                         sinf.name = server["name"].str();
3109 @@ -270,7 +270,7 @@
3110  
3111         void add_color_info(const config &v)
3112         {
3113 -               foreach (const config &teamC, v.child_range("color_range"))
3114 +               wes_foreach (const config &teamC, v.child_range("color_range"))
3115                 {
3116                         const config::attribute_value *a1 = teamC.get("id"),
3117                                 *a2 = teamC.get("rgb");
3118 @@ -304,9 +304,9 @@
3119                         DBG_NG << str.str() << '\n';
3120                 }
3121  
3122 -               foreach (const config &cp, v.child_range("color_palette"))
3123 +               wes_foreach (const config &cp, v.child_range("color_palette"))
3124                 {
3125 -                       foreach (const config::attribute &rgb, cp.attribute_range())
3126 +                       wes_foreach (const config::attribute &rgb, cp.attribute_range())
3127                         {
3128                                 std::vector<Uint32> temp;
3129                                 if(!string2rgb(rgb.second, temp)) {
3130 diff -ur wesnoth-1.10.3.orig/src/game_controller_abstract.cpp wesnoth-1.10.3/src/game_controller_abstract.cpp
3131 --- wesnoth-1.10.3.orig/src/game_controller_abstract.cpp        2011-10-13 20:25:06.000000000 +0200
3132 +++ wesnoth-1.10.3/src/game_controller_abstract.cpp     2012-07-11 13:16:05.959933359 +0200
3133 @@ -80,7 +80,7 @@
3134         language_def locale;
3135         if(cmdline_opts_.language) {
3136                 std::vector<language_def> langs = get_languages();
3137 -               foreach(const language_def & def, langs) {
3138 +               wes_foreach(const language_def & def, langs) {
3139                         if(def.localename == *cmdline_opts_.language) {
3140                                 locale = def;
3141                                 break;
3142 diff -ur wesnoth-1.10.3.orig/src/game_controller.cpp wesnoth-1.10.3/src/game_controller.cpp
3143 --- wesnoth-1.10.3.orig/src/game_controller.cpp 2012-01-22 00:20:08.000000000 +0100
3144 +++ wesnoth-1.10.3/src/game_controller.cpp      2012-07-11 13:16:05.949933359 +0200
3145 @@ -478,7 +478,7 @@
3146         }
3147  
3148         int side_num = 1;
3149 -       foreach (config &s, level.child_range("side"))
3150 +       wes_foreach (config &s, level.child_range("side"))
3151         {
3152                 std::map<int,std::string>::const_iterator type = side_types.find(side_num),
3153                                                           controller = side_controllers.find(side_num),
3154 @@ -507,7 +507,7 @@
3155                                 faction_excepts.clear();
3156                         }
3157                         unsigned j = 0;
3158 -                       foreach (const config &faction, era_cfg.child_range("multiplayer_side"))
3159 +                       wes_foreach (const config &faction, era_cfg.child_range("multiplayer_side"))
3160                         {
3161                                 if (faction["random_faction"].to_bool()) continue;
3162                                 const std::string &faction_id = faction["id"];
3163 @@ -673,7 +673,7 @@
3164         }
3165  
3166         if(state_.classification().campaign_type == "multiplayer") {
3167 -               foreach (config &side, state_.snapshot.child_range("side"))
3168 +               wes_foreach (config &side, state_.snapshot.child_range("side"))
3169                 {
3170                         if (side["controller"] == "network")
3171                                 side["controller"] = "human";
3172 @@ -683,10 +683,10 @@
3173         }
3174  
3175         if (load.cancel_orders()) {
3176 -               foreach (config &side, state_.snapshot.child_range("side"))
3177 +               wes_foreach (config &side, state_.snapshot.child_range("side"))
3178                 {
3179                         if (side["controller"] != "human") continue;
3180 -                       foreach (config &unit, side.child_range("unit"))
3181 +                       wes_foreach (config &unit, side.child_range("unit"))
3182                         {
3183                                 unit["goto_x"] = -999;
3184                                 unit["goto_y"] = -999;
3185 @@ -710,7 +710,7 @@
3186  
3187  void game_controller::mark_completed_campaigns(std::vector<config> &campaigns)
3188  {
3189 -       foreach (config &campaign, campaigns) {
3190 +       wes_foreach (config &campaign, campaigns) {
3191                 campaign["completed"] = preferences::is_campaign_completed(campaign["id"]);
3192         }
3193  }
3194 @@ -1218,7 +1218,7 @@
3195                 game_config_.splice_children(core_terrain_rules, "terrain_graphics");
3196  
3197                 config& hashes = game_config_.add_child("multiplayer_hashes");
3198 -               foreach (const config &ch, game_config_.child_range("multiplayer")) {
3199 +               wes_foreach (const config &ch, game_config_.child_range("multiplayer")) {
3200                         hashes[ch["id"]] = ch.hash();
3201                 }
3202  
3203 diff -ur wesnoth-1.10.3.orig/src/game.cpp wesnoth-1.10.3/src/game.cpp
3204 --- wesnoth-1.10.3.orig/src/game.cpp    2012-01-07 03:35:17.000000000 +0100
3205 +++ wesnoth-1.10.3/src/game.cpp 2012-07-11 13:16:06.029933357 +0200
3206 @@ -218,7 +218,7 @@
3207                         int read = 0;
3208  
3209                         // use static preproc_define::read_pair(config) to make a object
3210 -                       foreach ( const config::any_child &value, cfg.all_children_range() ) {
3211 +                       wes_foreach ( const config::any_child &value, cfg.all_children_range() ) {
3212                                 const preproc_map::value_type def = preproc_define::read_pair( value.cfg );
3213                                 input_macros[def.first] = def.second;
3214                                 ++read;
3215 @@ -245,7 +245,7 @@
3216                 if ( cmdline_opts.preprocess_defines ) {
3217  
3218                         // add the specified defines
3219 -                       foreach ( const std::string &define, *cmdline_opts.preprocess_defines ) {
3220 +                       wes_foreach ( const std::string &define, *cmdline_opts.preprocess_defines ) {
3221                                 if (define.empty()){
3222                                         std::cerr << "empty define supplied\n";
3223                                         continue;
3224 @@ -452,7 +452,7 @@
3225                         const config &cfg = game->game_config().child("titlescreen_music");
3226                         if (cfg) {
3227                     sound::play_music_repeatedly(game_config::title_music);
3228 -                               foreach (const config &i, cfg.child_range("music")) {
3229 +                               wes_foreach (const config &i, cfg.child_range("music")) {
3230                                         sound::play_music_config(i);
3231                                 }
3232                                 sound::commit_music_changes();
3233 diff -ur wesnoth-1.10.3.orig/src/game_display.cpp wesnoth-1.10.3/src/game_display.cpp
3234 --- wesnoth-1.10.3.orig/src/game_display.cpp    2012-04-23 01:53:28.000000000 +0200
3235 +++ wesnoth-1.10.3/src/game_display.cpp 2012-07-11 13:16:05.989933357 +0200
3236 @@ -297,7 +297,7 @@
3237         halo::unrender(invalidated_);
3238         display::draw_invalidated();
3239  
3240 -       foreach(unit* temp_unit, fake_units_) {
3241 +       wes_foreach(unit* temp_unit, fake_units_) {
3242                 const map_location& loc = temp_unit->get_location();
3243                 exclusive_unit_draw_requests_t::iterator request = exclusive_unit_draw_requests_.find(loc);
3244                 if (invalidated_.find(loc) != invalidated_.end()
3245 @@ -305,7 +305,7 @@
3246                         temp_unit->redraw_unit();
3247         }
3248  
3249 -       foreach (const map_location& loc, invalidated_) {
3250 +       wes_foreach (const map_location& loc, invalidated_) {
3251                 unit_map::iterator u_it = units_.find(loc);
3252                 exclusive_unit_draw_requests_t::iterator request = exclusive_unit_draw_requests_.find(loc);
3253                 if (u_it != units_.end()
3254 @@ -451,7 +451,7 @@
3255  
3256                 // We display the unit the mouse is over if it is over a unit,
3257                 // otherwise we display the unit that is selected.
3258 -               foreach (const std::string &name, reports::report_list()) {
3259 +               wes_foreach (const std::string &name, reports::report_list()) {
3260                         draw_report(name);
3261                 }
3262                 invalidateGameStatus_ = false;
3263 @@ -744,7 +744,7 @@
3264  void game_display::highlight_another_reach(const pathfind::paths &paths_list)
3265  {
3266         // Fold endpoints of routes into reachability map.
3267 -       foreach (const pathfind::paths::step &dest, paths_list.destinations) {
3268 +       wes_foreach (const pathfind::paths::step &dest, paths_list.destinations) {
3269                 reach_map_[dest.curr]++;
3270         }
3271         reach_map_changed_ = true;
3272 @@ -897,17 +897,17 @@
3273  void game_display::invalidate_animations()
3274  {
3275         display::invalidate_animations();
3276 -       foreach (unit& u, units_) {
3277 +       wes_foreach (unit& u, units_) {
3278                 u.refresh();
3279         }
3280 -       foreach(unit* temp_unit, fake_units_) {
3281 +       wes_foreach(unit* temp_unit, fake_units_) {
3282                 temp_unit->refresh();
3283         }
3284         std::vector<unit*> unit_list;
3285 -       foreach (unit &u, units_) {
3286 +       wes_foreach (unit &u, units_) {
3287                 unit_list.push_back(&u);
3288         }
3289 -       foreach (unit *u, fake_units_) {
3290 +       wes_foreach (unit *u, fake_units_) {
3291                 unit_list.push_back(u);
3292         }
3293         bool new_inval;
3294 @@ -1079,7 +1079,7 @@
3295  {
3296         const team& curr_team = teams_[playing_team()];
3297         const team& prev_team = teams_[playing_team()-1 < teams_.size() ? playing_team()-1 : teams_.size()-1];
3298 -       foreach (const game_display::overlay_map::value_type i, overlays_) {
3299 +       wes_foreach (const game_display::overlay_map::value_type i, overlays_) {
3300                 const overlay& ov = i.second;
3301                 if (!ov.team_name.empty() &&
3302                         ((ov.team_name.find(curr_team.team_name()) + 1) != 0) !=
3303 @@ -1485,7 +1485,7 @@
3304                 }
3305         }
3306  
3307 -       foreach (const chat_message &cm, chat_messages_) {
3308 +       wes_foreach (const chat_message &cm, chat_messages_) {
3309                 font::move_floating_label(cm.speaker_handle, 0, - movement);
3310                 font::move_floating_label(cm.handle, 0, - movement);
3311         }
3312 diff -ur wesnoth-1.10.3.orig/src/game_events.cpp wesnoth-1.10.3/src/game_events.cpp
3313 --- wesnoth-1.10.3.orig/src/game_events.cpp     2012-05-12 00:37:33.000000000 +0200
3314 +++ wesnoth-1.10.3/src/game_events.cpp  2012-07-11 13:16:06.023266690 +0200
3315 @@ -341,7 +341,7 @@
3316                         std::vector<std::pair<int,int> > counts = (*u).has_attribute("count")
3317                                 ? utils::parse_ranges((*u)["count"]) : default_counts;
3318                         int match_count = 0;
3319 -                       foreach (const unit &i, *resources::units)
3320 +                       wes_foreach (const unit &i, *resources::units)
3321                         {
3322                                 if(i.hitpoints() > 0 && unit_matches_filter(i, *u)) {
3323                                         ++match_count;
3324 @@ -396,7 +396,7 @@
3325                 const vconfig::child_list& variables = cond.get_children("variable");
3326                 backwards_compat = backwards_compat && variables.empty();
3327  
3328 -               foreach (const vconfig &values, variables)
3329 +               wes_foreach (const vconfig &values, variables)
3330                 {
3331                         const std::string name = values["name"];
3332                         config::attribute_value value = resources::state_of_game->get_variable_const(name);
3333 @@ -589,7 +589,7 @@
3334                         const std::vector<game_events::event_handler>& handlers,
3335                         const std::string& msg) {
3336  
3337 -                       foreach(const game_events::event_handler& h, handlers){
3338 +                       wes_foreach(const game_events::event_handler& h, handlers){
3339                                 const config& cfg = h.get_config();
3340                                 ss << "name=" << cfg["name"] << ", with id=" << cfg["id"] << "; ";
3341                         }
3342 @@ -603,7 +603,7 @@
3343                         std::stringstream ss;
3344                         log_handler(ss, active_, "active");
3345                         log_handler(ss, insert_buffer_, "insert buffered");
3346 -                       foreach(const std::string& h, remove_buffer_){
3347 +                       wes_foreach(const std::string& h, remove_buffer_){
3348                                 ss << "id=" << h << "; ";
3349                         }
3350                         DBG_EH << "remove buffered handlers are now " << ss.str() << "\n";
3351 @@ -631,7 +631,7 @@
3352                                 const config & cfg = new_handler.get_config();
3353                                 std::string id = cfg["id"];
3354                                 if(!id.empty()) {
3355 -                                       foreach( game_events::event_handler const & eh, active_) {
3356 +                                       wes_foreach( game_events::event_handler const & eh, active_) {
3357                                                 config const & temp_config( eh.get_config());
3358                                                 if(id == temp_config["id"]) {
3359                                                         DBG_EH << "ignoring event handler for name=" << cfg["name"] <<
3360 @@ -698,12 +698,12 @@
3361                                 return;
3362  
3363                         // Commit any event removals
3364 -                       foreach(std::string const & i ,  remove_buffer_ ){
3365 +                       wes_foreach(std::string const & i ,  remove_buffer_ ){
3366                                 remove_event_handler( i ); }
3367                         remove_buffer_.clear();
3368  
3369                         // Commit any spawned events-within-events
3370 -                       foreach( game_events::event_handler const & i ,  insert_buffer_ ){
3371 +                       wes_foreach( game_events::event_handler const & i ,  insert_buffer_ ){
3372                                 add_event_handler( i ); }
3373                         insert_buffer_.clear();
3374  
3375 @@ -735,7 +735,7 @@
3376         std::vector<int> sides = game_events::get_sides_vector(cfg);
3377         size_t index;
3378  
3379 -       foreach (const int &side_num, sides)
3380 +       wes_foreach (const int &side_num, sides)
3381         {
3382                 index = side_num - 1;
3383                 team &t = (*resources::teams)[index];
3384 @@ -744,7 +744,7 @@
3385                 filter.restrict_size(game_config::max_loop);
3386                 filter.get_locations(locs, true);
3387  
3388 -               foreach (map_location const &loc, locs)
3389 +               wes_foreach (map_location const &loc, locs)
3390                 {
3391                         if (remove) {
3392                                 t.clear_shroud(loc);
3393 @@ -774,7 +774,7 @@
3394         const bool remove = utils::string_bool(cfg["remove"], false);
3395         if (remove) {
3396                 const std::vector<std::string> ids = utils::split(cfg["id"]);
3397 -               foreach(const std::string &id, ids) {
3398 +               wes_foreach(const std::string &id, ids) {
3399                         resources::tunnels->remove(id);
3400                 }
3401         } else if (cfg.get_children("source").empty() ||
3402 @@ -941,7 +941,7 @@
3403  WML_HANDLER_FUNCTION(modify_ai, /*event_info*/, cfg)
3404  {
3405         std::vector<int> sides = game_events::get_sides_vector(cfg);
3406 -       foreach (const int &side_num, sides)
3407 +       wes_foreach (const int &side_num, sides)
3408         {
3409                 ai::manager::modify_active_ai_for_side(side_num,cfg.get_parsed_config());
3410         }
3411 @@ -967,7 +967,7 @@
3412         std::vector<int> sides = game_events::get_sides_vector(cfg);
3413         size_t team_index;
3414  
3415 -       foreach (const int &side_num, sides)
3416 +       wes_foreach (const int &side_num, sides)
3417         {
3418                 team_index = side_num - 1;
3419                 LOG_NG << "modifying side: " << side_num << "\n";
3420 @@ -1212,7 +1212,7 @@
3421  
3422         size_t longest_path = 0;
3423  
3424 -       foreach(const vconfig& config, unit_cfgs) {
3425 +       wes_foreach(const vconfig& config, unit_cfgs) {
3426                 const std::vector<std::string> xvals = utils::split(config["x"]);
3427                 const std::vector<std::string> yvals = utils::split(config["y"]);
3428                 int skip_steps = config["skip_steps"];
3429 @@ -1461,7 +1461,7 @@
3430  
3431                 variable_info vi(array_name, true, variable_info::TYPE_ARRAY);
3432                 bool first = true;
3433 -               foreach (const config &cfg, vi.as_array())
3434 +               wes_foreach (const config &cfg, vi.as_array())
3435                 {
3436                         std::string current_string = cfg[key_name];
3437                         if (remove_empty && current_string.empty()) continue;
3438 @@ -1589,7 +1589,7 @@
3439                                 dest.vars->merge_with(data);
3440                         }
3441                 } else if(mode == "insert" || dest.explicit_index) {
3442 -                       foreach (const config &child, data.child_range(dest.key))
3443 +                       wes_foreach (const config &child, data.child_range(dest.key))
3444                         {
3445                                 dest.vars->add_child_at(dest.key, child, dest.index++);
3446                         }
3447 @@ -1619,7 +1619,7 @@
3448                         item["type"] = *ti;
3449                 }
3450                 unit_map::iterator itor;
3451 -               foreach (unit &u, *resources::units) {
3452 +               wes_foreach (unit &u, *resources::units) {
3453                         if (game_events::unit_matches_filter(u, filter)) {
3454                                 u.set_role(cfg["role"]);
3455                                 found = true;
3456 @@ -1632,7 +1632,7 @@
3457                 std::set<std::string> player_ids;
3458                 std::vector<std::string> sides = utils::split(cfg["side"]);
3459                 const bool has_any_sides = !sides.empty();
3460 -               foreach(std::string const& side_str, sides) {
3461 +               wes_foreach(std::string const& side_str, sides) {
3462                         size_t side_num = lexical_cast_default<size_t>(side_str,0);
3463                         if(side_num > 0 && side_num <= resources::teams->size()) {
3464                                 player_ids.insert((resources::teams->begin() + (side_num - 1))->save_id());
3465 @@ -1699,7 +1699,7 @@
3466         game_map->set_terrain(loc, new_t);
3467         screen_needs_rebuild = true;
3468  
3469 -       foreach (const t_translation::t_terrain &ut, game_map->underlying_union_terrain(loc)) {
3470 +       wes_foreach (const t_translation::t_terrain &ut, game_map->underlying_union_terrain(loc)) {
3471                 preferences::encountered_terrains().insert(ut);
3472         }
3473  }
3474 @@ -1820,7 +1820,7 @@
3475                                 const map_location cfg_loc = cfg_to_loc(cfg);
3476  
3477                                 //TODO fendrin: comment this monster
3478 -                               foreach (unit_map::const_unit_iterator leader, leaders) {
3479 +                               wes_foreach (unit_map::const_unit_iterator leader, leaders) {
3480                                         DBG_NG << "...considering " + leader->id() + " as the recalling leader...\n";
3481                                         map_location loc = cfg_loc;
3482                                         if ( (leader_filter.null() || leader->matches_filter(leader_filter, leader->get_location())) &&
3483 @@ -1879,7 +1879,7 @@
3484  
3485         map_location loc;
3486         if(!filter.null()) {
3487 -               foreach (const unit &u, *resources::units) {
3488 +               wes_foreach (const unit &u, *resources::units) {
3489                         if (game_events::unit_matches_filter(u, filter)) {
3490                                 loc = u.get_location();
3491                                 break;
3492 @@ -1926,7 +1926,7 @@
3493                 }
3494         }
3495  
3496 -       foreach (const vconfig &cmd, cfg.get_children(command_type)) {
3497 +       wes_foreach (const vconfig &cmd, cfg.get_children(command_type)) {
3498                 handle_event_commands(event_info, cmd);
3499         }
3500  }
3501 @@ -2029,13 +2029,13 @@
3502         std::vector<unit *> dead_men_walking;
3503         // unit_map::iterator uit(resources::units->begin()), uend(resources::units->end());
3504         // for(;uit!=uend; ++uit){
3505 -       foreach(unit & u, *resources::units){
3506 +       wes_foreach(unit & u, *resources::units){
3507                 if(game_events::unit_matches_filter(u, cfg)){
3508                         dead_men_walking.push_back(&u);
3509                 }
3510         }
3511  
3512 -       foreach(unit * un, dead_men_walking) {
3513 +       wes_foreach(unit * un, dead_men_walking) {
3514                 map_location loc(un->get_location());
3515                 bool fire_event = false;
3516                 game_events::entity_location death_loc(*un);
3517 @@ -2429,7 +2429,7 @@
3518  
3519         if (clear_shroud_bool) {
3520                 side_filter filter(cfg);
3521 -               foreach(const int side, filter.get_teams()){
3522 +               wes_foreach(const int side, filter.get_teams()){
3523                         clear_shroud(side);
3524                 }
3525                 screen.recalculate_minimap();
3526 @@ -2466,7 +2466,7 @@
3527         const vconfig healers_filter = cfg.child("filter_second");
3528         std::vector<unit*> healers;
3529         if (!healers_filter.null()) {
3530 -               foreach (unit& u, *units) {
3531 +               wes_foreach (unit& u, *units) {
3532                         if (game_events::unit_matches_filter(u, healers_filter) && u.has_ability_type("heals")) {
3533                                 healers.push_back(&u);
3534                         }
3535 @@ -2835,7 +2835,7 @@
3536                         return;
3537                 }
3538  
3539 -               foreach (const vconfig &cmd, option_events[option_chosen]) {
3540 +               wes_foreach (const vconfig &cmd, option_events[option_chosen]) {
3541                         handle_event_commands(event_info, cmd);
3542                 }
3543         }
3544 @@ -2858,7 +2858,7 @@
3545         if(remove) {
3546                 const std::vector<std::string> id_list =
3547                         utils::split(ids, ',', utils::STRIP_SPACES | utils::REMOVE_EMPTY);
3548 -               foreach(const std::string& id, id_list) {
3549 +               wes_foreach(const std::string& id, id_list) {
3550                         resources::tod_manager->remove_time_area(id);
3551                         LOG_NG << "event WML removed time_area '" << id << "'\n";
3552                 }
3553 @@ -2997,7 +2997,7 @@
3554                         if(is_empty_command) {
3555                                 mref->command.add_child("allow_undo");
3556                         }
3557 -                       foreach(game_events::event_handler& hand, event_handlers) {
3558 +                       wes_foreach(game_events::event_handler& hand, event_handlers) {
3559                                 if(hand.is_menu_item() && hand.matches_name(mref->name)) {
3560                                         LOG_NG << "changing command for " << mref->name << " to:\n" << *wcc.second;
3561                                         hand = game_events::event_handler(mref->command, true);
3562 @@ -3029,14 +3029,14 @@
3563         vconfig filters(handler.get_config());
3564  
3565  
3566 -       foreach (const vconfig &condition, filters.get_children("filter_condition"))
3567 +       wes_foreach (const vconfig &condition, filters.get_children("filter_condition"))
3568         {
3569                 if (!game_events::conditional_passed(condition)) {
3570                         return false;
3571                 }
3572         }
3573  
3574 -       foreach (const vconfig &f, filters.get_children("filter"))
3575 +       wes_foreach (const vconfig &f, filters.get_children("filter"))
3576         {
3577                 if (unit1 == units->end() || !game_events::unit_matches_filter(*unit1, f)) {
3578                         return false;
3579 @@ -3046,7 +3046,7 @@
3580                 }
3581         }
3582  
3583 -       foreach (const vconfig &f, filters.get_children("filter_side"))
3584 +       wes_foreach (const vconfig &f, filters.get_children("filter_side"))
3585         {
3586                 side_filter ssf(f);
3587                 const int current_side = resources::controller->current_side();
3588 @@ -3055,7 +3055,7 @@
3589  
3590         vconfig::child_list special_filters = filters.get_children("filter_attack");
3591         bool special_matches = special_filters.empty();
3592 -       foreach (const vconfig &f, special_filters)
3593 +       wes_foreach (const vconfig &f, special_filters)
3594         {
3595                 if (unit1 != units->end() && game_events::matches_special_filter(ev.data.child("first"), f)) {
3596                         special_matches = true;
3597 @@ -3068,7 +3068,7 @@
3598                 return false;
3599         }
3600  
3601 -       foreach (const vconfig &f, filters.get_children("filter_second"))
3602 +       wes_foreach (const vconfig &f, filters.get_children("filter_second"))
3603         {
3604                 if (unit2 == units->end() || !game_events::unit_matches_filter(*unit2, f)) {
3605                         return false;
3606 @@ -3080,7 +3080,7 @@
3607  
3608         special_filters = filters.get_children("filter_second_attack");
3609         special_matches = special_filters.empty();
3610 -       foreach (const vconfig &f, special_filters)
3611 +       wes_foreach (const vconfig &f, special_filters)
3612         {
3613                 if (unit2 != units->end() && game_events::matches_special_filter(ev.data.child("second"), f)) {
3614                         special_matches = true;
3615 @@ -3275,17 +3275,17 @@
3616                 : variable_manager()
3617         {
3618                 assert(!manager_running);
3619 -               foreach (const config &ev, cfg.child_range("event")) {
3620 +               wes_foreach (const config &ev, cfg.child_range("event")) {
3621                         event_handlers.add_event_handler(game_events::event_handler(ev));
3622                 }
3623 -               foreach (const std::string &id, utils::split(cfg["unit_wml_ids"])) {
3624 +               wes_foreach (const std::string &id, utils::split(cfg["unit_wml_ids"])) {
3625                         unit_wml_ids.insert(id);
3626                 }
3627  
3628                 resources::lua_kernel = new LuaKernel(cfg);
3629                 manager_running = true;
3630  
3631 -               foreach (static_wml_action_map::value_type &action, static_wml_actions) {
3632 +               wes_foreach (static_wml_action_map::value_type &action, static_wml_actions) {
3633                         resources::lua_kernel->set_wml_action(action.first, action.second);
3634                 }
3635  
3636 @@ -3298,7 +3298,7 @@
3637                 }
3638                 int wmi_count = 0;
3639                 typedef std::pair<std::string, wml_menu_item *> item;
3640 -               foreach (const item &itor, resources::state_of_game->wml_menu_items) {
3641 +               wes_foreach (const item &itor, resources::state_of_game->wml_menu_items) {
3642                         if (!itor.second->command.empty()) {
3643                                 event_handlers.add_event_handler(game_events::event_handler(itor.second->command, true));
3644                         }
3645 @@ -3312,7 +3312,7 @@
3646         void write_events(config& cfg)
3647         {
3648                 assert(manager_running);
3649 -               foreach (const game_events::event_handler &eh, event_handlers) {
3650 +               wes_foreach (const game_events::event_handler &eh, event_handlers) {
3651                         if (eh.disabled() || eh.is_menu_item()) continue;
3652                         cfg.add_child("event", eh.get_config());
3653                 }
3654 @@ -3385,7 +3385,7 @@
3655                         if(std::find(unit_wml_ids.begin(),unit_wml_ids.end(),type) != unit_wml_ids.end()) return;
3656                         unit_wml_ids.insert(type);
3657                 }
3658 -               foreach (const config &new_ev, cfgs) {
3659 +               wes_foreach (const config &new_ev, cfgs) {
3660                         if(type.empty() && new_ev["id"].empty())
3661                         {
3662                                 WRN_NG << "attempt to add an [event] with empty id=, ignoring \n";
3663 @@ -3427,7 +3427,7 @@
3664  
3665                 if(!lg::debug.dont_log("event_handler")) {
3666                         std::stringstream ss;
3667 -                       foreach(const game_events::queued_event& ev, events_queue) {
3668 +                       wes_foreach(const game_events::queued_event& ev, events_queue) {
3669                                 ss << "name=" << ev.name << "; ";
3670                         }
3671                         DBG_EH << "processing queued events: " << ss.str() << "\n";
3672 @@ -3454,7 +3454,7 @@
3673  
3674                         bool init_event_vars = true;
3675  
3676 -                       foreach(game_events::event_handler& handler, event_handlers) {
3677 +                       wes_foreach(game_events::event_handler& handler, event_handlers) {
3678                                 if(!handler.matches_name(event_name))
3679                                         continue;
3680                                 // Set the variables for the event
3681 diff -ur wesnoth-1.10.3.orig/src/game_preferences.cpp wesnoth-1.10.3/src/game_preferences.cpp
3682 --- wesnoth-1.10.3.orig/src/game_preferences.cpp        2012-01-07 03:35:17.000000000 +0100
3683 +++ wesnoth-1.10.3/src/game_preferences.cpp     2012-07-11 13:16:05.963266693 +0200
3684 @@ -112,9 +112,9 @@
3685                                 message = foobar
3686                         [/line]
3687  */
3688 -               foreach (const config::any_child &h, history.all_children_range())
3689 +               wes_foreach (const config::any_child &h, history.all_children_range())
3690                 {
3691 -                       foreach (const config &l, h.cfg.child_range("line")) {
3692 +                       wes_foreach (const config &l, h.cfg.child_range("line")) {
3693                                 history_map[h.key].push_back(l["message"]);
3694                         }
3695                 }
3696 @@ -142,10 +142,10 @@
3697  */
3698         config history;
3699         typedef std::pair<std::string, std::vector<std::string> > hack;
3700 -       foreach(const hack& history_id, history_map) {
3701 +       wes_foreach(const hack& history_id, history_map) {
3702  
3703                 config history_id_cfg; // [history_id]
3704 -               foreach(const std::string& line, history_id.second) {
3705 +               wes_foreach(const std::string& line, history_id.second) {
3706                         config cfg; // [line]
3707  
3708                         cfg["message"] = line;
3709 @@ -314,7 +314,7 @@
3710                 std::vector<game_config::server_info> &game_servers = game_config::server_list;
3711                 VALIDATE(!game_servers.empty(), _("No server has been defined."));
3712                 pref_servers.insert(pref_servers.begin(), game_servers.begin(), game_servers.end());
3713 -               foreach (const config &server, get_prefs()->child_range("server")) {
3714 +               wes_foreach (const config &server, get_prefs()->child_range("server")) {
3715                         game_config::server_info sinf;
3716                         sinf.name = server["name"].str();
3717                         sinf.address = server["address"].str();
3718 @@ -945,8 +945,8 @@
3719  }
3720  
3721  void encounter_recallable_units(std::vector<team>& teams){
3722 -       foreach(const team& t, teams) {
3723 -               foreach(const unit& u, t.recall_list()) {
3724 +       wes_foreach(const team& t, teams) {
3725 +               wes_foreach(const unit& u, t.recall_list()) {
3726                         encountered_units_set.insert(u.type_id());
3727                 }
3728         }
3729 diff -ur wesnoth-1.10.3.orig/src/game_preferences_display.cpp wesnoth-1.10.3/src/game_preferences_display.cpp
3730 --- wesnoth-1.10.3.orig/src/game_preferences_display.cpp        2012-01-07 03:35:17.000000000 +0100
3731 +++ wesnoth-1.10.3/src/game_preferences_display.cpp     2012-07-11 13:16:06.029933357 +0200
3732 @@ -1071,7 +1071,7 @@
3733  void preferences_dialog::set_advanced_menu()
3734  {
3735         std::vector<std::string> advanced_items;
3736 -       foreach (const config &adv, adv_preferences_cfg_)
3737 +       wes_foreach (const config &adv, adv_preferences_cfg_)
3738         {
3739                 std::ostringstream str;
3740                 std::string field = preferences::get(adv["field"]);
3741 @@ -1096,7 +1096,7 @@
3742  {
3743         adv_preferences_cfg_.clear();
3744  
3745 -       foreach(const config& adv, game_cfg_.child_range("advanced_preference")) {
3746 +       wes_foreach(const config& adv, game_cfg_.child_range("advanced_preference")) {
3747                 adv_preferences_cfg_.push_back(adv);
3748         }
3749  
3750 diff -ur wesnoth-1.10.3.orig/src/gamestatus.cpp wesnoth-1.10.3/src/gamestatus.cpp
3751 --- wesnoth-1.10.3.orig/src/gamestatus.cpp      2012-01-07 03:35:17.000000000 +0100
3752 +++ wesnoth-1.10.3/src/gamestatus.cpp   2012-07-11 13:16:05.973266690 +0200
3753 @@ -178,9 +178,9 @@
3754                 tags.push_back("side");
3755                 tags.push_back("player"); //merge [player] tags for backwards compatibility of saves
3756  
3757 -               foreach (const std::string& side_tag, tags)
3758 +               wes_foreach (const std::string& side_tag, tags)
3759                 {
3760 -                       foreach (config &carryover_side, source->child_range(side_tag))
3761 +                       wes_foreach (config &carryover_side, source->child_range(side_tag))
3762                         {
3763                                 config *scenario_side = NULL;
3764  
3765 @@ -226,13 +226,13 @@
3766                                 (*scenario_side)["color"] = carryover_side["color"];
3767  
3768                                 //add recallable units
3769 -                               foreach (const config &u, carryover_side.child_range("unit")) {
3770 +                               wes_foreach (const config &u, carryover_side.child_range("unit")) {
3771                                         scenario_side->add_child("unit", u);
3772                                 }
3773                         }
3774                 }
3775         } else {
3776 -               foreach(const config &snapshot_side, source->child_range("side")) {
3777 +               wes_foreach(const config &snapshot_side, source->child_range("side")) {
3778                         //take all side tags and add them as players (assuming they only contain carryover information)
3779                         cfg.add_child("player", snapshot_side);
3780                 }
3781 @@ -306,7 +306,7 @@
3782                 //See also playcampaign::play_game, where after finishing the scenario the replay
3783                 //will be saved.
3784                 if(!starting_pos.empty()) {
3785 -                       foreach (const config &p, cfg.child_range("player")) {
3786 +                       wes_foreach (const config &p, cfg.child_range("player")) {
3787                                 config& cfg_player = starting_pos.add_child("player");
3788                                 cfg_player.merge_with(p);
3789                         }
3790 @@ -400,7 +400,7 @@
3791         std::string leader;
3792         std::string leader_image;
3793  
3794 -       //foreach (const config &p, cfg_save.child_range("player"))
3795 +       //wes_foreach (const config &p, cfg_save.child_range("player"))
3796         //{
3797         //      if (utils::string_bool(p["canrecruit"], false)) {
3798         //              leader = p["save_id"];
3799 @@ -413,7 +413,7 @@
3800         //{
3801                 if (const config &snapshot = *(has_snapshot ? &cfg_snapshot : &cfg_replay_start))
3802                 {
3803 -                       foreach (const config &side, snapshot.child_range("side"))
3804 +                       wes_foreach (const config &side, snapshot.child_range("side"))
3805                         {
3806                                 if (side["controller"] != "human") {
3807                                         continue;
3808 @@ -430,7 +430,7 @@
3809                                                 break;
3810                                 }
3811  
3812 -                               foreach (const config &u, side.child_range("unit"))
3813 +                               wes_foreach (const config &u, side.child_range("unit"))
3814                                 {
3815                                         if (u["canrecruit"].to_bool()) {
3816                                                 leader = u["id"].str();
3817 @@ -794,7 +794,7 @@
3818                 // can be recruited for the player, add them.
3819                 if (!player_cfg_) return;
3820                 if (const config::attribute_value *v = player_cfg_->get("previous_recruits")) {
3821 -                       foreach (const std::string &rec, utils::split(*v)) {
3822 +                       wes_foreach (const std::string &rec, utils::split(*v)) {
3823                                 DBG_NG_TC << "adding previous recruit: " << rec << '\n';
3824                                 t_->add_recruit(rec);
3825                         }
3826 @@ -857,7 +857,7 @@
3827                 if (!side_cfg_["no_leader"].to_bool() && side_cfg_["controller"] != "null") {
3828                         handle_leader(side_cfg_);
3829                 }
3830 -               foreach (const config &l, side_cfg_.child_range("leader")) {
3831 +               wes_foreach (const config &l, side_cfg_.child_range("leader")) {
3832                         handle_leader(l);
3833                 }
3834         }
3835 @@ -871,13 +871,13 @@
3836                         //only relevant in start-of-scenario saves, that's why !shapshot
3837                         //units that are in '[scenario][side]' are 'first'
3838                         //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_
3839 -                       foreach(const config &u, (*player_cfg_).child_range("unit")) {
3840 +                       wes_foreach(const config &u, (*player_cfg_).child_range("unit")) {
3841                                 handle_unit(u,"player_cfg");
3842                         }
3843  
3844                 } else {
3845                         //units in [side]
3846 -                       foreach (const config &su, side_cfg_.child_range("unit")) {
3847 +                       wes_foreach (const config &su, side_cfg_.child_range("unit")) {
3848                                 handle_unit(su, "side_cfg");
3849                         }
3850                 }
3851 @@ -902,7 +902,7 @@
3852                         "allow_changes", "faction_name", "user_description", "faction" };
3853  
3854                 log_step("place units");
3855 -               foreach (const config *u, unit_configs_) {
3856 +               wes_foreach (const config *u, unit_configs_) {
3857                         unit_creator uc(*t_,map_.starting_position(side_));
3858                         uc
3859                                 .allow_add_to_recall(true)
3860 @@ -913,7 +913,7 @@
3861                                 .allow_show(false);
3862  
3863                         config cfg = *u;
3864 -                       foreach (const char *attr, side_attrs) {
3865 +                       wes_foreach (const char *attr, side_attrs) {
3866                                 cfg.remove_attribute(attr);
3867                         }
3868                         uc.add_unit(cfg);
3869 @@ -953,7 +953,7 @@
3870  void game_state::set_menu_items(const config::const_child_itors &menu_items)
3871  {
3872         clear_wmi(wml_menu_items);
3873 -       foreach (const config &item, menu_items)
3874 +       wes_foreach (const config &item, menu_items)
3875         {
3876                 std::string id = item["id"];
3877                 wml_menu_item*& mref = wml_menu_items[id];
3878 diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/canvas.cpp wesnoth-1.10.3/src/gui/auxiliary/canvas.cpp
3879 --- wesnoth-1.10.3.orig/src/gui/auxiliary/canvas.cpp    2012-01-07 03:35:17.000000000 +0100
3880 +++ wesnoth-1.10.3/src/gui/auxiliary/canvas.cpp 2012-07-11 13:16:05.936600025 +0200
3881 @@ -1455,7 +1455,7 @@
3882         log_scope2(log_gui_parse, "Canvas: parsing config.");
3883         shapes_.clear();
3884  
3885 -       foreach(const config::any_child& shape, cfg.all_children_range()) {
3886 +       wes_foreach(const config::any_child& shape, cfg.all_children_range()) {
3887                 const std::string &type = shape.key;
3888                 const config &data = shape.cfg;
3889  
3890 @@ -1474,7 +1474,7 @@
3891                 } else if(type == "pre_commit") {
3892  
3893                         /* note this should get split if more preprocessing is used. */
3894 -                       foreach(const config::any_child& function,
3895 +                       wes_foreach(const config::any_child& function,
3896                                         data.all_children_range()) {
3897  
3898                                 if(function.key == "blur") {
3899 diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/event/handler.cpp wesnoth-1.10.3/src/gui/auxiliary/event/handler.cpp
3900 --- wesnoth-1.10.3.orig/src/gui/auxiliary/event/handler.cpp     2012-01-07 03:35:17.000000000 +0100
3901 +++ wesnoth-1.10.3/src/gui/auxiliary/event/handler.cpp  2012-07-11 13:16:05.933266691 +0200
3902 @@ -429,7 +429,7 @@
3903         }
3904  
3905         /***** Set proper state for the other dispatchers. *****/
3906 -       foreach(tdispatcher* dispatcher, dispatchers_) {
3907 +       wes_foreach(tdispatcher* dispatcher, dispatchers_) {
3908                 dynamic_cast<twidget&>(*dispatcher).set_dirty();
3909         }
3910  
3911 @@ -448,7 +448,7 @@
3912  
3913  void thandler::activate()
3914  {
3915 -       foreach(tdispatcher* dispatcher, dispatchers_) {
3916 +       wes_foreach(tdispatcher* dispatcher, dispatchers_) {
3917                 dispatcher->fire(SDL_ACTIVATE
3918                                 , dynamic_cast<twidget&>(*dispatcher)
3919                                 , NULL);
3920 @@ -472,7 +472,7 @@
3921          *
3922          * For now we use a hack, but would be nice to rewrite it for 1.9/1.11.
3923          */
3924 -       foreach(tdispatcher* dispatcher, dispatchers_) {
3925 +       wes_foreach(tdispatcher* dispatcher, dispatchers_) {
3926                 if(!first) {
3927                         /*
3928                          * This leaves glitches on window borders if the window beneath it
3929 @@ -503,7 +503,7 @@
3930  {
3931         DBG_GUI_E << "Firing: " << SDL_VIDEO_RESIZE << ".\n";
3932  
3933 -       foreach(tdispatcher* dispatcher, dispatchers_) {
3934 +       wes_foreach(tdispatcher* dispatcher, dispatchers_) {
3935                 dispatcher->fire(SDL_VIDEO_RESIZE
3936                                 , dynamic_cast<twidget&>(*dispatcher)
3937                                 , new_size);
3938 diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/notifier.hpp wesnoth-1.10.3/src/gui/auxiliary/notifier.hpp
3939 --- wesnoth-1.10.3.orig/src/gui/auxiliary/notifier.hpp  2012-01-07 03:35:17.000000000 +0100
3940 +++ wesnoth-1.10.3/src/gui/auxiliary/notifier.hpp       2012-07-11 13:16:05.933266691 +0200
3941 @@ -47,7 +47,7 @@
3942         ~tnotifier()
3943         {
3944                 typedef std::pair<tnotifiee<tfunctor>* const, tfunctor> thack;
3945 -               foreach(thack& item, notifiees_) {
3946 +               wes_foreach(thack& item, notifiees_) {
3947                         assert(item.first);
3948                         assert((*item.first).notifier_ == this);
3949  
3950 diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/tips.cpp wesnoth-1.10.3/src/gui/auxiliary/tips.cpp
3951 --- wesnoth-1.10.3.orig/src/gui/auxiliary/tips.cpp      2012-01-07 03:35:17.000000000 +0100
3952 +++ wesnoth-1.10.3/src/gui/auxiliary/tips.cpp   2012-07-11 13:16:05.936600025 +0200
3953 @@ -39,7 +39,7 @@
3954  {
3955         std::vector<ttip> result;
3956  
3957 -       foreach(const config &tip, cfg.child_range("tip")) {
3958 +       wes_foreach(const config &tip, cfg.child_range("tip")) {
3959                 result.push_back(ttip(tip["text"]
3960                                 , tip["source"]
3961                                 , tip["encountered_units"]));
3962 @@ -54,11 +54,11 @@
3963  
3964         const std::set<std::string>& units = preferences::encountered_units();
3965  
3966 -       foreach(const ttip& tip, tips) {
3967 +       wes_foreach(const ttip& tip, tips) {
3968                 if(tip.unit_filter_.empty()) {
3969                         result.push_back(tip);
3970                 } else {
3971 -                       foreach(const std::string& unit, tip.unit_filter_) {
3972 +                       wes_foreach(const std::string& unit, tip.unit_filter_) {
3973                                 if(units.find(unit) != units.end()) {
3974                                         result.push_back(tip);
3975                                         break;
3976 diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/widget_definition.hpp wesnoth-1.10.3/src/gui/auxiliary/widget_definition.hpp
3977 --- wesnoth-1.10.3.orig/src/gui/auxiliary/widget_definition.hpp 2012-01-07 03:35:17.000000000 +0100
3978 +++ wesnoth-1.10.3/src/gui/auxiliary/widget_definition.hpp      2012-07-11 13:16:05.936600025 +0200
3979 @@ -98,7 +98,7 @@
3980         void load_resolutions(const config &cfg)
3981         {
3982                 config::const_child_itors itors = cfg.child_range("resolution");
3983 -               foreach(const config &resolution, itors) {
3984 +               wes_foreach(const config &resolution, itors) {
3985                         resolutions.push_back(new T(resolution));
3986                 }
3987         }
3988 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
3989 --- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/helper.cpp     2012-01-07 03:35:17.000000000 +0100
3990 +++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/helper.cpp  2012-07-11 13:16:05.933266691 +0200
3991 @@ -60,7 +60,7 @@
3992  unsigned get_border(const std::vector<std::string>& border)
3993  {
3994         unsigned result = 0;
3995 -       foreach (const std::string& s, border) {
3996 +       wes_foreach (const std::string& s, border) {
3997                 if (s == "all") {
3998                         return tgrid::BORDER_ALL;
3999                 } else if (s == "top") {
4000 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
4001 --- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/horizontal_listbox.cpp 2012-01-07 03:35:17.000000000 +0100
4002 +++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/horizontal_listbox.cpp      2012-07-11 13:16:05.933266691 +0200
4003 @@ -53,12 +53,12 @@
4004         const config &data = cfg.child("list_data");
4005         if (!data) return;
4006  
4007 -       foreach(const config &row, data.child_range("row")) {
4008 +       wes_foreach(const config &row, data.child_range("row")) {
4009                 unsigned col = 0;
4010  
4011 -               foreach(const config &c, row.child_range("column")) {
4012 +               wes_foreach(const config &c, row.child_range("column")) {
4013                         list_data.push_back(string_map());
4014 -                       foreach (const config::attribute &i, c.attribute_range()) {
4015 +                       wes_foreach (const config::attribute &i, c.attribute_range()) {
4016                                 list_data.back()[i.first] = i.second;
4017                         }
4018                         ++col;
4019 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
4020 --- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/listbox.cpp    2012-01-07 03:35:17.000000000 +0100
4021 +++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/listbox.cpp 2012-07-11 13:16:05.933266691 +0200
4022 @@ -66,12 +66,12 @@
4023                 return;
4024         }
4025  
4026 -       foreach(const config& row, data.child_range("row")) {
4027 +       wes_foreach(const config& row, data.child_range("row")) {
4028                 unsigned col = 0;
4029  
4030 -               foreach(const config& c, row.child_range("column")) {
4031 +               wes_foreach(const config& c, row.child_range("column")) {
4032                         list_data.push_back(string_map());
4033 -                       foreach(const config::attribute& i, c.attribute_range()) {
4034 +                       wes_foreach(const config::attribute& i, c.attribute_range()) {
4035                                 list_data.back()[i.first] = i.second;
4036                         }
4037                         ++col;
4038 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
4039 --- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/multi_page.cpp 2012-01-07 03:35:17.000000000 +0100
4040 +++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/multi_page.cpp      2012-07-11 13:16:05.933266691 +0200
4041 @@ -46,12 +46,12 @@
4042                 return;
4043         }
4044  
4045 -       foreach(const config &row, d.child_range("row")) {
4046 +       wes_foreach(const config &row, d.child_range("row")) {
4047                 unsigned col = 0;
4048  
4049 -               foreach(const config &column, row.child_range("column")) {
4050 +               wes_foreach(const config &column, row.child_range("column")) {
4051                         data.push_back(string_map());
4052 -                       foreach(const config::attribute &i, column.attribute_range()) {
4053 +                       wes_foreach(const config::attribute &i, column.attribute_range()) {
4054                                 data.back()[i.first] = i.second;
4055                         }
4056                         ++col;
4057 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
4058 --- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/slider.cpp     2012-01-07 03:35:17.000000000 +0100
4059 +++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/slider.cpp  2012-07-11 13:16:05.933266691 +0200
4060 @@ -44,7 +44,7 @@
4061                 return;
4062         }
4063  
4064 -       foreach(const config& label, labels.child_range("value")) {
4065 +       wes_foreach(const config& label, labels.child_range("value")) {
4066                 value_labels_.push_back(label["label"]);
4067         }
4068  }
4069 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
4070 --- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/stacked_widget.cpp     2012-01-07 03:35:17.000000000 +0100
4071 +++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/stacked_widget.cpp  2012-07-11 13:16:05.933266691 +0200
4072 @@ -35,7 +35,7 @@
4073  {
4074         const config &s = cfg.child("stack");
4075         VALIDATE(s, _("No stack defined."));
4076 -       foreach(const config &layer, s.child_range("layer")) {
4077 +       wes_foreach(const config &layer, s.child_range("layer")) {
4078                 stack.push_back(new tbuilder_grid(layer));
4079         }
4080  }
4081 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
4082 --- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder/tree_view.cpp  2012-01-07 03:35:17.000000000 +0100
4083 +++ wesnoth-1.10.3/src/gui/auxiliary/window_builder/tree_view.cpp       2012-07-11 13:16:05.933266691 +0200
4084 @@ -39,7 +39,7 @@
4085         , nodes()
4086  {
4087  
4088 -       foreach(const config &node, cfg.child_range("node")) {
4089 +       wes_foreach(const config &node, cfg.child_range("node")) {
4090                 nodes.push_back(tnode(node));
4091         }
4092  
4093 diff -ur wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder.cpp wesnoth-1.10.3/src/gui/auxiliary/window_builder.cpp
4094 --- wesnoth-1.10.3.orig/src/gui/auxiliary/window_builder.cpp    2012-01-07 03:35:17.000000000 +0100
4095 +++ wesnoth-1.10.3/src/gui/auxiliary/window_builder.cpp 2012-07-11 13:16:05.936600025 +0200
4096 @@ -67,7 +67,7 @@
4097                                   std::string
4098                                 , boost::function<tbuilder_widget_ptr(config)> >
4099                         thack;
4100 -       foreach(const thack& item, builder_widget_lookup()) {
4101 +       wes_foreach(const thack& item, builder_widget_lookup()) {
4102                 if(item.first == "window" || item.first == "tooltip") {
4103                         continue;
4104                 }
4105 @@ -153,7 +153,7 @@
4106                         , definition->helptip);
4107         assert(window);
4108  
4109 -       foreach(const twindow_builder::tresolution::tlinked_group& lg,
4110 +       wes_foreach(const twindow_builder::tresolution::tlinked_group& lg,
4111                         definition->linked_groups) {
4112  
4113                 if(window->has_linked_size_group(lg.id)) {
4114 @@ -238,7 +238,7 @@
4115  
4116         config::const_child_itors cfgs = cfg.child_range("resolution");
4117         VALIDATE(cfgs.first != cfgs.second, _("No resolution defined."));
4118 -       foreach (const config &i, cfgs) {
4119 +       wes_foreach (const config &i, cfgs) {
4120                 resolutions.push_back(tresolution(i));
4121         }
4122  
4123 @@ -386,7 +386,7 @@
4124                 definition = "default";
4125         }
4126  
4127 -       foreach (const config &lg, cfg.child_range("linked_group")) {
4128 +       wes_foreach (const config &lg, cfg.child_range("linked_group")) {
4129                 tlinked_group linked_group;
4130                 linked_group.id = lg["id"].str();
4131                 linked_group.fixed_width = lg["fixed_width"].to_bool();
4132 @@ -501,13 +501,13 @@
4133   */
4134         log_scope2(log_gui_parse, "Window builder: parsing a grid");
4135  
4136 -       foreach (const config &row, cfg.child_range("row"))
4137 +       wes_foreach (const config &row, cfg.child_range("row"))
4138         {
4139                 unsigned col = 0;
4140  
4141                 row_grow_factor.push_back(row["grow_factor"]);
4142  
4143 -               foreach (const config &c, row.child_range("column"))
4144 +               wes_foreach (const config &c, row.child_range("column"))
4145                 {
4146                         flags.push_back(implementation::read_flags(c));
4147                         border_size.push_back(c["border_size"]);
4148 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/addon/description.cpp wesnoth-1.10.3/src/gui/dialogs/addon/description.cpp
4149 --- wesnoth-1.10.3.orig/src/gui/dialogs/addon/description.cpp   2012-01-07 03:35:17.000000000 +0100
4150 +++ wesnoth-1.10.3/src/gui/dialogs/addon/description.cpp        2012-07-11 13:16:05.923266694 +0200
4151 @@ -17,7 +17,7 @@
4152  namespace {
4153         std::string langcode_to_string(const std::string& lcode)
4154         {
4155 -               foreach(const language_def& ld, get_languages()) {
4156 +               wes_foreach(const language_def& ld, get_languages()) {
4157                         if(ld.localename == lcode || ld.localename.substr(0, 2) == lcode) {
4158                                 return ld.language;
4159                         }
4160 @@ -90,7 +90,7 @@
4161  
4162         std::string languages;
4163  
4164 -       foreach(const std::string& lc, addon.translations) {
4165 +       wes_foreach(const std::string& lc, addon.translations) {
4166                 const std::string& langlabel = langcode_to_string(lc);
4167                 if(!langlabel.empty()) {
4168                         if(!languages.empty()) {
4169 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
4170 --- wesnoth-1.10.3.orig/src/gui/dialogs/addon/uninstall_list.cpp        2011-12-12 02:29:49.000000000 +0100
4171 +++ wesnoth-1.10.3/src/gui/dialogs/addon/uninstall_list.cpp     2012-07-11 13:16:05.923266694 +0200
4172 @@ -50,7 +50,7 @@
4173         this->names_.clear();
4174         this->selections_.clear();
4175  
4176 -       foreach(const std::string& id, this->ids_) {
4177 +       wes_foreach(const std::string& id, this->ids_) {
4178                 this->names_.push_back(make_addon_name(id));
4179                 this->selections_[id] = false;
4180  
4181 @@ -87,7 +87,7 @@
4182         std::vector<std::string> retv;
4183  
4184         typedef std::map<std::string, bool> selections_map_type;
4185 -       foreach(const selections_map_type::value_type& entry, this->selections_) {
4186 +       wes_foreach(const selections_map_type::value_type& entry, this->selections_) {
4187                 if(entry.second) {
4188                         retv.push_back(entry.first);
4189                 }
4190 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/addon_list.cpp wesnoth-1.10.3/src/gui/dialogs/addon_list.cpp
4191 --- wesnoth-1.10.3.orig/src/gui/dialogs/addon_list.cpp  2012-01-07 03:35:17.000000000 +0100
4192 +++ wesnoth-1.10.3/src/gui/dialogs/addon_list.cpp       2012-07-11 13:16:05.926600026 +0200
4193 @@ -70,7 +70,7 @@
4194          * @todo do we really want to keep the length limit for the various
4195          * items?
4196          */
4197 -       foreach(const config &c, cfg_.child_range("campaign")) {
4198 +       wes_foreach(const config &c, cfg_.child_range("campaign")) {
4199                 std::map<std::string, string_map> data;
4200                 string_map item;
4201  
4202 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/campaign_difficulty.cpp wesnoth-1.10.3/src/gui/dialogs/campaign_difficulty.cpp
4203 --- wesnoth-1.10.3.orig/src/gui/dialogs/campaign_difficulty.cpp 2012-01-07 03:35:17.000000000 +0100
4204 +++ wesnoth-1.10.3/src/gui/dialogs/campaign_difficulty.cpp      2012-07-11 13:16:05.929933358 +0200
4205 @@ -65,7 +65,7 @@
4206  tcampaign_difficulty::tcampaign_difficulty(const std::vector<std::string>& items)
4207         : index_(-1), items_()
4208  {
4209 -       foreach(const std::string& it, items) {
4210 +       wes_foreach(const std::string& it, items) {
4211                 items_.push_back(tlegacy_menu_item(it));
4212         }
4213  }
4214 @@ -77,7 +77,7 @@
4215  
4216         std::map<std::string, string_map> data;
4217  
4218 -       foreach(const tlegacy_menu_item& item, items_) {
4219 +       wes_foreach(const tlegacy_menu_item& item, items_) {
4220                 if(item.is_default()) {
4221                         index_ = list.get_item_count();
4222                 }
4223 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/campaign_selection.cpp wesnoth-1.10.3/src/gui/dialogs/campaign_selection.cpp
4224 --- wesnoth-1.10.3.orig/src/gui/dialogs/campaign_selection.cpp  2012-01-07 03:35:17.000000000 +0100
4225 +++ wesnoth-1.10.3/src/gui/dialogs/campaign_selection.cpp       2012-07-11 13:16:05.929933358 +0200
4226 @@ -140,7 +140,7 @@
4227                                 &window, "campaign_details", false);
4228  
4229                 unsigned id = 0;
4230 -               foreach(const config &campaign, campaigns_) {
4231 +               wes_foreach(const config &campaign, campaigns_) {
4232  
4233                         /*** Add tree item ***/
4234                         tree_group_field["label"] = campaign["icon"];
4235 @@ -206,7 +206,7 @@
4236                 tmulti_page& multi_page = find_widget<tmulti_page>(
4237                                 &window, "campaign_details", false);
4238  
4239 -               foreach (const config &c, campaigns_) {
4240 +               wes_foreach (const config &c, campaigns_) {
4241  
4242                         /*** Add list item ***/
4243                         string_map list_item;
4244 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/chat_log.cpp wesnoth-1.10.3/src/gui/dialogs/chat_log.cpp
4245 --- wesnoth-1.10.3.orig/src/gui/dialogs/chat_log.cpp    2012-02-18 14:40:19.000000000 +0100
4246 +++ wesnoth-1.10.3/src/gui/dialogs/chat_log.cpp 2012-07-11 13:16:05.926600026 +0200
4247 @@ -113,7 +113,7 @@
4248                 std::stringstream str;
4249                 LOG_CHAT_LOG << "entering tchat_log::model::add_row_to_chat_message_list\n";
4250                 if (first<last) {
4251 -                       foreach (const chat_msg &t, make_pair(chat_log_history.begin()+first,chat_log_history.begin()+last))
4252 +                       wes_foreach (const chat_msg &t, make_pair(chat_log_history.begin()+first,chat_log_history.begin()+last))
4253                         {
4254                                 std::string prefix("/me");
4255                                 bool me = false;
4256 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/data_manage.cpp wesnoth-1.10.3/src/gui/dialogs/data_manage.cpp
4257 --- wesnoth-1.10.3.orig/src/gui/dialogs/data_manage.cpp 2012-01-07 03:35:17.000000000 +0100
4258 +++ wesnoth-1.10.3/src/gui/dialogs/data_manage.cpp      2012-07-11 13:16:05.929933358 +0200
4259 @@ -101,7 +101,7 @@
4260         tlistbox& list = find_widget<tlistbox>(&window, "persist_list", false);
4261         list.clear();
4262  
4263 -       foreach(const savegame::save_info game, games) {
4264 +       wes_foreach(const savegame::save_info game, games) {
4265                 std::map<std::string, string_map> data;
4266                 string_map item;
4267  
4268 @@ -142,7 +142,7 @@
4269                                 find_widget<tlabel>(*it, "filename", false);
4270  
4271                         bool found = false;
4272 -                       foreach (const std::string& word, words){
4273 +                       wes_foreach (const std::string& word, words){
4274                                 found = std::search(filename_label.label().str().begin()
4275                                                 , filename_label.label().str().end()
4276                                                 , word.begin(), word.end()
4277 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/debug_clock.cpp wesnoth-1.10.3/src/gui/dialogs/debug_clock.cpp
4278 --- wesnoth-1.10.3.orig/src/gui/dialogs/debug_clock.cpp 2012-01-07 03:35:17.000000000 +0100
4279 +++ wesnoth-1.10.3/src/gui/dialogs/debug_clock.cpp      2012-07-11 13:16:05.923266694 +0200
4280 @@ -153,7 +153,7 @@
4281         }
4282  
4283         if(clock_) {
4284 -               foreach(tcanvas& canvas, clock_->canvas()) {
4285 +               wes_foreach(tcanvas& canvas, clock_->canvas()) {
4286                         canvas.set_variable("hour", variant(hour_stamp));
4287                         canvas.set_variable("minute", variant(minute_stamp));
4288                         canvas.set_variable("second", variant(second_stamp));
4289 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/dialog.cpp wesnoth-1.10.3/src/gui/dialogs/dialog.cpp
4290 --- wesnoth-1.10.3.orig/src/gui/dialogs/dialog.cpp      2012-01-07 03:35:17.000000000 +0100
4291 +++ wesnoth-1.10.3/src/gui/dialogs/dialog.cpp   2012-07-11 13:16:05.926600026 +0200
4292 @@ -26,7 +26,7 @@
4293  
4294  tdialog::~tdialog()
4295  {
4296 -       foreach(tfield_* field, fields_) {
4297 +       wes_foreach(tfield_* field, fields_) {
4298                 delete field;
4299         }
4300  }
4301 @@ -193,7 +193,7 @@
4302  
4303  void tdialog::init_fields(twindow& window)
4304  {
4305 -       foreach(tfield_* field, fields_) {
4306 +       wes_foreach(tfield_* field, fields_) {
4307                 field->attach_to_window(window);
4308                 field->widget_init(window);
4309         }
4310 @@ -207,7 +207,7 @@
4311  
4312  void tdialog::finalize_fields(twindow& window, const bool save_fields)
4313  {
4314 -       foreach(tfield_* field, fields_) {
4315 +       wes_foreach(tfield_* field, fields_) {
4316                 if(save_fields) {
4317                         field->widget_finalize(window);
4318                 }
4319 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/formula_debugger.cpp wesnoth-1.10.3/src/gui/dialogs/formula_debugger.cpp
4320 --- wesnoth-1.10.3.orig/src/gui/dialogs/formula_debugger.cpp    2012-01-07 03:35:17.000000000 +0100
4321 +++ wesnoth-1.10.3/src/gui/dialogs/formula_debugger.cpp 2012-07-11 13:16:05.923266694 +0200
4322 @@ -73,7 +73,7 @@
4323         std::stringstream stack_text;
4324         std::string indent = "  ";
4325         int c = 0;
4326 -       foreach (const game_logic::debug_info &i, fdb_.get_call_stack()) {
4327 +       wes_foreach (const game_logic::debug_info &i, fdb_.get_call_stack()) {
4328                 for(int d = 0; d < c; ++d) {
4329                         stack_text << indent;
4330                 }
4331 @@ -92,7 +92,7 @@
4332                         &window, "execution", false, true);
4333  
4334         std::stringstream execution_text;
4335 -       foreach (const game_logic::debug_info &i, fdb_.get_execution_trace()) {
4336 +       wes_foreach (const game_logic::debug_info &i, fdb_.get_execution_trace()) {
4337                 for(int d = 0; d < i.level(); ++d) {
4338                         execution_text << indent;
4339                 }
4340 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/game_load.cpp wesnoth-1.10.3/src/gui/dialogs/game_load.cpp
4341 --- wesnoth-1.10.3.orig/src/gui/dialogs/game_load.cpp   2012-01-07 03:35:17.000000000 +0100
4342 +++ wesnoth-1.10.3/src/gui/dialogs/game_load.cpp        2012-07-11 13:16:05.933266691 +0200
4343 @@ -151,7 +151,7 @@
4344         tlistbox& list = find_widget<tlistbox>(&window, "savegame_list", false);
4345         list.clear();
4346  
4347 -       foreach(const savegame::save_info game, games) {
4348 +       wes_foreach(const savegame::save_info game, games) {
4349                 std::map<std::string, string_map> data;
4350                 string_map item;
4351  
4352 @@ -193,7 +193,7 @@
4353                                 find_widget<tlabel>(*it, "filename", false);
4354  
4355                         bool found = false;
4356 -                       foreach (const std::string& word, words){
4357 +                       wes_foreach (const std::string& word, words){
4358                                 found = std::search(filename_label.label().str().begin()
4359                                                 , filename_label.label().str().end()
4360                                                 , word.begin(), word.end()
4361 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/gamestate_inspector.cpp wesnoth-1.10.3/src/gui/dialogs/gamestate_inspector.cpp
4362 --- wesnoth-1.10.3.orig/src/gui/dialogs/gamestate_inspector.cpp 2012-05-12 18:30:08.000000000 +0200
4363 +++ wesnoth-1.10.3/src/gui/dialogs/gamestate_inspector.cpp      2012-07-11 13:16:05.933266691 +0200
4364 @@ -189,11 +189,11 @@
4365                                 ? resources::state_of_game->get_variables()
4366                                 : config();
4367  
4368 -               foreach( const config::attribute &a, vars.attribute_range()) {
4369 +               wes_foreach( const config::attribute &a, vars.attribute_range()) {
4370                         model_.add_row_to_stuff_list(a.first,a.first);
4371                 }
4372  
4373 -               foreach( const config::any_child &c, vars.all_children_range()) {
4374 +               wes_foreach( const config::any_child &c, vars.all_children_range()) {
4375                         model_.add_row_to_stuff_list("["+c.key+"]","["+c.key+"]");
4376                 }
4377  
4378 @@ -214,7 +214,7 @@
4379                                 ? resources::state_of_game->get_variables()
4380                                 : config();
4381  
4382 -               foreach( const config::attribute &a, vars.attribute_range()) {
4383 +               wes_foreach( const config::attribute &a, vars.attribute_range()) {
4384                         if (selected==i) {
4385                                 model_.set_inspect_window_text(a.second);
4386                                 return;
4387 @@ -222,7 +222,7 @@
4388                         i++;
4389                 }
4390  
4391 -               foreach( const config::any_child &c, vars.all_children_range()) {
4392 +               wes_foreach( const config::any_child &c, vars.all_children_range()) {
4393                         if (selected==i) {
4394                                 model_.set_inspect_window_text(c.cfg.debug());
4395                                 return;
4396 @@ -268,7 +268,7 @@
4397                                         << '/' << i->max_experience() << " xp; "
4398                                         << i->hitpoints() << '/' << i->max_hitpoints()
4399                                         << " hp; ";
4400 -                               foreach (const std::string &str, i->get_traits_list()) {
4401 +                               wes_foreach (const std::string &str, i->get_traits_list()) {
4402                                         s << str <<" ";
4403                                 }
4404  
4405 @@ -371,9 +371,9 @@
4406                                         : std::vector<unit>();
4407  
4408                         std::stringstream s;
4409 -                       foreach (const unit &u, recall_list) {
4410 +                       wes_foreach (const unit &u, recall_list) {
4411                                 s << "id=["<<u.id() << "] "<<u.type_id() << "; L"<<u.level()<<"; " << u.experience() <<"/" << u.max_experience()<< " xp "<< std::endl;
4412 -                               foreach (const std::string &str, u.get_traits_list() ) {
4413 +                               wes_foreach (const std::string &str, u.get_traits_list() ) {
4414                                         s << "\t" << str<< std::endl;
4415                                 }
4416                                 s << std::endl << std::endl;
4417 @@ -388,7 +388,7 @@
4418                                         : std::vector<unit>();
4419  
4420                         config c;
4421 -                       foreach (const unit &u, recall_list) {
4422 +                       wes_foreach (const unit &u, recall_list) {
4423                                 config c_unit;
4424                                 u.write(c_unit);
4425                                 c.add_child("unit",c_unit);
4426 @@ -423,7 +423,7 @@
4427                                                 << i->max_experience() << " xp; "
4428                                                 << i->hitpoints() << '/'
4429                                                 << i->max_hitpoints()<<" hp.\n";
4430 -                                       foreach (const std::string &str, i->get_traits_list() ) {
4431 +                                       wes_foreach (const std::string &str, i->get_traits_list() ) {
4432                                                 s << "\t" << str<< std::endl;
4433                                         }
4434                                         s << std::endl << std::endl;
4435 @@ -457,7 +457,7 @@
4436                                 boost::shared_ptr<single_mode_controller>(new variable_mode_controller("variables",model_)));
4437                 sm_controllers_.push_back(
4438                                 boost::shared_ptr<single_mode_controller>(new unit_mode_controller("units",model_)));
4439 -               //foreach team
4440 +               //wes_foreach team
4441                 int sides = resources::teams
4442                                 ? static_cast<int>((*resources::teams).size())
4443                                 : 0;
4444 @@ -481,7 +481,7 @@
4445         void show_stuff_types_list()
4446         {
4447                 model_.clear_stuff_types_list();
4448 -               foreach (boost::shared_ptr<single_mode_controller> sm_controller, sm_controllers_ ) {
4449 +               wes_foreach (boost::shared_ptr<single_mode_controller> sm_controller, sm_controllers_ ) {
4450                         model_.add_row_to_stuff_types_list(sm_controller->name(),sm_controller->name());
4451                 }
4452         }
4453 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/language_selection.cpp wesnoth-1.10.3/src/gui/dialogs/language_selection.cpp
4454 --- wesnoth-1.10.3.orig/src/gui/dialogs/language_selection.cpp  2012-01-07 03:35:17.000000000 +0100
4455 +++ wesnoth-1.10.3/src/gui/dialogs/language_selection.cpp       2012-07-11 13:16:05.933266691 +0200
4456 @@ -65,7 +65,7 @@
4457  
4458         const std::vector<language_def>& languages = get_languages();
4459         const language_def& current_language = get_language();
4460 -       foreach(const language_def& lang, languages) {
4461 +       wes_foreach(const language_def& lang, languages) {
4462                 string_map item;
4463                 item.insert(std::make_pair("label", lang.language));
4464  
4465 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
4466 --- wesnoth-1.10.3.orig/src/gui/dialogs/lobby/lobby_data.cpp    2012-01-07 03:35:17.000000000 +0100
4467 +++ wesnoth-1.10.3/src/gui/dialogs/lobby/lobby_data.cpp 2012-07-11 13:16:05.923266694 +0200
4468 @@ -89,7 +89,7 @@
4469  void room_info::process_room_members(const config& data)
4470  {
4471         members_.clear();
4472 -       foreach (const config& m, data.child_range("member")) {
4473 +       wes_foreach (const config& m, data.child_range("member")) {
4474                 members_.insert(m["name"]);
4475         }
4476  }
4477 @@ -254,7 +254,7 @@
4478                                 if (const config& hashes = game_config.child("multiplayer_hashes")) {
4479                                         std::string hash = game["hash"];
4480                                         bool hash_found = false;
4481 -                                       foreach (const config::attribute &i, hashes.attribute_range()) {
4482 +                                       wes_foreach (const config::attribute &i, hashes.attribute_range()) {
4483                                                 if (i.first == game["mp_scenario"] && i.second == hash) {
4484                                                         hash_found = true;
4485                                                         break;
4486 @@ -357,7 +357,7 @@
4487  
4488  game_filter_stack::~game_filter_stack()
4489  {
4490 -       foreach (game_filter_base* f, filters_) {
4491 +       wes_foreach (game_filter_base* f, filters_) {
4492                 delete f;
4493         }
4494  }
4495 @@ -369,7 +369,7 @@
4496  
4497  void game_filter_stack::clear()
4498  {
4499 -       foreach (game_filter_base* f, filters_) {
4500 +       wes_foreach (game_filter_base* f, filters_) {
4501                 delete f;
4502         }
4503         filters_.clear();
4504 @@ -377,7 +377,7 @@
4505  
4506  bool game_filter_and_stack::match(const game_info &game) const
4507  {
4508 -       foreach (game_filter_base* f, filters_) {
4509 +       wes_foreach (game_filter_base* f, filters_) {
4510                 if (!f->match(game)) return false;
4511         }
4512         return true;
4513 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
4514 --- wesnoth-1.10.3.orig/src/gui/dialogs/lobby/lobby_info.cpp    2012-01-07 03:35:17.000000000 +0100
4515 +++ wesnoth-1.10.3/src/gui/dialogs/lobby/lobby_info.cpp 2012-07-11 13:16:05.923266694 +0200
4516 @@ -66,7 +66,7 @@
4517  
4518  void lobby_info::delete_games()
4519  {
4520 -       foreach (const game_info_map::value_type& v, games_by_id_) {
4521 +       wes_foreach (const game_info_map::value_type& v, games_by_id_) {
4522                 delete v.second;
4523         }
4524  }
4525 @@ -76,7 +76,7 @@
4526  std::string dump_games_map(const lobby_info::game_info_map& games)
4527  {
4528         std::stringstream ss;
4529 -       foreach (const lobby_info::game_info_map::value_type& v, games) {
4530 +       wes_foreach (const lobby_info::game_info_map::value_type& v, games) {
4531                 const game_info& game = *v.second;
4532                 ss << "G" << game.id << "(" << game.name << ") " << game.display_status_string() << " ";
4533         }
4534 @@ -87,7 +87,7 @@
4535  std::string dump_games_config(const config& gamelist)
4536  {
4537         std::stringstream ss;
4538 -       foreach (const config& c, gamelist.child_range("game")) {
4539 +       wes_foreach (const config& c, gamelist.child_range("game")) {
4540                 ss << "g" << c["id"] << "(" << c["name"] << ") " << c[config::diff_track_attribute] << " ";
4541         }
4542         ss << "\n";
4543 @@ -103,7 +103,7 @@
4544         gamelist_initialized_ = true;
4545         delete_games();
4546         games_by_id_.clear();
4547 -       foreach (const config& c, gamelist_.child("gamelist").child_range("game")) {
4548 +       wes_foreach (const config& c, gamelist_.child("gamelist").child_range("game")) {
4549                 game_info* game = new game_info(c, game_config_);
4550                 games_by_id_[game->id] = game;
4551         }
4552 @@ -180,10 +180,10 @@
4553  {
4554         SCOPE_LB;
4555         users_.clear();
4556 -       foreach (const config& c, gamelist_.child_range("user")) {
4557 +       wes_foreach (const config& c, gamelist_.child_range("user")) {
4558                 users_.push_back(user_info(c));
4559         }
4560 -       foreach (user_info& ui, users_) {
4561 +       wes_foreach (user_info& ui, users_) {
4562                 if (ui.game_id != 0) {
4563                         game_info* g = get_game_by_id(ui.game_id);
4564                         if (g == NULL) {
4565 @@ -235,7 +235,7 @@
4566  
4567  room_info* lobby_info::get_room(const std::string &name)
4568  {
4569 -       foreach (room_info& r, rooms_) {
4570 +       wes_foreach (room_info& r, rooms_) {
4571                 if (r.name() == name) return &r;
4572         }
4573         return NULL;
4574 @@ -243,7 +243,7 @@
4575  
4576  const room_info* lobby_info::get_room(const std::string &name) const
4577  {
4578 -       foreach (const room_info& r, rooms_) {
4579 +       wes_foreach (const room_info& r, rooms_) {
4580                 if (r.name() == name) return &r;
4581         }
4582         return NULL;
4583 @@ -301,7 +301,7 @@
4584         games_filtered_.clear();
4585         games_visibility_.clear();
4586         games_.clear();
4587 -       foreach (const game_info_map::value_type& v, games_by_id_) {
4588 +       wes_foreach (const game_info_map::value_type& v, games_by_id_) {
4589                 games_.push_back(v.second);
4590         }
4591  }
4592 @@ -310,7 +310,7 @@
4593  {
4594         games_filtered_.clear();
4595         games_visibility_.clear();
4596 -       foreach (game_info* g, games_) {
4597 +       wes_foreach (game_info* g, games_) {
4598                 game_info& gi = *g;
4599                 bool show = game_filter_.match(gi);
4600                 if (game_filter_invert_) {
4601 @@ -325,7 +325,7 @@
4602  
4603  void lobby_info::update_user_statuses(int game_id, const room_info *room)
4604  {
4605 -       foreach (user_info& user, users_) {
4606 +       wes_foreach (user_info& user, users_) {
4607                 user.update_state(game_id, room);
4608         }
4609  }
4610 @@ -365,7 +365,7 @@
4611  void lobby_info::sort_users(bool by_name, bool by_relation)
4612  {
4613         users_sorted_.clear();
4614 -       foreach (user_info& u, users_) {
4615 +       wes_foreach (user_info& u, users_) {
4616                 users_sorted_.push_back(&u);
4617         }
4618         if (by_name) {
4619 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/lobby_main.cpp wesnoth-1.10.3/src/gui/dialogs/lobby_main.cpp
4620 --- wesnoth-1.10.3.orig/src/gui/dialogs/lobby_main.cpp  2012-01-07 03:35:17.000000000 +0100
4621 +++ wesnoth-1.10.3/src/gui/dialogs/lobby_main.cpp       2012-07-11 13:16:05.929933358 +0200
4622 @@ -499,14 +499,14 @@
4623  void modify_grid_with_data(tgrid* grid, const std::map<std::string, string_map>& map)
4624  {
4625         typedef std::map<std::string, string_map> strstrmap;
4626 -       foreach (const strstrmap::value_type v, map) {
4627 +       wes_foreach (const strstrmap::value_type v, map) {
4628                 const std::string& key = v.first;
4629                 const string_map& strmap = v.second;
4630                 twidget* w = grid->find(key, false);
4631                 if (w == NULL) continue;
4632                 tcontrol* c = dynamic_cast<tcontrol*>(w);
4633                 if (c == NULL) continue;
4634 -               foreach (const string_map::value_type& vv, strmap) {
4635 +               wes_foreach (const string_map::value_type& vv, strmap) {
4636                         if (vv.first == "label") {
4637                                 c->set_label(vv.second);
4638                         } else if (vv.first == "tooltip") {
4639 @@ -816,7 +816,7 @@
4640         player_list_.other_games.tree->clear();
4641         player_list_.other_rooms.tree->clear();
4642  
4643 -       foreach (user_info* userptr, lobby_info_.users_sorted())
4644 +       wes_foreach (user_info* userptr, lobby_info_.users_sorted())
4645         {
4646                 user_info& user = *userptr;
4647                 tsub_player_list* target_list(NULL);
4648 @@ -1093,7 +1093,7 @@
4649  
4650  tlobby_chat_window* tlobby_main::search_create_window(const std::string& name, bool whisper, bool open_new)
4651  {
4652 -       foreach (tlobby_chat_window& t, open_windows_) {
4653 +       wes_foreach (tlobby_chat_window& t, open_windows_) {
4654                 if (t.name == name && t.whisper == whisper) return &t;
4655         }
4656         if (open_new) {
4657 @@ -1477,7 +1477,7 @@
4658                         //TODO: this should really open a nice join room dialog instead
4659                         std::stringstream ss;
4660                         ss << "Rooms:";
4661 -                       foreach (const config& r, rooms.child_range("room")) {
4662 +                       wes_foreach (const config& r, rooms.child_range("room")) {
4663                                 ss << " " << r["name"];
4664                         }
4665                         add_active_window_message("server", ss.str());
4666 @@ -1667,7 +1667,7 @@
4667                 const std::vector<user_info>& match_infos = lobby_info_.users();
4668                 std::vector<std::string> matches;
4669  
4670 -               foreach(const user_info& ui, match_infos) {
4671 +               wes_foreach(const user_info& ui, match_infos) {
4672                         if(ui.name != preferences::login()) {
4673                                 matches.push_back(ui.name);
4674                         }
4675 @@ -1694,7 +1694,7 @@
4676  {
4677         lobby_info_.clear_game_filter();
4678  
4679 -       foreach (const std::string& s, utils::split(filter_text_->get_value(), ' ')) {
4680 +       wes_foreach (const std::string& s, utils::split(filter_text_->get_value(), ' ')) {
4681                 lobby_info_.add_game_filter(new game_filter_general_string_part(s));
4682         }
4683         //TODO: make changing friend/ignore lists trigger a refresh
4684 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/message.cpp wesnoth-1.10.3/src/gui/dialogs/message.cpp
4685 --- wesnoth-1.10.3.orig/src/gui/dialogs/message.cpp     2012-01-07 03:35:17.000000000 +0100
4686 +++ wesnoth-1.10.3/src/gui/dialogs/message.cpp  2012-07-11 13:16:05.926600026 +0200
4687 @@ -97,7 +97,7 @@
4688  
4689  void tmessage::post_show(twindow& /*window*/)
4690  {
4691 -       foreach(tbutton_status& button_status, buttons_) {
4692 +       wes_foreach(tbutton_status& button_status, buttons_) {
4693                 button_status.button = NULL;
4694         }
4695  }
4696 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
4697 --- wesnoth-1.10.3.orig/src/gui/dialogs/mp_change_control.cpp   2011-05-19 20:16:27.000000000 +0200
4698 +++ wesnoth-1.10.3/src/gui/dialogs/mp_change_control.cpp        2012-07-11 13:16:05.926600026 +0200
4699 @@ -184,7 +184,7 @@
4700  
4701                 int i = 0; // because we need to know which row contains the controlling player
4702  
4703 -               foreach (const std::string &nick, nicks)
4704 +               wes_foreach (const std::string &nick, nicks)
4705                 {
4706                         if (side_number_ <= static_cast<int>(resources::teams->size()) &&
4707                                 resources::teams->at(side_number_-1).current_player() == nick)
4708 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/mp_connect.cpp wesnoth-1.10.3/src/gui/dialogs/mp_connect.cpp
4709 --- wesnoth-1.10.3.orig/src/gui/dialogs/mp_connect.cpp  2012-01-07 03:35:17.000000000 +0100
4710 +++ wesnoth-1.10.3/src/gui/dialogs/mp_connect.cpp       2012-07-11 13:16:05.926600026 +0200
4711 @@ -90,7 +90,7 @@
4712         const std::vector<game_config::server_info>&
4713                 pref_servers = preferences::server_list();
4714  
4715 -       foreach(const game_config::server_info& server, pref_servers) {
4716 +       wes_foreach(const game_config::server_info& server, pref_servers) {
4717  
4718                 std::map<std::string, string_map> data;
4719                 string_map item;
4720 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
4721 --- wesnoth-1.10.3.orig/src/gui/dialogs/mp_create_game.cpp      2012-01-07 03:35:17.000000000 +0100
4722 +++ wesnoth-1.10.3/src/gui/dialogs/mp_create_game.cpp   2012-07-11 13:16:05.926600026 +0200
4723 @@ -101,7 +101,7 @@
4724         std::vector<std::string> maps;
4725         get_files_in_dir(get_user_data_dir() + "/editor/maps", &maps, NULL, FILE_NAME_ONLY);
4726  
4727 -       foreach(const std::string& map, maps) {
4728 +       wes_foreach(const std::string& map, maps) {
4729                 std::map<std::string, t_string> item;
4730                 item.insert(std::make_pair("label", map));
4731                 list->add_row(item);
4732 @@ -110,7 +110,7 @@
4733  
4734         // Standard maps
4735         int i = 0;
4736 -       foreach (const config &map, cfg_.child_range("multiplayer"))
4737 +       wes_foreach (const config &map, cfg_.child_range("multiplayer"))
4738         {
4739                 if (map["allow_new_game"].to_bool(true)) {
4740                         string_map item;
4741 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
4742 --- wesnoth-1.10.3.orig/src/gui/dialogs/simple_item_selector.cpp        2012-01-07 03:35:17.000000000 +0100
4743 +++ wesnoth-1.10.3/src/gui/dialogs/simple_item_selector.cpp     2012-07-11 13:16:05.929933358 +0200
4744 @@ -79,7 +79,7 @@
4745         tlistbox& list = find_widget<tlistbox>(&window, "listbox", false);
4746         window.keyboard_capture(&list);
4747  
4748 -       foreach(const tsimple_item_selector::item_type& it, items_) {
4749 +       wes_foreach(const tsimple_item_selector::item_type& it, items_) {
4750                 std::map<std::string, string_map> data;
4751                 string_map column;
4752  
4753 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/title_screen.cpp wesnoth-1.10.3/src/gui/dialogs/title_screen.cpp
4754 --- wesnoth-1.10.3.orig/src/gui/dialogs/title_screen.cpp        2012-01-07 03:35:17.000000000 +0100
4755 +++ wesnoth-1.10.3/src/gui/dialogs/title_screen.cpp     2012-07-11 13:16:05.929933358 +0200
4756 @@ -306,7 +306,7 @@
4757                 WRN_CF << "There are not tips of day available.\n";
4758         }
4759  
4760 -       foreach(const ttip& tip, tips) {
4761 +       wes_foreach(const ttip& tip, tips) {
4762  
4763                 string_map widget;
4764                 std::map<std::string, string_map> page;
4765 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/unit_attack.cpp wesnoth-1.10.3/src/gui/dialogs/unit_attack.cpp
4766 --- wesnoth-1.10.3.orig/src/gui/dialogs/unit_attack.cpp 2012-01-07 03:35:17.000000000 +0100
4767 +++ wesnoth-1.10.3/src/gui/dialogs/unit_attack.cpp      2012-07-11 13:16:05.926600026 +0200
4768 @@ -106,7 +106,7 @@
4769         const config empty;
4770         attack_type no_weapon(empty);
4771  
4772 -       foreach(const battle_context& weapon, weapons) {
4773 +       wes_foreach(const battle_context& weapon, weapons) {
4774                 const battle_context_unit_stats& attacker =
4775                                 weapon.get_attacker_stats();
4776  
4777 diff -ur wesnoth-1.10.3.orig/src/gui/dialogs/unit_create.cpp wesnoth-1.10.3/src/gui/dialogs/unit_create.cpp
4778 --- wesnoth-1.10.3.orig/src/gui/dialogs/unit_create.cpp 2012-01-07 03:35:17.000000000 +0100
4779 +++ wesnoth-1.10.3/src/gui/dialogs/unit_create.cpp      2012-07-11 13:16:05.929933358 +0200
4780 @@ -109,7 +109,7 @@
4781  
4782         std::vector< std::string > type_labels, race_labels;
4783  
4784 -       foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
4785 +       wes_foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
4786         {
4787                 unit_types.find(i.first, unit_type::HELP_INDEX);
4788  
4789 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/control.cpp wesnoth-1.10.3/src/gui/widgets/control.cpp
4790 --- wesnoth-1.10.3.orig/src/gui/widgets/control.cpp     2012-01-07 03:35:17.000000000 +0100
4791 +++ wesnoth-1.10.3/src/gui/widgets/control.cpp  2012-07-11 13:16:05.943266694 +0200
4792 @@ -211,7 +211,7 @@
4793  void tcontrol::place(const tpoint& origin, const tpoint& size)
4794  {
4795         // resize canvasses
4796 -       foreach(tcanvas& canvas, canvas_) {
4797 +       wes_foreach(tcanvas& canvas, canvas_) {
4798                 canvas.set_width(size.x);
4799                 canvas.set_height(size.y);
4800         }
4801 @@ -297,7 +297,7 @@
4802         const int max_height = get_text_maximum_height();
4803  
4804         // set label in canvases
4805 -       foreach(tcanvas& canvas, canvas_) {
4806 +       wes_foreach(tcanvas& canvas, canvas_) {
4807                 canvas.set_variable("text", variant(label_));
4808                 canvas.set_variable("text_markup", variant(use_markup_));
4809                 canvas.set_variable("text_alignment"
4810 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/debug.cpp wesnoth-1.10.3/src/gui/widgets/debug.cpp
4811 --- wesnoth-1.10.3.orig/src/gui/widgets/debug.cpp       2012-01-07 03:35:17.000000000 +0100
4812 +++ wesnoth-1.10.3/src/gui/widgets/debug.cpp    2012-07-11 13:16:05.943266694 +0200
4813 @@ -122,7 +122,7 @@
4814  
4815         std::vector<std::string> params = utils::split(level);
4816  
4817 -       foreach(const std::string& param, params) {
4818 +       wes_foreach(const std::string& param, params) {
4819                 if(param == "all") {
4820                         level_ = ALL;
4821                         // No need to look further eventhought invalid items are now
4822 @@ -149,7 +149,7 @@
4823  
4824         std::vector<std::string> params = utils::split(domain);
4825  
4826 -       foreach(const std::string& param, params) {
4827 +       wes_foreach(const std::string& param, params) {
4828                 if(param == "all") {
4829                         domain_ = ALL;
4830                         // No need to look further eventhought invalid items are now
4831 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/generator.cpp wesnoth-1.10.3/src/gui/widgets/generator.cpp
4832 --- wesnoth-1.10.3.orig/src/gui/widgets/generator.cpp   2012-01-07 03:35:17.000000000 +0100
4833 +++ wesnoth-1.10.3/src/gui/widgets/generator.cpp        2012-07-11 13:16:05.943266694 +0200
4834 @@ -678,7 +678,7 @@
4835         assert(!callback);
4836  
4837         typedef std::pair<std::string, string_map> hack;
4838 -       foreach(const hack& item, data) {
4839 +       wes_foreach(const hack& item, data) {
4840                 if(item.first.empty()) {
4841                         for(unsigned row = 0; row < grid->get_rows(); ++row) {
4842                                 for(unsigned col = 0; col < grid->get_cols(); ++col) {
4843 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/generator_private.hpp wesnoth-1.10.3/src/gui/widgets/generator_private.hpp
4844 --- wesnoth-1.10.3.orig/src/gui/widgets/generator_private.hpp   2012-01-07 03:35:17.000000000 +0100
4845 +++ wesnoth-1.10.3/src/gui/widgets/generator_private.hpp        2012-07-11 13:16:05.939933360 +0200
4846 @@ -584,7 +584,7 @@
4847         /** Inherited from tgenerator_. */
4848         void clear()
4849         {
4850 -               foreach(titem* item, items_) {
4851 +               wes_foreach(titem* item, items_) {
4852                         delete item;
4853                 }
4854                 selected_item_count_ = 0;
4855 @@ -750,7 +750,7 @@
4856         /** Inherited from tgenerator_. */
4857         void layout_init(const bool full_initialization)
4858         {
4859 -               foreach(titem* item, items_) {
4860 +               wes_foreach(titem* item, items_) {
4861                         if(item->grid.get_visible() != twidget::INVISIBLE && item->shown) {
4862                                 item->grid.layout_init(full_initialization);
4863                         }
4864 @@ -804,7 +804,7 @@
4865         {
4866                 assert(this->get_visible() == twidget::VISIBLE);
4867  
4868 -               foreach(titem* item, items_) {
4869 +               wes_foreach(titem* item, items_) {
4870                         if(item->grid.get_visible() == twidget::VISIBLE && item->shown) {
4871                                 item->grid.draw_children(frame_buffer);
4872                         }
4873 @@ -815,7 +815,7 @@
4874         void child_populate_dirty_list(twindow& caller,
4875                         const std::vector<twidget*>& call_stack)
4876         {
4877 -               foreach(titem* item, items_) {
4878 +               wes_foreach(titem* item, items_) {
4879                         std::vector<twidget*> child_call_stack = call_stack;
4880                         item->grid.populate_dirty_list(caller, child_call_stack);
4881                 }
4882 @@ -838,7 +838,7 @@
4883         /** Inherited from widget. */
4884         bool disable_click_dismiss() const
4885         {
4886 -               foreach(titem* item, items_) {
4887 +               wes_foreach(titem* item, items_) {
4888                         if(item->grid.disable_click_dismiss()) {
4889                                 return true;
4890                         }
4891 @@ -974,7 +974,7 @@
4892                         void (*callback)(twidget*))
4893         {
4894                 int i = index;
4895 -               foreach(const T& item_data, data) {
4896 +               wes_foreach(const T& item_data, data) {
4897                         create_item(i, list_builder, item_data, callback);
4898                         if(i != -1) {
4899                                 ++i;
4900 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/grid.cpp wesnoth-1.10.3/src/gui/widgets/grid.cpp
4901 --- wesnoth-1.10.3.orig/src/gui/widgets/grid.cpp        2012-01-07 03:35:17.000000000 +0100
4902 +++ wesnoth-1.10.3/src/gui/widgets/grid.cpp     2012-07-11 13:16:05.939933360 +0200
4903 @@ -48,7 +48,7 @@
4904  {
4905         // Delete the children in this destructor since resizing a vector copies the
4906         // children and thus frees the child prematurely.
4907 -       foreach(tchild& child, children_) {
4908 +       wes_foreach(tchild& child, children_) {
4909                 delete child.widget();
4910         }
4911  }
4912 @@ -99,7 +99,7 @@
4913  {
4914         assert(widget);
4915  
4916 -       foreach(tchild& child, children_) {
4917 +       wes_foreach(tchild& child, children_) {
4918                 if(child.id() != id) {
4919  
4920                         if(recurse) {
4921 @@ -145,7 +145,7 @@
4922  
4923  void tgrid::remove_child(const std::string& id, const bool find_all)
4924  {
4925 -       foreach(tchild& child, children_) {
4926 +       wes_foreach(tchild& child, children_) {
4927  
4928                 if(child.id() == id) {
4929                         delete child.widget();
4930 @@ -160,7 +160,7 @@
4931  
4932  void tgrid::set_active(const bool active)
4933  {
4934 -       foreach(tchild& child, children_) {
4935 +       wes_foreach(tchild& child, children_) {
4936  
4937                 twidget* widget = child.widget();
4938                 if(!widget) {
4939 @@ -186,7 +186,7 @@
4940         twidget::layout_init(full_initialization);
4941  
4942         // Clear child caches.
4943 -       foreach(tchild& child, children_) {
4944 +       wes_foreach(tchild& child, children_) {
4945  
4946                 child.layout_init(full_initialization);
4947  
4948 @@ -426,7 +426,7 @@
4949  
4950  bool tgrid::can_wrap() const
4951  {
4952 -       foreach(const tchild& child, children_) {
4953 +       wes_foreach(const tchild& child, children_) {
4954                 if(child.can_wrap()) {
4955                         return true;
4956                 }
4957 @@ -485,7 +485,7 @@
4958  
4959                         if(w_size == 0) {
4960                                 // If all sizes are 0 reset them to 1
4961 -                               foreach(unsigned& val, col_grow_factor_) {
4962 +                               wes_foreach(unsigned& val, col_grow_factor_) {
4963                                         val = 1;
4964                                 }
4965                                 w_size = cols_;
4966 @@ -516,7 +516,7 @@
4967  
4968                         if(h_size == 0) {
4969                                 // If all sizes are 0 reset them to 1
4970 -                               foreach(unsigned& val, row_grow_factor_) {
4971 +                               wes_foreach(unsigned& val, row_grow_factor_) {
4972                                         val = 1;
4973                                 }
4974                                 h_size = rows_;
4975 @@ -551,7 +551,7 @@
4976         // Inherited.
4977         twidget::set_origin(origin);
4978  
4979 -       foreach(tchild& child, children_) {
4980 +       wes_foreach(tchild& child, children_) {
4981  
4982                 twidget* widget = child.widget();
4983                 assert(widget);
4984 @@ -567,7 +567,7 @@
4985         // Inherited.
4986         twidget::set_visible_area(area);
4987  
4988 -       foreach(tchild& child, children_) {
4989 +       wes_foreach(tchild& child, children_) {
4990  
4991                 twidget* widget = child.widget();
4992                 assert(widget);
4993 @@ -578,7 +578,7 @@
4994  
4995  void tgrid::layout_children()
4996  {
4997 -       foreach(tchild& child, children_) {
4998 +       wes_foreach(tchild& child, children_) {
4999                 assert(child.widget());
5000                 child.widget()->layout_children();
5001         }
5002 @@ -589,7 +589,7 @@
5003  {
5004         assert(!call_stack.empty() && call_stack.back() == this);
5005  
5006 -       foreach(tchild& child, children_) {
5007 +       wes_foreach(tchild& child, children_) {
5008  
5009                 assert(child.widget());
5010  
5011 @@ -627,7 +627,7 @@
5012  
5013  bool tgrid::has_widget(const twidget* widget) const
5014  {
5015 -       foreach(const tchild& child, children_) {
5016 +       wes_foreach(const tchild& child, children_) {
5017                 if(child.widget() == widget) {
5018                         return true;
5019                 }
5020 @@ -641,7 +641,7 @@
5021                 return false;
5022         }
5023  
5024 -       foreach(const tchild& child, children_) {
5025 +       wes_foreach(const tchild& child, children_) {
5026                 const twidget* widget = child.widget();
5027                 assert(widget);
5028  
5029 @@ -936,7 +936,7 @@
5030         assert(get_visible() == twidget::VISIBLE);
5031         set_dirty(false);
5032  
5033 -       foreach(tchild& child, children_) {
5034 +       wes_foreach(tchild& child, children_) {
5035  
5036                 twidget* widget = child.widget();
5037                 assert(widget);
5038 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/grid_private.hpp wesnoth-1.10.3/src/gui/widgets/grid_private.hpp
5039 --- wesnoth-1.10.3.orig/src/gui/widgets/grid_private.hpp        2012-01-07 03:35:17.000000000 +0100
5040 +++ wesnoth-1.10.3/src/gui/widgets/grid_private.hpp     2012-07-11 13:16:05.939933360 +0200
5041 @@ -56,7 +56,7 @@
5042                         const tpoint& coordinate, const bool must_be_active)
5043         {
5044                 typedef typename tconst_duplicator<W, tgrid::tchild>::type hack;
5045 -               foreach(hack& child, grid.children_) {
5046 +               wes_foreach(hack& child, grid.children_) {
5047  
5048                         W* widget = child.widget();
5049                         if(!widget) {
5050 @@ -91,7 +91,7 @@
5051                 }
5052  
5053                 typedef typename tconst_duplicator<W, tgrid::tchild>::type hack;
5054 -               foreach(hack& child, grid.children_) {
5055 +               wes_foreach(hack& child, grid.children_) {
5056  
5057                         widget = child.widget();
5058                         if(!widget) {
5059 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/list.cpp wesnoth-1.10.3/src/gui/widgets/list.cpp
5060 --- wesnoth-1.10.3.orig/src/gui/widgets/list.cpp        2012-01-07 03:35:17.000000000 +0100
5061 +++ wesnoth-1.10.3/src/gui/widgets/list.cpp     2012-07-11 13:16:05.939933360 +0200
5062 @@ -137,7 +137,7 @@
5063  
5064  void tlist::append_rows(const std::vector<string_map>& items)
5065  {
5066 -       foreach(const string_map& item, items) {
5067 +       wes_foreach(const string_map& item, items) {
5068                 add_row(item);
5069         }
5070  }
5071 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/progress_bar.cpp wesnoth-1.10.3/src/gui/widgets/progress_bar.cpp
5072 --- wesnoth-1.10.3.orig/src/gui/widgets/progress_bar.cpp        2012-01-07 03:35:17.000000000 +0100
5073 +++ wesnoth-1.10.3/src/gui/widgets/progress_bar.cpp     2012-07-11 13:16:05.943266694 +0200
5074 @@ -38,7 +38,7 @@
5075         if(percentage_ != percentage) {
5076                 percentage_ = percentage;
5077  
5078 -               foreach(tcanvas& c, canvas()) {
5079 +               wes_foreach(tcanvas& c, canvas()) {
5080                         c.set_variable("percentage", variant(percentage));
5081                 }
5082  
5083 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/scrollbar_container.cpp wesnoth-1.10.3/src/gui/widgets/scrollbar_container.cpp
5084 --- wesnoth-1.10.3.orig/src/gui/widgets/scrollbar_container.cpp 2012-01-07 03:35:17.000000000 +0100
5085 +++ wesnoth-1.10.3/src/gui/widgets/scrollbar_container.cpp      2012-07-11 13:16:05.946600027 +0200
5086 @@ -692,7 +692,7 @@
5087  
5088         /***** Setup the scrollbar buttons *****/
5089         typedef std::pair<std::string, tscrollbar_::tscroll> hack;
5090 -       foreach(const hack& item, scroll_lookup()) {
5091 +       wes_foreach(const hack& item, scroll_lookup()) {
5092  
5093                 // Vertical.
5094                 tclickable_* button = find_widget<tclickable_>(
5095 @@ -838,7 +838,7 @@
5096  {
5097         if(true) { /** @todo scrollbar visibility. */
5098                 /***** set scroll up button status *****/
5099 -               foreach(const std::string& name, button_up_names) {
5100 +               wes_foreach(const std::string& name, button_up_names) {
5101                         tcontrol* button = find_widget<tcontrol>(
5102                                         vertical_scrollbar_grid_, name, false, false);
5103  
5104 @@ -848,7 +848,7 @@
5105                 }
5106  
5107                 /***** set scroll down status *****/
5108 -               foreach(const std::string& name, button_down_names) {
5109 +               wes_foreach(const std::string& name, button_down_names) {
5110                         tcontrol* button = find_widget<tcontrol>(
5111                                         vertical_scrollbar_grid_, name, false, false);
5112  
5113 @@ -864,7 +864,7 @@
5114  
5115         if(true) { /** @todo scrollbar visibility. */
5116                 /***** Set scroll left button status *****/
5117 -               foreach(const std::string& name, button_up_names) {
5118 +               wes_foreach(const std::string& name, button_up_names) {
5119                         tcontrol* button = find_widget<tcontrol>(
5120                                         horizontal_scrollbar_grid_, name, false, false);
5121  
5122 @@ -874,7 +874,7 @@
5123                 }
5124  
5125                 /***** Set scroll right button status *****/
5126 -               foreach(const std::string& name, button_down_names) {
5127 +               wes_foreach(const std::string& name, button_down_names) {
5128                         tcontrol* button = find_widget<tcontrol>(
5129                                         horizontal_scrollbar_grid_, name, false, false);
5130  
5131 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/scrollbar.cpp wesnoth-1.10.3/src/gui/widgets/scrollbar.cpp
5132 --- wesnoth-1.10.3.orig/src/gui/widgets/scrollbar.cpp   2012-01-07 03:35:17.000000000 +0100
5133 +++ wesnoth-1.10.3/src/gui/widgets/scrollbar.cpp        2012-07-11 13:16:05.946600027 +0200
5134 @@ -132,7 +132,7 @@
5135  
5136  void tscrollbar_::update_canvas() {
5137  
5138 -       foreach(tcanvas& tmp, canvas()) {
5139 +       wes_foreach(tcanvas& tmp, canvas()) {
5140                 tmp.set_variable("positioner_offset", variant(positioner_offset_));
5141                 tmp.set_variable("positioner_length", variant(positioner_length_));
5142         }
5143 @@ -287,7 +287,7 @@
5144  void tscrollbar_::load_config_extra()
5145  {
5146         // These values won't change so set them here.
5147 -       foreach(tcanvas& tmp, canvas()) {
5148 +       wes_foreach(tcanvas& tmp, canvas()) {
5149                 tmp.set_variable("offset_before", variant(offset_before()));
5150                 tmp.set_variable("offset_after", variant(offset_after()));
5151         }
5152 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/settings.cpp wesnoth-1.10.3/src/gui/widgets/settings.cpp
5153 --- wesnoth-1.10.3.orig/src/gui/widgets/settings.cpp    2012-01-07 03:35:17.000000000 +0100
5154 +++ wesnoth-1.10.3/src/gui/widgets/settings.cpp 2012-07-11 13:16:05.946600027 +0200
5155 @@ -283,12 +283,12 @@
5156                                   , const config&
5157                                   , const char *key)> > thack;
5158  
5159 -       foreach(thack& widget_type, registred_widget_type()) {
5160 +       wes_foreach(thack& widget_type, registred_widget_type()) {
5161                 widget_type.second(*this, widget_type.first, cfg, NULL);
5162         }
5163  
5164         /***** Window types *****/
5165 -       foreach (const config &w, cfg.child_range("window")) {
5166 +       wes_foreach (const config &w, cfg.child_range("window")) {
5167                 std::pair<std::string, twindow_builder> child;
5168                 child.first = child.second.read(w);
5169                 window_types.insert(child);
5170 @@ -423,7 +423,7 @@
5171                   const std::string& definition_type
5172                 , const std::vector<tcontrol_definition_ptr>& definitions)
5173  {
5174 -       foreach(const tcontrol_definition_ptr& def, definitions) {
5175 +       wes_foreach(const tcontrol_definition_ptr& def, definitions) {
5176  
5177                 // We assume all definitions are unique if not we would leak memory.
5178                 assert(control_definition[definition_type].find(def->id)
5179 @@ -497,7 +497,7 @@
5180                         ERR_GUI_P << e.message;
5181         }
5182         // Parse guis
5183 -       foreach (const config &g, cfg.child_range("gui")) {
5184 +       wes_foreach (const config &g, cfg.child_range("gui")) {
5185                 std::pair<std::string, tgui_definition> child;
5186                 child.first = child.second.read(g);
5187                 guis.insert(child);
5188 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/settings.hpp wesnoth-1.10.3/src/gui/widgets/settings.hpp
5189 --- wesnoth-1.10.3.orig/src/gui/widgets/settings.hpp    2012-01-07 03:35:17.000000000 +0100
5190 +++ wesnoth-1.10.3/src/gui/widgets/settings.hpp 2012-07-11 13:16:05.946600027 +0200
5191 @@ -124,7 +124,7 @@
5192  {
5193         std::vector<tcontrol_definition_ptr> definitions;
5194  
5195 -       foreach(const config& definition
5196 +       wes_foreach(const config& definition
5197                         , cfg.child_range(key ? key : definition_type + "_definition")) {
5198  
5199                 definitions.push_back(new T(definition));
5200 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/slider.cpp wesnoth-1.10.3/src/gui/widgets/slider.cpp
5201 --- wesnoth-1.10.3.orig/src/gui/widgets/slider.cpp      2012-01-07 03:35:17.000000000 +0100
5202 +++ wesnoth-1.10.3/src/gui/widgets/slider.cpp   2012-07-11 13:16:05.943266694 +0200
5203 @@ -232,7 +232,7 @@
5204         // Inherited.
5205         tscrollbar_::update_canvas();
5206  
5207 -       foreach(tcanvas& tmp, canvas()) {
5208 +       wes_foreach(tcanvas& tmp, canvas()) {
5209                 tmp.set_variable("text", variant(get_value_label()));
5210         }
5211  }
5212 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/stacked_widget.cpp wesnoth-1.10.3/src/gui/widgets/stacked_widget.cpp
5213 --- wesnoth-1.10.3.orig/src/gui/widgets/stacked_widget.cpp      2012-01-07 03:35:17.000000000 +0100
5214 +++ wesnoth-1.10.3/src/gui/widgets/stacked_widget.cpp   2012-07-11 13:16:05.939933360 +0200
5215 @@ -83,7 +83,7 @@
5216  {
5217         assert(generator_);
5218         string_map empty_data;
5219 -       foreach(const tbuilder_grid_const_ptr& builder, widget_builder) {
5220 +       wes_foreach(const tbuilder_grid_const_ptr& builder, widget_builder) {
5221                 generator_->create_item(-1, builder, empty_data, NULL);
5222         }
5223         swap_grid(NULL, &grid(), generator_, "_content_grid");
5224 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/text_box.cpp wesnoth-1.10.3/src/gui/widgets/text_box.cpp
5225 --- wesnoth-1.10.3.orig/src/gui/widgets/text_box.cpp    2012-01-07 03:35:17.000000000 +0100
5226 +++ wesnoth-1.10.3/src/gui/widgets/text_box.cpp 2012-07-11 13:16:05.939933360 +0200
5227 @@ -162,7 +162,7 @@
5228         const int max_width = get_text_maximum_width();
5229         const int max_height = get_text_maximum_height();
5230  
5231 -       foreach(tcanvas& tmp, canvas()) {
5232 +       wes_foreach(tcanvas& tmp, canvas()) {
5233  
5234                 tmp.set_variable("text", variant(get_value()));
5235                 tmp.set_variable("text_x_offset", variant(text_x_offset_));
5236 @@ -260,7 +260,7 @@
5237  
5238         // Since this variable doesn't change set it here instead of in
5239         // update_canvas().
5240 -       foreach(tcanvas& tmp, canvas()) {
5241 +       wes_foreach(tcanvas& tmp, canvas()) {
5242                 tmp.set_variable("text_font_height", variant(text_height_));
5243         }
5244  
5245 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/toggle_button.cpp wesnoth-1.10.3/src/gui/widgets/toggle_button.cpp
5246 --- wesnoth-1.10.3.orig/src/gui/widgets/toggle_button.cpp       2012-01-07 03:35:17.000000000 +0100
5247 +++ wesnoth-1.10.3/src/gui/widgets/toggle_button.cpp    2012-07-11 13:16:05.939933360 +0200
5248 @@ -89,7 +89,7 @@
5249  
5250         // set icon in canvases
5251         std::vector<tcanvas>& canvases = tcontrol::canvas();
5252 -       foreach(tcanvas& canvas, canvases) {
5253 +       wes_foreach(tcanvas& canvas, canvases) {
5254                 canvas.set_variable("icon", variant(icon_name_));
5255         }
5256  
5257 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/toggle_panel.cpp wesnoth-1.10.3/src/gui/widgets/toggle_panel.cpp
5258 --- wesnoth-1.10.3.orig/src/gui/widgets/toggle_panel.cpp        2012-01-07 03:35:17.000000000 +0100
5259 +++ wesnoth-1.10.3/src/gui/widgets/toggle_panel.cpp     2012-07-11 13:16:05.943266694 +0200
5260 @@ -72,7 +72,7 @@
5261  {
5262         // typedef boost problem work around.
5263         typedef std::pair<std::string, string_map> hack ;
5264 -       foreach(const hack& item, data) {
5265 +       wes_foreach(const hack& item, data) {
5266                 tcontrol* control = dynamic_cast<tcontrol*>(find(item.first, false));
5267                 if(control) {
5268                         control->set_members(item.second);
5269 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
5270 --- wesnoth-1.10.3.orig/src/gui/widgets/tree_view_node.cpp      2012-01-07 03:35:17.000000000 +0100
5271 +++ wesnoth-1.10.3/src/gui/widgets/tree_view_node.cpp   2012-07-11 13:16:05.946600027 +0200
5272 @@ -48,7 +48,7 @@
5273         grid_.set_parent(this);
5274         set_parent(&parent_tree_view);
5275         if(id != "root") {
5276 -               foreach(const tnode_definition& node_definition, node_definitions_) {
5277 +               wes_foreach(const tnode_definition& node_definition, node_definitions_) {
5278                         if(node_definition.id == id) {
5279                                 node_definition.builder->build(&grid_);
5280                                 init_grid(&grid_, data);
5281 @@ -217,7 +217,7 @@
5282         int height_reduction = 0;
5283  
5284         if(!is_folded()) {
5285 -               foreach(const ttree_view_node& node, children_) {
5286 +               wes_foreach(const ttree_view_node& node, children_) {
5287                         height_reduction += node.get_current_size().y;
5288                 }
5289         }
5290 @@ -301,7 +301,7 @@
5291                 return;
5292         }
5293  
5294 -       foreach(ttree_view_node& node, children_) {
5295 +       wes_foreach(ttree_view_node& node, children_) {
5296                 std::vector<twidget*> child_call_stack = call_stack;
5297                 node.impl_populate_dirty_list(caller, child_call_stack);
5298         }
5299 @@ -456,7 +456,7 @@
5300         }
5301  
5302         DBG_GUI_L << LOG_HEADER << " set children.\n";
5303 -       foreach(ttree_view_node& node, children_) {
5304 +       wes_foreach(ttree_view_node& node, children_) {
5305                 origin.y += node.place(indention_step_size, origin, width);
5306         }
5307  
5308 @@ -478,7 +478,7 @@
5309                 return;
5310         }
5311  
5312 -       foreach(ttree_view_node& node, children_) {
5313 +       wes_foreach(ttree_view_node& node, children_) {
5314                 node.set_visible_area(area);
5315         }
5316  }
5317 @@ -491,7 +491,7 @@
5318                 return;
5319         }
5320  
5321 -       foreach(ttree_view_node& node, children_) {
5322 +       wes_foreach(ttree_view_node& node, children_) {
5323                 node.impl_draw_children(frame_buffer);
5324         }
5325  }
5326 diff -ur wesnoth-1.10.3.orig/src/gui/widgets/window.cpp wesnoth-1.10.3/src/gui/widgets/window.cpp
5327 --- wesnoth-1.10.3.orig/src/gui/widgets/window.cpp      2012-01-07 03:35:17.000000000 +0100
5328 +++ wesnoth-1.10.3/src/gui/widgets/window.cpp   2012-07-11 13:16:05.949933359 +0200
5329 @@ -716,7 +716,7 @@
5330                 return;
5331         }
5332  
5333 -       foreach(std::vector<twidget*>& item, dirty_list_) {
5334 +       wes_foreach(std::vector<twidget*>& item, dirty_list_) {
5335  
5336                 assert(!item.empty());
5337  
5338 @@ -1047,12 +1047,12 @@
5339  {
5340         // evaluate the group sizes
5341         typedef std::pair<const std::string, tlinked_size> hack;
5342 -       foreach(hack& linked_size, linked_size_) {
5343 +       wes_foreach(hack& linked_size, linked_size_) {
5344  
5345                 tpoint max_size(0, 0);
5346  
5347                 // Determine the maximum size.
5348 -               foreach(twidget* widget, linked_size.second.widgets) {
5349 +               wes_foreach(twidget* widget, linked_size.second.widgets) {
5350  
5351                         const tpoint size = widget->get_best_size();
5352  
5353 @@ -1065,7 +1065,7 @@
5354                 }
5355  
5356                 // Set the maximum size.
5357 -               foreach(twidget* widget, linked_size.second.widgets) {
5358 +               wes_foreach(twidget* widget, linked_size.second.widgets) {
5359  
5360                         tpoint size = widget->get_best_size();
5361  
5362 diff -ur wesnoth-1.10.3.orig/src/help.cpp wesnoth-1.10.3/src/help.cpp
5363 --- wesnoth-1.10.3.orig/src/help.cpp    2012-01-07 03:35:17.000000000 +0100
5364 +++ wesnoth-1.10.3/src/help.cpp 2012-07-11 13:16:06.236600016 +0200
5365 @@ -793,7 +793,7 @@
5366                         // opening the help browser in the default manner.
5367                         config hidden_toplevel;
5368                         std::stringstream ss;
5369 -                       foreach (const config &section, help_config->child_range("section"))
5370 +                       wes_foreach (const config &section, help_config->child_range("section"))
5371                         {
5372                                 const std::string id = section["id"];
5373                                 if (find_section(toplevel, id) == NULL) {
5374 @@ -810,7 +810,7 @@
5375                         }
5376                         hidden_toplevel["sections"] = ss.str();
5377                         ss.str("");
5378 -                       foreach (const config &topic, help_config->child_range("topic"))
5379 +                       wes_foreach (const config &topic, help_config->child_range("topic"))
5380                         {
5381                                 const std::string id = topic["id"];
5382                                 if (find_topic(toplevel, id) == NULL) {
5383 @@ -861,7 +861,7 @@
5384                 }
5385         }
5386  
5387 -       foreach (const config &section, cfg.child_range("section"))
5388 +       wes_foreach (const config &section, cfg.child_range("section"))
5389         {
5390                 const std::vector<std::string> sections_refd
5391                         = utils::quoted_split(section["sections"]);
5392 @@ -885,7 +885,7 @@
5393                 }
5394         }
5395  
5396 -       foreach (const config &section, cfg.child_range("section"))
5397 +       wes_foreach (const config &section, cfg.child_range("section"))
5398         {
5399                 const std::vector<std::string> topics_refd
5400                         = utils::quoted_split(section["topics"]);
5401 @@ -1103,7 +1103,7 @@
5402         std::map<t_string, std::string> special_description;
5403         std::map<t_string, std::set<std::string, string_less> > special_units;
5404  
5405 -       foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
5406 +       wes_foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
5407         {
5408                 const unit_type &type = i.second;
5409                 // Only show the weapon special if we find it on a unit that
5410 @@ -1171,7 +1171,7 @@
5411         // should have a full description, if so, add this units abilities
5412         // for display. We do not want to show abilities that the user has
5413         // not encountered yet.
5414 -       foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
5415 +       wes_foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
5416         {
5417                 const unit_type &type = i.second;
5418                 if (description_type(type) == FULL_DESCRIPTION) {
5419 @@ -1244,7 +1244,7 @@
5420         const config& era = game_cfg->child("era");
5421         if (era) {
5422                 std::vector<std::string> faction_links;
5423 -               foreach (const config &f, era.child_range("multiplayer_side")) {
5424 +               wes_foreach (const config &f, era.child_range("multiplayer_side")) {
5425                         const std::string& id = f["id"];
5426                         if (id == "Random")
5427                                 continue;
5428 @@ -1260,7 +1260,7 @@
5429                         text << "<header>text='" << _("Leaders:") << "'</header>" << "\n";
5430                         const std::vector<std::string> leaders =
5431                                         make_unit_links_list( utils::split(f["leader"]), true );
5432 -                       foreach (const std::string &link, leaders) {
5433 +                       wes_foreach (const std::string &link, leaders) {
5434                                 text << link << "\n";
5435                         }
5436  
5437 @@ -1269,7 +1269,7 @@
5438                         text << "<header>text='" << _("Recruits:") << "'</header>" << "\n";
5439                         const std::vector<std::string> recruits =
5440                                         make_unit_links_list( utils::split(f["recruit"]), true );
5441 -                       foreach (const std::string &link, recruits) {
5442 +                       wes_foreach (const std::string &link, recruits) {
5443                                 text << link << "\n";
5444                         }
5445  
5446 @@ -1291,7 +1291,7 @@
5447                 text << "<header>text='" << _("Factions:") << "'</header>" << "\n";
5448  
5449                 std::sort(faction_links.begin(), faction_links.end());
5450 -               foreach (const std::string &link, faction_links) {
5451 +               wes_foreach (const std::string &link, faction_links) {
5452                         text << link << "\n";
5453                 }
5454  
5455 @@ -1366,7 +1366,7 @@
5456                                 reverse ? type_.advances_from() : type_.advances_to();
5457                         bool first = true;
5458  
5459 -                       foreach (const std::string &adv, adv_units)
5460 +                       wes_foreach (const std::string &adv, adv_units)
5461                         {
5462                                 const unit_type *type = unit_types.find(adv);
5463                                 if (!type || type->hide_help()) continue;
5464 @@ -1676,7 +1676,7 @@
5465  std::vector<std::string> make_unit_links_list(const std::vector<std::string>& type_id_list, bool ordered)
5466  {
5467         std::vector<std::string> links_list;
5468 -       foreach (const std::string &type_id, type_id_list) {
5469 +       wes_foreach (const std::string &type_id, type_id_list) {
5470                 std::string unit_link = make_unit_link(type_id);
5471                 if (!unit_link.empty())
5472                         links_list.push_back(unit_link);
5473 @@ -1693,7 +1693,7 @@
5474         std::set<std::string, string_less> races;
5475         std::set<std::string, string_less> visible_races;
5476  
5477 -       foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
5478 +       wes_foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
5479         {
5480                 const unit_type &type = i.second;
5481                 UNIT_DESCRIPTION_TYPE desc_type = description_type(type);
5482 @@ -1736,7 +1736,7 @@
5483         std::set<std::string, string_less> race_units;
5484         std::set<std::string, string_less> race_topics;
5485  
5486 -       foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
5487 +       wes_foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
5488         {
5489                 const unit_type &type = i.second;
5490  
5491 @@ -1768,7 +1768,7 @@
5492                 race_name = r->plural_name();
5493                 race_description = r->description();
5494                 // if (description.empty()) description =  _("No description Available");
5495 -               foreach (const config &additional_topic, r->additional_topics())
5496 +               wes_foreach (const config &additional_topic, r->additional_topics())
5497                   {
5498                     std::string id = additional_topic["id"];
5499                     std::string title = additional_topic["title"];
5500 diff -ur wesnoth-1.10.3.orig/src/hotkeys.cpp wesnoth-1.10.3/src/hotkeys.cpp
5501 --- wesnoth-1.10.3.orig/src/hotkeys.cpp 2012-03-31 20:47:10.000000000 +0200
5502 +++ wesnoth-1.10.3/src/hotkeys.cpp      2012-07-11 13:16:06.003266691 +0200
5503 @@ -609,7 +609,7 @@
5504  
5505  void load_hotkeys(const config& cfg)
5506  {
5507 -       foreach (const config &hk, cfg.child_range(hotkey_tag_name))
5508 +       wes_foreach (const config &hk, cfg.child_range(hotkey_tag_name))
5509         {
5510                 hotkey_item& h = get_hotkey(hk["command"]);
5511                 if(h.get_id() != HOTKEY_NULL) {
5512 diff -ur wesnoth-1.10.3.orig/src/image.cpp wesnoth-1.10.3/src/image.cpp
5513 --- wesnoth-1.10.3.orig/src/image.cpp   2012-01-21 20:23:47.000000000 +0100
5514 +++ wesnoth-1.10.3/src/image.cpp        2012-07-11 13:16:06.006600025 +0200
5515 @@ -376,7 +376,7 @@
5516                 std::string trackpath = get_binary_file_location("", "l10n-track");
5517                 std::string contents = read_file(trackpath);
5518                 std::vector<std::string> lines = utils::split(contents, '\n');
5519 -               foreach (const std::string &line, lines) {
5520 +               wes_foreach (const std::string &line, lines) {
5521                         size_t p1 = line.find(fsep);
5522                         if (p1 == std::string::npos)
5523                                 continue;
5524 @@ -423,7 +423,7 @@
5525         // add en_US with lowest priority, since the message above will
5526         // not have it when translated.
5527         langs.push_back("en_US");
5528 -       foreach (const std::string &lang, langs) {
5529 +       wes_foreach (const std::string &lang, langs) {
5530                 std::string loc_file = dir + "l10n" + "/" + lang + "/" + loc_base;
5531                 if (file_exists(loc_file) && localized_file_uptodate(loc_file)) {
5532                         return loc_file;
5533 diff -ur wesnoth-1.10.3.orig/src/image_modifications.cpp wesnoth-1.10.3/src/image_modifications.cpp
5534 --- wesnoth-1.10.3.orig/src/image_modifications.cpp     2012-01-07 03:35:17.000000000 +0100
5535 +++ wesnoth-1.10.3/src/image_modifications.cpp  2012-07-11 13:16:05.979933358 +0200
5536 @@ -99,7 +99,7 @@
5537  {
5538         modification_queue mods;
5539  
5540 -       foreach(const std::string& encoded_mod,
5541 +       wes_foreach(const std::string& encoded_mod,
5542                 utils::parenthetical_split(encoded_mods, '~')) {
5543                 modification* mod = decode_modification(encoded_mod);
5544  
5545 diff -ur wesnoth-1.10.3.orig/src/language.cpp wesnoth-1.10.3/src/language.cpp
5546 --- wesnoth-1.10.3.orig/src/language.cpp        2012-03-03 19:55:59.000000000 +0100
5547 +++ wesnoth-1.10.3/src/language.cpp     2012-07-11 13:16:06.026600024 +0200
5548 @@ -101,7 +101,7 @@
5549         known_languages.push_back(
5550                 language_def("", t_string(N_("System default language"), "wesnoth"), "ltr", "", "A"));
5551  
5552 -       foreach (const config &lang, cfg.child_range("locale"))
5553 +       wes_foreach (const config &lang, cfg.child_range("locale"))
5554         {
5555                 known_languages.push_back(
5556                         language_def(lang["locale"], lang["name"], lang["dir"],
5557 @@ -226,9 +226,9 @@
5558                 std::cerr << "No [language] block found\n";
5559                 return false;
5560         }
5561 -       foreach (const config &lang, languages_) {
5562 +       wes_foreach (const config &lang, languages_) {
5563                 DBG_G << "[language]\n";
5564 -               foreach (const config::attribute &j, lang.attribute_range()) {
5565 +               wes_foreach (const config::attribute &j, lang.attribute_range()) {
5566                         DBG_G << j.first << "=\"" << j.second << "\"\n";
5567                         strings_[j.first] = j.second;
5568                 }
5569 @@ -283,7 +283,7 @@
5570  
5571  void init_textdomains(const config& cfg)
5572  {
5573 -       foreach (const config &t, cfg.child_range("textdomain"))
5574 +       wes_foreach (const config &t, cfg.child_range("textdomain"))
5575         {
5576                 const std::string &name = t["name"];
5577                 const std::string &path = t["path"];
5578 @@ -307,7 +307,7 @@
5579  bool init_strings(const config& cfg)
5580  {
5581         languages_.clear();
5582 -       foreach(const config &l, cfg.child_range("language")) {
5583 +       wes_foreach(const config &l, cfg.child_range("language")) {
5584                 languages_.push_back(l);
5585         }
5586         return load_strings(true);
5587 diff -ur wesnoth-1.10.3.orig/src/log.cpp wesnoth-1.10.3/src/log.cpp
5588 --- wesnoth-1.10.3.orig/src/log.cpp     2012-01-07 03:35:17.000000000 +0100
5589 +++ wesnoth-1.10.3/src/log.cpp  2012-07-11 13:16:05.979933358 +0200
5590 @@ -88,11 +88,11 @@
5591  {
5592         std::string::size_type s = name.size();
5593         if (name == "all") {
5594 -               foreach (logd &l, *domains) {
5595 +               wes_foreach (logd &l, *domains) {
5596                         l.second = severity;
5597                 }
5598         } else if (s > 2 && name.compare(s - 2, 2, "/*") == 0) {
5599 -               foreach (logd &l, *domains) {
5600 +               wes_foreach (logd &l, *domains) {
5601                         if (l.first.compare(0, s - 1, name, 0, s - 1) == 0)
5602                                 l.second = severity;
5603                 }
5604 @@ -108,7 +108,7 @@
5605  std::string list_logdomains(const std::string& filter)
5606  {
5607         std::ostringstream res;
5608 -       foreach (logd &l, *domains) {
5609 +       wes_foreach (logd &l, *domains) {
5610                 if(l.first.find(filter) != std::string::npos)
5611                         res << l.first << "\n";
5612         }
5613 diff -ur wesnoth-1.10.3.orig/src/lua/ltablib.c wesnoth-1.10.3/src/lua/ltablib.c
5614 --- wesnoth-1.10.3.orig/src/lua/ltablib.c       2010-08-01 18:39:39.000000000 +0200
5615 +++ wesnoth-1.10.3/src/lua/ltablib.c    2012-07-11 13:16:05.949933359 +0200
5616 @@ -19,7 +19,7 @@
5617  #define aux_getn(L,n)  (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n))
5618  
5619  
5620 -static int foreachi (lua_State *L) {
5621 +static int wes_foreachi (lua_State *L) {
5622    int i;
5623    int n = aux_getn(L, 1);
5624    luaL_checktype(L, 2, LUA_TFUNCTION);
5625 @@ -36,7 +36,7 @@
5626  }
5627  
5628  
5629 -static int foreach (lua_State *L) {
5630 +static int wes_foreach (lua_State *L) {
5631    luaL_checktype(L, 1, LUA_TTABLE);
5632    luaL_checktype(L, 2, LUA_TFUNCTION);
5633    lua_pushnil(L);  /* first key */
5634 @@ -268,8 +268,8 @@
5635  
5636  static const luaL_Reg tab_funcs[] = {
5637    {"concat", tconcat},
5638 -  {"foreach", foreach},
5639 -  {"foreachi", foreachi},
5640 +  {"wes_foreach", wes_foreach},
5641 +  {"wes_foreachi", wes_foreachi},
5642    {"getn", getn},
5643    {"maxn", maxn},
5644    {"insert", tinsert},
5645 diff -ur wesnoth-1.10.3.orig/src/mapgen.cpp wesnoth-1.10.3/src/mapgen.cpp
5646 --- wesnoth-1.10.3.orig/src/mapgen.cpp  2012-01-07 03:35:17.000000000 +0100
5647 +++ wesnoth-1.10.3/src/mapgen.cpp       2012-07-11 13:16:05.983266692 +0200
5648 @@ -777,7 +777,7 @@
5649  
5650         std::vector<terrain_height_mapper> height_conversion;
5651  
5652 -       foreach (const config &h, cfg.child_range("height")) {
5653 +       wes_foreach (const config &h, cfg.child_range("height")) {
5654                 height_conversion.push_back(terrain_height_mapper(h));
5655         }
5656  
5657 @@ -912,7 +912,7 @@
5658         LOG_NG << (SDL_GetTicks() - ticks) << "\n"; ticks = SDL_GetTicks();
5659  
5660         std::vector<terrain_converter> converters;
5661 -       foreach (const config &cv, cfg.child_range("convert")) {
5662 +       wes_foreach (const config &cv, cfg.child_range("convert")) {
5663                 converters.push_back(terrain_converter(cv));
5664         }
5665  
5666 diff -ur wesnoth-1.10.3.orig/src/map_label.cpp wesnoth-1.10.3/src/map_label.cpp
5667 --- wesnoth-1.10.3.orig/src/map_label.cpp       2012-01-07 13:11:02.000000000 +0100
5668 +++ wesnoth-1.10.3/src/map_label.cpp    2012-07-11 13:16:05.953266691 +0200
5669 @@ -59,7 +59,7 @@
5670  {
5671         clear_all();
5672  
5673 -       foreach (const config &i, cfg.child_range("label"))
5674 +       wes_foreach (const config &i, cfg.child_range("label"))
5675         {
5676                 const map_location loc(i, resources::state_of_game);
5677                 terrain_label *label = new terrain_label(*this, i);
5678 @@ -222,7 +222,7 @@
5679  
5680  void map_labels::clear_all()
5681  {
5682 -       foreach (team_label_map::value_type &m, labels_)
5683 +       wes_foreach (team_label_map::value_type &m, labels_)
5684         {
5685                 clear_map(m.second, true);
5686         }
5687 @@ -231,9 +231,9 @@
5688  
5689  void map_labels::recalculate_labels()
5690  {
5691 -       foreach (team_label_map::value_type &m, labels_)
5692 +       wes_foreach (team_label_map::value_type &m, labels_)
5693         {
5694 -               foreach (label_map::value_type &l, m.second)
5695 +               wes_foreach (label_map::value_type &l, m.second)
5696                 {
5697                         l.second->recalculate();
5698                 }
5699 @@ -249,9 +249,9 @@
5700  
5701  void map_labels::recalculate_shroud()
5702  {
5703 -       foreach (team_label_map::value_type &m, labels_)
5704 +       wes_foreach (team_label_map::value_type &m, labels_)
5705         {
5706 -               foreach (label_map::value_type &l, m.second)
5707 +               wes_foreach (label_map::value_type &l, m.second)
5708                 {
5709                         l.second->calculate_shroud();
5710                 }
5711 diff -ur wesnoth-1.10.3.orig/src/menu_events.cpp wesnoth-1.10.3/src/menu_events.cpp
5712 --- wesnoth-1.10.3.orig/src/menu_events.cpp     2012-05-11 23:38:28.000000000 +0200
5713 +++ wesnoth-1.10.3/src/menu_events.cpp  2012-07-11 13:16:05.956600024 +0200
5714 @@ -863,7 +863,7 @@
5715  
5716  
5717         DBG_WB <<"menu_handler::recall: Contents of wb-modified recall list:\n";
5718 -       foreach(const unit* unit, recall_list_team)
5719 +       wes_foreach(const unit* unit, recall_list_team)
5720         {
5721                 DBG_WB << unit->name() << " [" << unit->id() <<"]\n";
5722         }
5723 @@ -896,7 +896,7 @@
5724         options.push_back(heading.str());
5725         options_to_filter.push_back(options.back());
5726  
5727 -       foreach (const unit* u, recall_list_team)
5728 +       wes_foreach (const unit* u, recall_list_team)
5729         {
5730                 std::stringstream option, option_to_filter;
5731                 std::string name = u->name();
5732 @@ -933,7 +933,7 @@
5733                 option_to_filter << u->type_name() << " " << name << " " << u->level();
5734  
5735                 option << COLUMN_SEPARATOR;
5736 -               foreach (const t_string& trait, u->trait_names()) {
5737 +               wes_foreach (const t_string& trait, u->trait_names()) {
5738                         option << trait << '\n';
5739                         option_to_filter << " " << trait;
5740                 }
5741 @@ -1540,7 +1540,7 @@
5742                                                                 _("Type");
5743         options.push_back(heading);
5744  
5745 -       foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
5746 +       wes_foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types())
5747         {
5748                 std::stringstream row;
5749  
5750 @@ -2047,7 +2047,7 @@
5751                 std::vector<std::string> get_commands_list() const
5752                 {
5753                         std::vector<std::string> res;
5754 -                       foreach(typename command_map::value_type i, command_map_) {
5755 +                       wes_foreach(typename command_map::value_type i, command_map_) {
5756                                 res.push_back(i.first);
5757                         }
5758                         return res;
5759 @@ -2638,7 +2638,7 @@
5760  
5761                         if (const config &alias_list = preferences::get_alias())
5762                         {
5763 -                               foreach (const config::attribute &a, alias_list.attribute_range()) {
5764 +                               wes_foreach (const config::attribute &a, alias_list.attribute_range()) {
5765                                         register_alias(a.second, a.first);
5766                                 }
5767                         }
5768 @@ -3241,7 +3241,7 @@
5769         tile->rebuild_cache(tod_id, &tile_logs);
5770  
5771         int order = 1;
5772 -       foreach(const terrain_builder::tile::log_details det, tile_logs) {
5773 +       wes_foreach(const terrain_builder::tile::log_details det, tile_logs) {
5774                 const terrain_builder::tile::rule_image_rand& ri = *det.first;
5775                 const terrain_builder::rule_image_variant& variant = *det.second;
5776  
5777 @@ -3356,7 +3356,7 @@
5778  void console_handler::do_choose_level() {
5779         std::vector<std::string> options;
5780         int next = 0, nb = 0;
5781 -       foreach (const config &sc, menu_handler_.game_config_.child_range("scenario"))
5782 +       wes_foreach (const config &sc, menu_handler_.game_config_.child_range("scenario"))
5783         {
5784                 const std::string &id = sc["id"];
5785                 options.push_back(id);
5786 @@ -3367,7 +3367,7 @@
5787         // find scenarios of multiplayer campaigns
5788         // (assumes that scenarios are ordered properly in the game_config)
5789         std::string& scenario = menu_handler_.gamestate_.mp_settings().mp_scenario;
5790 -       foreach (const config &mp, menu_handler_.game_config_.child_range("multiplayer"))
5791 +       wes_foreach (const config &mp, menu_handler_.game_config_.child_range("multiplayer"))
5792         {
5793                 if (mp["id"] == scenario)
5794                 {
5795 @@ -3596,7 +3596,7 @@
5796         }
5797  }*/
5798  void console_handler::do_discover() {
5799 -       foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types()) {
5800 +       wes_foreach (const unit_type_data::unit_type_map::value_type &i, unit_types.types()) {
5801                 preferences::encountered_units().insert(i.second.id());
5802         }
5803  }
5804 diff -ur wesnoth-1.10.3.orig/src/mouse_events.cpp wesnoth-1.10.3/src/mouse_events.cpp
5805 --- wesnoth-1.10.3.orig/src/mouse_events.cpp    2012-05-12 19:07:34.000000000 +0200
5806 +++ wesnoth-1.10.3/src/mouse_events.cpp 2012-07-11 13:16:05.999933356 +0200
5807 @@ -1040,7 +1040,7 @@
5808  
5809         map_location adj[6];
5810         get_adjacent_tiles(loc, adj);
5811 -       foreach (const map_location &aloc, adj) {
5812 +       wes_foreach (const map_location &aloc, adj) {
5813                 unit_map::const_iterator i = find_unit(aloc);
5814                 if (i != units_.end() && uteam.is_enemy(i->side()))
5815                         res.insert(aloc);
5816 @@ -1055,7 +1055,7 @@
5817  
5818         map_location adj[6];
5819         get_adjacent_tiles(u->get_location(), adj);
5820 -       foreach (const map_location &loc, adj)
5821 +       wes_foreach (const map_location &loc, adj)
5822         {
5823                 if (!map_.on_board(loc)) continue;
5824                 unit_map::const_iterator i = units_.find(loc);
5825 diff -ur wesnoth-1.10.3.orig/src/multiplayer_connect.cpp wesnoth-1.10.3/src/multiplayer_connect.cpp
5826 --- wesnoth-1.10.3.orig/src/multiplayer_connect.cpp     2012-01-07 17:23:59.000000000 +0100
5827 +++ wesnoth-1.10.3/src/multiplayer_connect.cpp  2012-07-11 13:16:05.966600026 +0200
5828 @@ -189,7 +189,7 @@
5829                 // Hack: if there is a unit which can recruit, use it as a leader.
5830                 // Necessary to display leader information when loading saves.
5831                 std::string leader_type;
5832 -               foreach (const config &side_unit, cfg.child_range("unit"))
5833 +               wes_foreach (const config &side_unit, cfg.child_range("unit"))
5834                 {
5835                         if (side_unit["canrecruit"].to_bool()) {
5836                                 leader_type = side_unit["type"].str();
5837 @@ -539,7 +539,7 @@
5838         std::vector<ai::description*> &ais_list = parent_->ai_algorithms_;
5839         std::vector<std::string> ais;
5840         int i = 0;
5841 -       foreach (const ai::description *desc,  ais_list){
5842 +       wes_foreach (const ai::description *desc,  ais_list){
5843                 ais.push_back(desc->text);
5844                 if (desc->id==ai_algorithm_){
5845                         sel = i;
5846 @@ -557,7 +557,7 @@
5847  void connect::side::update_faction_combo()
5848  {
5849         std::vector<std::string> factions;
5850 -       foreach (const config *faction, parent_->era_sides_)
5851 +       wes_foreach (const config *faction, parent_->era_sides_)
5852         {
5853                 const std::string& name = (*faction)["name"];
5854                 const std::string& icon = (*faction)["image"];
5855 @@ -724,7 +724,7 @@
5856                 static char const *attrs[] = { "side", "controller", "id",
5857                         "team_name", "user_team_name", "color", "colour", "gold",
5858                         "income", "allow_changes" };
5859 -               foreach (const char *attr, attrs) {
5860 +               wes_foreach (const char *attr, attrs) {
5861                         trimmed.remove_attribute(attr);
5862                 }
5863  
5864 @@ -827,8 +827,8 @@
5865  {
5866         std::map<std::string, config> children;
5867  
5868 -       foreach(const std::string& children_to_swap, get_children_to_swap())
5869 -               foreach(const config& child, cfg_.child_range(children_to_swap))
5870 +       wes_foreach(const std::string& children_to_swap, get_children_to_swap())
5871 +               wes_foreach(const config& child, cfg_.child_range(children_to_swap))
5872                         children.insert(std::pair<std::string, config>(children_to_swap, child));
5873  
5874         return children;
5875 @@ -836,12 +836,12 @@
5876  
5877  void connect::side::set_side_children(std::map<std::string, config> children)
5878  {
5879 -       foreach(const std::string& children_to_remove, get_children_to_swap())
5880 +       wes_foreach(const std::string& children_to_remove, get_children_to_swap())
5881                 cfg_.clear_children(children_to_remove);
5882  
5883         std::pair<std::string, config> child_map;
5884  
5885 -       foreach(child_map, children)
5886 +       wes_foreach(child_map, children)
5887                 cfg_.add_child(child_map.first, child_map.second);
5888  }
5889  
5890 @@ -920,7 +920,7 @@
5891                 // Builds the list of sides eligible for choice (nonrandom factions)
5892                 std::vector<int> nonrandom_sides;
5893                 int num = -1;
5894 -               foreach (const config *i, parent_->era_sides_)
5895 +               wes_foreach (const config *i, parent_->era_sides_)
5896                 {
5897                         ++num;
5898                         if (!(*i)["random_faction"].to_bool()) {
5899 @@ -1524,7 +1524,7 @@
5900         player_types_.push_back(_("Computer Player"));
5901         player_types_.push_back(_("Empty"));
5902  
5903 -       foreach (const config *faction, era_sides_) {
5904 +       wes_foreach (const config *faction, era_sides_) {
5905                 player_factions_.push_back((*faction)["name"]);
5906         }
5907  
5908 @@ -1539,7 +1539,7 @@
5909         // Teams
5910         if(params_.use_map_settings) {
5911                 int side_num = 1;
5912 -               foreach (config &side, sides)
5913 +               wes_foreach (config &side, sides)
5914                 {
5915                         config::attribute_value &team_name = side["team_name"];
5916                         config::attribute_value &user_team_name = side["user_team_name"];
5917 @@ -1566,7 +1566,7 @@
5918         } else {
5919                 std::vector<std::string> map_team_names;
5920                 int _side_num = 1;
5921 -               foreach (config &side, sides)
5922 +               wes_foreach (config &side, sides)
5923                 {
5924                         const std::string side_num = lexical_cast<std::string>(_side_num);
5925                         config::attribute_value &team_name = side["team_name"];
5926 @@ -1599,7 +1599,7 @@
5927  
5928         // Populates "sides_" from the level configuration
5929         int index = 0;
5930 -       foreach (const config &s, sides) {
5931 +       wes_foreach (const config &s, sides) {
5932                 sides_.push_back(side(*this, s, index++));
5933         }
5934         int offset=0;
5935 @@ -1683,7 +1683,7 @@
5936         else
5937         {
5938                 era_sides_.clear();
5939 -               foreach (const config &e, era_cfg.child_range("multiplayer_side")) {
5940 +               wes_foreach (const config &e, era_cfg.child_range("multiplayer_side")) {
5941                         era_sides_.push_back(&e);
5942                 }
5943                 level_.add_child("era", era_cfg);
5944 @@ -1789,7 +1789,7 @@
5945          * creative in what is used in multiplayer [1] so use a simpler test now.
5946          * [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=568029
5947          */
5948 -       foreach(const side& s, sides_) {
5949 +       wes_foreach(const side& s, sides_) {
5950                 if(s.get_controller() != CNTR_EMPTY) {
5951                         if(s.allow_player()) {
5952                                 return true;
5953 diff -ur wesnoth-1.10.3.orig/src/multiplayer.cpp wesnoth-1.10.3/src/multiplayer.cpp
5954 --- wesnoth-1.10.3.orig/src/multiplayer.cpp     2012-01-07 03:35:17.000000000 +0100
5955 +++ wesnoth-1.10.3/src/multiplayer.cpp  2012-07-11 13:16:05.993266689 +0200
5956 @@ -573,7 +573,7 @@
5957         while (true) {
5958                 const config &cfg = game_config.child("lobby_music");
5959                 if (cfg) {
5960 -                       foreach (const config &i, cfg.child_range("music")) {
5961 +                       wes_foreach (const config &i, cfg.child_range("music")) {
5962                                 sound::play_music_config(i);
5963                         }
5964                         sound::commit_music_changes();
5965 diff -ur wesnoth-1.10.3.orig/src/multiplayer_create.cpp wesnoth-1.10.3/src/multiplayer_create.cpp
5966 --- wesnoth-1.10.3.orig/src/multiplayer_create.cpp      2012-05-03 06:03:41.000000000 +0200
5967 +++ wesnoth-1.10.3/src/multiplayer_create.cpp   2012-07-11 13:16:05.969933358 +0200
5968 @@ -127,7 +127,7 @@
5969  
5970         // Standard maps
5971         i = 0;
5972 -       foreach (const config &j, cfg.child_range("multiplayer"))
5973 +       wes_foreach (const config &j, cfg.child_range("multiplayer"))
5974         {
5975                 if (j["allow_new_game"].to_bool(true))
5976                 {
5977 @@ -217,7 +217,7 @@
5978  
5979         // The possible eras to play
5980         std::vector<std::string> eras;
5981 -       foreach (const config &er, cfg.child_range("era")) {
5982 +       wes_foreach (const config &er, cfg.child_range("era")) {
5983                 eras.push_back(er["name"]);
5984         }
5985         if(eras.empty()) {
5986 @@ -547,7 +547,7 @@
5987                 }
5988  
5989                 int nsides = 0;
5990 -               foreach (const config &k, parameters_.scenario_data.child_range("side")) {
5991 +               wes_foreach (const config &k, parameters_.scenario_data.child_range("side")) {
5992                         if (k["allow_player"].to_bool(true)) ++nsides;
5993                 }
5994  
5995 diff -ur wesnoth-1.10.3.orig/src/multiplayer_lobby.cpp wesnoth-1.10.3/src/multiplayer_lobby.cpp
5996 --- wesnoth-1.10.3.orig/src/multiplayer_lobby.cpp       2011-11-16 04:42:09.000000000 +0100
5997 +++ wesnoth-1.10.3/src/multiplayer_lobby.cpp    2012-07-11 13:16:06.026600024 +0200
5998 @@ -424,7 +424,7 @@
5999  
6000         games_.clear();
6001  
6002 -       foreach (const config &game, cfg.child("gamelist").child_range("game"))
6003 +       wes_foreach (const config &game, cfg.child("gamelist").child_range("game"))
6004         {
6005                 bool verified = true;
6006                 games_.push_back(game_item());
6007 @@ -502,7 +502,7 @@
6008                                 if (map_hashes_ && !games_.back().reloaded) {
6009                                         std::string hash = game["hash"];
6010                                         bool hash_found = false;
6011 -                                       foreach (const config::attribute &i, map_hashes_.attribute_range()) {
6012 +                                       wes_foreach (const config::attribute &i, map_hashes_.attribute_range()) {
6013                                                 if (i.first == game["mp_scenario"] && i.second == hash) {
6014                                                         hash_found = true;
6015                                                         break;
6016 @@ -639,7 +639,7 @@
6017  
6018      if(preferences::fi_friends_in_game()) {
6019          bool found_friend = false;
6020 -        foreach(const config &user, cfg.child_range("user")) {
6021 +        wes_foreach(const config &user, cfg.child_range("user")) {
6022              if(preferences::is_friend(user["name"]) && user["game_id"] == i.id) {
6023                  found_friend = true;
6024                  break;
6025 @@ -650,7 +650,7 @@
6026  
6027      if(!preferences::fi_text().empty()) {
6028          bool found_match = true;
6029 -        foreach(const std::string& search_string, utils::split(preferences::fi_text(), ' ', utils::STRIP_SPACES)) {
6030 +        wes_foreach(const std::string& search_string, utils::split(preferences::fi_text(), ' ', utils::STRIP_SPACES)) {
6031              if(std::search(i.map_info.begin(), i.map_info.end(), search_string.begin(), search_string.end(), chars_equal_insensitive) == i.map_info.end() &&
6032                      std::search(i.name.begin(), i.name.end(), search_string.begin(), search_string.end(), chars_equal_insensitive) == i.name.end()) {
6033                  found_match = false;
6034 diff -ur wesnoth-1.10.3.orig/src/multiplayer_ui.cpp wesnoth-1.10.3/src/multiplayer_ui.cpp
6035 --- wesnoth-1.10.3.orig/src/multiplayer_ui.cpp  2012-01-07 03:35:17.000000000 +0100
6036 +++ wesnoth-1.10.3/src/multiplayer_ui.cpp       2012-07-11 13:16:05.979933358 +0200
6037 @@ -163,9 +163,9 @@
6038                         state.starting_pos.child_range("side");
6039                 config::const_child_itors level_sides = level.child_range("side");
6040  
6041 -               foreach (config &side, saved_sides)
6042 +               wes_foreach (config &side, saved_sides)
6043                 {
6044 -                       foreach (const config &lside, level_sides)
6045 +                       wes_foreach (const config &lside, level_sides)
6046                         {
6047                                 if (side["side"] == lside["side"] &&
6048                                                 (side["current_player"] != lside["current_player"] ||
6049 @@ -599,7 +599,7 @@
6050                 if (const config &ms = c.child("members")) {
6051                         std::stringstream ss;
6052                         ss << "Room " << c["room"].str() << " members: ";
6053 -                       foreach (const config& m, ms.child_range("member")) {
6054 +                       wes_foreach (const config& m, ms.child_range("member")) {
6055                                 ss << m["name"] << " ";
6056                         }
6057                         chat_.add_message(time(NULL), "server", ss.str());
6058 @@ -608,7 +608,7 @@
6059                 if (const config &rs = c.child("rooms")) {
6060                         std::stringstream ss;
6061                         ss << "Rooms: ";
6062 -                       foreach (const config& r, rs.child_range("room")) {
6063 +                       wes_foreach (const config& r, rs.child_range("room")) {
6064                                 ss << r["name"].str() << "(" << r["size"].str() << ") ";
6065                         }
6066                         chat_.add_message(time(NULL), "server", ss.str());
6067 @@ -706,7 +706,7 @@
6068  {
6069         std::list<user_info> u_list;
6070  
6071 -       foreach (const config &user, gamelist_.child_range("user"))
6072 +       wes_foreach (const config &user, gamelist_.child_range("user"))
6073         {
6074                 user_info u_elem;
6075                 u_elem.name = user["name"].str();
6076 @@ -848,12 +848,12 @@
6077         }
6078  
6079         int res = -1, index = 0, best_score = 0;
6080 -       foreach (const config *faction, fl)
6081 +       wes_foreach (const config *faction, fl)
6082         {
6083                 int faction_score = 0;
6084                 std::vector<std::string> recruit = utils::split((*faction)[search_field]);
6085 -               foreach (const std::string &search, find) {
6086 -                       foreach (const std::string &r, recruit) {
6087 +               wes_foreach (const std::string &search, find) {
6088 +                       wes_foreach (const std::string &r, recruit) {
6089                                 if (r == search) {
6090                                         ++faction_score;
6091                                         break;
6092 diff -ur wesnoth-1.10.3.orig/src/multiplayer_wait.cpp wesnoth-1.10.3/src/multiplayer_wait.cpp
6093 --- wesnoth-1.10.3.orig/src/multiplayer_wait.cpp        2012-01-07 03:35:17.000000000 +0100
6094 +++ wesnoth-1.10.3/src/multiplayer_wait.cpp     2012-07-11 13:16:05.973266690 +0200
6095 @@ -222,7 +222,7 @@
6096                 //available side.
6097                 const config *side_choice = NULL;
6098                 int side_num = -1, nb_sides = 0;
6099 -               foreach (const config &sd, level_.child_range("side"))
6100 +               wes_foreach (const config &sd, level_.child_range("side"))
6101                 {
6102                         if (sd["controller"] == "reserved" && sd["current_player"] == preferences::login())
6103                         {
6104 @@ -275,7 +275,7 @@
6105                                 color = game_config::color_info(color_str).index() - 1;
6106  
6107                         std::vector<const config *> leader_sides;
6108 -                       foreach (const config &side, possible_sides) {
6109 +                       wes_foreach (const config &side, possible_sides) {
6110                                 leader_sides.push_back(&side);
6111                         }
6112  
6113 @@ -287,7 +287,7 @@
6114                         }
6115  
6116                         std::vector<std::string> choices;
6117 -                       foreach (const config *s, leader_sides)
6118 +                       wes_foreach (const config *s, leader_sides)
6119                         {
6120                                 const config &side = *s;
6121                                 const std::string &name = side["name"];
6122 @@ -442,7 +442,7 @@
6123         std::vector<std::string> details;
6124         std::vector<std::string> playerlist;
6125  
6126 -       foreach (const config &sd, level_.child_range("side"))
6127 +       wes_foreach (const config &sd, level_.child_range("side"))
6128         {
6129                 if (!sd["allow_player"].to_bool(true)) {
6130                         continue;
6131 @@ -458,7 +458,7 @@
6132                 // Hack: if there is a unit which can recruit, use it as a
6133                 // leader. Necessary to display leader information when loading
6134                 // saves.
6135 -               foreach (const config &side_unit, sd.child_range("unit"))
6136 +               wes_foreach (const config &side_unit, sd.child_range("unit"))
6137                 {
6138                         if (side_unit["canrecruit"].to_bool()) {
6139                                 leader_type = side_unit["type"].str();
6140 diff -ur wesnoth-1.10.3.orig/src/pathfind/pathfind.cpp wesnoth-1.10.3/src/pathfind/pathfind.cpp
6141 --- wesnoth-1.10.3.orig/src/pathfind/pathfind.cpp       2012-01-07 03:35:17.000000000 +0100
6142 +++ wesnoth-1.10.3/src/pathfind/pathfind.cpp    2012-07-11 13:16:05.983266692 +0200
6143 @@ -59,7 +59,7 @@
6144                 std::set<map_location> tiles_checking;
6145                 tiles_checking.swap(pending_tiles_to_check);
6146                 //Iterate over all the hexes we need to check
6147 -               foreach (const map_location &loc, tiles_checking)
6148 +               wes_foreach (const map_location &loc, tiles_checking)
6149                 {
6150                         //If this area is not a castle but should, skip it.
6151                         if (vacancy == pathfind::VACANT_CASTLE && !map.is_castle(loc)) continue;
6152 @@ -76,7 +76,7 @@
6153                         if (units.find(loc) == units.end() && !pass_check_and_unreachable) return loc;
6154                         map_location adjs[6];
6155                         get_adjacent_tiles(loc,adjs);
6156 -                       foreach (const map_location &loc, adjs)
6157 +                       wes_foreach (const map_location &loc, adjs)
6158                         {
6159                                 if (!map.on_board(loc)) continue;
6160                                 // Add the tile to be checked if it hasn't already been and
6161 diff -ur wesnoth-1.10.3.orig/src/pathfind/teleport.cpp wesnoth-1.10.3/src/pathfind/teleport.cpp
6162 --- wesnoth-1.10.3.orig/src/pathfind/teleport.cpp       2011-10-10 04:43:29.000000000 +0200
6163 +++ wesnoth-1.10.3/src/pathfind/teleport.cpp    2012-07-11 13:16:05.983266692 +0200
6164 @@ -108,16 +108,16 @@
6165         , targets_()
6166  {
6167  
6168 -       foreach(const teleport_group& group, groups) {
6169 +       wes_foreach(const teleport_group& group, groups) {
6170  
6171                 teleport_pair locations;
6172                 group.get_teleport_pair(locations, u, ignore_units);
6173                 if (!see_all && !group.always_visible() && viewing_team.is_enemy(u.side())) {
6174                         teleport_pair filter_locs;
6175 -                       foreach(const map_location &loc, locations.first)
6176 +                       wes_foreach(const map_location &loc, locations.first)
6177                                 if(!viewing_team.fogged(loc))
6178                                         filter_locs.first.insert(loc);
6179 -                       foreach(const map_location &loc, locations.second)
6180 +                       wes_foreach(const map_location &loc, locations.second)
6181                                 if(!viewing_team.fogged(loc))
6182                                         filter_locs.second.insert(loc);
6183                         locations.first.swap(filter_locs.first);
6184 diff -ur wesnoth-1.10.3.orig/src/persist_manager.cpp wesnoth-1.10.3/src/persist_manager.cpp
6185 --- wesnoth-1.10.3.orig/src/persist_manager.cpp 2012-01-07 03:35:17.000000000 +0100
6186 +++ wesnoth-1.10.3/src/persist_manager.cpp      2012-07-11 13:16:06.036600021 +0200
6187 @@ -36,7 +36,7 @@
6188  bool persist_manager::start_transaction() {
6189         if (in_transaction_) return false;
6190         bool result = true;
6191 -       foreach (context_map::reference ctx, contexts_){
6192 +       wes_foreach (context_map::reference ctx, contexts_){
6193                 result &= ctx.second->start_transaction();
6194         }
6195         in_transaction_ = true;
6196 @@ -46,7 +46,7 @@
6197  bool persist_manager::end_transaction() {
6198         if (!in_transaction_) return false;
6199         bool result = true;
6200 -       foreach (context_map::reference ctx, contexts_){
6201 +       wes_foreach (context_map::reference ctx, contexts_){
6202                 result &= ctx.second->end_transaction();
6203         }
6204         in_transaction_ = !result;
6205 @@ -56,7 +56,7 @@
6206  bool persist_manager::cancel_transaction() {
6207         if (!in_transaction_) return false;
6208         bool result = true;
6209 -       foreach (context_map::reference ctx, contexts_){
6210 +       wes_foreach (context_map::reference ctx, contexts_){
6211                 result &= ctx.second->cancel_transaction();
6212         }
6213         in_transaction_ = false;
6214 diff -ur wesnoth-1.10.3.orig/src/playcampaign.cpp wesnoth-1.10.3/src/playcampaign.cpp
6215 --- wesnoth-1.10.3.orig/src/playcampaign.cpp    2012-01-07 03:35:17.000000000 +0100
6216 +++ wesnoth-1.10.3/src/playcampaign.cpp 2012-07-11 13:16:06.033266689 +0200
6217 @@ -260,7 +260,7 @@
6218         controller_map controllers;
6219  
6220         if(io_type == IO_SERVER) {
6221 -               foreach (config &side, const_cast<config *>(scenario)->child_range("side"))
6222 +               wes_foreach (config &side, const_cast<config *>(scenario)->child_range("side"))
6223                 {
6224                         if (side["current_player"] == preferences::login()) {
6225                                 side["controller"] = preferences::client_type();
6226 @@ -280,7 +280,7 @@
6227                                 scenario = &starting_pos;
6228                         }
6229  
6230 -                       foreach (config &side, starting_pos.child_range("side"))
6231 +                       wes_foreach (config &side, starting_pos.child_range("side"))
6232                         {
6233                                 if (side["current_player"] == preferences::login()) {
6234                                         side["controller"] = preferences::client_type();
6235 @@ -474,7 +474,7 @@
6236  
6237                         if(io_type == IO_SERVER && scenario != NULL) {
6238                                 // Tweaks sides to adapt controllers and descriptions.
6239 -                               foreach (config &side, starting_pos.child_range("side"))
6240 +                               wes_foreach (config &side, starting_pos.child_range("side"))
6241                                 {
6242                                         std::string id = side["save_id"];
6243                                         if(id.empty()) {
6244 @@ -547,7 +547,7 @@
6245                                 next_cfg.add_child("replay_start", gamestate.starting_pos);
6246                                 //move side information from gamestate into the config that is sent to the other clients
6247                                 next_cfg.clear_children("side");
6248 -                               foreach (config& side, gamestate.starting_pos.child_range("side"))
6249 +                               wes_foreach (config& side, gamestate.starting_pos.child_range("side"))
6250                                         next_cfg.add_child("side", side);
6251  
6252                                 network::send_data(cfg, 0);
6253 diff -ur wesnoth-1.10.3.orig/src/play_controller.cpp wesnoth-1.10.3/src/play_controller.cpp
6254 --- wesnoth-1.10.3.orig/src/play_controller.cpp 2012-01-18 01:43:13.000000000 +0100
6255 +++ wesnoth-1.10.3/src/play_controller.cpp      2012-07-11 13:16:05.973266690 +0200
6256 @@ -173,7 +173,7 @@
6257                 place_sides_in_preferred_locations();
6258         }
6259  
6260 -       foreach (const config &t, level_.child_range("time_area")) {
6261 +       wes_foreach (const config &t, level_.child_range("time_area")) {
6262                 tod_manager_.add_time_area(t);
6263         }
6264  
6265 @@ -192,7 +192,7 @@
6266         std::vector<team_builder_ptr> team_builders;
6267  
6268         int team_num = 0;
6269 -       foreach (const config &side, level_.child_range("side"))
6270 +       wes_foreach (const config &side, level_.child_range("side"))
6271         {
6272                 std::string save_id = get_unique_saveid(side, seen_save_ids);
6273                 seen_save_ids.insert(save_id);
6274 @@ -212,7 +212,7 @@
6275                 team_builders.push_back(tb_ptr);
6276         }
6277  
6278 -       foreach (team_builder_ptr tb_ptr, team_builders)
6279 +       wes_foreach (team_builder_ptr tb_ptr, team_builders)
6280         {
6281                 gamestate_.build_team_stage_two(tb_ptr);
6282         }
6283 @@ -337,7 +337,7 @@
6284         int num_pos = map_.num_valid_starting_positions();
6285  
6286         int side_num = 1;
6287 -       foreach (const config &side, level_.child_range("side"))
6288 +       wes_foreach (const config &side, level_.child_range("side"))
6289         {
6290                 for(int p = 1; p <= num_pos; ++p) {
6291                         const map_location& pos = map_.starting_position(p);
6292 @@ -703,7 +703,7 @@
6293         }
6294  
6295         // Write terrain_graphics data in snapshot, too
6296 -       foreach (const config &tg, level_.child_range("terrain_graphics")) {
6297 +       wes_foreach (const config &tg, level_.child_range("terrain_graphics")) {
6298                 cfg.add_child("terrain_graphics", tg);
6299         }
6300  
6301 @@ -914,7 +914,7 @@
6302         switch(mode) {
6303         case gui::TEXTBOX_SEARCH:
6304         {
6305 -               foreach (const unit &u, units_){
6306 +               wes_foreach (const unit &u, units_){
6307                         const map_location& loc = u.get_location();
6308                         if(!gui_->fogged(loc) &&
6309                                         !(teams_[gui_->viewing_team()].is_enemy(u.side()) && u.invisible(loc)))
6310 @@ -931,13 +931,13 @@
6311         }
6312         case gui::TEXTBOX_MESSAGE:
6313         {
6314 -               foreach(const team& t, teams_) {
6315 +               wes_foreach(const team& t, teams_) {
6316                         if(!t.is_empty())
6317                                 dictionary.insert(t.current_player());
6318                 }
6319  
6320                 // Add observers
6321 -               foreach(const std::string& o, gui_->observers()){
6322 +               wes_foreach(const std::string& o, gui_->observers()){
6323                         dictionary.insert(o);
6324                 }
6325                 //Exclude own nick from tab-completion.
6326 @@ -1341,7 +1341,7 @@
6327  
6328         if (non_interactive()) {
6329                 std::cout << "winner: ";
6330 -               foreach (unsigned l, seen_leaders) {
6331 +               wes_foreach (unsigned l, seen_leaders) {
6332                         std::string ai = ai::manager::get_active_ai_identifier_for_side(l);
6333                         if (ai.empty()) ai = "default ai";
6334                         std::cout << l << " (using " << ai << ") ";
6335 diff -ur wesnoth-1.10.3.orig/src/playmp_controller.cpp wesnoth-1.10.3/src/playmp_controller.cpp
6336 --- wesnoth-1.10.3.orig/src/playmp_controller.cpp       2012-01-18 01:18:09.000000000 +0100
6337 +++ wesnoth-1.10.3/src/playmp_controller.cpp    2012-07-11 13:16:06.029933357 +0200
6338 @@ -326,7 +326,7 @@
6339         // stay stuck in linger state when the *next* scenario is over.
6340         gamestate_.classification().completion = "running";
6341         // End all unit moves
6342 -       foreach (unit &u, units_) {
6343 +       wes_foreach (unit &u, units_) {
6344                 u.set_user_end_turn(true);
6345         }
6346         //current_team().set_countdown_time(0);
6347 diff -ur wesnoth-1.10.3.orig/src/playsingle_controller.cpp wesnoth-1.10.3/src/playsingle_controller.cpp
6348 --- wesnoth-1.10.3.orig/src/playsingle_controller.cpp   2012-05-17 22:19:01.000000000 +0200
6349 +++ wesnoth-1.10.3/src/playsingle_controller.cpp        2012-07-11 13:16:05.983266692 +0200
6350 @@ -324,7 +324,7 @@
6351         LOG_NG << "in playsingle_controller::play_scenario()...\n";
6352  
6353         // Start music.
6354 -       foreach (const config &m, level_.child_range("music")) {
6355 +       wes_foreach (const config &m, level_.child_range("music")) {
6356                 sound::play_music_config(m);
6357         }
6358         sound::commit_music_changes();
6359 @@ -336,7 +336,7 @@
6360  
6361         // Read sound sources
6362         assert(soundsources_manager_ != NULL);
6363 -       foreach (const config &s, level_.child_range("sound_source")) {
6364 +       wes_foreach (const config &s, level_.child_range("sound_source")) {
6365                 soundsource::sourcespec spec(s);
6366                 soundsources_manager_->add(spec);
6367         }
6368 @@ -906,14 +906,14 @@
6369                         new_side["previous_recruits"] = can_recruit_str;
6370                         LOG_NG << "stored side in snapshot:\n" << new_side["save_id"] << std::endl;
6371                         //add the units of the recall list
6372 -                       foreach(const unit& u, i->recall_list()) {
6373 +                       wes_foreach(const unit& u, i->recall_list()) {
6374                                 config& new_unit = new_side.add_child("unit");
6375                                 u.write(new_unit);
6376                         }
6377                 }
6378         }
6379         //add any players from starting_pos that do not have a team in the current scenario
6380 -       foreach (const config &player_cfg, gamestate_.starting_pos.child_range("player")) {
6381 +       wes_foreach (const config &player_cfg, gamestate_.starting_pos.child_range("player")) {
6382                 if (side_ids.count(player_cfg["save_id"]) == 0) {
6383                         LOG_NG << "stored inactive side in snapshot:\n" << player_cfg["save_id"] << std::endl;
6384                         gamestate_.snapshot.add_child("side", player_cfg);
6385 @@ -938,7 +938,7 @@
6386         }
6387  
6388         int persistent_teams = 0;
6389 -       foreach (const team &t, teams_) {
6390 +       wes_foreach (const team &t, teams_) {
6391                 if (t.persistent()) ++persistent_teams;
6392         }
6393  
6394 @@ -953,7 +953,7 @@
6395                 int turns_left = std::max<int>(0, tod_manager_.number_of_turns() - turn());
6396                 int finishing_bonus = (end_level.gold_bonus && turns_left > -1) ?
6397                         finishing_bonus_per_turn * turns_left : 0;
6398 -               foreach (const team &t, teams_)
6399 +               wes_foreach (const team &t, teams_)
6400                 {
6401                         if (!t.persistent()) continue;
6402                         int carryover_gold = div100rounded((t.gold() + finishing_bonus) * end_level.carryover_percentage);
6403 diff -ur wesnoth-1.10.3.orig/src/playturn.cpp wesnoth-1.10.3/src/playturn.cpp
6404 --- wesnoth-1.10.3.orig/src/playturn.cpp        2012-01-07 03:35:17.000000000 +0100
6405 +++ wesnoth-1.10.3/src/playturn.cpp     2012-07-11 13:16:05.979933358 +0200
6406 @@ -124,11 +124,11 @@
6407                                 preferences::message_bell());
6408         }
6409  
6410 -       foreach (const config &ob, cfg.child_range("observer")) {
6411 +       wes_foreach (const config &ob, cfg.child_range("observer")) {
6412                 resources::screen->add_observer(ob["name"]);
6413         }
6414  
6415 -       foreach (const config &ob, cfg.child_range("observer_quit")) {
6416 +       wes_foreach (const config &ob, cfg.child_range("observer_quit")) {
6417                 resources::screen->remove_observer(ob["name"]);
6418         }
6419  
6420 @@ -147,7 +147,7 @@
6421         const config& change = cfg.child_or_empty("change_controller");
6422         const std::string& side_drop = cfg["side_drop"].str();
6423  
6424 -       foreach (const config &t, turns)
6425 +       wes_foreach (const config &t, turns)
6426         {
6427                 handle_turn(turn_end, t, skip_replay, backlog);
6428         }
6429 @@ -240,7 +240,7 @@
6430                         options.push_back(_("Abort game"));
6431  
6432                         //get all observers in as options to transfer control
6433 -                       foreach (const std::string &ob, resources::screen->observers())
6434 +                       wes_foreach (const std::string &ob, resources::screen->observers())
6435                         {
6436                                 t_vars["player"] = ob;
6437                                 options.push_back(vgettext("Replace with $player", t_vars));
6438 @@ -248,7 +248,7 @@
6439                         }
6440  
6441                         //get all allies in as options to transfer control
6442 -                       foreach (team &t, *resources::teams)
6443 +                       wes_foreach (team &t, *resources::teams)
6444                         {
6445                                 if (!t.is_enemy(side) && !t.is_human() && !t.is_ai() && !t.is_empty()
6446                                         && t.current_player() != tm.current_player())
6447 diff -ur wesnoth-1.10.3.orig/src/preferences_display.cpp wesnoth-1.10.3/src/preferences_display.cpp
6448 --- wesnoth-1.10.3.orig/src/preferences_display.cpp     2012-01-07 03:35:17.000000000 +0100
6449 +++ wesnoth-1.10.3/src/preferences_display.cpp  2012-07-11 13:16:05.989933357 +0200
6450 @@ -82,7 +82,7 @@
6451         bpp = video.modePossible(resolution.first, resolution.second,
6452                 DefaultBPP, video_flags, true);
6453  
6454 -       foreach (const res_t &res, res_list)
6455 +       wes_foreach (const res_t &res, res_list)
6456         {
6457                 if (bpp != 0) break;
6458                 std::cerr << "Video mode " << resolution.first << 'x'
6459 diff -ur wesnoth-1.10.3.orig/src/replay_controller.cpp wesnoth-1.10.3/src/replay_controller.cpp
6460 --- wesnoth-1.10.3.orig/src/replay_controller.cpp       2012-01-07 03:35:17.000000000 +0100
6461 +++ wesnoth-1.10.3/src/replay_controller.cpp    2012-07-11 13:16:06.236600015 +0200
6462 @@ -417,7 +417,7 @@
6463                         finish_side_turn();
6464  
6465                         // This is necessary for replays in order to show possible movements.
6466 -                       foreach (unit &u, units_) {
6467 +                       wes_foreach (unit &u, units_) {
6468                                 if (u.side() != player_number_) {
6469                                         u.new_turn();
6470                                 }
6471 diff -ur wesnoth-1.10.3.orig/src/replay.cpp wesnoth-1.10.3/src/replay.cpp
6472 --- wesnoth-1.10.3.orig/src/replay.cpp  2012-01-07 03:35:17.000000000 +0100
6473 +++ wesnoth-1.10.3/src/replay.cpp       2012-07-11 13:16:06.013266690 +0200
6474 @@ -67,7 +67,7 @@
6475                            << nunits << " according to data source. " << units.size() << " locally\n";
6476  
6477                 std::set<map_location> locs;
6478 -               foreach (const config &u, cfg.child_range("unit"))
6479 +               wes_foreach (const config &u, cfg.child_range("unit"))
6480                 {
6481                         const map_location loc(u, resources::state_of_game);
6482                         locs.insert(loc);
6483 @@ -88,7 +88,7 @@
6484                 errbuf.clear();
6485         }
6486  
6487 -       foreach (const config &un, cfg.child_range("unit"))
6488 +       wes_foreach (const config &un, cfg.child_range("unit"))
6489         {
6490                 const map_location loc(un, resources::state_of_game);
6491                 const unit_map::const_iterator u = units.find(loc);
6492 @@ -560,7 +560,7 @@
6493                 const map_location &src = steps.front();
6494                 const map_location &dst = steps.back();
6495  
6496 -               foreach (const async_cmd &ac, async_cmds)
6497 +               wes_foreach (const async_cmd &ac, async_cmds)
6498                 {
6499                         if (config &async_child = ac.cfg->child("rename")) {
6500                                 map_location aloc(async_child, resources::state_of_game);
6501 @@ -576,7 +576,7 @@
6502                         // A unit is being un-recruited or un-recalled.
6503                         // Remove unsynced commands that would act on that unit.
6504                         map_location src(*chld, resources::state_of_game);
6505 -                       foreach (const async_cmd &ac, async_cmds)
6506 +                       wes_foreach (const async_cmd &ac, async_cmds)
6507                         {
6508                                 if (config &async_child = ac.cfg->child("rename"))
6509                                 {
6510 @@ -680,7 +680,7 @@
6511  
6512  void replay::add_config(const config& cfg, MARK_SENT mark)
6513  {
6514 -       foreach (const config &cmd, cfg.child_range("command"))
6515 +       wes_foreach (const config &cmd, cfg.child_range("command"))
6516         {
6517                 config &cfg = cfg_.add_child("command", cmd);
6518                 if (cfg.child("speak"))
6519 @@ -730,7 +730,7 @@
6520         if(! game_config::mp_debug) {
6521                 return;
6522         }
6523 -       foreach (const config &ch, cfg.child_range("checksum"))
6524 +       wes_foreach (const config &ch, cfg.child_range("checksum"))
6525         {
6526                 map_location loc(ch, resources::state_of_game);
6527                 unit_map::const_iterator u = resources::units->find(loc);
6528 @@ -1151,7 +1151,7 @@
6529                 }
6530                 else if (const config &child = cfg->child("fire_event"))
6531                 {
6532 -                       foreach (const config &v, child.child_range("set_variable")) {
6533 +                       wes_foreach (const config &v, child.child_range("set_variable")) {
6534                                 resources::state_of_game->set_variable(v["name"], v["value"]);
6535                         }
6536                         const std::string &event = child["raise"];
6537 diff -ur wesnoth-1.10.3.orig/src/reports.cpp wesnoth-1.10.3/src/reports.cpp
6538 --- wesnoth-1.10.3.orig/src/reports.cpp 2012-01-07 03:35:17.000000000 +0100
6539 +++ wesnoth-1.10.3/src/reports.cpp      2012-07-11 13:16:05.966600026 +0200
6540 @@ -260,7 +260,7 @@
6541         if (!u) return report();
6542         config res;
6543         typedef std::pair<std::string, std::string> pair_string;
6544 -       foreach(const pair_string &ps, u->amla_icons()) {
6545 +       wes_foreach(const pair_string &ps, u->amla_icons()) {
6546                 add_image(res, ps.first, ps.second);
6547         }
6548         return res;
6549 @@ -395,7 +395,7 @@
6550  
6551         bool att_def_diff = false;
6552         map_location displayed_unit_hex = resources::screen->displayed_unit_hex();
6553 -       foreach (const utils::string_map::value_type &resist, u->get_base_resistances())
6554 +       wes_foreach (const utils::string_map::value_type &resist, u->get_base_resistances())
6555         {
6556                 std::ostringstream line;
6557                 line << gettext(resist.first.c_str()) << ": ";
6558 @@ -415,7 +415,7 @@
6559         if (att_def_diff)
6560                 tooltip << _("(Att / Def)");
6561         tooltip << '\n';
6562 -       foreach (const std::string &line, resistances_table) {
6563 +       wes_foreach (const std::string &line, resistances_table) {
6564                 tooltip << line;
6565         }
6566         return text_report(str.str(), tooltip.str());
6567 @@ -458,7 +458,7 @@
6568         if (!u) return report();
6569         config res;
6570         typedef std::pair<std::string, std::string> pair_string;
6571 -       foreach (const pair_string &ps, u->advancement_icons()) {
6572 +       wes_foreach (const pair_string &ps, u->advancement_icons()) {
6573                 add_image(res, ps.first, ps.second);
6574         }
6575         return res;
6576 @@ -497,7 +497,7 @@
6577         bool revert = false;
6578         if (underlyings.size() != 1 || underlyings.front() != terrain)
6579         {
6580 -               foreach (const t_translation::t_terrain &t, underlyings)
6581 +               wes_foreach (const t_translation::t_terrain &t, underlyings)
6582                 {
6583                         if (t == t_translation::MINUS) {
6584                                 revert = true;
6585 @@ -641,7 +641,7 @@
6586         std::set<std::string> seen_types;
6587         const team &unit_team = (*resources::teams)[u->side() - 1];
6588         const team &viewing_team = (*resources::teams)[resources::screen->viewing_team()];
6589 -       foreach(const unit &enemy, *resources::units)
6590 +       wes_foreach(const unit &enemy, *resources::units)
6591         {
6592                 if (!unit_team.is_enemy(enemy.side()))
6593                         continue;
6594 @@ -662,7 +662,7 @@
6595         damage_multiplier += tod_bonus;
6596  
6597         typedef std::pair<int, std::set<std::string> > resist_units;
6598 -       foreach (const resist_units &resist, resistances) {
6599 +       wes_foreach (const resist_units &resist, resistances) {
6600                 int damage = round_damage(base_damage, damage_multiplier * resist.first, damage_divisor);
6601                 tooltip << "<b>" << damage << "</b>  "
6602                         << "<i>(" << utils::signed_percent(resist.first-100) << ")</i> : "
6603 @@ -755,7 +755,7 @@
6604                 }
6605         }
6606  
6607 -       foreach(const battle_context& weapon, weapons) {
6608 +       wes_foreach(const battle_context& weapon, weapons) {
6609  
6610                 // Predict the battle outcome.
6611                 combatant attacker_combatant(weapon.get_attacker_stats());
6612 @@ -869,7 +869,7 @@
6613         map_location displayed_unit_hex = resources::screen->displayed_unit_hex();
6614         config res;
6615  
6616 -       foreach (const attack_type &at, u->attacks())
6617 +       wes_foreach (const attack_type &at, u->attacks())
6618         {
6619                 attack_info(at, res, u, displayed_unit_hex);
6620         }
6621 @@ -1023,7 +1023,7 @@
6622         str << td.villages << '/';
6623         if (viewing_team.uses_shroud()) {
6624                 int unshrouded_villages = 0;
6625 -               foreach (const map_location &loc, resources::game_map->villages()) {
6626 +               wes_foreach (const map_location &loc, resources::game_map->villages()) {
6627                         if (!viewing_team.shrouded(loc))
6628                                 ++unshrouded_villages;
6629                 }
6630 @@ -1178,7 +1178,7 @@
6631  
6632         std::ostringstream str;
6633         str << _("Observers:") << '\n';
6634 -       foreach (const std::string &obs, observers) {
6635 +       wes_foreach (const std::string &obs, observers) {
6636                 str << obs << '\n';
6637         }
6638         return image_report(game_config::images::observer, str.str());
6639 @@ -1250,7 +1250,7 @@
6640  
6641  void reports::reset_generators()
6642  {
6643 -       foreach (dynamic_report_generators::value_type &rg, dynamic_generators) {
6644 +       wes_foreach (dynamic_report_generators::value_type &rg, dynamic_generators) {
6645                 delete rg.second;
6646         }
6647         dynamic_generators.clear();
6648 @@ -1283,10 +1283,10 @@
6649  const std::set<std::string> &reports::report_list()
6650  {
6651         if (!all_reports.empty()) return all_reports;
6652 -       foreach (const static_report_generators::value_type &v, static_generators) {
6653 +       wes_foreach (const static_report_generators::value_type &v, static_generators) {
6654                 all_reports.insert(v.first);
6655         }
6656 -       foreach (const dynamic_report_generators::value_type &v, dynamic_generators) {
6657 +       wes_foreach (const dynamic_report_generators::value_type &v, dynamic_generators) {
6658                 all_reports.insert(v.first);
6659         }
6660         return all_reports;
6661 diff -ur wesnoth-1.10.3.orig/src/savegame.cpp wesnoth-1.10.3/src/savegame.cpp
6662 --- wesnoth-1.10.3.orig/src/savegame.cpp        2012-03-21 02:45:39.000000000 +0100
6663 +++ wesnoth-1.10.3/src/savegame.cpp     2012-07-11 13:16:06.009933358 +0200
6664 @@ -913,7 +913,7 @@
6665         bool shrouded = false;
6666  
6667         const config& snapshot = has_snapshot ? gamestate_.snapshot : gamestate_.starting_pos;
6668 -       foreach (const config &side, snapshot.child_range("side"))
6669 +       wes_foreach (const config &side, snapshot.child_range("side"))
6670         {
6671                 if (side["controller"] != "human") {
6672                         continue;
6673 @@ -922,7 +922,7 @@
6674                         shrouded = true;
6675                 }
6676  
6677 -               foreach (const config &u, side.child_range("unit"))
6678 +               wes_foreach (const config &u, side.child_range("unit"))
6679                 {
6680                         if (u["canrecruit"].to_bool()) {
6681                                 leader = u["id"].str();
6682 @@ -960,7 +960,7 @@
6683         // if there is no scenario information in the starting pos, add the (persistent) sides from the snapshot
6684         // else do nothing, as persistence information was already added at the end of the previous scenario
6685         if (gamestate().starting_pos["id"].empty()) {
6686 -               foreach(const config &snapshot_side, gamestate().snapshot.child_range("side")) {
6687 +               wes_foreach(const config &snapshot_side, gamestate().snapshot.child_range("side")) {
6688                         //add all side tags (assuming they only contain carryover information)
6689                         gamestate().starting_pos.add_child("side", snapshot_side);
6690                 }
6691 diff -ur wesnoth-1.10.3.orig/src/scripting/lua.cpp wesnoth-1.10.3/src/scripting/lua.cpp
6692 --- wesnoth-1.10.3.orig/src/scripting/lua.cpp   2012-01-17 15:57:24.000000000 +0100
6693 +++ wesnoth-1.10.3/src/scripting/lua.cpp        2012-07-11 13:16:06.036600021 +0200
6694 @@ -87,7 +87,7 @@
6695  void extract_preload_scripts(config const &game_config)
6696  {
6697         preload_scripts.clear();
6698 -       foreach (config const &cfg, game_config.child_range("lua")) {
6699 +       wes_foreach (config const &cfg, game_config.child_range("lua")) {
6700                 preload_scripts.push_back(cfg);
6701         }
6702         preload_config = game_config.child("game_config");
6703 @@ -254,7 +254,7 @@
6704                 return;
6705  
6706         int k = 1;
6707 -       foreach (const config::any_child &ch, cfg.all_children_range())
6708 +       wes_foreach (const config::any_child &ch, cfg.all_children_range())
6709         {
6710                 lua_createtable(L, 2, 0);
6711                 lua_pushstring(L, ch.key.c_str());
6712 @@ -264,7 +264,7 @@
6713                 lua_rawseti(L, -2, 2);
6714                 lua_rawseti(L, -2, k++);
6715         }
6716 -       foreach (const config::attribute &attr, cfg.attribute_range())
6717 +       wes_foreach (const config::attribute &attr, cfg.attribute_range())
6718         {
6719                 luaW_pushscalar(L, attr.second);
6720                 lua_setfield(L, -2, attr.first.c_str());
6721 @@ -534,7 +534,7 @@
6722  {
6723         if (ptr) return ptr;
6724         if (side) {
6725 -               foreach (unit &u, (*resources::teams)[side - 1].recall_list()) {
6726 +               wes_foreach (unit &u, (*resources::teams)[side - 1].recall_list()) {
6727                         if (u.underlying_id() == uid) return &u;
6728                 }
6729                 return NULL;
6730 @@ -710,7 +710,7 @@
6731         if (shallow_literal || strcmp(m, "__shallow_parsed") == 0)
6732         {
6733                 lua_newtable(L);
6734 -               foreach (const config::attribute &a, v->get_config().attribute_range()) {
6735 +               wes_foreach (const config::attribute &a, v->get_config().attribute_range()) {
6736                         if (shallow_literal)
6737                                 luaW_pushscalar(L, a.second);
6738                         else
6739 @@ -813,7 +813,7 @@
6740                 const std::vector<std::string>& vector = accessor; \
6741                 lua_createtable(L, vector.size(), 0); \
6742                 int i = 1; \
6743 -               foreach (const std::string& s, vector) { \
6744 +               wes_foreach (const std::string& s, vector) { \
6745                         lua_pushstring(L, s.c_str()); \
6746                         lua_rawseti(L, -2, i); \
6747                         ++i; \
6748 @@ -1292,9 +1292,9 @@
6749         lua_rawget(L, LUA_REGISTRYINDEX);
6750         lua_newtable(L);
6751         int i = 1, s = 1;
6752 -       foreach (team &t, *resources::teams)
6753 +       wes_foreach (team &t, *resources::teams)
6754         {
6755 -               foreach (unit &u, t.recall_list())
6756 +               wes_foreach (unit &u, t.recall_list())
6757                 {
6758                         if (!filter.null()) {
6759                                 scoped_recall_unit auto_store("this_unit",
6760 @@ -1560,7 +1560,7 @@
6761                 std::set<std::string> const &recruits = t.recruits();
6762                 lua_createtable(L, recruits.size(), 0);
6763                 int i = 1;
6764 -               foreach (std::string const &r, t.recruits()) {
6765 +               wes_foreach (std::string const &r, t.recruits()) {
6766                         lua_pushstring(L, r.c_str());
6767                         lua_rawseti(L, -2, i++);
6768                 }
6769 @@ -3130,7 +3130,7 @@
6770  
6771         lua_createtable(L, res.size(), 0);
6772         int i = 1;
6773 -       foreach (map_location const &loc, res)
6774 +       wes_foreach (map_location const &loc, res)
6775         {
6776                 lua_createtable(L, 2, 0);
6777                 lua_pushinteger(L, loc.x + 1);
6778 @@ -3227,7 +3227,7 @@
6779         lua_rawget(L, LUA_REGISTRYINDEX);
6780         lua_createtable(L, sides.size(), 0);
6781         unsigned index = 1;
6782 -       foreach(int side, sides) {
6783 +       wes_foreach(int side, sides) {
6784                 // Create a full userdata containing a pointer to the team.
6785                 team** t = static_cast<team**>(lua_newuserdata(L, sizeof(team*)));
6786                 *t = &((*resources::teams)[side - 1]);
6787 @@ -3247,7 +3247,7 @@
6788  static int intf_get_traits(lua_State* L)
6789  {
6790         lua_newtable(L);
6791 -       foreach(const config& trait, unit_types.traits()) {
6792 +       wes_foreach(const config& trait, unit_types.traits()) {
6793                 const std::string& id = trait["id"];
6794                 //It seems the engine does nowhere check the id field for emptyness or duplicates
6795                 //(also not later on).
6796 @@ -3767,7 +3767,7 @@
6797                         , static_cast<void *>(const_cast<char *>(&gettypeKey)));
6798         lua_rawget(L, LUA_REGISTRYINDEX);
6799         lua_newtable(L);
6800 -       foreach (const unit_type_data::unit_type_map::value_type &ut, unit_types.types())
6801 +       wes_foreach (const unit_type_data::unit_type_map::value_type &ut, unit_types.types())
6802         {
6803                 lua_createtable(L, 0, 1);
6804                 lua_pushstring(L, ut.first.c_str());
6805 @@ -3786,7 +3786,7 @@
6806         lua_rawget(L, LUA_REGISTRYINDEX);
6807         const race_map& races = unit_types.races();
6808         lua_createtable(L, 0, races.size());
6809 -       foreach(const race_map::value_type &race, races)
6810 +       wes_foreach(const race_map::value_type &race, races)
6811         {
6812                 lua_createtable(L, 0, 1);
6813                 char const* id = race.first.c_str();
6814 @@ -3801,10 +3801,10 @@
6815  
6816         // Execute the preload scripts.
6817         game_config::load_config(preload_config);
6818 -       foreach (const config &cfg, preload_scripts) {
6819 +       wes_foreach (const config &cfg, preload_scripts) {
6820                 execute(cfg["code"].str().c_str(), 0, 0);
6821         }
6822 -       foreach (const config &cfg, level_.child_range("lua")) {
6823 +       wes_foreach (const config &cfg, level_.child_range("lua")) {
6824                 execute(cfg["code"].str().c_str(), 0, 0);
6825         }
6826  
6827 @@ -3822,7 +3822,7 @@
6828  
6829  static bool is_handled_file_tag(const std::string &s)
6830  {
6831 -       foreach (char const *t, handled_file_tags) {
6832 +       wes_foreach (char const *t, handled_file_tags) {
6833                 if (s == t) return true;
6834         }
6835         return false;
6836 @@ -3841,7 +3841,7 @@
6837  
6838         lua_newtable(L);
6839         int k = 1;
6840 -       foreach (const config::any_child &v, level_.all_children_range())
6841 +       wes_foreach (const config::any_child &v, level_.all_children_range())
6842         {
6843                 if (is_handled_file_tag(v.key)) continue;
6844                 lua_createtable(L, 2, 0);
6845 @@ -3861,7 +3861,7 @@
6846   */
6847  void LuaKernel::save_game(config &cfg)
6848  {
6849 -       foreach (const config &v, level_.child_range("lua")) {
6850 +       wes_foreach (const config &v, level_.child_range("lua")) {
6851                 cfg.add_child("lua", v);
6852         }
6853  
6854 diff -ur wesnoth-1.10.3.orig/src/serialization/parser.cpp wesnoth-1.10.3/src/serialization/parser.cpp
6855 --- wesnoth-1.10.3.orig/src/serialization/parser.cpp    2012-05-06 14:08:37.000000000 +0200
6856 +++ wesnoth-1.10.3/src/serialization/parser.cpp 2012-07-11 13:16:06.009933358 +0200
6857 @@ -343,7 +343,7 @@
6858  {
6859         i18n_symbols["pos"] = ::lineno_string(lineno);
6860         std::string result = _(error_string);
6861 -       foreach(utils::string_map::value_type& var, i18n_symbols)
6862 +       wes_foreach(utils::string_map::value_type& var, i18n_symbols)
6863                 boost::algorithm::replace_all(result, std::string("$") + var.first, std::string(var.second));
6864         return result;
6865  }
6866 @@ -503,11 +503,11 @@
6867         if (tab > max_recursion_levels)
6868                 throw config::error("Too many recursion levels in config write");
6869  
6870 -       foreach (const config::attribute &i, cfg.attribute_range()) {
6871 +       wes_foreach (const config::attribute &i, cfg.attribute_range()) {
6872                 write_key_val(out, i.first, i.second, tab, textdomain);
6873         }
6874  
6875 -       foreach (const config::any_child &item, cfg.all_children_range())
6876 +       wes_foreach (const config::any_child &item, cfg.all_children_range())
6877         {
6878                 write_open_child(out, item.key, tab);
6879                 write_internal(item.cfg, out, textdomain, tab + 1);
6880 diff -ur wesnoth-1.10.3.orig/src/serialization/preprocessor.cpp wesnoth-1.10.3/src/serialization/preprocessor.cpp
6881 --- wesnoth-1.10.3.orig/src/serialization/preprocessor.cpp      2012-04-23 20:55:21.000000000 +0200
6882 +++ wesnoth-1.10.3/src/serialization/preprocessor.cpp   2012-07-11 13:16:06.009933358 +0200
6883 @@ -64,7 +64,7 @@
6884         int n = 0;
6885         s >> std::hex >> n;
6886  
6887 -       foreach(const t_file_number_map::value_type& p, file_number_map){
6888 +       wes_foreach(const t_file_number_map::value_type& p, file_number_map){
6889                 if(p.second == n)
6890                         return p.first;
6891         }
6892 @@ -142,7 +142,7 @@
6893         writer.write_key_val("linenum", lexical_cast<std::string>(linenum));
6894         writer.write_key_val("location", get_location(location));
6895  
6896 -       foreach (const std::string &arg, arguments)
6897 +       wes_foreach (const std::string &arg, arguments)
6898                 write_argument(writer, arg);
6899  
6900         writer.close_child(key);
6901 @@ -160,7 +160,7 @@
6902         linenum = cfg["linenum"];
6903         location = cfg["location"].str();
6904  
6905 -       foreach (const config &arg, cfg.child_range("argument"))
6906 +       wes_foreach (const config &arg, cfg.child_range("argument"))
6907                 read_argument(arg);
6908  }
6909  
6910 @@ -1157,14 +1157,14 @@
6911                 get_files_in_dir(res_name, &files, &dirs, ENTIRE_FILE_PATH, SKIP_MEDIA_DIR, DO_REORDER);
6912  
6913                 // subdirectories
6914 -               foreach(const std::string& dir, dirs)
6915 +               wes_foreach(const std::string& dir, dirs)
6916                 {
6917                         LOG_PREPROC<<"processing sub-dir: "<<dir<<'\n';
6918                         preprocess_resource(dir,defines_map,write_cfg,write_plain_cfg,target_directory);
6919                 }
6920  
6921                 // files in current directory
6922 -               foreach(const std::string& file, files)
6923 +               wes_foreach(const std::string& file, files)
6924                 {
6925                         preprocess_resource(file,defines_map,write_cfg,write_plain_cfg,target_directory);
6926                 }
6927 diff -ur wesnoth-1.10.3.orig/src/serialization/schema_validator.cpp wesnoth-1.10.3/src/serialization/schema_validator.cpp
6928 --- wesnoth-1.10.3.orig/src/serialization/schema_validator.cpp  2012-01-07 03:35:17.000000000 +0100
6929 +++ wesnoth-1.10.3/src/serialization/schema_validator.cpp       2012-07-11 13:16:06.009933358 +0200
6930 @@ -143,14 +143,14 @@
6931         } catch(config::error&) {
6932                 return false;
6933         }
6934 -       foreach (const config &g, cfg.child_range("wml_schema")) {
6935 -               foreach (const config &schema, g.child_range("tag")) {
6936 +       wes_foreach (const config &g, cfg.child_range("wml_schema")) {
6937 +               wes_foreach (const config &schema, g.child_range("tag")) {
6938                         if (schema["name"].str() == "root"){
6939                                 //@NOTE Don't know, maybe merging of roots needed.
6940                                 root_ = class_tag (schema);
6941                         }
6942                 }
6943 -               foreach (const config &type, g.child_range("type")) {
6944 +               wes_foreach (const config &type, g.child_range("type")) {
6945                         try{
6946                                 types_[type["name"].str()] = boost::regex( type["value"].str());
6947                         }
6948 diff -ur wesnoth-1.10.3.orig/src/server/ban.cpp wesnoth-1.10.3/src/server/ban.cpp
6949 --- wesnoth-1.10.3.orig/src/server/ban.cpp      2012-01-07 03:35:17.000000000 +0100
6950 +++ wesnoth-1.10.3/src/server/ban.cpp   2012-07-11 13:16:06.016600022 +0200
6951 @@ -260,7 +260,7 @@
6952                 scoped_istream ban_file = istream_file(filename_);
6953                 read_gz(cfg, *ban_file);
6954  
6955 -               foreach (const config &b, cfg.child_range("ban"))
6956 +               wes_foreach (const config &b, cfg.child_range("ban"))
6957                 {
6958                         try {
6959                                 banned_ptr new_ban(new banned(b));
6960 @@ -276,7 +276,7 @@
6961                 // load deleted too
6962                 if (const config &cfg_del = cfg.child("deleted"))
6963                 {
6964 -                       foreach (const config &b, cfg_del.child_range("ban"))
6965 +                       wes_foreach (const config &b, cfg_del.child_range("ban"))
6966                         {
6967                                 try {
6968                                         banned_ptr new_ban(new banned(b));
6969 @@ -680,7 +680,7 @@
6970         void ban_manager::load_config(const config& cfg)
6971         {
6972                 ban_times_.clear();
6973 -               foreach (const config &bt, cfg.child_range("ban_time")) {
6974 +               wes_foreach (const config &bt, cfg.child_range("ban_time")) {
6975                         time_t duration = 0;
6976                         if (parse_time(bt["time"], &duration)) {
6977                                 ban_times_.insert(default_ban_times::value_type(bt["name"], duration));
6978 diff -ur wesnoth-1.10.3.orig/src/server/room_manager.cpp wesnoth-1.10.3/src/server/room_manager.cpp
6979 --- wesnoth-1.10.3.orig/src/server/room_manager.cpp     2012-01-07 03:35:17.000000000 +0100
6980 +++ wesnoth-1.10.3/src/server/room_manager.cpp  2012-07-11 13:16:06.019933355 +0200
6981 @@ -58,7 +58,7 @@
6982         // this assumes the server is shutting down, so there's no need to
6983         // send the actual room-quit messages to clients
6984         write_rooms();
6985 -       foreach (t_rooms_by_name_::value_type i, rooms_by_name_) {
6986 +       wes_foreach (t_rooms_by_name_::value_type i, rooms_by_name_) {
6987                 delete i.second;
6988         }
6989  }
6990 @@ -97,7 +97,7 @@
6991                         read(cfg, *file);
6992                 }
6993  
6994 -               foreach (const config &c, cfg.child_range("room")) {
6995 +               wes_foreach (const config &c, cfg.child_range("room")) {
6996                         room* r(new room(c));
6997                         if (room_exists(r->name())) {
6998                                 ERR_LOBBY << "Duplicate room ignored in stored rooms: "
6999 @@ -122,7 +122,7 @@
7000         if (filename_.empty()) return;
7001         LOG_LOBBY << "Writing rooms to " << filename_ << "\n";
7002         config cfg;
7003 -       foreach (const t_rooms_by_name_::value_type& v, rooms_by_name_) {
7004 +       wes_foreach (const t_rooms_by_name_::value_type& v, rooms_by_name_) {
7005                 const room& r = *v.second;
7006                 if (r.persistent()) {
7007                         config& c = cfg.add_child("room");
7008 @@ -211,7 +211,7 @@
7009  
7010  void room_manager::enter_lobby(const wesnothd::game &game)
7011  {
7012 -       foreach (network::connection player, game.all_game_users()) {
7013 +       wes_foreach (network::connection player, game.all_game_users()) {
7014                 enter_lobby(player);
7015         }
7016  }
7017 @@ -225,7 +225,7 @@
7018         store_player_rooms(player);
7019         t_rooms_by_player_::iterator i = rooms_by_player_.find(player);
7020         if (i != rooms_by_player_.end()) {
7021 -               foreach (room* r, i->second) {
7022 +               wes_foreach (room* r, i->second) {
7023                         r->remove_player(player);
7024                 }
7025         }
7026 @@ -244,7 +244,7 @@
7027         lobby_->remove_player(player);
7028         t_rooms_by_player_::iterator i = rooms_by_player_.find(player);
7029         if (i != rooms_by_player_.end()) {
7030 -               foreach (room* r, i->second) {
7031 +               wes_foreach (room* r, i->second) {
7032                         r->remove_player(player);
7033                 }
7034         }
7035 @@ -315,7 +315,7 @@
7036         t_player_stored_rooms_::iterator it =
7037                 player_stored_rooms_.insert(std::make_pair(player, std::set<std::string>())).first;
7038         std::set<std::string>& store = it->second;
7039 -       foreach (room* r, i->second) {
7040 +       wes_foreach (room* r, i->second) {
7041                 store.insert(r->name());
7042         }
7043  }
7044 @@ -337,7 +337,7 @@
7045         simple_wml::document doc;
7046         simple_wml::node& join_msg = doc.root().add_child("room_join");
7047         join_msg.set_attr_dup("player", user->second.name().c_str());
7048 -       foreach (const std::string& room_name, it->second) {
7049 +       wes_foreach (const std::string& room_name, it->second) {
7050                 room* r = get_create_room(room_name, user->first);
7051                 if (r == NULL) {
7052                         LOG_LOBBY << "Player " << user->second.name() << " unable to rejoin room " << room_name << "\n";
7053 @@ -528,7 +528,7 @@
7054  void room_manager::fill_room_list(simple_wml::node& root)
7055  {
7056         simple_wml::node& rooms = root.add_child("rooms");
7057 -       foreach (const t_rooms_by_name_::value_type& tr, rooms_by_name_) {
7058 +       wes_foreach (const t_rooms_by_name_::value_type& tr, rooms_by_name_) {
7059                 const room& r = *tr.second;
7060                 simple_wml::node& room = rooms.add_child("room");
7061                 room.set_attr_dup("name", r.name().c_str());
7062 @@ -539,7 +539,7 @@
7063  void room_manager::fill_member_list(const room* room, simple_wml::node& root)
7064  {
7065         simple_wml::node& members = root.add_child("members");
7066 -       foreach (network::connection m, room->members()) {
7067 +       wes_foreach (network::connection m, room->members()) {
7068                 simple_wml::node& member = members.add_child("member");
7069                 player_map::const_iterator mi = all_players_.find(m);
7070                 if (mi != all_players_.end()) {
7071 diff -ur wesnoth-1.10.3.orig/src/server/server.cpp wesnoth-1.10.3/src/server/server.cpp
7072 --- wesnoth-1.10.3.orig/src/server/server.cpp   2012-01-22 14:50:25.000000000 +0100
7073 +++ wesnoth-1.10.3/src/server/server.cpp        2012-07-11 13:16:06.016600022 +0200
7074 @@ -556,15 +556,15 @@
7075         }
7076  
7077         redirected_versions_.clear();
7078 -       foreach (const config &redirect, cfg_.child_range("redirect")) {
7079 -               foreach (const std::string &version, utils::split(redirect["version"])) {
7080 +       wes_foreach (const config &redirect, cfg_.child_range("redirect")) {
7081 +               wes_foreach (const std::string &version, utils::split(redirect["version"])) {
7082                         redirected_versions_[version] = redirect;
7083                 }
7084         }
7085  
7086         proxy_versions_.clear();
7087 -       foreach (const config &proxy, cfg_.child_range("proxy")) {
7088 -               foreach (const std::string &version, utils::split(proxy["version"])) {
7089 +       wes_foreach (const config &proxy, cfg_.child_range("proxy")) {
7090 +               wes_foreach (const std::string &version, utils::split(proxy["version"])) {
7091                         proxy_versions_[version] = proxy;
7092                 }
7093         }
7094 @@ -704,7 +704,7 @@
7095                                 simple_wml::document ping( strstr.str().c_str(),
7096                                                            simple_wml::INIT_COMPRESSED );
7097                                 simple_wml::string_span s = ping.output_compressed();
7098 -                               foreach (network::connection sock, ghost_players_) {
7099 +                               wes_foreach (network::connection sock, ghost_players_) {
7100                                         if (!lg::debug.dont_log(log_server)) {
7101                                                 wesnothd::player_map::const_iterator i = players_.find(sock);
7102                                                 if (i != players_.end()) {
7103 @@ -720,7 +720,7 @@
7104                                 // Only a single thread should be accessing this
7105                                 // Erase before we copy - speeds inserts
7106                                 ghost_players_.clear();
7107 -                               foreach (const wesnothd::player_map::value_type v, players_) {
7108 +                               wes_foreach (const wesnothd::player_map::value_type v, players_) {
7109                                         ghost_players_.insert(v.first);
7110                                 }
7111                                 last_ping_ = now;
7112 diff -ur wesnoth-1.10.3.orig/src/side_filter.cpp wesnoth-1.10.3/src/side_filter.cpp
7113 --- wesnoth-1.10.3.orig/src/side_filter.cpp     2012-01-07 03:35:17.000000000 +0100
7114 +++ wesnoth-1.10.3/src/side_filter.cpp  2012-07-11 13:16:06.019933355 +0200
7115 @@ -61,7 +61,7 @@
7116  {
7117         //@todo: replace with better implementation
7118         std::vector<int> result;
7119 -       foreach (const team &t, *resources::teams) {
7120 +       wes_foreach (const team &t, *resources::teams) {
7121                 if (match(t)) {
7122                         result.push_back(t.side());
7123                 }
7124 @@ -109,7 +109,7 @@
7125                 else {
7126                         const std::vector<std::string>& these_team_names = utils::split(this_team_name);
7127                         bool search_futile = true;
7128 -                       foreach(const std::string& this_single_team_name, these_team_names) {
7129 +                       wes_foreach(const std::string& this_single_team_name, these_team_names) {
7130                                 if(this_single_team_name == that_team_name) {
7131                                         search_futile = false;
7132                                         break;
7133 @@ -123,7 +123,7 @@
7134         if(cfg_.has_child("has_unit")) {
7135                 const vconfig& unit_filter = cfg_.child("has_unit");
7136                 bool found = false;
7137 -               foreach (unit &u, *resources::units) {
7138 +               wes_foreach (unit &u, *resources::units) {
7139                         if (u.side() != t.side()) {
7140                                 continue;
7141                         }
7142 @@ -134,7 +134,7 @@
7143                 }
7144                 if(!found && unit_filter["search_recall_list"].to_bool(false)) {
7145                         const std::vector<unit>& recall_list = t.recall_list();
7146 -                       foreach(const unit& u, recall_list) {
7147 +                       wes_foreach(const unit& u, recall_list) {
7148                                 scoped_recall_unit this_unit("this_unit", t.save_id(), &u - &recall_list[0]);
7149                                 if(u.matches_filter(unit_filter, u.get_location(), flat_)) {
7150                                         found = true;
7151 @@ -152,7 +152,7 @@
7152                 side_filter s_filter(enemy_of);
7153                 const std::vector<int>& teams = s_filter.get_teams();
7154                 if(teams.empty()) return false;
7155 -               foreach(const int side, teams) {
7156 +               wes_foreach(const int side, teams) {
7157                         if(!(*resources::teams)[side - 1].is_enemy(t.side()))
7158                                 return false;
7159                 }
7160 @@ -163,7 +163,7 @@
7161                 side_filter s_filter(allied_with);
7162                 const std::vector<int>& teams = s_filter.get_teams();
7163                 if(teams.empty()) return false;
7164 -               foreach(const int side, teams) {
7165 +               wes_foreach(const int side, teams) {
7166                         if((*resources::teams)[side - 1].is_enemy(t.side()))
7167                                 return false;
7168                 }
7169 diff -ur wesnoth-1.10.3.orig/src/sound.cpp wesnoth-1.10.3/src/sound.cpp
7170 --- wesnoth-1.10.3.orig/src/sound.cpp   2012-01-07 03:35:17.000000000 +0100
7171 +++ wesnoth-1.10.3/src/sound.cpp        2012-07-11 13:16:06.006600025 +0200
7172 @@ -596,7 +596,7 @@
7173                 return;
7174  
7175         // If current track no longer on playlist, change it.
7176 -       foreach (const music_track &m, current_track_list) {
7177 +       wes_foreach (const music_track &m, current_track_list) {
7178                 if (current_track == m)
7179                         return;
7180         }
7181 @@ -614,7 +614,7 @@
7182  {
7183         // First entry clears playlist, others append to it.
7184         bool append = false;
7185 -       foreach (music_track &m, current_track_list) {
7186 +       wes_foreach (music_track &m, current_track_list) {
7187                 m.write(snapshot, append);
7188                 append = true;
7189         }
7190 diff -ur wesnoth-1.10.3.orig/src/statistics.cpp wesnoth-1.10.3/src/statistics.cpp
7191 --- wesnoth-1.10.3.orig/src/statistics.cpp      2012-01-07 03:35:17.000000000 +0100
7192 +++ wesnoth-1.10.3/src/statistics.cpp   2012-07-11 13:16:06.013266690 +0200
7193 @@ -57,7 +57,7 @@
7194         team_stats(),
7195         scenario_name(cfg["scenario"])
7196  {
7197 -       foreach (const config &team, cfg.child_range("team")) {
7198 +       wes_foreach (const config &team, cfg.child_range("team")) {
7199                 team_stats[team["save_id"]] = stats(team);
7200         }
7201  }
7202 @@ -121,7 +121,7 @@
7203  static stats::str_int_map read_str_int_map(const config& cfg)
7204  {
7205         stats::str_int_map m;
7206 -       foreach (const config::attribute &i, cfg.attribute_range()) {
7207 +       wes_foreach (const config::attribute &i, cfg.attribute_range()) {
7208                 m[i.first] = i.second;
7209         }
7210  
7211 @@ -159,7 +159,7 @@
7212  static stats::battle_result_map read_battle_result_map(const config& cfg)
7213  {
7214         stats::battle_result_map m;
7215 -       foreach (const config &i, cfg.child_range("sequence"))
7216 +       wes_foreach (const config &i, cfg.child_range("sequence"))
7217         {
7218                 config item = i;
7219                 int key = item["_num"];
7220 @@ -612,7 +612,7 @@
7221         fresh_stats();
7222         mid_scenario = cfg["mid_scenario"].to_bool();
7223  
7224 -       foreach (const config &s, cfg.child_range("scenario")) {
7225 +       wes_foreach (const config &s, cfg.child_range("scenario")) {
7226                 master_stats.push_back(scenario_stats(s));
7227         }
7228  }
7229 diff -ur wesnoth-1.10.3.orig/src/storyscreen/controller.cpp wesnoth-1.10.3/src/storyscreen/controller.cpp
7230 --- wesnoth-1.10.3.orig/src/storyscreen/controller.cpp  2012-01-07 03:35:17.000000000 +0100
7231 +++ wesnoth-1.10.3/src/storyscreen/controller.cpp       2012-07-11 13:16:06.236600015 +0200
7232 @@ -138,7 +138,7 @@
7233         // caching the scaled backgrounds can take over a decent amount of memory.
7234  #ifndef LOW_MEM
7235         std::vector< render_pointer_type > uis_;
7236 -       foreach(part_pointer_type p, parts_) {
7237 +       wes_foreach(part_pointer_type p, parts_) {
7238                 ASSERT_LOG( p != NULL, "Ouch: hit NULL storyscreen part in collection" );
7239                 render_pointer_type const rpt(new part_ui(*p, disp_, next_button, back_button, play_button));
7240                 uis_.push_back(rpt);
7241 diff -ur wesnoth-1.10.3.orig/src/storyscreen/render.cpp wesnoth-1.10.3/src/storyscreen/render.cpp
7242 --- wesnoth-1.10.3.orig/src/storyscreen/render.cpp      2012-02-16 21:15:27.000000000 +0100
7243 +++ wesnoth-1.10.3/src/storyscreen/render.cpp   2012-07-11 13:16:06.036600021 +0200
7244 @@ -167,7 +167,7 @@
7245  void part_ui::prepare_floating_images()
7246  {
7247         // Build floating image surfaces
7248 -       foreach(const floating_image& fi, p_.get_floating_images()) {
7249 +       wes_foreach(const floating_image& fi, p_.get_floating_images()) {
7250                 imgs_.push_back( fi.get_render_input(scale_factor_, base_rect_) );
7251         }
7252  }
7253 @@ -190,7 +190,7 @@
7254         last_key_ = true;
7255  
7256         size_t fi_n = 0;
7257 -       foreach(floating_image::render_input& ri, imgs_) {
7258 +       wes_foreach(floating_image::render_input& ri, imgs_) {
7259                 const floating_image& fi = p_.get_floating_images()[fi_n];
7260  
7261                 if(!ri.image.null()) {
7262 diff -ur wesnoth-1.10.3.orig/src/team.cpp wesnoth-1.10.3/src/team.cpp
7263 --- wesnoth-1.10.3.orig/src/team.cpp    2012-04-07 19:02:33.000000000 +0200
7264 +++ wesnoth-1.10.3/src/team.cpp 2012-07-11 13:16:05.953266691 +0200
7265 @@ -318,7 +318,7 @@
7266         // Was it correct?
7267  
7268         // Load in the villages the side controls at the start
7269 -       foreach (const config &v, cfg.child_range("village"))
7270 +       wes_foreach (const config &v, cfg.child_range("village"))
7271         {
7272                 map_location loc(v, resources::state_of_game);
7273                 if (map.is_village(loc)) {
7274 @@ -397,7 +397,7 @@
7275                 return info_.minimum_recruit_price;
7276         }else{
7277                 int min = 20;
7278 -               foreach(std::string recruit, info_.can_recruit){
7279 +               wes_foreach(std::string recruit, info_.can_recruit){
7280                         const unit_type *ut = unit_types.find(recruit);
7281                         if(!ut)
7282                                 continue;
7283 @@ -605,7 +605,7 @@
7284                 return true;
7285         }
7286  
7287 -       foreach (const team &t, *teams) {
7288 +       wes_foreach (const team &t, *teams) {
7289                 if (t.is_human())
7290                         return false;
7291         }
7292 diff -ur wesnoth-1.10.3.orig/src/terrain.cpp wesnoth-1.10.3/src/terrain.cpp
7293 --- wesnoth-1.10.3.orig/src/terrain.cpp 2012-02-08 02:47:55.000000000 +0100
7294 +++ wesnoth-1.10.3/src/terrain.cpp      2012-07-11 13:16:05.949933359 +0200
7295 @@ -284,7 +284,7 @@
7296                           t_translation::t_list& terrain_list,
7297                           std::map<t_translation::t_terrain, terrain_type>& letter_to_terrain)
7298  {
7299 -       foreach (const config &t, cfgs)
7300 +       wes_foreach (const config &t, cfgs)
7301         {
7302                 terrain_type terrain(t);
7303                 DBG_G << "create_terrain_maps: " << terrain.number() << " "
7304 @@ -301,9 +301,9 @@
7305                                 std::vector<std::string> eg2 = utils::split(terrain.editor_group());
7306                                 std::set<std::string> egs;
7307                                 bool clean_merge = true;
7308 -                               foreach(std::string& t, eg1)
7309 +                               wes_foreach(std::string& t, eg1)
7310                                         clean_merge &= egs.insert(t).second;
7311 -                               foreach(std::string& t, eg2)
7312 +                               wes_foreach(std::string& t, eg2)
7313                                         clean_merge &= egs.insert(t).second;
7314  
7315                                 std::string joined = utils::join(egs);
7316 diff -ur wesnoth-1.10.3.orig/src/terrain_filter.cpp wesnoth-1.10.3/src/terrain_filter.cpp
7317 --- wesnoth-1.10.3.orig/src/terrain_filter.cpp  2012-01-07 03:35:17.000000000 +0100
7318 +++ wesnoth-1.10.3/src/terrain_filter.cpp       2012-07-11 13:16:05.979933358 +0200
7319 @@ -129,7 +129,7 @@
7320                                 }
7321                         } else {
7322                                 bool found = false;
7323 -                               foreach (const config &cfg, vi.as_array()) {
7324 +                               wes_foreach (const config &cfg, vi.as_array()) {
7325                                         if (map_location(cfg, NULL) == loc) {
7326                                                 found = true;
7327                                                 break;
7328 @@ -358,7 +358,7 @@
7329                         }
7330                 } else {
7331                         std::set<map_location> findin_locs;
7332 -                       foreach (const config &cfg, vi.as_array()) {
7333 +                       wes_foreach (const config &cfg, vi.as_array()) {
7334                                 map_location test_loc(cfg, NULL);
7335                                 if (xy_set.count(test_loc)) {
7336                                         findin_locs.insert(test_loc);
7337 diff -ur wesnoth-1.10.3.orig/src/tests/gui/test_gui2.cpp wesnoth-1.10.3/src/tests/gui/test_gui2.cpp
7338 --- wesnoth-1.10.3.orig/src/tests/gui/test_gui2.cpp     2012-01-07 03:35:17.000000000 +0100
7339 +++ wesnoth-1.10.3/src/tests/gui/test_gui2.cpp  2012-07-11 13:16:05.963266693 +0200
7340 @@ -139,7 +139,7 @@
7341         template<class T>
7342         void test_resolutions(const tresolution_list& resolutions)
7343         {
7344 -               foreach(const tresolution& resolution, resolutions) {
7345 +               wes_foreach(const tresolution& resolution, resolutions) {
7346                         video().make_test_fake(resolution.first, resolution.second);
7347  
7348                         boost::scoped_ptr<gui2::tdialog> dlg(twrapper<T>::create());
7349 @@ -178,7 +178,7 @@
7350         {
7351                 bool interact = false;
7352                 for(int i = 0; i < 2; ++i) {
7353 -                       foreach(const tresolution& resolution, resolutions) {
7354 +                       wes_foreach(const tresolution& resolution, resolutions) {
7355                                 video().make_test_fake(resolution.first, resolution.second);
7356  
7357                                 boost::scoped_ptr<gui2::tpopup> dlg(twrapper<T>::create());
7358 @@ -225,7 +225,7 @@
7359         void test_tip_resolutions(const tresolution_list& resolutions
7360                         , const std::string& id)
7361         {
7362 -               foreach(const tresolution& resolution, resolutions) {
7363 +               wes_foreach(const tresolution& resolution, resolutions) {
7364                         video().make_test_fake(resolution.first, resolution.second);
7365  
7366                         std::vector<std::string>& list =
7367 @@ -416,7 +416,7 @@
7368  
7369         // Test size() instead of empty() to get the number of offenders
7370         BOOST_CHECK_EQUAL(list.size(), 0);
7371 -       foreach(const std::string& id, list) {
7372 +       wes_foreach(const std::string& id, list) {
7373                 std::cerr << "Window '" << id << "' registered but not tested.\n";
7374         }
7375  }
7376 @@ -638,7 +638,7 @@
7377                 BOOST_REQUIRE_MESSAGE(result, "Failed to create a dialog.");
7378  
7379                 std::vector<map_generator*> map_generators;
7380 -               foreach (const config &i, main_config.child_range("multiplayer")) {
7381 +               wes_foreach (const config &i, main_config.child_range("multiplayer")) {
7382                         if(i["map_generation"] == "default") {
7383                                 const config &generator_cfg = i.child("generator");
7384                                 if (generator_cfg) {
7385 @@ -694,7 +694,7 @@
7386                 BOOST_REQUIRE_MESSAGE(cfg, "No editor time-of-day defined");
7387  
7388                 std::vector<time_of_day> tods;
7389 -               foreach (const config &i, cfg.child_range("time")) {
7390 +               wes_foreach (const config &i, cfg.child_range("time")) {
7391                         tods.push_back(time_of_day(i));
7392                 }
7393                 return new gui2::teditor_settings(NULL, tods);
7394 diff -ur wesnoth-1.10.3.orig/src/theme.cpp wesnoth-1.10.3/src/theme.cpp
7395 --- wesnoth-1.10.3.orig/src/theme.cpp   2012-01-07 03:35:17.000000000 +0100
7396 +++ wesnoth-1.10.3/src/theme.cpp        2012-07-11 13:16:06.013266690 +0200
7397 @@ -162,7 +162,7 @@
7398  {
7399         std::vector<config> res_cfgs_;
7400         // resolve all the partialresolutions
7401 -       foreach (const config &part, top_cfg.child_range("partialresolution"))
7402 +       wes_foreach (const config &part, top_cfg.child_range("partialresolution"))
7403         {
7404                 // follow the inheritance hierarchy and push all the nodes on the stack
7405                 std::vector<const config*> parent_stack(1, &part);
7406 @@ -182,11 +182,11 @@
7407                 while (!parent_stack.empty()) {
7408                         //override attributes
7409                         res_cfgs_.back().merge_attributes(*parent_stack.back());
7410 -                       foreach (const config &rm, parent_stack.back()->child_range("remove")) {
7411 +                       wes_foreach (const config &rm, parent_stack.back()->child_range("remove")) {
7412                                 find_ref(rm["id"], res_cfgs_.back(), true);
7413                         }
7414  
7415 -                       foreach (const config &chg, parent_stack.back()->child_range("change"))
7416 +                       wes_foreach (const config &chg, parent_stack.back()->child_range("change"))
7417                         {
7418                                 config &target = find_ref(chg["id"], res_cfgs_.back());
7419                                 target.merge_attributes(chg);
7420 @@ -195,7 +195,7 @@
7421                         // cannot add [status] sub-elements, but who cares
7422                         if (const config &c = parent_stack.back()->child("add"))
7423                         {
7424 -                               foreach (const config::any_child &j, c.all_children_range()) {
7425 +                               wes_foreach (const config::any_child &j, c.all_children_range()) {
7426                                         res_cfgs_.back().add_child(j.key, j.cfg);
7427                                 }
7428                         }
7429 @@ -204,7 +204,7 @@
7430                 }
7431         }
7432         // Add all the resolutions
7433 -       foreach (const config &res, top_cfg.child_range("resolution")) {
7434 +       wes_foreach (const config &res, top_cfg.child_range("resolution")) {
7435                 dst_cfg.add_child("resolution", res);
7436         }
7437         // Add all the resolved resolutions
7438 @@ -217,7 +217,7 @@
7439  static void do_resolve_rects(const config& cfg, config& resolved_config, config* resol_cfg = NULL) {
7440  
7441                 // recursively resolve children
7442 -               foreach (const config::any_child &value, cfg.all_children_range()) {
7443 +               wes_foreach (const config::any_child &value, cfg.all_children_range()) {
7444                         config &childcfg = resolved_config.add_child(value.key);
7445                         do_resolve_rects(value.cfg, childcfg,
7446                                 value.key == "resolution" ? &childcfg : resol_cfg);
7447 @@ -549,7 +549,7 @@
7448  
7449         int current_rating = 1000000;
7450         const config *current = NULL;
7451 -       foreach (const config &i, cfg_.child_range("resolution"))
7452 +       wes_foreach (const config &i, cfg_.child_range("resolution"))
7453         {
7454                 int width = i["width"];
7455                 int height = i["height"];
7456 @@ -611,7 +611,7 @@
7457  
7458         if (const config &status_cfg = cfg.child("status"))
7459         {
7460 -               foreach (const config::any_child &i, status_cfg.all_children_range()) {
7461 +               wes_foreach (const config::any_child &i, status_cfg.all_children_range()) {
7462                         status_.insert(std::pair<std::string, status_item>(i.key, status_item(i.cfg)));
7463                 }
7464                 if (const config &unit_image_cfg = status_cfg.child("unit_image")) {
7465 @@ -621,19 +621,19 @@
7466                 }
7467         }
7468  
7469 -       foreach (const config &p, cfg.child_range("panel")) {
7470 +       wes_foreach (const config &p, cfg.child_range("panel")) {
7471                 panel new_panel(p);
7472                 set_object_location(new_panel, p["rect"], p["ref"]);
7473                 panels_.push_back(new_panel);
7474         }
7475  
7476 -       foreach (const config &lb, cfg.child_range("label")) {
7477 +       wes_foreach (const config &lb, cfg.child_range("label")) {
7478                 label new_label(lb);
7479                 set_object_location(new_label, lb["rect"], lb["ref"]);
7480                 labels_.push_back(new_label);
7481         }
7482  
7483 -       foreach (const config &m, cfg.child_range("menu"))
7484 +       wes_foreach (const config &m, cfg.child_range("menu"))
7485         {
7486                 menu new_menu(m);
7487                 DBG_DP << "adding menu: " << (new_menu.is_context() ? "is context" : "not context") << "\n";
7488 @@ -699,7 +699,7 @@
7489         }
7490  
7491         // Change existing theme objects.
7492 -       foreach (const config &c, cfg.child_range("change"))
7493 +       wes_foreach (const config &c, cfg.child_range("change"))
7494         {
7495                 std::string id = c["id"];
7496                 std::string ref_id = c["ref"];
7497 @@ -709,12 +709,12 @@
7498         }
7499  
7500         // Add new theme objects.
7501 -       foreach (const config &c, cfg.child_range("add")) {
7502 +       wes_foreach (const config &c, cfg.child_range("add")) {
7503                 add_object(c);
7504         }
7505  
7506         // Remove existent theme objects.
7507 -       foreach (const config &c, cfg.child_range("remove")) {
7508 +       wes_foreach (const config &c, cfg.child_range("remove")) {
7509                 remove_object(c["id"]);
7510         }
7511  
7512 @@ -758,7 +758,7 @@
7513         if (!cfg)
7514                 return;
7515  
7516 -       foreach (const config &thm, cfg->child_range("theme"))
7517 +       wes_foreach (const config &thm, cfg->child_range("theme"))
7518         {
7519                 std::string thm_name = thm["name"];
7520                 if (!thm["hidden"].to_bool(false))
7521 @@ -778,7 +778,7 @@
7522  
7523  const theme::menu *theme::get_menu_item(const std::string &key) const
7524  {
7525 -       foreach (const theme::menu &m, menus_) {
7526 +       wes_foreach (const theme::menu &m, menus_) {
7527                 if (m.get_id() == key) return &m;
7528         }
7529         return NULL;
7530 diff -ur wesnoth-1.10.3.orig/src/time_of_day.cpp wesnoth-1.10.3/src/time_of_day.cpp
7531 --- wesnoth-1.10.3.orig/src/time_of_day.cpp     2012-01-07 03:35:17.000000000 +0100
7532 +++ wesnoth-1.10.3/src/time_of_day.cpp  2012-07-11 13:16:05.983266692 +0200
7533 @@ -62,7 +62,7 @@
7534  
7535  void time_of_day::parse_times(const config& cfg, std::vector<time_of_day>& normal_times)
7536  {
7537 -       foreach (const config &t, cfg.child_range("time")) {
7538 +       wes_foreach (const config &t, cfg.child_range("time")) {
7539                 normal_times.push_back(time_of_day(t));
7540         }
7541  
7542 diff -ur wesnoth-1.10.3.orig/src/tod_manager.cpp wesnoth-1.10.3/src/tod_manager.cpp
7543 --- wesnoth-1.10.3.orig/src/tod_manager.cpp     2012-01-07 03:35:17.000000000 +0100
7544 +++ wesnoth-1.10.3/src/tod_manager.cpp  2012-07-11 13:16:05.996600022 +0200
7545 @@ -279,7 +279,7 @@
7546  void tod_manager::set_new_current_times(const int new_current_turn_number)
7547  {
7548         currentTime_ = calculate_current_time(times_.size(), new_current_turn_number, currentTime_);
7549 -       foreach(area_time_of_day& area, areas_) {
7550 +       wes_foreach(area_time_of_day& area, areas_) {
7551                 area.currentTime = calculate_current_time(
7552                         area.times.size(),
7553                         new_current_turn_number,
7554 diff -ur wesnoth-1.10.3.orig/src/tools/exploder_cutter.cpp wesnoth-1.10.3/src/tools/exploder_cutter.cpp
7555 --- wesnoth-1.10.3.orig/src/tools/exploder_cutter.cpp   2012-01-07 03:35:17.000000000 +0100
7556 +++ wesnoth-1.10.3/src/tools/exploder_cutter.cpp        2012-07-11 13:16:05.963266693 +0200
7557 @@ -48,7 +48,7 @@
7558  
7559  void cutter::load_masks(const config& conf)
7560  {
7561 -       foreach (const config &m, conf.child_range("mask"))
7562 +       wes_foreach (const config &m, conf.child_range("mask"))
7563         {
7564                 const std::string name = m["name"];
7565                 const std::string image = get_mask_dir() + "/" + std::string(m["image"]);
7566 @@ -94,7 +94,7 @@
7567  {
7568         surface_map res;
7569  
7570 -       foreach (const config &part, conf.child_range("part")) {
7571 +       wes_foreach (const config &part, conf.child_range("part")) {
7572                 add_sub_image(surf, res, &part);
7573         }
7574  
7575 diff -ur wesnoth-1.10.3.orig/src/tools/schema/tag.cpp wesnoth-1.10.3/src/tools/schema/tag.cpp
7576 --- wesnoth-1.10.3.orig/src/tools/schema/tag.cpp        2012-01-07 03:35:17.000000000 +0100
7577 +++ wesnoth-1.10.3/src/tools/schema/tag.cpp     2012-07-11 13:16:05.963266693 +0200
7578 @@ -81,15 +81,15 @@
7579                 if (cfg.has_attribute("super")){
7580                         super_ = cfg["super"].str();
7581                 }
7582 -               foreach (const config &child, cfg.child_range("tag")) {
7583 +               wes_foreach (const config &child, cfg.child_range("tag")) {
7584                         class_tag child_tag (child);
7585                         add_tag(child_tag);
7586                 }
7587 -               foreach (const config &child, cfg.child_range("key")) {
7588 +               wes_foreach (const config &child, cfg.child_range("key")) {
7589                         class_key child_key (child);
7590                         add_key(child_key);
7591                 }
7592 -               foreach (const config &link, cfg.child_range("link")) {
7593 +               wes_foreach (const config &link, cfg.child_range("link")) {
7594                         std::string link_name = link["name"].str();
7595                         add_link(link_name);
7596                 }
7597 diff -ur wesnoth-1.10.3.orig/src/tooltips.cpp wesnoth-1.10.3/src/tooltips.cpp
7598 --- wesnoth-1.10.3.orig/src/tooltips.cpp        2012-03-18 15:57:27.000000000 +0100
7599 +++ wesnoth-1.10.3/src/tooltips.cpp     2012-07-11 13:16:05.973266690 +0200
7600 @@ -172,7 +172,7 @@
7601  
7602  bool click(int mousex, int mousey)
7603  {
7604 -       foreach(tooltip tip, tips) {
7605 +       wes_foreach(tooltip tip, tips) {
7606                 if(!tip.action.empty() && point_in_rect(mousex, mousey, tip.rect)) {
7607                         display* disp = resources::screen;
7608                         help::show_help(*disp, tip.action);
7609 diff -ur wesnoth-1.10.3.orig/src/unit_abilities.cpp wesnoth-1.10.3/src/unit_abilities.cpp
7610 --- wesnoth-1.10.3.orig/src/unit_abilities.cpp  2012-01-07 03:35:17.000000000 +0100
7611 +++ wesnoth-1.10.3/src/unit_abilities.cpp       2012-07-11 13:16:06.239933349 +0200
7612 @@ -124,7 +124,7 @@
7613  {
7614         if (const config &abilities = cfg_.child("abilities"))
7615         {
7616 -               foreach (const config &i, abilities.child_range(ability)) {
7617 +               wes_foreach (const config &i, abilities.child_range(ability)) {
7618                         if (ability_active(ability, i, loc) &&
7619                             ability_affects_self(ability, i, loc))
7620                                 return true;
7621 @@ -141,7 +141,7 @@
7622                 const config &adj_abilities = it->cfg_.child("abilities");
7623                 if (!adj_abilities)
7624                         continue;
7625 -               foreach (const config &j, adj_abilities.child_range(ability)) {
7626 +               wes_foreach (const config &j, adj_abilities.child_range(ability)) {
7627                         if (unit_abilities::affects_side(j, teams_manager::get_teams(), side(), it->side()) &&
7628                             it->ability_active(ability, j, adjacent[i]) &&
7629                             ability_affects_adjacent(ability,  j, i, loc))
7630 @@ -158,7 +158,7 @@
7631  
7632         if (const config &abilities = cfg_.child("abilities"))
7633         {
7634 -               foreach (const config &i, abilities.child_range(ability)) {
7635 +               wes_foreach (const config &i, abilities.child_range(ability)) {
7636                         if (ability_active(ability, i, loc) &&
7637                             ability_affects_self(ability, i, loc))
7638                                 res.cfgs.push_back(std::pair<const config *, map_location>(&i, loc));
7639 @@ -175,7 +175,7 @@
7640                 const config &adj_abilities = it->cfg_.child("abilities");
7641                 if (!adj_abilities)
7642                         continue;
7643 -               foreach (const config &j, adj_abilities.child_range(ability)) {
7644 +               wes_foreach (const config &j, adj_abilities.child_range(ability)) {
7645                         if (unit_abilities::affects_side(j, teams_manager::get_teams(), side(), it->side()) &&
7646                             it->ability_active(ability, j, adjacent[i]) &&
7647                             ability_affects_adjacent(ability, j, i, loc))
7648 @@ -193,7 +193,7 @@
7649  
7650         const config &abilities = cfg_.child("abilities");
7651         if (!abilities) return res;
7652 -       foreach (const config::any_child &ab, abilities.all_children_range()) {
7653 +       wes_foreach (const config::any_child &ab, abilities.all_children_range()) {
7654                 std::string const &id = ab.cfg["id"];
7655                 if (!id.empty())
7656                         res.push_back(id);
7657 @@ -208,7 +208,7 @@
7658         const config &abilities = cfg_.child("abilities");
7659         if (!abilities) return res;
7660  
7661 -       foreach (const config::any_child &ab, abilities.all_children_range())
7662 +       wes_foreach (const config::any_child &ab, abilities.all_children_range())
7663         {
7664                 if (force_active || ability_active(ab.key, ab.cfg, loc_))
7665                 {
7666 @@ -265,9 +265,9 @@
7667         get_adjacent_tiles(loc,adjacent);
7668         const unit_map& units = *resources::units;
7669  
7670 -       foreach (const config &i, cfg.child_range("filter_adjacent"))
7671 +       wes_foreach (const config &i, cfg.child_range("filter_adjacent"))
7672         {
7673 -               foreach (const std::string &j, utils::split(i["adjacent"]))
7674 +               wes_foreach (const std::string &j, utils::split(i["adjacent"]))
7675                 {
7676                         map_location::DIRECTION index =
7677                                 map_location::parse_direction(j);
7678 @@ -282,9 +282,9 @@
7679                 }
7680         }
7681  
7682 -       foreach (const config &i, cfg.child_range("filter_adjacent_location"))
7683 +       wes_foreach (const config &i, cfg.child_range("filter_adjacent_location"))
7684         {
7685 -               foreach (const std::string &j, utils::split(i["adjacent"]))
7686 +               wes_foreach (const std::string &j, utils::split(i["adjacent"]))
7687                 {
7688                         map_location::DIRECTION index = map_location::parse_direction(j);
7689                         if (index == map_location::NDIRECTIONS) {
7690 @@ -310,7 +310,7 @@
7691  
7692         assert(dir >=0 && dir <= 5);
7693         static const std::string adjacent_names[6] = {"n","ne","se","s","sw","nw"};
7694 -       foreach (const config &i, cfg.child_range("affect_adjacent"))
7695 +       wes_foreach (const config &i, cfg.child_range("affect_adjacent"))
7696         {
7697                 std::vector<std::string> dirs = utils::split(i["adjacent"]);
7698                 if(std::find(dirs.begin(),dirs.end(),adjacent_names[dir]) != dirs.end()) {
7699 @@ -366,7 +366,7 @@
7700         int flat = 0;
7701         int stack = 0;
7702         typedef std::pair<const config *, map_location> pt;
7703 -       foreach (pt const &p, cfgs)
7704 +       wes_foreach (pt const &p, cfgs)
7705         {
7706                 int value = (*p.first)[key].to_int(def);
7707                 if ((*p.first)["cumulative"].to_bool()) {
7708 @@ -398,7 +398,7 @@
7709         int flat = 0;
7710         int stack = 0;
7711         typedef std::pair<const config *, map_location> pt;
7712 -       foreach (pt const &p, cfgs)
7713 +       wes_foreach (pt const &p, cfgs)
7714         {
7715                 int value = (*p.first)[key].to_int(def);
7716                 if ((*p.first)["cumulative"].to_bool()) {
7717 @@ -448,7 +448,7 @@
7718  namespace {
7719         bool get_special_children(std::vector<const config*>& result, const config& parent,
7720                                    const std::string& id, bool just_peeking=false) {
7721 -               foreach (const config::any_child &sp, parent.all_children_range())
7722 +               wes_foreach (const config::any_child &sp, parent.all_children_range())
7723                 {
7724                         if (sp.key == id || sp.cfg["id"] == id) {
7725                                 if(just_peeking) {
7726 @@ -495,7 +495,7 @@
7727         unit_ability_list res;
7728         if (const config &specials = cfg_.child("specials"))
7729         {
7730 -               foreach (const config &i, specials.child_range(special)) {
7731 +               wes_foreach (const config &i, specials.child_range(special)) {
7732                         if (special_active(i, true))
7733                                 res.cfgs.push_back(std::pair<const config *, map_location>
7734                                         (&i, attacker_ ? aloc_ : dloc_));
7735 @@ -504,7 +504,7 @@
7736         if (!other_attack_) return res;
7737         if (const config &specials = other_attack_->cfg_.child("specials"))
7738         {
7739 -               foreach (const config &i, specials.child_range(special)) {
7740 +               wes_foreach (const config &i, specials.child_range(special)) {
7741                         if (other_attack_->special_active(i, false))
7742                                 res.cfgs.push_back(std::pair<const config *, map_location>
7743                                         (&i, attacker_ ? dloc_ : aloc_));
7744 @@ -519,7 +519,7 @@
7745         const config &specials = cfg_.child("specials");
7746         if (!specials) return res;
7747  
7748 -       foreach (const config::any_child &sp, specials.all_children_range())
7749 +       wes_foreach (const config::any_child &sp, specials.all_children_range())
7750         {
7751                 if (force || special_active(sp.cfg, true)) {
7752                         const t_string &name = sp.cfg["name"];
7753 @@ -544,7 +544,7 @@
7754         const config &specials = cfg_.child("specials");
7755         if (!specials) return res;
7756  
7757 -       foreach (const config::any_child &sp, specials.all_children_range())
7758 +       wes_foreach (const config::any_child &sp, specials.all_children_range())
7759         {
7760                 char const *s = force || special_active(sp.cfg, true) ?
7761                         "name" : "name_inactive";
7762 @@ -679,9 +679,9 @@
7763                 get_adjacent_tiles(dloc_,adjacent);
7764         }
7765  
7766 -       foreach (const config &i, cfg.child_range("filter_adjacent"))
7767 +       wes_foreach (const config &i, cfg.child_range("filter_adjacent"))
7768         {
7769 -               foreach (const std::string &j, utils::split(i["adjacent"]))
7770 +               wes_foreach (const std::string &j, utils::split(i["adjacent"]))
7771                 {
7772                         map_location::DIRECTION index =
7773                                 map_location::parse_direction(j);
7774 @@ -694,9 +694,9 @@
7775                 }
7776         }
7777  
7778 -       foreach (const config &i, cfg.child_range("filter_adjacent_location"))
7779 +       wes_foreach (const config &i, cfg.child_range("filter_adjacent_location"))
7780         {
7781 -               foreach (const std::string &j, utils::split(i["adjacent"]))
7782 +               wes_foreach (const std::string &j, utils::split(i["adjacent"]))
7783                 {
7784                         map_location::DIRECTION index =
7785                                 map_location::parse_direction(j);
7786 diff -ur wesnoth-1.10.3.orig/src/unit_animation.cpp wesnoth-1.10.3/src/unit_animation.cpp
7787 --- wesnoth-1.10.3.orig/src/unit_animation.cpp  2012-01-07 03:35:17.000000000 +0100
7788 +++ wesnoth-1.10.3/src/unit_animation.cpp       2012-07-11 13:16:05.969933358 +0200
7789 @@ -78,7 +78,7 @@
7790         config merge() const
7791         {
7792                 config result = attributes;
7793 -               foreach (const config::all_children_iterator &i, children)
7794 +               wes_foreach (const config::all_children_iterator &i, children)
7795                         result.add_child(i->key, i->cfg);
7796                 return result;
7797         }
7798 @@ -99,7 +99,7 @@
7799         animation_cursor(const config &cfg, animation_cursor *p):
7800                 itors(cfg.all_children_range()), branches(p->branches), parent(p)
7801         {
7802 -               foreach (animation_branch &ab, branches)
7803 +               wes_foreach (animation_branch &ab, branches)
7804                         ab.attributes.merge_attributes(cfg);
7805         }
7806  };
7807 @@ -122,7 +122,7 @@
7808                 if (ac.itors.first->key != "if")
7809                 {
7810                         // Append current config object to all the branches in scope.
7811 -                       foreach (animation_branch &ab, ac.branches) {
7812 +                       wes_foreach (animation_branch &ab, ac.branches) {
7813                                 ab.children.push_back(ac.itors.first);
7814                         }
7815                         ++ac.itors.first;
7816 @@ -154,7 +154,7 @@
7817  static animation_branches prepare_animation(const config &cfg, const std::string &animation_tag)
7818  {
7819         animation_branches expanded_animations;
7820 -       foreach (const config &anim, cfg.child_range(animation_tag)) {
7821 +       wes_foreach (const config &anim, cfg.child_range(animation_tag)) {
7822                 prepare_single_animation(anim, expanded_animations);
7823         }
7824         return expanded_animations;
7825 @@ -207,7 +207,7 @@
7826         overlaped_hex_()
7827  {
7828  //     if(!cfg["debug"].empty()) printf("DEBUG WML: FINAL\n%s\n\n",cfg.debug().c_str());
7829 -       foreach (const config::any_child &fr, cfg.all_children_range())
7830 +       wes_foreach (const config::any_child &fr, cfg.all_children_range())
7831         {
7832                 if (fr.key == frame_string) continue;
7833                 if (fr.key.find("_frame", fr.key.size() - 6) == std::string::npos) continue;
7834 @@ -221,11 +221,11 @@
7835                 const map_location::DIRECTION d = map_location::parse_direction(*i);
7836                 directions_.push_back(d);
7837         }
7838 -       foreach (const config &filter, cfg.child_range("filter")) {
7839 +       wes_foreach (const config &filter, cfg.child_range("filter")) {
7840                 unit_filter_.push_back(filter);
7841         }
7842  
7843 -       foreach (const config &filter, cfg.child_range("filter_second")) {
7844 +       wes_foreach (const config &filter, cfg.child_range("filter_second")) {
7845                 secondary_unit_filter_.push_back(filter);
7846         }
7847  
7848 @@ -253,10 +253,10 @@
7849         for(value2=value2_str.begin() ; value2 != value2_str.end() ; ++value2) {
7850                 value2_.push_back(atoi(value2->c_str()));
7851         }
7852 -       foreach (const config &filter, cfg.child_range("filter_attack")) {
7853 +       wes_foreach (const config &filter, cfg.child_range("filter_attack")) {
7854                 primary_attack_filter_.push_back(filter);
7855         }
7856 -       foreach (const config &filter, cfg.child_range("filter_second_attack")) {
7857 +       wes_foreach (const config &filter, cfg.child_range("filter_second_attack")) {
7858                 secondary_attack_filter_.push_back(filter);
7859         }
7860         play_offscreen_ = cfg["offscreen"].to_bool(true);
7861 @@ -487,7 +487,7 @@
7862         display::tdrawing_layer layer = display::LAYER_UNIT_DEFAULT,
7863         bool offscreen = true)
7864  {
7865 -       foreach (const animation_branch &ab, prepare_animation(cfg, tag_name))
7866 +       wes_foreach (const animation_branch &ab, prepare_animation(cfg, tag_name))
7867         {
7868                 config anim = ab.merge();
7869                 anim["apply_to"] = apply_to;
7870 @@ -503,7 +503,7 @@
7871  
7872  void unit_animation::add_anims( std::vector<unit_animation> & animations, const config & cfg)
7873  {
7874 -       foreach (const animation_branch &ab, prepare_animation(cfg, "animation")) {
7875 +       wes_foreach (const animation_branch &ab, prepare_animation(cfg, "animation")) {
7876                 animations.push_back(unit_animation(ab.merge()));
7877         }
7878  
7879 @@ -519,7 +519,7 @@
7880         add_simple_anim(animations, cfg, "levelin_anim", "levelin");
7881         add_simple_anim(animations, cfg, "levelout_anim", "levelout");
7882  
7883 -       foreach (const animation_branch &ab, prepare_animation(cfg, "standing_anim"))
7884 +       wes_foreach (const animation_branch &ab, prepare_animation(cfg, "standing_anim"))
7885         {
7886                 config anim = ab.merge();
7887                 anim["apply_to"] = "default";
7888 @@ -528,7 +528,7 @@
7889                 if (anim["offscreen"].empty()) anim["offscreen"] = false;
7890                 animations.push_back(unit_animation(anim));
7891         }
7892 -       foreach (const animation_branch &ab, prepare_animation(cfg, "standing_anim"))
7893 +       wes_foreach (const animation_branch &ab, prepare_animation(cfg, "standing_anim"))
7894         {
7895                 config anim = ab.merge();
7896                 anim["apply_to"] = "standing";
7897 @@ -537,7 +537,7 @@
7898                 if (anim["offscreen"].empty()) anim["offscreen"] = false;
7899                 animations.push_back(unit_animation(anim));
7900         }
7901 -       foreach (const animation_branch &ab, prepare_animation(cfg, "healing_anim"))
7902 +       wes_foreach (const animation_branch &ab, prepare_animation(cfg, "healing_anim"))
7903         {
7904                 config anim = ab.merge();
7905                 anim["apply_to"] = "healing";
7906 @@ -546,7 +546,7 @@
7907                 animations.push_back(unit_animation(anim));
7908         }
7909  
7910 -       foreach (const animation_branch &ab, prepare_animation(cfg, "healed_anim"))
7911 +       wes_foreach (const animation_branch &ab, prepare_animation(cfg, "healed_anim"))
7912         {
7913                 config anim = ab.merge();
7914                 anim["apply_to"] = "healed";
7915 @@ -558,7 +558,7 @@
7916                 animations.back().sub_anims_["_healed_sound"].add_frame(1,frame_builder().sound("heal.wav"),true);
7917         }
7918  
7919 -       foreach (const animation_branch &ab, prepare_animation(cfg, "poison_anim"))
7920 +       wes_foreach (const animation_branch &ab, prepare_animation(cfg, "poison_anim"))
7921         {
7922                 config anim = ab.merge();
7923                 anim["apply_to"] ="poisoned";
7924 @@ -572,7 +572,7 @@
7925  
7926         add_simple_anim(animations, cfg, "pre_movement_anim", "pre_movement", display::LAYER_UNIT_MOVE_DEFAULT);
7927  
7928 -       foreach (const animation_branch &ab, prepare_animation(cfg, "movement_anim"))
7929 +       wes_foreach (const animation_branch &ab, prepare_animation(cfg, "movement_anim"))
7930         {
7931                 config anim = ab.merge();
7932                 if (anim["offset"].empty()) {
7933 @@ -585,7 +585,7 @@
7934  
7935         add_simple_anim(animations, cfg, "post_movement_anim", "post_movement", display::LAYER_UNIT_MOVE_DEFAULT);
7936  
7937 -       foreach (const animation_branch &ab, prepare_animation(cfg, "defend"))
7938 +       wes_foreach (const animation_branch &ab, prepare_animation(cfg, "defend"))
7939         {
7940                 config anim = ab.merge();
7941                 anim["apply_to"] = "defend";
7942 @@ -607,7 +607,7 @@
7943                 else
7944                 {
7945                         std::vector<std::string> v = utils::split(anim["hits"]);
7946 -                       foreach (const std::string &hit_type, v)
7947 +                       wes_foreach (const std::string &hit_type, v)
7948                         {
7949                                 config tmp = anim;
7950                                 tmp["hits"] = hit_type;
7951 @@ -625,7 +625,7 @@
7952         add_simple_anim(animations, cfg, "draw_weapon_anim", "draw_wepaon", display::LAYER_UNIT_MOVE_DEFAULT);
7953         add_simple_anim(animations, cfg, "sheath_weapon_anim", "sheath_wepaon", display::LAYER_UNIT_MOVE_DEFAULT);
7954  
7955 -       foreach (const animation_branch &ab, prepare_animation(cfg, "attack_anim"))
7956 +       wes_foreach (const animation_branch &ab, prepare_animation(cfg, "attack_anim"))
7957         {
7958                 config anim = ab.merge();
7959                 anim["apply_to"] = "attack";
7960 @@ -646,7 +646,7 @@
7961                 animations.push_back(unit_animation(anim));
7962         }
7963  
7964 -       foreach (const animation_branch &ab, prepare_animation(cfg, "death"))
7965 +       wes_foreach (const animation_branch &ab, prepare_animation(cfg, "death"))
7966         {
7967                 config anim = ab.merge();
7968                 anim["apply_to"] = "death";
7969 @@ -663,7 +663,7 @@
7970  
7971         add_simple_anim(animations, cfg, "victory_anim", "victory");
7972  
7973 -       foreach (const animation_branch &ab, prepare_animation(cfg, "extra_anim"))
7974 +       wes_foreach (const animation_branch &ab, prepare_animation(cfg, "extra_anim"))
7975         {
7976                 config anim = ab.merge();
7977                 anim["apply_to"] = anim["flag"];
7978 @@ -671,7 +671,7 @@
7979                 animations.push_back(unit_animation(anim));
7980         }
7981  
7982 -       foreach (const animation_branch &ab, prepare_animation(cfg, "teleport_anim"))
7983 +       wes_foreach (const animation_branch &ab, prepare_animation(cfg, "teleport_anim"))
7984         {
7985                 config anim = ab.merge();
7986                 if (anim["layer"].empty()) anim["layer"] = default_layer;
7987 @@ -742,14 +742,14 @@
7988         config::const_child_itors range = cfg.child_range(frame_string+"frame");
7989         starting_frame_time_=INT_MAX;
7990         if(cfg[frame_string+"start_time"].empty() &&range.first != range.second) {
7991 -               foreach (const config &frame, range) {
7992 +               wes_foreach (const config &frame, range) {
7993                         starting_frame_time_ = std::min(starting_frame_time_, frame["begin"].to_int());
7994                 }
7995         } else {
7996                 starting_frame_time_ = cfg[frame_string+"start_time"];
7997         }
7998  
7999 -       foreach (const config &frame, range)
8000 +       wes_foreach (const config &frame, range)
8001         {
8002                 unit_frame tmp_frame(frame);
8003                 add_frame(tmp_frame.duration(),tmp_frame,!tmp_frame.does_not_change());
8004 diff -ur wesnoth-1.10.3.orig/src/unit.cpp wesnoth-1.10.3/src/unit.cpp
8005 --- wesnoth-1.10.3.orig/src/unit.cpp    2012-04-06 18:38:23.000000000 +0200
8006 +++ wesnoth-1.10.3/src/unit.cpp 2012-07-11 13:16:05.959933359 +0200
8007 @@ -288,7 +288,7 @@
8008                         filter_recall_ = filter_recall.get_config();
8009  
8010                 const vconfig::child_list& events = vcfg->get_children("event");
8011 -               foreach(const vconfig& e, events) {
8012 +               wes_foreach(const vconfig& e, events) {
8013                         events_.add_child("event", e.get_config());
8014                 }
8015         }
8016 @@ -296,7 +296,7 @@
8017         {
8018                 filter_recall_ = cfg.child_or_empty("filter_recall");
8019  
8020 -               foreach(const config& unit_event, cfg.child_range("event")) {
8021 +               wes_foreach(const config& unit_event, cfg.child_range("event")) {
8022                         events_.add_child("event", unit_event);
8023                 }
8024         }
8025 @@ -375,7 +375,7 @@
8026                         formula_vars_ = new game_logic::map_formula_callable;
8027  
8028                         variant var;
8029 -                       foreach (const config::attribute &i, ai_vars.attribute_range()) {
8030 +                       wes_foreach (const config::attribute &i, ai_vars.attribute_range()) {
8031                                 var.serialize_from_string(i.second);
8032                                 formula_vars_->add(i.first, var);
8033                         }
8034 @@ -432,7 +432,7 @@
8035  
8036         if (const config &status_flags = cfg.child("status"))
8037         {
8038 -               foreach (const config::attribute &st, status_flags.attribute_range()) {
8039 +               wes_foreach (const config::attribute &st, status_flags.attribute_range()) {
8040                         if (st.first == "healable") {
8041                                 ///@deprecated 1.9.2 'healable' instead of 'unhealable'
8042                                 ERR_UT << "Usage of 'healable' is deprecated, use 'unhealable' instead, "
8043 @@ -449,7 +449,7 @@
8044         }
8045  
8046         // Remove animations from private cfg, they're not needed there now
8047 -       foreach(const std::string& tag_name, unit_animation::all_tag_names()) {
8048 +       wes_foreach(const std::string& tag_name, unit_animation::all_tag_names()) {
8049                 cfg_.clear_children(tag_name);
8050         }
8051  
8052 @@ -518,7 +518,7 @@
8053                 "canrecruit", "extra_recruit", "x", "y", "placement",
8054                 // Useless attributes created when saving units to WML:
8055                 "flag_rgb", "language_name" };
8056 -       foreach (const char *attr, internalized_attrs) {
8057 +       wes_foreach (const char *attr, internalized_attrs) {
8058                 input_cfg.remove_attribute(attr);
8059                 cfg_.remove_attribute(attr);
8060         }
8061 @@ -526,11 +526,11 @@
8062         static char const *raw_attrs[] = { "description", "halo",
8063                 "profile", "small_profile", "upkeep", "usage", "ellipse",
8064                 "image", "image_icon", "random_traits", "generate_name" };
8065 -       foreach (const char *attr, raw_attrs) {
8066 +       wes_foreach (const char *attr, raw_attrs) {
8067                 input_cfg.remove_attribute(attr);
8068         }
8069  
8070 -       foreach (const config::attribute &attr, input_cfg.attribute_range()) {
8071 +       wes_foreach (const config::attribute &attr, input_cfg.attribute_range()) {
8072                 if (attr.first == "do_not_list") continue;
8073                 WRN_UT << "Unknown attribute '" << attr.first << "' discarded.\n";
8074         }
8075 @@ -715,12 +715,12 @@
8076         config::const_child_itors current_traits = modifications_.child_range("trait");
8077         std::vector<config> candidate_traits;
8078  
8079 -       foreach (const config &t, type->possible_traits())
8080 +       wes_foreach (const config &t, type->possible_traits())
8081         {
8082                 // Skip the trait if the unit already has it.
8083                 const std::string &tid = t["id"];
8084                 bool already = false;
8085 -               foreach (const config &mod, current_traits)
8086 +               wes_foreach (const config &mod, current_traits)
8087                 {
8088                         if (mod["id"] == tid) {
8089                                 already = true;
8090 @@ -767,7 +767,7 @@
8091  {
8092         std::vector<std::string> res;
8093  
8094 -       foreach (const config &mod, modifications_.child_range("trait"))
8095 +       wes_foreach (const config &mod, modifications_.child_range("trait"))
8096         {
8097                         std::string const &id = mod["id"];
8098                         if (!id.empty())
8099 @@ -797,7 +797,7 @@
8100         config new_cfg;
8101         static char const *persistent_attrs[] = { "upkeep", "ellipse",
8102                 "image", "image_icon", "usage", "random_traits", "generate_name" };
8103 -       foreach (const char *attr, persistent_attrs) {
8104 +       wes_foreach (const char *attr, persistent_attrs) {
8105                 if (const config::attribute_value *v = old_cfg.get(attr)) {
8106                         new_cfg[attr] = *v;
8107                 }
8108 @@ -813,7 +813,7 @@
8109         static char const *unit_type_attrs[] = { "movement", "movement_type",
8110                 "die_sound", "flies", "inherit", "variation_name",
8111                 "ignore_race_traits", "hide_help" };
8112 -       foreach (const char *attr, unit_type_attrs) {
8113 +       wes_foreach (const char *attr, unit_type_attrs) {
8114                 new_cfg.remove_attribute(attr);
8115         }
8116  
8117 @@ -1020,7 +1020,7 @@
8118  const std::vector<std::string> unit::advances_to_translated() const
8119  {
8120         std::vector<std::string> result;
8121 -       foreach (std::string type_id, advances_to_)
8122 +       wes_foreach (std::string type_id, advances_to_)
8123         {
8124                 const unit_type *type = unit_types.find(type_id);
8125                 if (type)
8126 @@ -1120,7 +1120,7 @@
8127  const std::map<std::string,std::string> unit::get_states() const
8128  {
8129         std::map<std::string, std::string> all_states;
8130 -       foreach (std::string const &s, states_) {
8131 +       wes_foreach (std::string const &s, states_) {
8132                 all_states[s] = "yes";
8133         }
8134         for (std::map<std::string, state_t>::const_iterator i = known_boolean_state_names_.begin(),
8135 @@ -1195,7 +1195,7 @@
8136  {
8137         if (const config &abil = cfg_.child("abilities"))
8138         {
8139 -               foreach (const config::any_child &ab, abil.all_children_range()) {
8140 +               wes_foreach (const config::any_child &ab, abil.all_children_range()) {
8141                         if (ab.cfg["id"] == ability)
8142                                 return true;
8143                 }
8144 @@ -2197,7 +2197,7 @@
8145         if (const config &resistance = cfg_.child("resistance"))
8146         {
8147                 utils::string_map res;
8148 -               foreach (const config::attribute &i, resistance.attribute_range()) {
8149 +               wes_foreach (const config::attribute &i, resistance.attribute_range()) {
8150                         res[i.first] = i.second;
8151                 }
8152                 return res;
8153 @@ -2222,7 +2222,7 @@
8154         {
8155                 std::ostringstream tooltip;
8156                 const std::string &image = game_config::images::level;
8157 -               foreach (const std::string &s, advances_to())
8158 +               wes_foreach (const std::string &s, advances_to())
8159                 {
8160                         if (!s.empty())
8161                                 tooltip << s << '\n';
8162 @@ -2230,7 +2230,7 @@
8163                 temp[image] = tooltip.str();
8164         }
8165  
8166 -       foreach (const config &adv, get_modification_advances())
8167 +       wes_foreach (const config &adv, get_modification_advances())
8168         {
8169                 const std::string &image = adv["image"];
8170                 if (image.empty()) continue;
8171 @@ -2248,7 +2248,7 @@
8172         std::vector<std::pair<std::string,std::string> > temp;
8173         std::pair<std::string,std::string> icon; //<image,tooltip>
8174  
8175 -       foreach (const config &adv, get_modification_advances())
8176 +       wes_foreach (const config &adv, get_modification_advances())
8177         {
8178                 icon.first = adv["icon"].str();
8179                 icon.second = adv["description"].str();
8180 @@ -2265,7 +2265,7 @@
8181  std::vector<config> unit::get_modification_advances() const
8182  {
8183         std::vector<config> res;
8184 -       foreach (const config &adv, modification_advancements())
8185 +       wes_foreach (const config &adv, modification_advancements())
8186         {
8187                 if (adv["strict_amla"].to_bool() && !advances_to_.empty())
8188                         continue;
8189 @@ -2283,7 +2283,7 @@
8190                 std::unique_copy(temp.begin(), temp.end(), std::back_inserter(uniq));
8191  
8192                 bool requirements_done = true;
8193 -               foreach (const std::string &s, uniq)
8194 +               wes_foreach (const std::string &s, uniq)
8195                 {
8196                         int required_num = std::count(temp.begin(), temp.end(), s);
8197                         int mod_num = modification_count("advance", s);
8198 @@ -2302,7 +2302,7 @@
8199  size_t unit::modification_count(const std::string& type, const std::string& id) const
8200  {
8201         size_t res = 0;
8202 -       foreach (const config &item, modifications_.child_range(type)) {
8203 +       wes_foreach (const config &item, modifications_.child_range(type)) {
8204                 if (item["id"] == id) {
8205                         ++res;
8206                 }
8207 @@ -2314,7 +2314,7 @@
8208  /** Helper function for add_modifications */
8209  static void mod_mdr_merge(config& dst, const config& mod, bool delta)
8210  {
8211 -       foreach (const config::attribute &i, mod.attribute_range()) {
8212 +       wes_foreach (const config::attribute &i, mod.attribute_range()) {
8213                 int v = 0;
8214                 if (delta) v = dst[i.first];
8215                 dst[i.first] = v + i.second.to_int();
8216 @@ -2336,7 +2336,7 @@
8217         }
8218         config last_effect;
8219         std::vector<t_string> effects_description;
8220 -       foreach (const config &effect, mod.child_range("effect"))
8221 +       wes_foreach (const config &effect, mod.child_range("effect"))
8222         {
8223                 // See if the effect only applies to certain unit types
8224                 const std::string &type_filter = effect["unit_type"];
8225 @@ -2524,7 +2524,7 @@
8226                                         config &def = cfg_.child_or_add("defense");
8227                                         if (const config &ap = effect.child("defense")) {
8228                                                 bool replace = effect["replace"].to_bool();
8229 -                                               foreach (const config::attribute &i, ap.attribute_range()) {
8230 +                                               wes_foreach (const config::attribute &i, ap.attribute_range()) {
8231                                                         int v = i.second.to_int();
8232                                                         config::attribute_value &dst = def[i.first];
8233                                                         if (!replace) {
8234 @@ -2551,7 +2551,7 @@
8235                                         config &ab = cfg_.child_or_add("abilities");
8236                                         if (const config &ab_effect = effect.child("abilities")) {
8237                                                 config to_append;
8238 -                                               foreach (const config::any_child &ab, ab_effect.all_children_range()) {
8239 +                                               wes_foreach (const config::any_child &ab, ab_effect.all_children_range()) {
8240                                                         if(!has_ability_by_id(ab.cfg["id"])) {
8241                                                                 to_append.add_child(ab.key, ab.cfg);
8242                                                         }
8243 @@ -2560,7 +2560,7 @@
8244                                         }
8245                                 } else if (apply_to == "remove_ability") {
8246                                         if (const config &ab_effect = effect.child("abilities")) {
8247 -                                               foreach (const config::any_child &ab, ab_effect.all_children_range()) {
8248 +                                               wes_foreach (const config::any_child &ab, ab_effect.all_children_range()) {
8249                                                         remove_ability_by_id(ab.cfg["id"]);
8250                                                 }
8251                                         }
8252 @@ -2749,7 +2749,7 @@
8253  
8254         for(size_t i = 0; i != NumModificationTypes; ++i) {
8255                 const std::string& mod = ModificationTypes[i];
8256 -               foreach (const config &m, modifications_.child_range(mod)) {
8257 +               wes_foreach (const config &m, modifications_.child_range(mod)) {
8258                         log_scope("add mod");
8259                         add_modification(ModificationTypes[i], m, true);
8260                 }
8261 @@ -2779,7 +2779,7 @@
8262         bool is_inv = !get_state(STATE_UNCOVERED) && get_ability_bool(hides,loc);
8263         if(is_inv){
8264                 const std::vector<team>& teams = *resources::teams;
8265 -               foreach (const unit &u, *resources::units)
8266 +               wes_foreach (const unit &u, *resources::units)
8267                 {
8268                         const map_location &u_loc = u.get_location();
8269                         if (teams[side_-1].is_enemy(u.side()) && tiles_adjacent(loc, u_loc)) {
8270 @@ -2881,7 +2881,7 @@
8271  int side_units(int side)
8272  {
8273         int res = 0;
8274 -       foreach (const unit &u, *resources::units) {
8275 +       wes_foreach (const unit &u, *resources::units) {
8276                 if (u.side() == side) ++res;
8277         }
8278         return res;
8279 @@ -2890,7 +2890,7 @@
8280  int side_units_cost(int side)
8281  {
8282         int res = 0;
8283 -       foreach (const unit &u, *resources::units) {
8284 +       wes_foreach (const unit &u, *resources::units) {
8285                 if (u.side() == side) res += u.cost();
8286         }
8287         return res;
8288 @@ -2899,7 +2899,7 @@
8289  int side_upkeep(int side)
8290  {
8291         int res = 0;
8292 -       foreach (const unit &u, *resources::units) {
8293 +       wes_foreach (const unit &u, *resources::units) {
8294                 if (u.side() == side) res += u.upkeep();
8295         }
8296         return res;
8297 @@ -3029,7 +3029,7 @@
8298  const tportrait* unit::portrait(
8299                 const unsigned size, const tportrait::tside side) const
8300  {
8301 -       foreach(const tportrait& portrait, (type()->portraits())) {
8302 +       wes_foreach(const tportrait& portrait, (type()->portraits())) {
8303                 if(portrait.size == size
8304                                 && (side ==  portrait.side || portrait.side == tportrait::BOTH)) {
8305  
8306 @@ -3107,20 +3107,20 @@
8307                 "number",
8308                 ""};
8309  
8310 -       foreach (const config &att, unit_config.child_range("attack"))
8311 +       wes_foreach (const config &att, unit_config.child_range("attack"))
8312         {
8313                 config& child = wcfg.add_child("attack");
8314                 for (int i = 0; !attack_keys[i].empty(); ++i) {
8315                         child[attack_keys[i]] = att[attack_keys[i]];
8316                 }
8317 -               foreach (const config &spec, att.child_range("specials")) {
8318 +               wes_foreach (const config &spec, att.child_range("specials")) {
8319                         config& child_spec = child.add_child("specials", spec);
8320                         child_spec.recursive_clear_value("description");
8321                 }
8322  
8323         }
8324  
8325 -       foreach (const config &abi, unit_config.child_range("abilities"))
8326 +       wes_foreach (const config &abi, unit_config.child_range("abilities"))
8327         {
8328                 config& child = wcfg.add_child("abilities", abi);
8329                 child.recursive_clear_value("description");
8330 @@ -3129,7 +3129,7 @@
8331                 child.recursive_clear_value("name_inactive");
8332         }
8333  
8334 -       foreach (const config &trait, unit_config.child_range("trait"))
8335 +       wes_foreach (const config &trait, unit_config.child_range("trait"))
8336         {
8337                 config& child = wcfg.add_child("trait", trait);
8338                 child.recursive_clear_value("description");
8339 @@ -3142,7 +3142,7 @@
8340  
8341         for (int i = 0; !child_keys[i].empty(); ++i)
8342         {
8343 -               foreach (const config &c, unit_config.child_range(child_keys[i])) {
8344 +               wes_foreach (const config &c, unit_config.child_range(child_keys[i])) {
8345                         wcfg.add_child(child_keys[i], c);
8346                 }
8347         }
8348 diff -ur wesnoth-1.10.3.orig/src/unit_display.cpp wesnoth-1.10.3/src/unit_display.cpp
8349 --- wesnoth-1.10.3.orig/src/unit_display.cpp    2012-01-07 03:35:17.000000000 +0100
8350 +++ wesnoth-1.10.3/src/unit_display.cpp 2012-07-11 13:16:05.953266691 +0200
8351 @@ -472,7 +472,7 @@
8352         disp->display_unit_hex(healed_loc);
8353         unit_animator animator;
8354  
8355 -       foreach (unit *h, healers) {
8356 +       wes_foreach (unit *h, healers) {
8357                 h->set_facing(h->get_location().get_relative_dir(healed_loc));
8358                 animator.add_animation(h, "healing", h->get_location(),
8359                         healed_loc, healing);
8360 diff -ur wesnoth-1.10.3.orig/src/unit_map.cpp wesnoth-1.10.3/src/unit_map.cpp
8361 --- wesnoth-1.10.3.orig/src/unit_map.cpp        2012-01-07 03:35:17.000000000 +0100
8362 +++ wesnoth-1.10.3/src/unit_map.cpp     2012-07-11 13:16:05.986600025 +0200
8363 @@ -444,7 +444,7 @@
8364  {
8365         assert(u);
8366  
8367 -       foreach(const unit_pod& item, ilist_) {
8368 +       wes_foreach(const unit_pod& item, ilist_) {
8369                 if(item.unit == u) {
8370                         return true;
8371                 }
8372 diff -ur wesnoth-1.10.3.orig/src/unit_map.hpp wesnoth-1.10.3/src/unit_map.hpp
8373 --- wesnoth-1.10.3.orig/src/unit_map.hpp        2012-01-07 03:35:17.000000000 +0100
8374 +++ wesnoth-1.10.3/src/unit_map.hpp     2012-07-11 13:16:05.986600025 +0200
8375 @@ -480,7 +480,7 @@
8376          */
8377         mutable t_ilist ilist_;
8378  
8379 -       /// The last list item, a sentinel that allows BOOST::foreach to hoist end()
8380 +       /// The last list item, a sentinel that allows BOOST::wes_foreach to hoist end()
8381         t_ilist::iterator the_end_;
8382  
8383  };
8384 diff -ur wesnoth-1.10.3.orig/src/unit_types.cpp wesnoth-1.10.3/src/unit_types.cpp
8385 --- wesnoth-1.10.3.orig/src/unit_types.cpp      2012-01-07 03:35:17.000000000 +0100
8386 +++ wesnoth-1.10.3/src/unit_types.cpp   2012-07-11 13:16:06.019933355 +0200
8387 @@ -156,7 +156,7 @@
8388                 if (config &specials = cfg_.child("specials"))
8389                 {
8390                         config new_specials;
8391 -                       foreach (const config::any_child &vp, specials.all_children_range()) {
8392 +                       wes_foreach (const config::any_child &vp, specials.all_children_range()) {
8393                                 std::vector<std::string>::const_iterator found_id =
8394                                         std::find(dsl.begin(), dsl.end(), vp.cfg["id"]);
8395                                 if (found_id == dsl.end()) {
8396 @@ -174,7 +174,7 @@
8397                         cfg_.clear_children("specials");
8398                 }
8399                 config &new_specials = cfg_.child_or_add("specials");
8400 -               foreach (const config::any_child &value, set_specials.all_children_range()) {
8401 +               wes_foreach (const config::any_child &value, set_specials.all_children_range()) {
8402                         new_specials.add_child(value.key, value.cfg);
8403                 }
8404         }
8405 @@ -345,7 +345,7 @@
8406  
8407         if (const config &resistance = cfg_.child("resistance"))
8408         {
8409 -               foreach (const config::attribute &i, resistance.attribute_range()) {
8410 +               wes_foreach (const config::attribute &i, resistance.attribute_range()) {
8411                         res[i.first] = i.second;
8412                 }
8413         }
8414 @@ -666,11 +666,11 @@
8415         movementType_ = unit_movement_type(cfg);
8416         alpha_ = ftofxp(1.0);
8417  
8418 -       foreach (const config &t, traits)
8419 +       wes_foreach (const config &t, traits)
8420         {
8421                 possibleTraits_.add_child("trait", t);
8422         }
8423 -       foreach (config &var_cfg, cfg.child_range("variation"))
8424 +       wes_foreach (config &var_cfg, cfg.child_range("variation"))
8425         {
8426                 if (var_cfg["inherit"].to_bool()) {
8427                         config nvar_cfg(cfg);
8428 @@ -710,7 +710,7 @@
8429                 if (cfg["ignore_race_traits"].to_bool()) {
8430                         possibleTraits_.clear();
8431                 } else {
8432 -                       foreach (const config &t, race_->additional_traits())
8433 +                       wes_foreach (const config &t, race_->additional_traits())
8434                         {
8435                                 if (alignment_ != NEUTRAL || t["id"] != "fearless")
8436                                         possibleTraits_.add_child("trait", t);
8437 @@ -722,7 +722,7 @@
8438         }
8439  
8440         // Insert any traits that are just for this unit type
8441 -       foreach (const config &trait, cfg.child_range("trait"))
8442 +       wes_foreach (const config &trait, cfg.child_range("trait"))
8443         {
8444                 possibleTraits_.add_child("trait", trait);
8445         }
8446 @@ -750,7 +750,7 @@
8447         game_config::add_color_info(cfg);
8448  
8449  
8450 -       foreach (const config &portrait, cfg_.child_range("portrait")) {
8451 +       wes_foreach (const config &portrait, cfg_.child_range("portrait")) {
8452                 portraits_.push_back(tportrait(portrait));
8453         }
8454  
8455 @@ -807,7 +807,7 @@
8456  
8457         if (const config &abil_cfg = cfg.child("abilities"))
8458         {
8459 -               foreach (const config::any_child &ab, abil_cfg.all_children_range()) {
8460 +               wes_foreach (const config::any_child &ab, abil_cfg.all_children_range()) {
8461                         const config::attribute_value &name = ab.cfg["name"];
8462                         if (!name.empty()) {
8463                                 abilities_.push_back(name.t_str());
8464 @@ -816,15 +816,15 @@
8465                 }
8466         }
8467  
8468 -       foreach (const config &adv, cfg.child_range("advancement"))
8469 +       wes_foreach (const config &adv, cfg.child_range("advancement"))
8470         {
8471 -               foreach (const config &effect, adv.child_range("effect"))
8472 +               wes_foreach (const config &effect, adv.child_range("effect"))
8473                 {
8474                         const config &abil_cfg = effect.child("abilities");
8475                         if (!abil_cfg || effect["apply_to"] != "new_ability") {
8476                                 continue;
8477                         }
8478 -                       foreach (const config::any_child &ab, abil_cfg.all_children_range()) {
8479 +                       wes_foreach (const config::any_child &ab, abil_cfg.all_children_range()) {
8480                                 const config::attribute_value &name = ab.cfg["name"];
8481                                 if (!name.empty()) {
8482                                         adv_abilities_.push_back(name.t_str());
8483 @@ -934,7 +934,7 @@
8484  std::vector<attack_type> unit_type::attacks() const
8485  {
8486         std::vector<attack_type> res;
8487 -       foreach (const config &att, cfg_.child_range("attack")) {
8488 +       wes_foreach (const config &att, cfg_.child_range("attack")) {
8489                 res.push_back(attack_type(att));
8490         }
8491  
8492 @@ -990,7 +990,7 @@
8493  {
8494         if (const config &abil = cfg_.child("abilities"))
8495         {
8496 -               foreach (const config::any_child &ab, abil.all_children_range()) {
8497 +               wes_foreach (const config::any_child &ab, abil.all_children_range()) {
8498                         if (ab.cfg["id"] == ability)
8499                                 return true;
8500                 }
8501 @@ -1005,7 +1005,7 @@
8502         const config &abilities = cfg_.child("abilities");
8503         if (!abilities) return res;
8504  
8505 -       foreach (const config::any_child &ab, abilities.all_children_range()) {
8506 +       wes_foreach (const config::any_child &ab, abilities.all_children_range()) {
8507                 const std::string &id = ab.cfg["id"];
8508                 if (!id.empty())
8509                         res.push_back(id);
8510 @@ -1077,7 +1077,7 @@
8511         if (!ut)
8512                 return;
8513  
8514 -       foreach(const std::string& adv, ut->advances_to()) {
8515 +       wes_foreach(const std::string& adv, ut->advances_to()) {
8516                 if (tree.insert(adv).second) {
8517                         // insertion succeed, expand the new type
8518                         advancement_tree_internal(adv, tree);
8519 @@ -1098,9 +1098,9 @@
8520         unit_types.build_all(unit_type::HELP_INDEX);
8521  
8522         std::vector<std::string> adv_from;
8523 -       foreach (const unit_type_data::unit_type_map::value_type &ut, unit_types.types())
8524 +       wes_foreach (const unit_type_data::unit_type_map::value_type &ut, unit_types.types())
8525         {
8526 -               foreach(const std::string& adv, ut.second.advances_to()) {
8527 +               wes_foreach(const std::string& adv, ut.second.advances_to()) {
8528                         if (adv == id_)
8529                                 adv_from.push_back(ut.second.id());
8530                 }
8531 @@ -1127,7 +1127,7 @@
8532      clear();
8533      set_unit_config(cfg);
8534  
8535 -       foreach (const config &mt, cfg.child_range("movetype"))
8536 +       wes_foreach (const config &mt, cfg.child_range("movetype"))
8537         {
8538                 const unit_movement_type move_type(mt);
8539                 movement_types_.insert(
8540 @@ -1135,14 +1135,14 @@
8541                 loadscreen::increment_progress();
8542         }
8543  
8544 -       foreach (const config &r, cfg.child_range("race"))
8545 +       wes_foreach (const config &r, cfg.child_range("race"))
8546         {
8547                 const unit_race race(r);
8548                 races_.insert(std::pair<std::string,unit_race>(race.id(),race));
8549                 loadscreen::increment_progress();
8550         }
8551  
8552 -       foreach (config &ut, cfg.child_range("unit_type"))
8553 +       wes_foreach (config &ut, cfg.child_range("unit_type"))
8554         {
8555                 std::string id = ut["id"];
8556                 if (const config &bu = ut.child("base_unit"))
8557 @@ -1195,7 +1195,7 @@
8558  
8559  void unit_type_data::check_types(const std::vector<std::string>& types) const
8560  {
8561 -       foreach(const std::string& type, types) {
8562 +       wes_foreach(const std::string& type, types) {
8563                 if(!find(type)) throw game::game_error("unknown unit type: " + type);
8564         }
8565  }
8566 @@ -1279,7 +1279,7 @@
8567  
8568         std::vector<std::string> trees = utils::split(cfg["type_adv_tree"]);
8569         hide_help_type_.back().insert(trees.begin(), trees.end());
8570 -       foreach(const std::string& t_id, trees) {
8571 +       wes_foreach(const std::string& t_id, trees) {
8572                 unit_type_map::iterator ut = types_.find(t_id);
8573                 if (ut != types_.end()) {
8574                         std::set<std::string> adv_tree = ut->second.advancement_tree();
8575 @@ -1310,7 +1310,7 @@
8576  {
8577      const config& cfg = to_unit.get_cfg();
8578  
8579 -    foreach (const config &af, cfg.child_range("advancefrom"))
8580 +    wes_foreach (const config &af, cfg.child_range("advancefrom"))
8581      {
8582          const std::string &from = af["unit"];
8583          int xp = af["experience"];
8584 @@ -1349,12 +1349,12 @@
8585         // status gets changed. In the unlikely event it gets changed
8586         // multiple times, we want to try to do it in the same order
8587         // that unit::apply_modifications does things.
8588 -       foreach (const config &mod, possible_traits())
8589 +       wes_foreach (const config &mod, possible_traits())
8590         {
8591                 if (mod["availability"] != "musthave")
8592                         continue;
8593  
8594 -               foreach (const config &effect, mod.child_range("effect"))
8595 +               wes_foreach (const config &effect, mod.child_range("effect"))
8596                 {
8597                         // See if the effect only applies to
8598                         // certain unit types But don't worry
8599 diff -ur wesnoth-1.10.3.orig/src/variable.cpp wesnoth-1.10.3/src/variable.cpp
8600 --- wesnoth-1.10.3.orig/src/variable.cpp        2012-01-07 03:35:17.000000000 +0100
8601 +++ wesnoth-1.10.3/src/variable.cpp     2012-07-11 13:16:06.026600024 +0200
8602 @@ -233,11 +233,11 @@
8603  {
8604         config res;
8605  
8606 -       foreach (const config::attribute &i, cfg_->attribute_range()) {
8607 +       wes_foreach (const config::attribute &i, cfg_->attribute_range()) {
8608                 res[i.first] = expand(i.first);
8609         }
8610  
8611 -       foreach (const config::any_child &child, cfg_->all_children_range())
8612 +       wes_foreach (const config::any_child &child, cfg_->all_children_range())
8613         {
8614                 if (child.key == "insert_tag") {
8615                         vconfig insert_cfg(child.cfg);
8616 @@ -283,7 +283,7 @@
8617  {
8618         vconfig::child_list res;
8619  
8620 -       foreach (const config::any_child &child, cfg_->all_children_range())
8621 +       wes_foreach (const config::any_child &child, cfg_->all_children_range())
8622         {
8623                 if (child.key == key) {
8624                         res.push_back(vconfig(&child.cfg, cache_key_));
8625 @@ -319,7 +319,7 @@
8626         if (const config &natural = cfg_->child(key)) {
8627                 return vconfig(&natural, cache_key_);
8628         }
8629 -       foreach (const config &ins, cfg_->child_range("insert_tag"))
8630 +       wes_foreach (const config &ins, cfg_->child_range("insert_tag"))
8631         {
8632                 vconfig insert_cfg(ins);
8633                 if(insert_cfg["name"] == key) {
8634 @@ -339,7 +339,7 @@
8635         if (cfg_->child(key)) {
8636                 return true;
8637         }
8638 -       foreach (const config &ins, cfg_->child_range("insert_tag"))
8639 +       wes_foreach (const config &ins, cfg_->child_range("insert_tag"))
8640         {
8641                 vconfig insert_cfg(ins);
8642                 if(insert_cfg["name"] == key) {
8643 @@ -475,7 +475,7 @@
8644  
8645  config &scoped_wml_variable::store(const config &var_value)
8646  {
8647 -       foreach (const config &i, repos->get_variables().child_range(var_name_)) {
8648 +       wes_foreach (const config &i, repos->get_variables().child_range(var_name_)) {
8649                 previous_val_.add_child(var_name_, i);
8650         }
8651         repos->clear_variable_cfg(var_name_);
8652 @@ -489,7 +489,7 @@
8653  {
8654         if(activated_) {
8655                 repos->clear_variable_cfg(var_name_);
8656 -               foreach (const config &i, previous_val_.child_range(var_name_)) {
8657 +               wes_foreach (const config &i, previous_val_.child_range(var_name_)) {
8658                         repos->add_variable_cfg(var_name_, i);
8659                 }
8660                 LOG_NG << "scoped_wml_variable: var_name \"" << var_name_ << "\" has been reverted.\n";
8661 diff -ur wesnoth-1.10.3.orig/src/video.cpp wesnoth-1.10.3/src/video.cpp
8662 --- wesnoth-1.10.3.orig/src/video.cpp   2012-01-07 03:35:17.000000000 +0100
8663 +++ wesnoth-1.10.3/src/video.cpp        2012-07-11 13:16:05.949933359 +0200
8664 @@ -105,7 +105,7 @@
8665  {
8666         events.clear();
8667  
8668 -       foreach (SDL_Rect const &rect, update_rects) {
8669 +       wes_foreach (SDL_Rect const &rect, update_rects) {
8670                 events.push_back(event(rect, true));
8671                 events.push_back(event(rect, false));
8672         }
8673 @@ -354,7 +354,7 @@
8674  int CVideo::bppForMode( int x, int y, int flags)
8675  {
8676         int test_values[3] = {getBpp(), 32, 16};
8677 -       foreach(int &bpp, test_values) {
8678 +       wes_foreach(int &bpp, test_values) {
8679                 if(modePossible(x, y, bpp, flags) > 0) {
8680                         return bpp;
8681                 }
8682 diff -ur wesnoth-1.10.3.orig/src/whiteboard/highlight_visitor.cpp wesnoth-1.10.3/src/whiteboard/highlight_visitor.cpp
8683 --- wesnoth-1.10.3.orig/src/whiteboard/highlight_visitor.cpp    2012-01-07 03:35:17.000000000 +0100
8684 +++ wesnoth-1.10.3/src/whiteboard/highlight_visitor.cpp 2012-07-11 13:16:06.003266691 +0200
8685 @@ -147,7 +147,7 @@
8686                 {
8687                         //Highlight secondary highlights
8688                         mode_ = HIGHLIGHT_SECONDARY;
8689 -                       foreach(weak_action_ptr weak, secondary_highlights_)
8690 +                       wes_foreach(weak_action_ptr weak, secondary_highlights_)
8691                         {
8692                                 if (action_ptr action = weak.lock())
8693                                 {
8694 @@ -169,7 +169,7 @@
8695  
8696         //unhighlight secondary highlights
8697         mode_ = UNHIGHLIGHT_SECONDARY;
8698 -       foreach(weak_action_ptr weak, secondary_highlights_)
8699 +       wes_foreach(weak_action_ptr weak, secondary_highlights_)
8700         {
8701                 if (action_ptr action = weak.lock())
8702                 {
8703 @@ -178,7 +178,7 @@
8704         }
8705  
8706         //unhide other units if needed
8707 -       foreach(map_location hex, exclusive_display_hexes_)
8708 +       wes_foreach(map_location hex, exclusive_display_hexes_)
8709         {
8710                 resources::screen->remove_exclusive_draw(hex);
8711         }
8712 diff -ur wesnoth-1.10.3.orig/src/whiteboard/manager.cpp wesnoth-1.10.3/src/whiteboard/manager.cpp
8713 --- wesnoth-1.10.3.orig/src/whiteboard/manager.cpp      2012-04-23 04:44:12.000000000 +0200
8714 +++ wesnoth-1.10.3/src/whiteboard/manager.cpp   2012-07-11 13:16:06.003266691 +0200
8715 @@ -268,7 +268,7 @@
8716         }
8717  
8718         //Look for planned recruits that depend on this leader
8719 -       foreach(action_const_ptr action, *viewer_actions())
8720 +       wes_foreach(action_const_ptr action, *viewer_actions())
8721         {
8722                 recruit_const_ptr recruit = boost::dynamic_pointer_cast<class recruit const>(action);
8723                 recall_const_ptr recall = boost::dynamic_pointer_cast<class recall const>(action);
8724 @@ -332,7 +332,7 @@
8725  
8726  static void hide_all_plans()
8727  {
8728 -       foreach(team& t, *resources::teams)
8729 +       wes_foreach(team& t, *resources::teams)
8730                 t.get_side_actions()->hide();
8731  }
8732  
8733 @@ -344,7 +344,7 @@
8734                 hide_all_plans();
8735         else //< normal circumstance
8736         {
8737 -               foreach(team& t, *resources::teams)
8738 +               wes_foreach(team& t, *resources::teams)
8739                 {
8740                         //make sure only appropriate teams are hidden
8741                         if(!t.is_network_human())
8742 @@ -498,7 +498,7 @@
8743         if (can_modify_game_state() && has_actions())
8744         {
8745                 units_owning_moves_ = move_owners_finder().get_units_owning_moves();
8746 -               foreach(size_t unit_id, units_owning_moves_)
8747 +               wes_foreach(size_t unit_id, units_owning_moves_)
8748                 {
8749                         unit_map::iterator unit_iter = resources::units->find(unit_id);
8750                         assert(unit_iter.valid());
8751 @@ -509,7 +509,7 @@
8752  
8753  void manager::post_draw()
8754  {
8755 -       foreach(size_t unit_id, units_owning_moves_)
8756 +       wes_foreach(size_t unit_id, units_owning_moves_)
8757         {
8758                 unit_map::iterator unit_iter = resources::units->find(unit_id);
8759                 if (unit_iter.valid()) { 
8760 @@ -558,7 +558,7 @@
8761  
8762                 //Info about the action numbers to be displayed on screen.
8763                 side_actions::numbers_t numbers;
8764 -               foreach(team& t, *resources::teams)
8765 +               wes_foreach(team& t, *resources::teams)
8766                 {
8767                         side_actions& sa = *t.get_side_actions();
8768                         if(!sa.hidden())
8769 @@ -571,7 +571,7 @@
8770  
8771  void manager::on_mouseover_change(const map_location& hex)
8772  {
8773 -       foreach(map_location const& hex, hidden_unit_hexes_)
8774 +       wes_foreach(map_location const& hex, hidden_unit_hexes_)
8775                 resources::screen->remove_exclusive_draw(hex);
8776         hidden_unit_hexes_.clear();
8777  
8778 @@ -636,7 +636,7 @@
8779                 LOG_WB << "Received wb data (" << count << ").\n";
8780  
8781                 team& team_from = resources::teams->at(wb_cfg["side"]-1);
8782 -               foreach(side_actions::net_cmd const& cmd, wb_cfg.child_range("net_cmd"))
8783 +               wes_foreach(side_actions::net_cmd const& cmd, wb_cfg.child_range("net_cmd"))
8784                         team_from.get_side_actions()->execute_net_cmd(cmd);
8785         }
8786  }
8787 @@ -1138,7 +1138,7 @@
8788         options.push_back(_("HIDE ALL allies’ plans"));
8789  
8790         //populate list of networked allies
8791 -       foreach(team &t, *resources::teams)
8792 +       wes_foreach(team &t, *resources::teams)
8793         {
8794                 //Exclude enemies, AIs, and local players
8795                 if(t.is_enemy(v_side) || !t.is_network())
8796 @@ -1164,11 +1164,11 @@
8797         switch(selection)
8798         {
8799         case 0:
8800 -               foreach(team* t, allies)
8801 +               wes_foreach(team* t, allies)
8802                         team_plans_hidden_[t->side()-1]=false;
8803                 break;
8804         case 1:
8805 -               foreach(team* t, allies)
8806 +               wes_foreach(team* t, allies)
8807                         team_plans_hidden_[t->side()-1]=true;
8808                 break;
8809         default:
8810 diff -ur wesnoth-1.10.3.orig/src/whiteboard/mapbuilder.cpp wesnoth-1.10.3/src/whiteboard/mapbuilder.cpp
8811 --- wesnoth-1.10.3.orig/src/whiteboard/mapbuilder.cpp   2012-01-07 03:35:17.000000000 +0100
8812 +++ wesnoth-1.10.3/src/whiteboard/mapbuilder.cpp        2012-07-11 13:16:06.003266691 +0200
8813 @@ -51,14 +51,14 @@
8814  
8815  void mapbuilder::pre_build()
8816  {
8817 -       foreach(team& t, *resources::teams)
8818 +       wes_foreach(team& t, *resources::teams)
8819         {
8820                 //Reset spent gold to zero, it'll be recalculated during the map building
8821                 t.get_side_actions()->reset_gold_spent();
8822         }
8823  
8824         int current_side = resources::controller->current_side();
8825 -       foreach(unit& u, *resources::units)
8826 +       wes_foreach(unit& u, *resources::units)
8827         {
8828                 bool on_current_side = (u.side() == current_side);
8829  
8830 diff -ur wesnoth-1.10.3.orig/src/whiteboard/move.cpp wesnoth-1.10.3/src/whiteboard/move.cpp
8831 --- wesnoth-1.10.3.orig/src/whiteboard/move.cpp 2012-04-23 01:53:28.000000000 +0200
8832 +++ wesnoth-1.10.3/src/whiteboard/move.cpp      2012-07-11 13:16:06.003266691 +0200
8833 @@ -108,10 +108,10 @@
8834         if(!route_cfg)
8835                 throw action::ctor_err("move: Invalid route_");
8836         route_->move_cost = route_cfg["move_cost"];
8837 -       foreach(config const& loc_cfg, route_cfg.child_range("step")) {
8838 +       wes_foreach(config const& loc_cfg, route_cfg.child_range("step")) {
8839                 route_->steps.push_back(map_location(loc_cfg["x"],loc_cfg["y"]));
8840         }
8841 -       foreach(config const& mark_cfg, route_cfg.child_range("mark")) {
8842 +       wes_foreach(config const& mark_cfg, route_cfg.child_range("mark")) {
8843                 route_->marks[map_location(mark_cfg["x"],mark_cfg["y"])]
8844                                 = pathfind::marked_route::mark(mark_cfg["turns"],mark_cfg["zoc"],mark_cfg["capture"],mark_cfg["invisible"]);
8845         }
8846 @@ -470,7 +470,7 @@
8847         //Serialize route_
8848         config route_cfg;
8849         route_cfg["move_cost"]=route_->move_cost;
8850 -       foreach(map_location const& loc, route_->steps)
8851 +       wes_foreach(map_location const& loc, route_->steps)
8852         {
8853                 config loc_cfg;
8854                 loc_cfg["x"]=loc.x;
8855 @@ -478,7 +478,7 @@
8856                 route_cfg.add_child("step",loc_cfg);
8857         }
8858         typedef std::pair<map_location,pathfind::marked_route::mark> pair_loc_mark;
8859 -       foreach(pair_loc_mark const& item, route_->marks)
8860 +       wes_foreach(pair_loc_mark const& item, route_->marks)
8861         {
8862                 config mark_cfg;
8863                 mark_cfg["x"]=item.first.x;
8864 diff -ur wesnoth-1.10.3.orig/src/whiteboard/recall.cpp wesnoth-1.10.3/src/whiteboard/recall.cpp
8865 --- wesnoth-1.10.3.orig/src/whiteboard/recall.cpp       2012-01-07 03:35:17.000000000 +0100
8866 +++ wesnoth-1.10.3/src/whiteboard/recall.cpp    2012-07-11 13:16:06.003266691 +0200
8867 @@ -71,7 +71,7 @@
8868  {
8869         // Construct and validate temp_unit_
8870         size_t underlying_id = cfg["temp_unit_"];
8871 -       foreach(unit const& recall_unit, resources::teams->at(team_index()).recall_list())
8872 +       wes_foreach(unit const& recall_unit, resources::teams->at(team_index()).recall_list())
8873         {
8874                 if(recall_unit.underlying_id()==underlying_id)
8875                 {
8876 diff -ur wesnoth-1.10.3.orig/src/whiteboard/side_actions.cpp wesnoth-1.10.3/src/whiteboard/side_actions.cpp
8877 --- wesnoth-1.10.3.orig/src/whiteboard/side_actions.cpp 2012-04-23 01:18:06.000000000 +0200
8878 +++ wesnoth-1.10.3/src/whiteboard/side_actions.cpp      2012-07-11 13:16:06.006600025 +0200
8879 @@ -48,13 +48,13 @@
8880  {
8881         s << "Content of side_actions:";
8882         int turn = 1;
8883 -       foreach(action_queue const& turn_queue, side_actions.actions())
8884 +       wes_foreach(action_queue const& turn_queue, side_actions.actions())
8885         {
8886                 s << "\n  Turn " << turn;
8887                 ++turn;
8888  
8889                 int count = 1;
8890 -               foreach(action_ptr const& action, turn_queue)
8891 +               wes_foreach(action_ptr const& action, turn_queue)
8892                 {
8893                         s << "\n    (" << count << ") " << action;
8894                         ++count;
8895 @@ -114,7 +114,7 @@
8896                                         main_number = index;
8897                                 }
8898  
8899 -                               foreach(weak_action_ptr action, highlighter->get_secondary_highlights())
8900 +                               wes_foreach(weak_action_ptr action, highlighter->get_secondary_highlights())
8901                                 {
8902                                         if (action.lock() == *it)
8903                                         {
8904 @@ -199,7 +199,7 @@
8905  size_t side_actions::size() const
8906  {
8907         size_t result = 0;
8908 -       foreach(action_queue const& queue, actions_)
8909 +       wes_foreach(action_queue const& queue, actions_)
8910                 result += queue.size();
8911         return result;
8912  }
8913 @@ -234,7 +234,7 @@
8914                 return;
8915         }
8916  
8917 -       foreach(action_ptr act, *this)
8918 +       wes_foreach(action_ptr act, *this)
8919                 act->hide();
8920  }
8921  void side_actions::show()
8922 @@ -244,7 +244,7 @@
8923  
8924         hidden_ = false;
8925  
8926 -       foreach(action_ptr act, *this)
8927 +       wes_foreach(action_ptr act, *this)
8928                 act->show();
8929  }
8930  
8931 @@ -507,7 +507,7 @@
8932  size_t side_actions::count_actions_of(unit const* unit)
8933  {
8934         size_t count = 0;
8935 -       foreach(action_ptr action, *this)
8936 +       wes_foreach(action_ptr action, *this)
8937         {
8938                 if (action->get_unit() == unit)
8939                 {
8940 @@ -783,7 +783,7 @@
8941         else if(type=="refresh")
8942         {
8943                 safe_clear();
8944 -               foreach(net_cmd const& sub_cmd, cmd.child_range("net_cmd"))
8945 +               wes_foreach(net_cmd const& sub_cmd, cmd.child_range("net_cmd"))
8946                         execute_net_cmd(sub_cmd);
8947         }
8948         else
8949 @@ -890,7 +890,7 @@
8950  
8951         //find units who still have plans for turn 0 (i.e. were too lazy to finish their jobs)
8952         std::set<unit const*> lazy_units;
8953 -       foreach(action_ptr const& act, iter_turn(0))
8954 +       wes_foreach(action_ptr const& act, iter_turn(0))
8955         {
8956                 unit const* u = act->get_unit();
8957                 if(u)
8958 @@ -913,7 +913,7 @@
8959         }
8960  
8961         //push any remaining first-turn plans into the second turn
8962 -       foreach(action_ptr act, actions_.front())
8963 +       wes_foreach(action_ptr act, actions_.front())
8964                 actions_[1].push_front(act);
8965         actions_.front().clear();
8966  
8967 diff -ur wesnoth-1.10.3.orig/src/whiteboard/utility.cpp wesnoth-1.10.3/src/whiteboard/utility.cpp
8968 --- wesnoth-1.10.3.orig/src/whiteboard/utility.cpp      2012-01-07 03:35:17.000000000 +0100
8969 +++ wesnoth-1.10.3/src/whiteboard/utility.cpp   2012-07-11 13:16:06.003266691 +0200
8970 @@ -60,7 +60,7 @@
8971  {
8972         assert(leader.can_recruit());
8973         assert(resources::game_map->is_keep(leader.get_location()));
8974 -       foreach(unit const& unit, *resources::units)
8975 +       wes_foreach(unit const& unit, *resources::units)
8976         {
8977                 if (unit.can_recruit() &&
8978                                 resources::game_map->is_keep(unit.get_location()) &&
8979 @@ -83,7 +83,7 @@
8980         if(!map.is_castle(hex))
8981                 return NULL;
8982  
8983 -       foreach(unit& u, *resources::units)
8984 +       wes_foreach(unit& u, *resources::units)
8985                 if(u.can_recruit()
8986                                 && u.side() == static_cast<int>(team_index+1)
8987                                 && can_recruit_on(map,u.get_location(),hex))
8988 @@ -124,7 +124,7 @@
8989  
8990         int result = 0;
8991         gamemap const& map = *resources::game_map;
8992 -       foreach(map_location const& loc, std::make_pair(path.begin()+1,path.end()))
8993 +       wes_foreach(map_location const& loc, std::make_pair(path.begin()+1,path.end()))
8994                 result += u.movement_cost(map[loc]);
8995         return result;
8996  }
8997 @@ -149,7 +149,7 @@
8998  
8999  bool has_actions()
9000  {
9001 -       foreach(team& t, *resources::teams)
9002 +       wes_foreach(team& t, *resources::teams)
9003                 if (!t.get_side_actions()->empty())
9004                         return true;
9005  
9006 diff -ur wesnoth-1.10.3.orig/src/whiteboard/validate_visitor.cpp wesnoth-1.10.3/src/whiteboard/validate_visitor.cpp
9007 --- wesnoth-1.10.3.orig/src/whiteboard/validate_visitor.cpp     2012-04-23 04:44:12.000000000 +0200
9008 +++ wesnoth-1.10.3/src/whiteboard/validate_visitor.cpp  2012-07-11 13:16:06.006600025 +0200
9009 @@ -60,7 +60,7 @@
9010         {
9011                 int side_actions_size_before = viewer_actions_.size();
9012                 LOG_WB << "Erasing " << actions_to_erase_.size() << " invalid actions.\n";
9013 -               foreach(action_ptr action, actions_to_erase_)
9014 +               wes_foreach(action_ptr action, actions_to_erase_)
9015                 {
9016                         viewer_actions_.remove_action(viewer_actions_.get_position_of(action), false);
9017                 }
9018 diff -ur wesnoth-1.10.3.orig/src/whiteboard/visitor.hpp wesnoth-1.10.3/src/whiteboard/visitor.hpp
9019 --- wesnoth-1.10.3.orig/src/whiteboard/visitor.hpp      2012-04-23 01:53:28.000000000 +0200
9020 +++ wesnoth-1.10.3/src/whiteboard/visitor.hpp   2012-07-11 13:16:06.003266691 +0200
9021 @@ -81,7 +81,7 @@
9022  
9023                 //Determine how many turns' worth of plans there are
9024                 size_t max_turns = 0;
9025 -               foreach(team& t, *resources::teams)
9026 +               wes_foreach(team& t, *resources::teams)
9027                         max_turns = std::max(max_turns,t.get_side_actions()->num_turns());
9028  
9029                 size_t const current_team = resources::controller->current_side() - 1;
This page took 0.835063 seconds and 3 git commands to generate.