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
5 if(percentage_ != percentage) {
6 percentage_ = percentage;
8 - foreach(tcanvas& c, canvas()) {
9 + wes_foreach(tcanvas& c, canvas()) {
10 c.set_variable("percentage", variant(percentage));
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
19 std::vector<std::string> lines = utils::split(c["text"], '\n');
20 - foreach (std::string &line, lines)
21 + wes_foreach (std::string &line, lines)
23 if (line.size() > 1 && line[0] == '+')
24 line = "+ " + line.substr(1);
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());
35 config::child_itors about_entries = about_list.child_range("about");
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);
47 - foreach (const config &about, about_entries) {
48 + wes_foreach (const config &about, about_entries) {
49 add_lines(res, about);
56 - foreach (const config &about, cfg.child_range("about"))
57 + wes_foreach (const config &about, cfg.child_range("about"))
59 about_list.add_child("about", about);
60 const std::string &im = about["images"];
65 - foreach (const config &campaign, cfg.child_range("campaign"))
66 + wes_foreach (const config &campaign, cfg.child_range("campaign"))
68 config::const_child_itors abouts = campaign.child_range("about");
69 if (abouts.first == abouts.second) continue;
72 std::string campaign_images;
74 - foreach (const config &about, abouts)
75 + wes_foreach (const config &about, abouts)
77 const std::string &subtitle = about["title"];
78 if (!subtitle.empty())
83 - foreach (const std::string &line, utils::split(about["text"], '\n'))
84 + wes_foreach (const std::string &line, utils::split(about["text"], '\n'))
86 text << " " << line << '\n';
89 - foreach (const config &entry, about.child_range("entry"))
90 + wes_foreach (const config &entry, about.child_range("entry"))
92 text << " " << entry["name"] << '\n';
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
98 placements.push_back("map");
99 placements.push_back("recall");
101 - foreach(std::string place, placements) {
102 + wes_foreach(std::string place, placements) {
104 bool pass((place == "leader_passable") || (place == "map_passable"));
107 leader_in_place= true;
110 - foreach (const unit& recall_unit, recall_list)
111 + wes_foreach (const unit& recall_unit, recall_list)
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]);
118 if (!(recall_loc_is_castle && leader_in_place)) {
119 - foreach (const unit &recall, recall_list)
120 + wes_foreach (const unit &recall, recall_list)
122 result.push_back(&recall);
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;
133 @@ -1925,7 +1925,7 @@
134 // Simple algorithm: no maximum number of patients per healer.
135 void reset_resting(unit_map& units, int side)
137 - foreach (unit &u, units) {
138 + wes_foreach (unit &u, units) {
139 if (u.side() == side)
142 @@ -1946,7 +1946,7 @@
143 std::list<unit_healing_struct> l;
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) {
149 if (u.get_state("unhealable") || u.incapacitated())
151 @@ -2307,7 +2307,7 @@
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);
160 @@ -2350,7 +2350,7 @@
164 - foreach (unit &u, *resources::units)
165 + wes_foreach (unit &u, *resources::units)
167 if (u.side() == side) {
168 const unit_movement_resetter move_resetter(u);
169 @@ -2372,7 +2372,7 @@
173 - foreach (unit &u, *resources::units)
174 + wes_foreach (unit &u, *resources::units)
176 if (u.side() == side) {
177 const unit_movement_resetter move_resetter(u);
178 @@ -2435,7 +2435,7 @@
180 std::set<map_location> known_units;
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 @@
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());
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 @@
203 - foreach (const config &d, cfg.child_range("dir")) {
204 + wes_foreach (const config &d, cfg.child_range("dir")) {
205 unarchive_dir(dir, d);
208 - foreach (const config &f, cfg.child_range("file")) {
209 + wes_foreach (const config &f, cfg.child_range("file")) {
210 unarchive_file(dir, f);
214 std::string missing = "";
215 size_t count_missing = 0;
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()) {
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)
229 const std::string& name = remote_addon["name"];
230 if (std::find(dependencies.begin(), dependencies.end(), name) != dependencies.end()) {
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;
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)
247 const std::string& name = remote_addon["name"];
248 const std::string& version = remote_addon["version"];
249 @@ -1065,7 +1065,7 @@
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;
258 @@ -1090,7 +1090,7 @@
259 const std::string& addon,
260 const std::vector<std::string>& own_addons)
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 @@
269 std::vector< addon_info > infos;
271 - foreach(const config &c, addon_cfgs)
272 + wes_foreach(const config &c, addon_cfgs)
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);
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);
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 @@
294 remove_names.clear();
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));
301 @@ -1425,7 +1425,7 @@
303 std::vector<std::string> failed_names, skipped_names, succeeded_names;
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);
309 if(have_addon_pbl_info(id) || have_addon_in_vcs_tree(id)) {
310 @@ -1531,12 +1531,12 @@
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");
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());
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
330 bool check_names_legal(const config& dir)
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;
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;
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
345 cfg_["id"]<<"]"<<std::endl;
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);
354 std::vector< stage_ptr > stages;
355 create_stage(stages,cfg);
357 - foreach (stage_ptr b, stages ){
358 + wes_foreach (stage_ptr b, stages ){
359 stages_.push_back(b);
363 std::vector< goal_ptr > goals;
364 create_goal(goals,cfg);
366 - foreach (goal_ptr b, goals ){
367 + wes_foreach (goal_ptr b, goals ){
368 get_goals().push_back(b);
374 void ai_composite::play_turn(){
375 - foreach(stage_ptr &s, stages_){
376 + wes_foreach(stage_ptr &s, stages_){
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());
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
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);
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);
411 virtual void recalculate() const
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())) {
417 this->value_ = boost::shared_ptr<T>(f->get_ptr());
420 virtual config to_config() const
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());
429 std::vector< aspect_ptr > facets;
430 engine::parse_aspect_from_config(*this,cfg,this->get_id(),std::back_inserter(facets));
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);
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
441 std::vector<std::string> component::get_children_types()
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);
451 s << offset_str << type<<"["<<root->get_id() <<"] "<<root->get_engine()<<" "<<root->get_name()<< std::endl;
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);
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
465 if (!criteria) return;
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);
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)
480 LOG_AI_GOAL << "found explicit target location ... " << loc << " with value: " << value() << std::endl;
481 *target_list = target(loc, value(), target::EXPLICIT);
484 std::set<map_location> items;
486 - foreach (const unit &u, units)
487 + wes_foreach (const unit &u, units)
489 if (protect_only_own_unit_ && u.side() != get_side()) {
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)
498 - foreach (const unit &u, units)
499 + wes_foreach (const unit &u, units)
501 int distance = distance_between(u.get_location(), loc);
502 if (current_team().is_enemy(u.side()) && distance < radius_ &&
504 handler_->handle(c, true, l_obj);
505 std::vector < target > targets = *(l_obj->get());
507 - foreach (target tg, targets)
508 + wes_foreach (target tg, targets)
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
516 std::vector<component*> handle_get_children()
518 std::vector<component*> children;
519 - foreach (t_ptr v, values_) {
520 + wes_foreach (t_ptr v, values_) {
521 children.push_back(&*v);
526 factory_(values,cfg);
528 - foreach (t_ptr b, values ){
529 + wes_foreach (t_ptr b, values ){
530 values_.insert(values_.begin()+pos+j,b);
534 //* is a special case - 'delete all facets'
535 if (child.id == "*") {
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();
543 std::vector<component*> handle_get_children()
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);
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
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"];
564 void configuration::add_era_ai_from_config(const config &era)
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"];
573 config aspect_config;
574 aspect_config["id"] = id;
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);
580 aspect_config.append(_aspect);
582 if (aspect_was_attribute) {
583 facet_config["value"] = aiparam[id];
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);
592 //leave only the [ai] children
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);
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);
609 config parsed_cfg = config();
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);
618 parsed_cfg.merge_children_by_attribute("aspect","id");
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;
627 if (cfg["ai_algorithm"]=="idle_ai") {
630 - foreach (config &aiparam, cfg.child_range("ai")) {
631 + wes_foreach (config &aiparam, cfg.child_range("ai")) {
632 if (aiparam["ai_algorithm"]=="idle_ai") {
637 config fallback_stage_cfg_ai;
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_);
650 - foreach (const config &aitarget, aiparam.child_range("target")) {
651 + wes_foreach (const config &aitarget, aiparam.child_range("target")) {
653 transfer_turns_and_time_of_day_data(aiparam,aigoal);
655 @@ -388,14 +388,14 @@
656 aiparam.clear_children("target");
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);
664 aiparam.clear_children("protect_unit");
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);
672 @@ -423,19 +423,19 @@
673 fallback_stage_cfg_ai.clear_children("aspect");
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);
680 fallback_stage_cfg_ai.clear_children("stage");
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);
687 fallback_stage_cfg_ai.clear_children("goal");
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);
694 fallback_stage_cfg_ai.clear_children("modify_ai");
695 @@ -452,12 +452,12 @@
699 - foreach (const config &aiparam, ai_parameters) {
700 + wes_foreach (const config &aiparam, ai_parameters) {
701 cfg.add_child("ai",aiparam);
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_);
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 @@
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_));
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);
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()));
736 @@ -255,13 +255,13 @@
737 config readonly_context_impl::to_readonly_context_config() const
740 - foreach(const engine_ptr e, engines_) {
741 + wes_foreach(const engine_ptr e, engines_) {
742 cfg.add_child("engine",e->to_config());
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());
748 - foreach(const goal_ptr g, goals_) {
749 + wes_foreach(const goal_ptr g, goals_) {
750 cfg.add_child("goal",g->to_config());
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)
760 const map_location& src = m->first;
761 const map_location& dst = dest.curr;
764 void readonly_context_impl::add_aspects(std::vector< aspect_ptr > &aspects )
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);
775 - foreach (const attack_type &att, un.attacks())
776 + wes_foreach (const attack_type &att, un.attacks())
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;
784 - foreach (const pathfind::paths::step &dest, leader_paths.destinations)
785 + wes_foreach (const pathfind::paths::step &dest, leader_paths.destinations)
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
794 void ai_default_recruitment_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)));
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())
808 const unit_type *ut = unit_types.find(name);
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);
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);
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
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)) {
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));
848 return variant(&vars);
850 std::vector<variant> v;
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)));
857 for( size_t i = 0; i<tmp.size(); ++i)
859 //make sure we don't run out of refcount
862 - foreach (const config &func, cfg_.child_range("function"))
863 + wes_foreach (const config &func, cfg_.child_range("function"))
865 const t_string &name = func["name"];
866 const t_string &inputs = func["inputs"];
868 if (const config &ai_vars = cfg_.child("vars"))
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);
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
880 void candidate_action_manager::load_config(const config& cfg, ai::formula_ai* ai, function_symbol_table* function_table)
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"))
886 candidate_action_ptr new_ca = load_candidate_action_from_config(rc_action,ai,function_table);
890 evaluated_candidate_actions_.clear();
892 - foreach(candidate_action_ptr cm, candidate_actions_)
893 + wes_foreach(candidate_action_ptr cm, candidate_actions_)
895 cm->evaluate(ai, units);
896 evaluated_candidate_actions_.insert(cm);
898 const config & filter_params = cfg.child("filter");
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() )
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
910 if( scores[current_side][i] > 98 )
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) {
922 - foreach( int side , allies) {
923 + wes_foreach( int side , allies) {
924 if ( scores[current_side][i] - scores[side][i] > ally_tollerancy ) {
928 visited_locs.erase(starting_loc);
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 ) ) );
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);
945 @@ -1629,7 +1629,7 @@
947 std::vector<attack_type> attacks = attacker.attacks();
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
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;
967 cfg_.merge_children_by_attribute("aspect","id");
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);
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
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);
984 - foreach (const attack_type &att, un.attacks())
985 + wes_foreach (const attack_type &att, un.attacks())
987 int damage = att.damage() * att.num_attacks() * (100 + tod_modifier);
988 if (damage > most_damage) {
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);
993 - foreach (const attack_type &att, un.attacks())
994 + wes_foreach (const attack_type &att, un.attacks())
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
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())
1008 const unit_type *ut = unit_types.find(name);
1011 possible_moves.insert(std::pair<map_location,pathfind::paths>(leader->get_location(), leader_paths));
1014 - foreach (const map_location &l, route.steps)
1015 + wes_foreach (const map_location &l, route.steps)
1017 if (leader_paths.destinations.contains(l) &&
1018 power_projection(l, get_enemy_dstsrc()) < leader->hitpoints() * max_risk)
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)
1026 if (!units_.find(dest.curr).valid()){
1027 const int new_distance = distance_between(dest.curr,keep);
1028 @@ -1728,12 +1728,12 @@
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){
1039 - foreach(map_location &new_loc, leaders_adj_v){
1040 + wes_foreach(map_location &new_loc, leaders_adj_v){
1044 @@ -1974,7 +1974,7 @@
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);
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())) {
1062 @@ -2059,7 +2059,7 @@
1064 ai_leader->remove_movement_ai();
1066 - foreach(unit_map::unit_iterator &leader, ai_leaders){
1067 + wes_foreach(unit_map::unit_iterator &leader, ai_leaders){
1068 leader->remove_movement_ai();
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
1075 LOG_AI << "start" << std::endl;
1076 const int ticks = SDL_GetTicks();
1078 - foreach( unit &u, *resources::units)
1079 + wes_foreach( unit &u, *resources::units)
1081 if (u.side()!=get_side())
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
1087 int get_current_qty(const std::string &name) const
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?
1096 const int hitpoints_const = 100;
1098 double total_weight = 0;
1099 - foreach(const unit &enemy_unit, *resources::units)
1100 + wes_foreach(const unit &enemy_unit, *resources::units)
1102 if(enemy_unit.can_recruit() || !t.is_enemy(enemy_unit.side()))
1104 @@ -358,13 +358,13 @@
1106 score += compare_unit_types(info, *enemy_info) * weight;
1108 - foreach(fake_team &enemy_team, fake_teams)
1109 + wes_foreach(fake_team &enemy_team, fake_teams)
1111 if(!t.is_enemy(enemy_team.side()))
1115 - foreach(const potential_recruit &enemy_unit, enemy_team.extra_units())
1116 + wes_foreach(const potential_recruit &enemy_unit, enemy_team.extra_units())
1118 const unit_type *enemy_info = enemy_unit.type();
1119 VALIDATE(enemy_info, "Unknown unit type : " + enemy_unit.id() + " while updating recruit quality.");
1122 /*static void update_recruit_qualities(fake_team &t, std::vector<fake_team> &fake_teams)
1124 - foreach ( potential_recruit &recruit, t.recruit_list() )
1125 + wes_foreach ( potential_recruit &recruit, t.recruit_list() )
1127 double score = get_unit_quality(*recruit.type(),t,fake_teams);
1128 recruit.set_quality(score);
1129 @@ -425,11 +425,11 @@
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())
1136 current_units[(i.id())]++;
1138 - foreach (const unit &i, *resources::units)
1139 + wes_foreach (const unit &i, *resources::units)
1141 if (i.side()==t.side())
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)
1150 if(i.cost() > max_cost)
1153 potential_recruit_sorter sorter(max_cost, max_quality, quality_factor);
1154 std::sort(sorted.begin(), sorted.end(), sorter);
1156 - foreach(const potential_recruit *i, sorted)
1157 + wes_foreach(const potential_recruit *i, sorted)
1159 if(recruited < max_units_to_recruit)
1162 static void ai_choose_recruits(fake_team &t, int max_units_to_recruit, double quality_factor, bool counter_recruit)
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) {
1171 //DBG_AI << "start of get_recruit_qualities" << std::endl;
1172 typedef std::map<const unit_type*, std::vector<double> > unit_map;
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 @@
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)
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())
1190 enemies[rec.type()].push_back(1.0);
1192 @@ -573,10 +573,10 @@
1194 DBG_AI << "after extra_units of fake_teams: enemies.size() = " << enemies.size() << std::endl;
1196 - foreach(potential_recruit &rec, recruit_list) {
1197 + wes_foreach(potential_recruit &rec, recruit_list) {
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 @@
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)
1212 if(t.is_enemy(un.side()))
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)
1220 if(!t.is_enemy(defender.side())){
1221 //int score = compare_unit_types(*defender.type(), enemy_type);
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);
1233 //pair->add_defender(new unit_data(rec.id(), rec.type()));
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)
1241 //int score = compare_unit_types(defender_type, *enemy.type());
1244 pair->add_enemy(enemy.type());
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());
1254 //pair->add_enemy(new unit_data(rec.id(), rec.type()));
1255 @@ -680,14 +680,14 @@
1256 defenders.push_back(pair);
1259 - foreach(fake_team &tmp_t, fake_teams)
1260 + wes_foreach(fake_team &tmp_t, fake_teams)
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())){
1273 @@ -698,11 +698,11 @@
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())){
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);
1286 //pair->add_defender(new unit_data(sub_rec.id(), sub_rec.type()));
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)
1294 if(!t.is_enemy(enemy.side())){
1296 @@ -726,11 +726,11 @@
1297 pair->add_enemy(rec.type());
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())){
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());
1309 //pair->add_enemy(new unit_data(sub_rec.id(), sub_rec.type()));
1310 @@ -744,17 +744,17 @@
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)
1317 // if(pair->defenders.size() == 0)
1319 // pair->score = -10000;
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)
1326 unsigned int defender_enemies = 0;
1327 - foreach(defender_pair_type *defender_p, defenders)
1328 + wes_foreach(defender_pair_type *defender_p, defenders)
1330 //if(defender->id == defender_p->defender->id){
1331 if(defender->type_name()() == defender_p->defender->type_name()){
1335 score -= max_score - min_score;
1336 - foreach(enemy_pair_type *pair, enemies)
1337 + wes_foreach(enemy_pair_type *pair, enemies)
1339 score += pair->score;
1341 @@ -798,16 +798,16 @@
1342 typedef std::map<const unit_type*, std::vector<double> > unit_map;
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());
1350 defenders[un.type()].push_back(un.hitpoints() / un.max_hitpoints());
1353 - foreach(fake_team &tmp_t, fake_teams)
1354 + wes_foreach(fake_team &tmp_t, fake_teams)
1356 - foreach(potential_recruit &rec, tmp_t.extra_units())
1357 + wes_foreach(potential_recruit &rec, tmp_t.extra_units())
1359 if(t.is_enemy(tmp_t.side())){
1360 enemies[rec.type()].push_back(1.0);
1361 @@ -817,13 +817,13 @@
1365 - foreach(unit_map::value_type &defender, defenders)
1366 + wes_foreach(unit_map::value_type &defender, defenders)
1368 double defenders_score = 0;
1369 - foreach(unit_map::value_type &enemy, enemies)
1370 + wes_foreach(unit_map::value_type &enemy, enemies)
1372 double hitpoints_sum = 0;
1373 - foreach(double i, enemy.second)
1374 + wes_foreach(double i, enemy.second)
1381 double hitpoints_sum = 0;
1382 - foreach(double i, defender.second)
1383 + wes_foreach(double i, defender.second)
1389 // vector<defender_pair> defenders;
1390 // vector<enemy_pair> enemies;
1391 -// //foreach(unit &un, *resources::units)
1392 +// //wes_foreach(unit &un, *resources::units)
1394 // // if(t.is_enemy(un.side()))
1396 @@ -851,14 +851,14 @@
1397 // // defenders.push_back(un.id());
1400 -// foreach(unit &un, *resources::units)
1401 +// wes_foreach(unit &un, *resources::units)
1403 // if(t.is_enemy(un.side()))
1405 // const unit_type &enemy_type = un.type();
1407 // pair.enemy = new unit_data(un.id(), enemy_type);
1408 -// foreach(unit &defender, *resources::units)
1409 +// wes_foreach(unit &defender, *resources::units)
1411 // int score = compare_unit_types(defender.type(), enemy_type);
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)
1420 // int score = compare_unit_types(defender_type, enemy.type());
1422 @@ -885,10 +885,10 @@
1423 // enemies.push_back(pair);
1426 -// foreach(fake_team &tmp_t, fake_teams)
1427 +// wes_foreach(fake_team &tmp_t, fake_teams)
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())
1438 // //std::vector<unit> no_defense_enemies;
1439 -// foreach(enemy_pair &pair, enemies)
1440 +// wes_foreach(enemy_pair &pair, enemies)
1442 // if(pair.defenders.size() == 0)
1444 @@ -906,11 +906,11 @@
1448 -// foreach(unit_data &defender, pair.defenders)
1449 +// wes_foreach(unit_data &defender, pair.defenders)
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)
1456 // if(defender.id == defender_p.defender.id){
1457 // defender_enemies = defender_p.enemies.size();
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)
1465 // total_score += pair.score;
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)
1474 // if(t.is_enemy(un.side()))
1476 @@ -945,14 +945,14 @@
1477 // defenders.push_back(un.id());
1480 -// foreach(unit &un, *resources::units)
1481 +// wes_foreach(unit &un, *resources::units)
1483 // if(t.is_enemy(un.side()))
1485 // const unit_type &enemy_type = un.type();
1488 -// foreach(unit &defender, *resources::units)
1489 +// wes_foreach(unit &defender, *resources::units)
1491 // int score = compare_unit_types(defender.type(), enemy_type);
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)
1500 // int score = compare_unit_types(defender_type, enemy.type());
1505 // //std::vector<unit> no_defense_enemies;
1506 -// foreach(enemy_pair &pair, enemies)
1507 +// wes_foreach(enemy_pair &pair, enemies)
1509 // if(pair.defenders.size() == 0)
1511 @@ -988,10 +988,10 @@
1512 // return pair.enemy;
1513 // //pair.score = 0;
1515 -// foreach(unit &defender, pair.defenders)
1516 +// wes_foreach(unit &defender, pair.defenders)
1518 // unsigned int defender_enemies = 0;
1519 -// foreach(defender_pair &defender_p, defenders)
1520 +// wes_foreach(defender_pair &defender_p, defenders)
1522 // if(defender.id() == defender_p.defender.id()){
1523 // defender_enemies = defender_p.enemies.size();
1524 @@ -1004,7 +1004,7 @@
1527 // enemy_pair *worst_pair = &enemies[0];
1528 -// foreach(enemy_pair &pair, enemies)
1529 +// wes_foreach(enemy_pair &pair, enemies)
1531 // if(pair.score < worst_pair.score)
1533 @@ -1039,16 +1039,16 @@
1534 for(int recruited_amount = 0; recruited_amount < max_units_to_recruit; recruited_amount++)
1537 - foreach(fake_team &t, fake_teams)
1538 + wes_foreach(fake_team &t, fake_teams)
1543 std::vector<potential_recruit> ai_recruit_list = ai_t->recruit_list();
1545 - foreach(potential_recruit &recruit_type, ai_recruit_list)
1546 + wes_foreach(potential_recruit &recruit_type, ai_recruit_list)
1548 - foreach(fake_team &t, fake_teams)
1549 + wes_foreach(fake_team &t, fake_teams)
1553 @@ -1063,7 +1063,7 @@
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)
1560 if(ai_t->side() == t.side())
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
1566 void candidate_action_evaluation_loop::on_create()
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_));
1575 config candidate_action_evaluation_loop::to_config() const
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());
1585 LOG_AI_TESTING_RCA_DEFAULT << "Starting candidate action evaluation loop for side "<< get_side() << std::endl;
1587 - foreach(candidate_action_ptr ca, candidate_actions_){
1588 + wes_foreach(candidate_action_ptr ca, candidate_actions_){
1593 candidate_action_ptr best_ptr;
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;
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
1608 - foreach(map_location const& loc, path)
1609 + wes_foreach(map_location const& loc, path)
1611 SCREEN->invalidate(loc);
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
1617 sorted_images = true;
1620 - foreach(const rule_image_rand& ri, images){
1621 + wes_foreach(const rule_image_rand& ri, images){
1622 bool is_background = ri->is_background();
1624 imagelist& img_list = is_background ? images_background : images_foreground;
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())
1631 @@ -250,12 +250,12 @@
1633 tile& btile = tile_map_[loc];
1635 - foreach(animated<image::locator>& a, btile.images_background) {
1636 + wes_foreach(animated<image::locator>& a, btile.images_background) {
1639 a.update_last_draw_time();
1641 - foreach(animated<image::locator>& a, btile.images_foreground) {
1642 + wes_foreach(animated<image::locator>& a, btile.images_foreground) {
1645 a.update_last_draw_time();
1648 std::vector<std::string> vars = utils::split(variations, ';', 0);
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 @@
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)
1662 - foreach(rule_image& ri, constraint.images)
1663 + wes_foreach(rule_image& ri, constraint.images)
1665 - foreach(rule_image_variant& variant, ri.variants)
1666 + wes_foreach(rule_image_variant& variant, ri.variants)
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)
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;
1677 - foreach(const std::string& frame, frames)
1678 + wes_foreach(const std::string& frame, frames)
1680 const std::vector<std::string> items = utils::split(frame, ':');
1681 const std::string& str = items.front();
1683 void terrain_builder::replace_rotate_tokens(rule_image &image, int angle,
1684 const std::vector<std::string> &replacement)
1686 - foreach(rule_image_variant& variant, image.variants) {
1687 + wes_foreach(rule_image_variant& variant, image.variants) {
1688 replace_rotate_tokens(variant, angle, replacement);
1692 void terrain_builder::replace_rotate_tokens(rule_imagelist &list, int angle,
1693 const std::vector<std::string> &replacement)
1695 - foreach (rule_image &img, list) {
1696 + wes_foreach (rule_image &img, list) {
1697 replace_rotate_tokens(img, angle, replacement);
1700 @@ -515,16 +515,16 @@
1701 void terrain_builder::replace_rotate_tokens(building_rule &rule, int angle,
1702 const std::vector<std::string> &replacement)
1704 - foreach (terrain_constraint &cons, rule.constraints)
1705 + wes_foreach (terrain_constraint &cons, rule.constraints)
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);
1712 - foreach (std::string &flag, cons.no_flag) {
1713 + wes_foreach (std::string &flag, cons.no_flag) {
1714 replace_rotate_tokens(flag, angle, replacement);
1716 - foreach (std::string &flag, cons.has_flag) {
1717 + wes_foreach (std::string &flag, cons.has_flag) {
1718 replace_rotate_tokens(flag, angle, replacement);
1720 replace_rotate_tokens(cons.images, angle, replacement);
1725 - foreach (terrain_constraint &cons, ret.constraints) {
1726 + wes_foreach (terrain_constraint &cons, ret.constraints) {
1727 rotate(cons, angle);
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);
1740 if(!(miny & 1) && (minx & 1) && (minx > 0))
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)));
1750 void terrain_builder::add_images_from_config(rule_imagelist& images, const config &cfg, bool global, int dx, int dy)
1752 - foreach (const config &img, cfg.child_range("image"))
1753 + wes_foreach (const config &img, cfg.child_range("image"))
1755 int layer = img["layer"];
1758 images.push_back(rule_image(layer, basex - dx, basey - dy, global, center_x, center_y));
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"))
1764 const std::string &name = variant["name"];
1765 const std::string &variations = img["variations"];
1767 const t_translation::t_match& type, const config& global_images)
1769 terrain_constraint *cons = NULL;
1770 - foreach (terrain_constraint &c, constraints) {
1771 + wes_foreach (terrain_constraint &c, constraints) {
1776 log_scope("terrain_builder::parse_config");
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"))
1782 building_rule pbr; // Parsed Building rule
1785 parse_mapstring(br["map"], pbr, anchors, br);
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"))
1791 // Adds the terrain constraint to the current built terrain's list
1792 // of terrain constraints, if it does not exist.
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"]);
1797 - foreach (terrain_constraint &constraint, pbr.constraints)
1798 + wes_foreach (terrain_constraint &constraint, pbr.constraints)
1800 constraint.set_flag.insert(constraint.set_flag.end(),
1801 global_set_flag.begin(), global_set_flag.end());
1806 - foreach (const terrain_constraint &cons, rule.constraints)
1807 + wes_foreach (const terrain_constraint &cons, rule.constraints)
1809 // Translated location
1810 const map_location tloc = loc.legacy_sum(cons.loc);
1811 @@ -943,13 +943,13 @@
1813 const std::set<std::string> &flags = tile_map_[tloc].flags;
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()) {
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()) {
1829 unsigned int rand_seed = get_noise(loc, rule.get_hash());
1831 - foreach (const terrain_constraint &constraint, rule.constraints)
1832 + wes_foreach (const terrain_constraint &constraint, rule.constraints)
1834 const map_location tloc = loc.legacy_sum(constraint.loc);
1835 if(!tile_map_.on_map(tloc)) {
1836 @@ -973,12 +973,12 @@
1838 tile& btile = tile_map_[tloc];
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));
1846 - foreach (const std::string &flag, constraint.set_flag) {
1847 + wes_foreach (const std::string &flag, constraint.set_flag) {
1848 btile.flags.insert(flag);
1851 @@ -1001,9 +1001,9 @@
1852 if(hash_ != DUMMY_HASH)
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);
1864 @@ -1031,7 +1031,7 @@
1868 - foreach (const building_rule &rule, building_rules_)
1869 + wes_foreach (const building_rule &rule, building_rules_)
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;
1877 - foreach (const terrain_constraint &constraint, rule.constraints)
1878 + wes_foreach (const terrain_constraint &constraint, rule.constraints)
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
1887 void find_translations(const config& cfg, config& campaign)
1889 - foreach (const config &dir, cfg.child_range("dir"))
1890 + wes_foreach (const config &dir, cfg.child_range("dir"))
1892 if (dir["name"] == "LC_MESSAGES") {
1893 config &language = campaign.add_child("translation");
1895 LOG_CS << "Encoding all stored addons. Number of addons: "
1896 << std::distance(camps.first, camps.second) << '\n';
1898 - foreach (const config &cm, camps)
1899 + wes_foreach (const config &cm, camps)
1901 LOG_CS << "Encoding " << cm["name"] << '\n';
1902 std::string filename = cm["filename"], newfilename = filename + ".new";
1904 } catch(bad_lexical_cast) {}
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"))
1910 if (!name.empty() && name != i["name"]) continue;
1911 std::string tm = i["timestamp"];
1913 if (after_flag && (tm.empty() || lexical_cast_default<time_t>(tm, 0) <= after)) continue;
1914 if (!lang.empty()) {
1916 - foreach (const config &j, i.child_range("translation")) {
1917 + wes_foreach (const config &j, i.child_range("translation")) {
1918 if (j["language"] == lang) {
1922 campaign_list.add_child("campaign", i);
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();
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) {
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
1944 void cave_map_generator::generate_chambers()
1946 - foreach (const config &ch, cfg_.child_range("chamber"))
1947 + wes_foreach (const config &ch, cfg_.child_range("chamber"))
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()) {
1953 chambers_.push_back(new_chamber);
1955 - foreach (const config &p, ch.child_range("passage"))
1956 + wes_foreach (const config &p, ch.child_range("passage"))
1958 const std::string &dst = p["destination"];
1961 if (c.items == NULL || c.locs.empty()) return;
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())
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
1973 void commandline_options::parse_log_domains_(const std::string &domains_string, const int severity)
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)
1980 log = std::vector<boost::tuple<int, std::string> >();
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)
1988 const std::vector<std::string> tokens = utils::split(s, separator);
1989 if (tokens.size()!=2)
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)
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
2003 config_writer writer(*stream, gzip, game_config::cache_compression_level);
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);
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));
2021 void config_cache::read_defines_queue()
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);
2030 std::insert_iterator<preproc_map>(temp,temp.begin()),
2033 - foreach (const preproc_map::value_type &def, temp) {
2034 + wes_foreach (const preproc_map::value_type &def, temp) {
2035 insert_to_active(def);
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
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);
2051 void config::append(const config &cfg)
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;
2060 if (child_count(key) < 2) return;
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);
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() ) {
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);
2087 ordered_children.erase(std::remove_if(ordered_children.begin(),
2088 ordered_children.end(), remove_ordered(i)), ordered_children.end());
2090 - foreach (config *c, i->second) {
2091 + wes_foreach (config *c, i->second) {
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);
2105 /* Find the position with the correct index and decrement all the
2106 indices in the ordering that are above this index. */
2108 - foreach (child_pos &p, ordered_children)
2109 + wes_foreach (child_pos &p, ordered_children)
2111 if (p.pos != pos) continue;
2112 if (p.index == index)
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;
2122 @@ -860,21 +860,21 @@
2123 if (track) values[diff_track_attribute] = "modified";
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;
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);
2139 - foreach (const config &i, diff.child_range("change_child"))
2140 + wes_foreach (const config &i, diff.child_range("change_child"))
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())
2146 if (item.key.empty()) {
2148 @@ -889,19 +889,19 @@
2152 - foreach (const config &i, diff.child_range("insert_child"))
2153 + wes_foreach (const config &i, diff.child_range("insert_child"))
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";
2163 - foreach (const config &i, diff.child_range("delete_child"))
2164 + wes_foreach (const config &i, diff.child_range("delete_child"))
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()) {
2170 remove_child(item.key, index);
2172 @@ -918,18 +918,18 @@
2173 void config::clear_diff_track(const config& diff)
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"))
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);
2186 - foreach (const config &i, diff.child_range("change_child"))
2187 + wes_foreach (const config &i, diff.child_range("change_child"))
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())
2193 if (item.key.empty()) {
2196 itor->second[index]->clear_diff_track(item.cfg);
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);
2204 @@ -984,20 +984,20 @@
2206 check_valid(filter);
2208 - foreach (const attribute &i, filter.attribute_range())
2209 + wes_foreach (const attribute &i, filter.attribute_range())
2211 const attribute_value *v = get(i.first);
2212 if (!v || *v != i.second) return false;
2215 - foreach (const any_child &i, filter.all_children_range())
2216 + wes_foreach (const any_child &i, filter.all_children_range())
2218 if (i.key == "not") {
2219 if (matches(i.cfg)) return 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)) {
2228 @@ -1021,11 +1021,11 @@
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';
2237 - foreach (const config::any_child &child, cfg.all_children_range())
2238 + wes_foreach (const config::any_child &child, cfg.all_children_range())
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;
2246 - foreach (const attribute &val, values)
2247 + wes_foreach (const attribute &val, values)
2249 for (c = val.first.begin(); c != val.first.end(); ++c) {
2251 @@ -1067,10 +1067,10 @@
2255 - foreach (const any_child &ch, all_children_range())
2256 + wes_foreach (const any_child &ch, all_children_range())
2258 std::string child_hash = ch.cfg.hash();
2259 - foreach (char c, child_hash) {
2260 + wes_foreach (char c, child_hash) {
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
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;
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
2282 bool always_display = false;
2283 - foreach (const config &mod, u->get_modification_advances())
2284 + wes_foreach (const config &mod, u->get_modification_advances())
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 @@
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())
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())
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
2310 // now get the surfaces
2311 std::vector<surface> res;
2313 - foreach(std::string& name, names) {
2314 + wes_foreach(std::string& name, names) {
2315 const surface surf(image::get_image(name, image_type));
2317 res.push_back(surf);
2319 * layergroup > location > layer > 'tblit' > surface
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";
2333 - foreach (boost::function<void(display&)> f, redraw_observers_) {
2334 + wes_foreach (boost::function<void(display&)> f, redraw_observers_) {
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);
2347 @@ -2058,7 +2058,7 @@
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) {
2356 @@ -2388,7 +2388,7 @@
2360 - foreach (const map_location& loc, locs) {
2361 + wes_foreach (const map_location& loc, locs) {
2363 #pragma omp critical(invalidated_)
2365 @@ -2438,7 +2438,7 @@
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);
2374 @@ -2450,7 +2450,7 @@
2375 animate_map_ = preferences::animate_map();
2376 if (!animate_map_) return;
2378 - foreach (const map_location &loc, get_visible_hexes())
2379 + wes_foreach (const map_location &loc, get_visible_hexes())
2381 if (shrouded(loc)) continue;
2382 if (builder_->update_animation(loc)) {
2383 @@ -2464,7 +2464,7 @@
2384 void display::add_arrow(arrow& arrow)
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)
2390 arrows_map_[loc].push_back(&arrow);
2392 @@ -2473,7 +2473,7 @@
2393 void display::remove_arrow(arrow& arrow)
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)
2399 arrows_map_[loc].remove(&arrow);
2401 @@ -2482,12 +2482,12 @@
2402 void display::update_arrow(arrow & arrow)
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)
2408 arrows_map_[loc].remove(&arrow);
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)
2414 arrows_map_[loc].push_back(&arrow);
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
2420 editor_action_chain::editor_action_chain(const editor::editor_action_chain &other)
2421 : editor_action(), actions_()
2423 - foreach (editor_action* a, other.actions_) {
2424 + wes_foreach (editor_action* a, other.actions_) {
2425 actions_.push_back(a->clone());
2428 editor_action_chain& editor_action_chain::operator=(const editor_action_chain& other)
2430 if (this == &other) return *this;
2431 - foreach (editor_action* a, actions_) {
2432 + wes_foreach (editor_action* a, actions_) {
2436 - foreach (editor_action* a, other.actions_) {
2437 + wes_foreach (editor_action* a, other.actions_) {
2438 actions_.push_back(a->clone());
2442 editor_action_chain::~editor_action_chain()
2444 - foreach (editor_action* a, actions_) {
2445 + wes_foreach (editor_action* a, actions_) {
2451 int editor_action_chain::action_count() const {
2453 - foreach (const editor_action* a, actions_) {
2454 + wes_foreach (const editor_action* a, actions_) {
2456 count += a->action_count();
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_) {
2465 undo->append_action(a->perform(mc));
2469 void editor_action_chain::perform_without_undo(map_context& mc) const
2471 - foreach (editor_action* a, actions_) {
2472 + wes_foreach (editor_action* a, actions_) {
2474 a->perform_without_undo(mc);
2478 void editor_action_select::extend(const editor_map& map, const std::set<map_location>& locs)
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";
2486 editor_action* editor_action_select::perform(map_context& mc) const
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);
2496 void editor_action_select::perform_without_undo(map_context& mc) const
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);
2505 void editor_action_deselect::extend(const editor_map& map, const std::set<map_location>& locs)
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";
2513 editor_action* editor_action_deselect::perform(map_context& mc) const
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);
2523 void editor_action_deselect::perform_without_undo(map_context& mc) const
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);
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
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);
2542 - foreach (const config &relative, cfg.child_range("relative"))
2543 + wes_foreach (const config &relative, cfg.child_range("relative"))
2545 int x = relative["x"];
2546 int y = relative["y"];
2548 std::set<map_location> brush::project(const map_location& hotspot) const
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));
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
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;
2570 void editor_controller::init_brushes(const config& game_config)
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));
2576 if (brushes_.empty()) {
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);
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()) {
2597 void editor_controller::init_map_generators(const config& game_config)
2599 - foreach (const config &i, game_config.child_range("multiplayer"))
2600 + wes_foreach (const config &i, game_config.child_range("multiplayer"))
2602 if (i["map_generation"] == "default") {
2603 const config &generator_cfg = i.child("generator");
2605 ERR_ED << "No editor time-of-day defined\n";
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));
2614 ERR_ED << "No editor music defined\n";
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);
2621 sound::commit_music_changes();
2622 @@ -265,13 +265,13 @@
2624 editor_controller::~editor_controller()
2626 - foreach (const mouse_action_map::value_type a, mouse_actions_) {
2627 + wes_foreach (const mouse_action_map::value_type a, mouse_actions_) {
2630 - foreach (map_generator* m, map_generators_) {
2631 + wes_foreach (map_generator* m, map_generators_) {
2634 - foreach (map_context* mc, map_contexts_) {
2635 + wes_foreach (map_context* mc, map_contexts_) {
2640 void editor_controller::quit_confirm(EXIT_STATUS mode)
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());
2649 message = _("Do you really want to quit? Changes in the map since the last save will be lost.");
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;
2658 map_context* mc = new map_context(editor_map(game_config_, 44, 33, t_translation::GRASS_LAND));
2659 add_map_context(mc);
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);
2667 get_map_context().set_needs_terrain_rebuild(false);
2668 gui().invalidate_all();
2670 - foreach (const map_location& loc, changed_locs) {
2671 + wes_foreach (const map_location& loc, changed_locs) {
2672 gui().rebuild_terrain(loc);
2674 gui().invalidate(changed_locs);
2675 @@ -1290,7 +1290,7 @@
2677 void editor_controller::redraw_toolbar()
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
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";
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
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"))
2706 if (group_names.find(g["id"]) == group_names.end()) {
2707 terrain_groups_.push_back(terrain_group(g, gui));
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));
2716 // The rest of the code assumes this is a valid pointer
2717 assert(checked_group_btn_ != 0);
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() << "') "
2726 // add the terrain to the requested groups
2727 const std::vector<std::string>& keys = utils::split(t_info.editor_group());
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);
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;
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);
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
2756 if (!one_layer_only) {
2757 terrain = map_.get_terrain_info(terrain).terrain_with_default_base();
2759 - foreach (const map_location& loc, locs) {
2760 + wes_foreach (const map_location& loc, locs) {
2761 draw_terrain_actual(terrain, loc, one_layer_only);
2766 void map_context::clear_stack(action_stack& stack)
2768 - foreach (editor_action* a, stack) {
2769 + wes_foreach (editor_action* a, stack) {
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
2778 void map_fragment::add_tiles(const gamemap& map, const std::set<map_location>& locs)
2780 - foreach (const map_location& loc, locs) {
2781 + wes_foreach (const map_location& loc, locs) {
2786 std::set<map_location> map_fragment::get_offset_area(const map_location& loc) const
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));
2796 void map_fragment::paste_into(gamemap& map, const map_location& loc) const
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);
2804 void map_fragment::shift(const map_location& offset)
2806 - foreach (tile_info& ti, items_) {
2807 + wes_foreach (tile_info& ti, items_) {
2808 ti.offset.vector_sum_assign(offset);
2812 map_location map_fragment::center_of_mass() const
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);
2819 sum.x /= static_cast<int>(items_.size());
2822 shift(center_of_mass().vector_negation());
2824 - foreach (tile_info& ti, items_) {
2825 + wes_foreach (tile_info& ti, items_) {
2826 area_.insert(ti.offset);
2830 void map_fragment::rotate_60_cw()
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;
2839 void map_fragment::rotate_60_ccw()
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;
2849 void map_fragment::flip_horizontal()
2851 - foreach (tile_info& ti, items_) {
2852 + wes_foreach (tile_info& ti, items_) {
2853 ti.offset.x = -ti.offset.x;
2858 void map_fragment::flip_vertical()
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) {
2865 @@ -166,11 +166,11 @@
2867 std::stringstream ss;
2869 - foreach (const tile_info& ti, items_) {
2870 + wes_foreach (const tile_info& ti, items_) {
2871 ss << "(" << ti.offset << ")";
2874 - foreach (const map_location& loc, area_) {
2875 + wes_foreach (const map_location& loc, area_) {
2876 ss << "(" << loc << ")";
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
2884 init_binary_paths();
2886 - foreach (const config &bp, cfg.child_range("binary_path"))
2887 + wes_foreach (const config &bp, cfg.child_range("binary_path"))
2889 std::string path = bp["path"].str();
2890 if (path.find("..") != std::string::npos) {
2891 @@ -1042,7 +1042,7 @@
2893 init_binary_paths();
2895 - foreach (const std::string &path, binary_paths)
2896 + wes_foreach (const std::string &path, binary_paths)
2898 res.push_back(get_user_data_dir() + "/" + path + type + "/");
2900 @@ -1083,7 +1083,7 @@
2901 return std::string();
2904 - foreach (const std::string &path, get_binary_paths(type))
2905 + wes_foreach (const std::string &path, get_binary_paths(type))
2907 const std::string file = path + filename;
2908 DBG_FS << " checking '" << path << "'\n";
2909 @@ -1111,7 +1111,7 @@
2910 return std::string();
2913 - foreach (const std::string &path, get_binary_paths(type))
2914 + wes_foreach (const std::string &path, get_binary_paths(type))
2916 const std::string file = path + filename;
2917 DBG_FS << " checking '" << path << "'\n";
2918 @@ -1276,7 +1276,7 @@
2922 - foreach (const std::string &s, components)
2923 + wes_foreach (const std::string &s, components)
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 @@
2932 init_binary_paths();
2934 - foreach (const config &bp, cfg.child_range("binary_path"))
2935 + wes_foreach (const config &bp, cfg.child_range("binary_path"))
2937 std::string path = bp["path"].str();
2938 if (path.find("..") != std::string::npos) {
2939 @@ -1057,7 +1057,7 @@
2941 init_binary_paths();
2943 - foreach (const std::string &path, binary_paths)
2944 + wes_foreach (const std::string &path, binary_paths)
2946 res.push_back(get_user_data_dir() + "/" + path + type + "/");
2948 @@ -1098,7 +1098,7 @@
2949 return std::string();
2952 - foreach (const std::string &path, get_binary_paths(type))
2953 + wes_foreach (const std::string &path, get_binary_paths(type))
2955 const std::string file = path + filename;
2956 DBG_FS << " checking '" << path << "'\n";
2957 @@ -1126,7 +1126,7 @@
2958 return std::string();
2961 - foreach (const std::string &path, get_binary_paths(type))
2962 + wes_foreach (const std::string &path, get_binary_paths(type))
2964 const std::string file = path + filename;
2965 DBG_FS << " checking '" << path << "'\n";
2966 @@ -1291,7 +1291,7 @@
2970 - foreach (const std::string &s, components)
2971 + wes_foreach (const std::string &s, components)
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 @@
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());
2991 @@ -372,10 +372,10 @@
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());
3005 const subset_id subset = font_names.size();
3006 font_names.push_back(itor->name);
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);
3017 - foreach (text_chunk const &chunk, chunks_)
3018 + wes_foreach (text_chunk const &chunk, chunks_)
3020 TTF_Font* ttfont = get_font(font_id(chunk.subset, font_size_));
3023 if(width() > max_text_line_width)
3026 - foreach (text_chunk const &chunk, chunks_)
3027 + wes_foreach (text_chunk const &chunk, chunks_)
3029 TTF_Font* ttfont = get_font(font_id(chunk.subset, font_size_));
3031 @@ -1261,7 +1261,7 @@
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"]);
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
3044 #include <boost/foreach.hpp>
3046 #ifdef __CDT_PARSER__
3047 - #define foreach(a, b) for(a : b)
3048 + #define wes_foreach(a, b) for(a : b)
3050 - #define foreach BOOST_FOREACH
3051 + #define wes_foreach BOOST_FOREACH
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
3059 std::stringstream s;
3061 bool first_item = true;
3062 - foreach(expression_ptr a , items_) {
3063 + wes_foreach(expression_ptr a , items_) {
3068 std::stringstream s;
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()<<"]";
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
3082 bool first_arg = true;
3083 - foreach(expression_ptr a , args()) {
3084 + wes_foreach(expression_ptr a , args()) {
3092 - foreach(expression_ptr arg, args()) {
3093 + wes_foreach(expression_ptr arg, args()) {
3094 result += arg->evaluate(variables, fdb).string_cast();
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
3103 server_list.clear();
3104 - foreach (const config &server, v.child_range("server"))
3105 + wes_foreach (const config &server, v.child_range("server"))
3108 sinf.name = server["name"].str();
3111 void add_color_info(const config &v)
3113 - foreach (const config &teamC, v.child_range("color_range"))
3114 + wes_foreach (const config &teamC, v.child_range("color_range"))
3116 const config::attribute_value *a1 = teamC.get("id"),
3117 *a2 = teamC.get("rgb");
3119 DBG_NG << str.str() << '\n';
3122 - foreach (const config &cp, v.child_range("color_palette"))
3123 + wes_foreach (const config &cp, v.child_range("color_palette"))
3125 - foreach (const config::attribute &rgb, cp.attribute_range())
3126 + wes_foreach (const config::attribute &rgb, cp.attribute_range())
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
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) {
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
3149 - foreach (config &s, level.child_range("side"))
3150 + wes_foreach (config &s, level.child_range("side"))
3152 std::map<int,std::string>::const_iterator type = side_types.find(side_num),
3153 controller = side_controllers.find(side_num),
3155 faction_excepts.clear();
3158 - foreach (const config &faction, era_cfg.child_range("multiplayer_side"))
3159 + wes_foreach (const config &faction, era_cfg.child_range("multiplayer_side"))
3161 if (faction["random_faction"].to_bool()) continue;
3162 const std::string &faction_id = faction["id"];
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"))
3170 if (side["controller"] == "network")
3171 side["controller"] = "human";
3172 @@ -683,10 +683,10 @@
3175 if (load.cancel_orders()) {
3176 - foreach (config &side, state_.snapshot.child_range("side"))
3177 + wes_foreach (config &side, state_.snapshot.child_range("side"))
3179 if (side["controller"] != "human") continue;
3180 - foreach (config &unit, side.child_range("unit"))
3181 + wes_foreach (config &unit, side.child_range("unit"))
3183 unit["goto_x"] = -999;
3184 unit["goto_y"] = -999;
3187 void game_controller::mark_completed_campaigns(std::vector<config> &campaigns)
3189 - foreach (config &campaign, campaigns) {
3190 + wes_foreach (config &campaign, campaigns) {
3191 campaign["completed"] = preferences::is_campaign_completed(campaign["id"]);
3194 @@ -1218,7 +1218,7 @@
3195 game_config_.splice_children(core_terrain_rules, "terrain_graphics");
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();
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
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;
3216 if ( cmdline_opts.preprocess_defines ) {
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";
3225 const config &cfg = game->game_config().child("titlescreen_music");
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);
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
3237 halo::unrender(invalidated_);
3238 display::draw_invalidated();
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()
3246 temp_unit->redraw_unit();
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()
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()) {
3262 invalidateGameStatus_ = false;
3264 void game_display::highlight_another_reach(const pathfind::paths &paths_list)
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]++;
3271 reach_map_changed_ = true;
3272 @@ -897,17 +897,17 @@
3273 void game_display::invalidate_animations()
3275 display::invalidate_animations();
3276 - foreach (unit& u, units_) {
3277 + wes_foreach (unit& u, units_) {
3280 - foreach(unit* temp_unit, fake_units_) {
3281 + wes_foreach(unit* temp_unit, fake_units_) {
3282 temp_unit->refresh();
3284 std::vector<unit*> unit_list;
3285 - foreach (unit &u, units_) {
3286 + wes_foreach (unit &u, units_) {
3287 unit_list.push_back(&u);
3289 - foreach (unit *u, fake_units_) {
3290 + wes_foreach (unit *u, fake_units_) {
3291 unit_list.push_back(u);
3294 @@ -1079,7 +1079,7 @@
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 @@
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);
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
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)
3322 if(i.hitpoints() > 0 && unit_matches_filter(i, *u)) {
3325 const vconfig::child_list& variables = cond.get_children("variable");
3326 backwards_compat = backwards_compat && variables.empty();
3328 - foreach (const vconfig &values, variables)
3329 + wes_foreach (const vconfig &values, variables)
3331 const std::string name = values["name"];
3332 config::attribute_value value = resources::state_of_game->get_variable_const(name);
3334 const std::vector<game_events::event_handler>& handlers,
3335 const std::string& msg) {
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"] << "; ";
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 << "; ";
3350 DBG_EH << "remove buffered handlers are now " << ss.str() << "\n";
3352 const config & cfg = new_handler.get_config();
3353 std::string id = cfg["id"];
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 @@
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();
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();
3376 std::vector<int> sides = game_events::get_sides_vector(cfg);
3379 - foreach (const int &side_num, sides)
3380 + wes_foreach (const int &side_num, sides)
3382 index = side_num - 1;
3383 team &t = (*resources::teams)[index];
3385 filter.restrict_size(game_config::max_loop);
3386 filter.get_locations(locs, true);
3388 - foreach (map_location const &loc, locs)
3389 + wes_foreach (map_location const &loc, locs)
3392 t.clear_shroud(loc);
3394 const bool remove = utils::string_bool(cfg["remove"], false);
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);
3401 } else if (cfg.get_children("source").empty() ||
3403 WML_HANDLER_FUNCTION(modify_ai, /*event_info*/, cfg)
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)
3409 ai::manager::modify_active_ai_for_side(side_num,cfg.get_parsed_config());
3412 std::vector<int> sides = game_events::get_sides_vector(cfg);
3415 - foreach (const int &side_num, sides)
3416 + wes_foreach (const int &side_num, sides)
3418 team_index = side_num - 1;
3419 LOG_NG << "modifying side: " << side_num << "\n";
3420 @@ -1212,7 +1212,7 @@
3422 size_t longest_path = 0;
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 @@
3431 variable_info vi(array_name, true, variable_info::TYPE_ARRAY);
3433 - foreach (const config &cfg, vi.as_array())
3434 + wes_foreach (const config &cfg, vi.as_array())
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);
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))
3445 dest.vars->add_child_at(dest.key, child, dest.index++);
3447 @@ -1619,7 +1619,7 @@
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"]);
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;
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);
3474 @@ -1820,7 +1820,7 @@
3475 const map_location cfg_loc = cfg_to_loc(cfg);
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 @@
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();
3492 @@ -1926,7 +1926,7 @@
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);
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);
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 @@
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()){
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);
3535 @@ -2835,7 +2835,7 @@
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);
3544 @@ -2858,7 +2858,7 @@
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";
3553 @@ -2997,7 +2997,7 @@
3554 if(is_empty_command) {
3555 mref->command.add_child("allow_undo");
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());
3566 - foreach (const vconfig &condition, filters.get_children("filter_condition"))
3567 + wes_foreach (const vconfig &condition, filters.get_children("filter_condition"))
3569 if (!game_events::conditional_passed(condition)) {
3574 - foreach (const vconfig &f, filters.get_children("filter"))
3575 + wes_foreach (const vconfig &f, filters.get_children("filter"))
3577 if (unit1 == units->end() || !game_events::unit_matches_filter(*unit1, f)) {
3579 @@ -3046,7 +3046,7 @@
3583 - foreach (const vconfig &f, filters.get_children("filter_side"))
3584 + wes_foreach (const vconfig &f, filters.get_children("filter_side"))
3587 const int current_side = resources::controller->current_side();
3588 @@ -3055,7 +3055,7 @@
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)
3595 if (unit1 != units->end() && game_events::matches_special_filter(ev.data.child("first"), f)) {
3596 special_matches = true;
3597 @@ -3068,7 +3068,7 @@
3601 - foreach (const vconfig &f, filters.get_children("filter_second"))
3602 + wes_foreach (const vconfig &f, filters.get_children("filter_second"))
3604 if (unit2 == units->end() || !game_events::unit_matches_filter(*unit2, f)) {
3606 @@ -3080,7 +3080,7 @@
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)
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()
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));
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);
3628 resources::lua_kernel = new LuaKernel(cfg);
3629 manager_running = true;
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);
3636 @@ -3298,7 +3298,7 @@
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));
3645 @@ -3312,7 +3312,7 @@
3646 void write_events(config& cfg)
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());
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);
3658 - foreach (const config &new_ev, cfgs) {
3659 + wes_foreach (const config &new_ev, cfgs) {
3660 if(type.empty() && new_ev["id"].empty())
3662 WRN_NG << "attempt to add an [event] with empty id=, ignoring \n";
3663 @@ -3427,7 +3427,7 @@
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 << "; ";
3671 DBG_EH << "processing queued events: " << ss.str() << "\n";
3672 @@ -3454,7 +3454,7 @@
3674 bool init_event_vars = true;
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))
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
3688 - foreach (const config::any_child &h, history.all_children_range())
3689 + wes_foreach (const config::any_child &h, history.all_children_range())
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"]);
3696 @@ -142,10 +142,10 @@
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) {
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]
3708 cfg["message"] = line;
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();
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());
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()
3735 std::vector<std::string> advanced_items;
3736 - foreach (const config &adv, adv_preferences_cfg_)
3737 + wes_foreach (const config &adv, adv_preferences_cfg_)
3739 std::ostringstream str;
3740 std::string field = preferences::get(adv["field"]);
3741 @@ -1096,7 +1096,7 @@
3743 adv_preferences_cfg_.clear();
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);
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
3754 tags.push_back("side");
3755 tags.push_back("player"); //merge [player] tags for backwards compatibility of saves
3757 - foreach (const std::string& side_tag, tags)
3758 + wes_foreach (const std::string& side_tag, tags)
3760 - foreach (config &carryover_side, source->child_range(side_tag))
3761 + wes_foreach (config &carryover_side, source->child_range(side_tag))
3763 config *scenario_side = NULL;
3765 @@ -226,13 +226,13 @@
3766 (*scenario_side)["color"] = carryover_side["color"];
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);
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);
3782 //See also playcampaign::play_game, where after finishing the scenario the replay
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);
3792 std::string leader_image;
3794 - //foreach (const config &p, cfg_save.child_range("player"))
3795 + //wes_foreach (const config &p, cfg_save.child_range("player"))
3797 // if (utils::string_bool(p["canrecruit"], false)) {
3798 // leader = p["save_id"];
3801 if (const config &snapshot = *(has_snapshot ? &cfg_snapshot : &cfg_replay_start))
3803 - foreach (const config &side, snapshot.child_range("side"))
3804 + wes_foreach (const config &side, snapshot.child_range("side"))
3806 if (side["controller"] != "human") {
3812 - foreach (const config &u, side.child_range("unit"))
3813 + wes_foreach (const config &u, side.child_range("unit"))
3815 if (u["canrecruit"].to_bool()) {
3816 leader = u["id"].str();
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);
3827 if (!side_cfg_["no_leader"].to_bool() && side_cfg_["controller"] != "null") {
3828 handle_leader(side_cfg_);
3830 - foreach (const config &l, side_cfg_.child_range("leader")) {
3831 + wes_foreach (const config &l, side_cfg_.child_range("leader")) {
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");
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");
3852 "allow_changes", "faction_name", "user_description", "faction" };
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_));
3859 .allow_add_to_recall(true)
3864 - foreach (const char *attr, side_attrs) {
3865 + wes_foreach (const char *attr, side_attrs) {
3866 cfg.remove_attribute(attr);
3870 void game_state::set_menu_items(const config::const_child_itors &menu_items)
3872 clear_wmi(wml_menu_items);
3873 - foreach (const config &item, menu_items)
3874 + wes_foreach (const config &item, menu_items)
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.");
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;
3890 @@ -1474,7 +1474,7 @@
3891 } else if(type == "pre_commit") {
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()) {
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
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();
3913 void thandler::activate()
3915 - foreach(tdispatcher* dispatcher, dispatchers_) {
3916 + wes_foreach(tdispatcher* dispatcher, dispatchers_) {
3917 dispatcher->fire(SDL_ACTIVATE
3918 , dynamic_cast<twidget&>(*dispatcher)
3922 * For now we use a hack, but would be nice to rewrite it for 1.9/1.11.
3924 - foreach(tdispatcher* dispatcher, dispatchers_) {
3925 + wes_foreach(tdispatcher* dispatcher, dispatchers_) {
3928 * This leaves glitches on window borders if the window beneath it
3931 DBG_GUI_E << "Firing: " << SDL_VIDEO_RESIZE << ".\n";
3933 - foreach(tdispatcher* dispatcher, dispatchers_) {
3934 + wes_foreach(tdispatcher* dispatcher, dispatchers_) {
3935 dispatcher->fire(SDL_VIDEO_RESIZE
3936 , dynamic_cast<twidget&>(*dispatcher)
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
3944 typedef std::pair<tnotifiee<tfunctor>* const, tfunctor> thack;
3945 - foreach(thack& item, notifiees_) {
3946 + wes_foreach(thack& item, notifiees_) {
3948 assert((*item.first).notifier_ == this);
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
3955 std::vector<ttip> result;
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"]
3961 , tip["encountered_units"]));
3964 const std::set<std::string>& units = preferences::encountered_units();
3966 - foreach(const ttip& tip, tips) {
3967 + wes_foreach(const ttip& tip, tips) {
3968 if(tip.unit_filter_.empty()) {
3969 result.push_back(tip);
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);
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
3980 void load_resolutions(const config &cfg)
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));
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
3992 unsigned get_border(const std::vector<std::string>& border)
3994 unsigned result = 0;
3995 - foreach (const std::string& s, border) {
3996 + wes_foreach (const std::string& s, border) {
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
4004 const config &data = cfg.child("list_data");
4007 - foreach(const config &row, data.child_range("row")) {
4008 + wes_foreach(const config &row, data.child_range("row")) {
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;
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
4026 - foreach(const config& row, data.child_range("row")) {
4027 + wes_foreach(const config& row, data.child_range("row")) {
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;
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
4045 - foreach(const config &row, d.child_range("row")) {
4046 + wes_foreach(const config &row, d.child_range("row")) {
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;
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
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"]);
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
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));
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
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));
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
4098 , boost::function<tbuilder_widget_ptr(config)> >
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") {
4106 , definition->helptip);
4109 - foreach(const twindow_builder::tresolution::tlinked_group& lg,
4110 + wes_foreach(const twindow_builder::tresolution::tlinked_group& lg,
4111 definition->linked_groups) {
4113 if(window->has_linked_size_group(lg.id)) {
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));
4124 definition = "default";
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 @@
4134 log_scope2(log_gui_parse, "Window builder: parsing a grid");
4136 - foreach (const config &row, cfg.child_range("row"))
4137 + wes_foreach (const config &row, cfg.child_range("row"))
4141 row_grow_factor.push_back(row["grow_factor"]);
4143 - foreach (const config &c, row.child_range("column"))
4144 + wes_foreach (const config &c, row.child_range("column"))
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
4153 std::string langcode_to_string(const std::string& lcode)
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) {
4162 std::string languages;
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
4173 this->names_.clear();
4174 this->selections_.clear();
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;
4182 std::vector<std::string> retv;
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_) {
4188 retv.push_back(entry.first);
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
4194 * @todo do we really want to keep the length limit for the various
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;
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
4206 tcampaign_difficulty::tcampaign_difficulty(const std::vector<std::string>& items)
4207 : index_(-1), items_()
4209 - foreach(const std::string& it, items) {
4210 + wes_foreach(const std::string& it, items) {
4211 items_.push_back(tlegacy_menu_item(it));
4216 std::map<std::string, string_map> data;
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();
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
4227 &window, "campaign_details", false);
4230 - foreach(const config &campaign, campaigns_) {
4231 + wes_foreach(const config &campaign, campaigns_) {
4233 /*** Add tree item ***/
4234 tree_group_field["label"] = campaign["icon"];
4236 tmulti_page& multi_page = find_widget<tmulti_page>(
4237 &window, "campaign_details", false);
4239 - foreach (const config &c, campaigns_) {
4240 + wes_foreach (const config &c, campaigns_) {
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
4248 std::stringstream str;
4249 LOG_CHAT_LOG << "entering tchat_log::model::add_row_to_chat_message_list\n";
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))
4254 std::string prefix("/me");
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
4260 tlistbox& list = find_widget<tlistbox>(&window, "persist_list", false);
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;
4269 find_widget<tlabel>(*it, "filename", 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
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
4296 - foreach(tfield_* field, fields_) {
4297 + wes_foreach(tfield_* field, fields_) {
4303 void tdialog::init_fields(twindow& window)
4305 - foreach(tfield_* field, fields_) {
4306 + wes_foreach(tfield_* field, fields_) {
4307 field->attach_to_window(window);
4308 field->widget_init(window);
4312 void tdialog::finalize_fields(twindow& window, const bool save_fields)
4314 - foreach(tfield_* field, fields_) {
4315 + wes_foreach(tfield_* field, fields_) {
4317 field->widget_finalize(window);
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
4323 std::stringstream stack_text;
4324 std::string indent = " ";
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;
4332 &window, "execution", false, true);
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;
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
4344 tlistbox& list = find_widget<tlistbox>(&window, "savegame_list", false);
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;
4353 find_widget<tlabel>(*it, "filename", 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()
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);
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+"]");
4379 ? resources::state_of_game->get_variables()
4382 - foreach( const config::attribute &a, vars.attribute_range()) {
4383 + wes_foreach( const config::attribute &a, vars.attribute_range()) {
4385 model_.set_inspect_window_text(a.second);
4391 - foreach( const config::any_child &c, vars.all_children_range()) {
4392 + wes_foreach( const config::any_child &c, vars.all_children_range()) {
4394 model_.set_inspect_window_text(c.cfg.debug());
4397 << '/' << i->max_experience() << " xp; "
4398 << i->hitpoints() << '/' << i->max_hitpoints()
4400 - foreach (const std::string &str, i->get_traits_list()) {
4401 + wes_foreach (const std::string &str, i->get_traits_list()) {
4406 : std::vector<unit>();
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;
4416 s << std::endl << std::endl;
4418 : std::vector<unit>();
4421 - foreach (const unit &u, recall_list) {
4422 + wes_foreach (const unit &u, recall_list) {
4425 c.add_child("unit",c_unit);
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;
4434 s << std::endl << std::endl;
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_)));
4440 + //wes_foreach team
4441 int sides = resources::teams
4442 ? static_cast<int>((*resources::teams).size())
4445 void show_stuff_types_list()
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());
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
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) {
4463 item.insert(std::make_pair("label", lang.language));
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
4469 void room_info::process_room_members(const config& data)
4472 - foreach (const config& m, data.child_range("member")) {
4473 + wes_foreach (const config& m, data.child_range("member")) {
4474 members_.insert(m["name"]);
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) {
4488 game_filter_stack::~game_filter_stack()
4490 - foreach (game_filter_base* f, filters_) {
4491 + wes_foreach (game_filter_base* f, filters_) {
4497 void game_filter_stack::clear()
4499 - foreach (game_filter_base* f, filters_) {
4500 + wes_foreach (game_filter_base* f, filters_) {
4506 bool game_filter_and_stack::match(const game_info &game) const
4508 - foreach (game_filter_base* f, filters_) {
4509 + wes_foreach (game_filter_base* f, filters_) {
4510 if (!f->match(game)) return false;
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
4518 void lobby_info::delete_games()
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_) {
4526 std::string dump_games_map(const lobby_info::game_info_map& games)
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() << " ";
4535 std::string dump_games_config(const config& gamelist)
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] << " ";
4544 gamelist_initialized_ = true;
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;
4552 @@ -180,10 +180,10 @@
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));
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);
4567 room_info* lobby_info::get_room(const std::string &name)
4569 - foreach (room_info& r, rooms_) {
4570 + wes_foreach (room_info& r, rooms_) {
4571 if (r.name() == name) return &r;
4576 const room_info* lobby_info::get_room(const std::string &name) const
4578 - foreach (const room_info& r, rooms_) {
4579 + wes_foreach (const room_info& r, rooms_) {
4580 if (r.name() == name) return &r;
4584 games_filtered_.clear();
4585 games_visibility_.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);
4594 games_filtered_.clear();
4595 games_visibility_.clear();
4596 - foreach (game_info* g, games_) {
4597 + wes_foreach (game_info* g, games_) {
4599 bool show = game_filter_.match(gi);
4600 if (game_filter_invert_) {
4603 void lobby_info::update_user_statuses(int game_id, const room_info *room)
4605 - foreach (user_info& user, users_) {
4606 + wes_foreach (user_info& user, users_) {
4607 user.update_state(game_id, room);
4611 void lobby_info::sort_users(bool by_name, bool by_relation)
4613 users_sorted_.clear();
4614 - foreach (user_info& u, users_) {
4615 + wes_foreach (user_info& u, users_) {
4616 users_sorted_.push_back(&u);
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)
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") {
4640 player_list_.other_games.tree->clear();
4641 player_list_.other_rooms.tree->clear();
4643 - foreach (user_info* userptr, lobby_info_.users_sorted())
4644 + wes_foreach (user_info* userptr, lobby_info_.users_sorted())
4646 user_info& user = *userptr;
4647 tsub_player_list* target_list(NULL);
4648 @@ -1093,7 +1093,7 @@
4650 tlobby_chat_window* tlobby_main::search_create_window(const std::string& name, bool whisper, bool open_new)
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;
4657 @@ -1477,7 +1477,7 @@
4658 //TODO: this should really open a nice join room dialog instead
4659 std::stringstream ss;
4661 - foreach (const config& r, rooms.child_range("room")) {
4662 + wes_foreach (const config& r, rooms.child_range("room")) {
4663 ss << " " << r["name"];
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;
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);
4675 @@ -1694,7 +1694,7 @@
4677 lobby_info_.clear_game_filter();
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));
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
4689 void tmessage::post_show(twindow& /*window*/)
4691 - foreach(tbutton_status& button_status, buttons_) {
4692 + wes_foreach(tbutton_status& button_status, buttons_) {
4693 button_status.button = NULL;
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
4701 int i = 0; // because we need to know which row contains the controlling player
4703 - foreach (const std::string &nick, nicks)
4704 + wes_foreach (const std::string &nick, nicks)
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
4712 const std::vector<game_config::server_info>&
4713 pref_servers = preferences::server_list();
4715 - foreach(const game_config::server_info& server, pref_servers) {
4716 + wes_foreach(const game_config::server_info& server, pref_servers) {
4718 std::map<std::string, string_map> data;
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
4724 std::vector<std::string> maps;
4725 get_files_in_dir(get_user_data_dir() + "/editor/maps", &maps, NULL, FILE_NAME_ONLY);
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);
4736 - foreach (const config &map, cfg_.child_range("multiplayer"))
4737 + wes_foreach (const config &map, cfg_.child_range("multiplayer"))
4739 if (map["allow_new_game"].to_bool(true)) {
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
4745 tlistbox& list = find_widget<tlistbox>(&window, "listbox", false);
4746 window.keyboard_capture(&list);
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;
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
4757 WRN_CF << "There are not tips of day available.\n";
4760 - foreach(const ttip& tip, tips) {
4761 + wes_foreach(const ttip& tip, tips) {
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
4770 attack_type no_weapon(empty);
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();
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
4782 std::vector< std::string > type_labels, race_labels;
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())
4787 unit_types.find(i.first, unit_type::HELP_INDEX);
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
4793 void tcontrol::place(const tpoint& origin, const tpoint& size)
4796 - foreach(tcanvas& canvas, canvas_) {
4797 + wes_foreach(tcanvas& canvas, canvas_) {
4798 canvas.set_width(size.x);
4799 canvas.set_height(size.y);
4802 const int max_height = get_text_maximum_height();
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
4815 std::vector<std::string> params = utils::split(level);
4817 - foreach(const std::string& param, params) {
4818 + wes_foreach(const std::string& param, params) {
4819 if(param == "all") {
4821 // No need to look further eventhought invalid items are now
4824 std::vector<std::string> params = utils::split(domain);
4826 - foreach(const std::string& param, params) {
4827 + wes_foreach(const std::string& param, params) {
4828 if(param == "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
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
4847 /** Inherited from tgenerator_. */
4850 - foreach(titem* item, items_) {
4851 + wes_foreach(titem* item, items_) {
4854 selected_item_count_ = 0;
4856 /** Inherited from tgenerator_. */
4857 void layout_init(const bool full_initialization)
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);
4866 assert(this->get_visible() == twidget::VISIBLE);
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);
4874 void child_populate_dirty_list(twindow& caller,
4875 const std::vector<twidget*>& call_stack)
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);
4883 /** Inherited from widget. */
4884 bool disable_click_dismiss() const
4886 - foreach(titem* item, items_) {
4887 + wes_foreach(titem* item, items_) {
4888 if(item->grid.disable_click_dismiss()) {
4892 void (*callback)(twidget*))
4895 - foreach(const T& item_data, data) {
4896 + wes_foreach(const T& item_data, data) {
4897 create_item(i, list_builder, item_data, callback);
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
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();
4916 - foreach(tchild& child, children_) {
4917 + wes_foreach(tchild& child, children_) {
4918 if(child.id() != id) {
4923 void tgrid::remove_child(const std::string& id, const bool find_all)
4925 - foreach(tchild& child, children_) {
4926 + wes_foreach(tchild& child, children_) {
4928 if(child.id() == id) {
4929 delete child.widget();
4932 void tgrid::set_active(const bool active)
4934 - foreach(tchild& child, children_) {
4935 + wes_foreach(tchild& child, children_) {
4937 twidget* widget = child.widget();
4940 twidget::layout_init(full_initialization);
4942 // Clear child caches.
4943 - foreach(tchild& child, children_) {
4944 + wes_foreach(tchild& child, children_) {
4946 child.layout_init(full_initialization);
4950 bool tgrid::can_wrap() const
4952 - foreach(const tchild& child, children_) {
4953 + wes_foreach(const tchild& child, children_) {
4954 if(child.can_wrap()) {
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_) {
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_) {
4977 twidget::set_origin(origin);
4979 - foreach(tchild& child, children_) {
4980 + wes_foreach(tchild& child, children_) {
4982 twidget* widget = child.widget();
4986 twidget::set_visible_area(area);
4988 - foreach(tchild& child, children_) {
4989 + wes_foreach(tchild& child, children_) {
4991 twidget* widget = child.widget();
4995 void tgrid::layout_children()
4997 - foreach(tchild& child, children_) {
4998 + wes_foreach(tchild& child, children_) {
4999 assert(child.widget());
5000 child.widget()->layout_children();
5004 assert(!call_stack.empty() && call_stack.back() == this);
5006 - foreach(tchild& child, children_) {
5007 + wes_foreach(tchild& child, children_) {
5009 assert(child.widget());
5013 bool tgrid::has_widget(const twidget* widget) const
5015 - foreach(const tchild& child, children_) {
5016 + wes_foreach(const tchild& child, children_) {
5017 if(child.widget() == widget) {
5024 - foreach(const tchild& child, children_) {
5025 + wes_foreach(const tchild& child, children_) {
5026 const twidget* widget = child.widget();
5030 assert(get_visible() == twidget::VISIBLE);
5033 - foreach(tchild& child, children_) {
5034 + wes_foreach(tchild& child, children_) {
5036 twidget* widget = child.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
5042 const tpoint& coordinate, const bool must_be_active)
5044 typedef typename tconst_duplicator<W, tgrid::tchild>::type hack;
5045 - foreach(hack& child, grid.children_) {
5046 + wes_foreach(hack& child, grid.children_) {
5048 W* widget = child.widget();
5053 typedef typename tconst_duplicator<W, tgrid::tchild>::type hack;
5054 - foreach(hack& child, grid.children_) {
5055 + wes_foreach(hack& child, grid.children_) {
5057 widget = child.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
5064 void tlist::append_rows(const std::vector<string_map>& items)
5066 - foreach(const string_map& item, items) {
5067 + wes_foreach(const string_map& item, items) {
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
5075 if(percentage_ != percentage) {
5076 percentage_ = percentage;
5078 - foreach(tcanvas& c, canvas()) {
5079 + wes_foreach(tcanvas& c, canvas()) {
5080 c.set_variable("percentage", variant(percentage));
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
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()) {
5094 tclickable_* button = find_widget<tclickable_>(
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);
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);
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);
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);
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
5136 void tscrollbar_::update_canvas() {
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_));
5144 void tscrollbar_::load_config_extra()
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()));
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 @@
5157 , const char *key)> > thack;
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);
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);
5171 const std::string& definition_type
5172 , const std::vector<tcontrol_definition_ptr>& definitions)
5174 - foreach(const tcontrol_definition_ptr& def, definitions) {
5175 + wes_foreach(const tcontrol_definition_ptr& def, definitions) {
5177 // We assume all definitions are unique if not we would leak memory.
5178 assert(control_definition[definition_type].find(def->id)
5180 ERR_GUI_P << e.message;
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);
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
5193 std::vector<tcontrol_definition_ptr> definitions;
5195 - foreach(const config& definition
5196 + wes_foreach(const config& definition
5197 , cfg.child_range(key ? key : definition_type + "_definition")) {
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
5205 tscrollbar_::update_canvas();
5207 - foreach(tcanvas& tmp, canvas()) {
5208 + wes_foreach(tcanvas& tmp, canvas()) {
5209 tmp.set_variable("text", variant(get_value_label()));
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
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);
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
5228 const int max_width = get_text_maximum_width();
5229 const int max_height = get_text_maximum_height();
5231 - foreach(tcanvas& tmp, canvas()) {
5232 + wes_foreach(tcanvas& tmp, canvas()) {
5234 tmp.set_variable("text", variant(get_value()));
5235 tmp.set_variable("text_x_offset", variant(text_x_offset_));
5238 // Since this variable doesn't change set it here instead of in
5240 - foreach(tcanvas& tmp, canvas()) {
5241 + wes_foreach(tcanvas& tmp, canvas()) {
5242 tmp.set_variable("text_font_height", variant(text_height_));
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
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_));
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
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));
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
5273 grid_.set_parent(this);
5274 set_parent(&parent_tree_view);
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);
5282 int height_reduction = 0;
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;
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);
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);
5312 - foreach(ttree_view_node& node, children_) {
5313 + wes_foreach(ttree_view_node& node, children_) {
5314 node.set_visible_area(area);
5321 - foreach(ttree_view_node& node, children_) {
5322 + wes_foreach(ttree_view_node& node, children_) {
5323 node.impl_draw_children(frame_buffer);
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
5333 - foreach(std::vector<twidget*>& item, dirty_list_) {
5334 + wes_foreach(std::vector<twidget*>& item, dirty_list_) {
5336 assert(!item.empty());
5338 @@ -1047,12 +1047,12 @@
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_) {
5345 tpoint max_size(0, 0);
5347 // Determine the maximum size.
5348 - foreach(twidget* widget, linked_size.second.widgets) {
5349 + wes_foreach(twidget* widget, linked_size.second.widgets) {
5351 const tpoint size = widget->get_best_size();
5353 @@ -1065,7 +1065,7 @@
5356 // Set the maximum size.
5357 - foreach(twidget* widget, linked_size.second.widgets) {
5358 + wes_foreach(twidget* widget, linked_size.second.widgets) {
5360 tpoint size = widget->get_best_size();
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
5366 // opening the help browser in the default manner.
5367 config hidden_toplevel;
5368 std::stringstream ss;
5369 - foreach (const config §ion, help_config->child_range("section"))
5370 + wes_foreach (const config §ion, help_config->child_range("section"))
5372 const std::string id = section["id"];
5373 if (find_section(toplevel, id) == NULL) {
5376 hidden_toplevel["sections"] = ss.str();
5378 - foreach (const config &topic, help_config->child_range("topic"))
5379 + wes_foreach (const config &topic, help_config->child_range("topic"))
5381 const std::string id = topic["id"];
5382 if (find_topic(toplevel, id) == NULL) {
5387 - foreach (const config §ion, cfg.child_range("section"))
5388 + wes_foreach (const config §ion, cfg.child_range("section"))
5390 const std::vector<std::string> sections_refd
5391 = utils::quoted_split(section["sections"]);
5396 - foreach (const config §ion, cfg.child_range("section"))
5397 + wes_foreach (const config §ion, cfg.child_range("section"))
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;
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())
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())
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");
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"];
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";
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";
5446 @@ -1291,7 +1291,7 @@
5447 text << "<header>text='" << _("Factions:") << "'</header>" << "\n";
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";
5455 @@ -1366,7 +1366,7 @@
5456 reverse ? type_.advances_from() : type_.advances_to();
5459 - foreach (const std::string &adv, adv_units)
5460 + wes_foreach (const std::string &adv, adv_units)
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)
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;
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())
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;
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())
5489 const unit_type &type = i.second;
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())
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
5505 void load_hotkeys(const config& cfg)
5507 - foreach (const config &hk, cfg.child_range(hotkey_tag_name))
5508 + wes_foreach (const config &hk, cfg.child_range(hotkey_tag_name))
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
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)
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)) {
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
5538 modification_queue mods;
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);
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
5549 known_languages.push_back(
5550 language_def("", t_string(N_("System default language"), "wesnoth"), "ltr", "", "A"));
5552 - foreach (const config &lang, cfg.child_range("locale"))
5553 + wes_foreach (const config &lang, cfg.child_range("locale"))
5555 known_languages.push_back(
5556 language_def(lang["locale"], lang["name"], lang["dir"],
5558 std::cerr << "No [language] block found\n";
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;
5571 void init_textdomains(const config& cfg)
5573 - foreach (const config &t, cfg.child_range("textdomain"))
5574 + wes_foreach (const config &t, cfg.child_range("textdomain"))
5576 const std::string &name = t["name"];
5577 const std::string &path = t["path"];
5579 bool init_strings(const config& cfg)
5582 - foreach(const config &l, cfg.child_range("language")) {
5583 + wes_foreach(const config &l, cfg.child_range("language")) {
5584 languages_.push_back(l);
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
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;
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;
5605 std::string list_logdomains(const std::string& filter)
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";
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
5617 #define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n))
5620 -static int foreachi (lua_State *L) {
5621 +static int wes_foreachi (lua_State *L) {
5623 int n = aux_getn(L, 1);
5624 luaL_checktype(L, 2, LUA_TFUNCTION);
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 */
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},
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
5650 std::vector<terrain_height_mapper> height_conversion;
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));
5658 LOG_NG << (SDL_GetTicks() - ticks) << "\n"; ticks = SDL_GetTicks();
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));
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
5673 - foreach (const config &i, cfg.child_range("label"))
5674 + wes_foreach (const config &i, cfg.child_range("label"))
5676 const map_location loc(i, resources::state_of_game);
5677 terrain_label *label = new terrain_label(*this, i);
5680 void map_labels::clear_all()
5682 - foreach (team_label_map::value_type &m, labels_)
5683 + wes_foreach (team_label_map::value_type &m, labels_)
5685 clear_map(m.second, true);
5689 void map_labels::recalculate_labels()
5691 - foreach (team_label_map::value_type &m, labels_)
5692 + wes_foreach (team_label_map::value_type &m, labels_)
5694 - foreach (label_map::value_type &l, m.second)
5695 + wes_foreach (label_map::value_type &l, m.second)
5697 l.second->recalculate();
5701 void map_labels::recalculate_shroud()
5703 - foreach (team_label_map::value_type &m, labels_)
5704 + wes_foreach (team_label_map::value_type &m, labels_)
5706 - foreach (label_map::value_type &l, m.second)
5707 + wes_foreach (label_map::value_type &l, m.second)
5709 l.second->calculate_shroud();
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
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)
5721 DBG_WB << unit->name() << " [" << unit->id() <<"]\n";
5724 options.push_back(heading.str());
5725 options_to_filter.push_back(options.back());
5727 - foreach (const unit* u, recall_list_team)
5728 + wes_foreach (const unit* u, recall_list_team)
5730 std::stringstream option, option_to_filter;
5731 std::string name = u->name();
5733 option_to_filter << u->type_name() << " " << name << " " << u->level();
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;
5741 @@ -1540,7 +1540,7 @@
5743 options.push_back(heading);
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())
5748 std::stringstream row;
5750 @@ -2047,7 +2047,7 @@
5751 std::vector<std::string> get_commands_list() const
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);
5759 @@ -2638,7 +2638,7 @@
5761 if (const config &alias_list = preferences::get_alias())
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);
5768 @@ -3241,7 +3241,7 @@
5769 tile->rebuild_cache(tod_id, &tile_logs);
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;
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"))
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"))
5793 if (mp["id"] == scenario)
5795 @@ -3596,7 +3596,7 @@
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());
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 @@
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()))
5816 @@ -1055,7 +1055,7 @@
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)
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
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"))
5835 if (side_unit["canrecruit"].to_bool()) {
5836 leader_type = side_unit["type"].str();
5838 std::vector<ai::description*> &ais_list = parent_->ai_algorithms_;
5839 std::vector<std::string> ais;
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_){
5847 void connect::side::update_faction_combo()
5849 std::vector<std::string> factions;
5850 - foreach (const config *faction, parent_->era_sides_)
5851 + wes_foreach (const config *faction, parent_->era_sides_)
5853 const std::string& name = (*faction)["name"];
5854 const std::string& icon = (*faction)["image"];
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);
5866 std::map<std::string, config> children;
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));
5875 @@ -836,12 +836,12 @@
5877 void connect::side::set_side_children(std::map<std::string, config> children)
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);
5883 std::pair<std::string, config> child_map;
5885 - foreach(child_map, children)
5886 + wes_foreach(child_map, children)
5887 cfg_.add_child(child_map.first, child_map.second);
5891 // Builds the list of sides eligible for choice (nonrandom factions)
5892 std::vector<int> nonrandom_sides;
5894 - foreach (const config *i, parent_->era_sides_)
5895 + wes_foreach (const config *i, parent_->era_sides_)
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"));
5903 - foreach (const config *faction, era_sides_) {
5904 + wes_foreach (const config *faction, era_sides_) {
5905 player_factions_.push_back((*faction)["name"]);
5908 @@ -1539,7 +1539,7 @@
5910 if(params_.use_map_settings) {
5912 - foreach (config &side, sides)
5913 + wes_foreach (config &side, sides)
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 @@
5919 std::vector<std::string> map_team_names;
5921 - foreach (config &side, sides)
5922 + wes_foreach (config &side, sides)
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 @@
5928 // Populates "sides_" from the level configuration
5930 - foreach (const config &s, sides) {
5931 + wes_foreach (const config &s, sides) {
5932 sides_.push_back(side(*this, s, index++));
5935 @@ -1683,7 +1683,7 @@
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);
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
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()) {
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
5958 const config &cfg = game_config.child("lobby_music");
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);
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
5972 - foreach (const config &j, cfg.child_range("multiplayer"))
5973 + wes_foreach (const config &j, cfg.child_range("multiplayer"))
5975 if (j["allow_new_game"].to_bool(true))
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"]);
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;
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
6002 - foreach (const config &game, cfg.child("gamelist").child_range("game"))
6003 + wes_foreach (const config &game, cfg.child("gamelist").child_range("game"))
6005 bool verified = true;
6006 games_.push_back(game_item());
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) {
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;
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
6038 state.starting_pos.child_range("side");
6039 config::const_child_itors level_sides = level.child_range("side");
6041 - foreach (config &side, saved_sides)
6042 + wes_foreach (config &side, saved_sides)
6044 - foreach (const config &lside, level_sides)
6045 + wes_foreach (const config &lside, level_sides)
6047 if (side["side"] == lside["side"] &&
6048 (side["current_player"] != lside["current_player"] ||
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"] << " ";
6057 chat_.add_message(time(NULL), "server", ss.str());
6059 if (const config &rs = c.child("rooms")) {
6060 std::stringstream ss;
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() << ") ";
6066 chat_.add_message(time(NULL), "server", ss.str());
6069 std::list<user_info> u_list;
6071 - foreach (const config &user, gamelist_.child_range("user"))
6072 + wes_foreach (const config &user, gamelist_.child_range("user"))
6075 u_elem.name = user["name"].str();
6076 @@ -848,12 +848,12 @@
6079 int res = -1, index = 0, best_score = 0;
6080 - foreach (const config *faction, fl)
6081 + wes_foreach (const config *faction, fl)
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) {
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
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"))
6102 if (sd["controller"] == "reserved" && sd["current_player"] == preferences::login())
6105 color = game_config::color_info(color_str).index() - 1;
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);
6116 std::vector<std::string> choices;
6117 - foreach (const config *s, leader_sides)
6118 + wes_foreach (const config *s, leader_sides)
6120 const config &side = *s;
6121 const std::string &name = side["name"];
6123 std::vector<std::string> details;
6124 std::vector<std::string> playerlist;
6126 - foreach (const config &sd, level_.child_range("side"))
6127 + wes_foreach (const config &sd, level_.child_range("side"))
6129 if (!sd["allow_player"].to_bool(true)) {
6132 // Hack: if there is a unit which can recruit, use it as a
6133 // leader. Necessary to display leader information when loading
6135 - foreach (const config &side_unit, sd.child_range("unit"))
6136 + wes_foreach (const config &side_unit, sd.child_range("unit"))
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
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)
6150 //If this area is not a castle but should, skip it.
6151 if (vacancy == pathfind::VACANT_CASTLE && !map.is_castle(loc)) continue;
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)
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 @@
6168 - foreach(const teleport_group& group, groups) {
6169 + wes_foreach(const teleport_group& group, groups) {
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
6188 bool persist_manager::start_transaction() {
6189 if (in_transaction_) return false;
6191 - foreach (context_map::reference ctx, contexts_){
6192 + wes_foreach (context_map::reference ctx, contexts_){
6193 result &= ctx.second->start_transaction();
6195 in_transaction_ = true;
6197 bool persist_manager::end_transaction() {
6198 if (!in_transaction_) return false;
6200 - foreach (context_map::reference ctx, contexts_){
6201 + wes_foreach (context_map::reference ctx, contexts_){
6202 result &= ctx.second->end_transaction();
6204 in_transaction_ = !result;
6206 bool persist_manager::cancel_transaction() {
6207 if (!in_transaction_) return false;
6209 - foreach (context_map::reference ctx, contexts_){
6210 + wes_foreach (context_map::reference ctx, contexts_){
6211 result &= ctx.second->cancel_transaction();
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
6218 controller_map controllers;
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"))
6224 if (side["current_player"] == preferences::login()) {
6225 side["controller"] = preferences::client_type();
6227 scenario = &starting_pos;
6230 - foreach (config &side, starting_pos.child_range("side"))
6231 + wes_foreach (config &side, starting_pos.child_range("side"))
6233 if (side["current_player"] == preferences::login()) {
6234 side["controller"] = preferences::client_type();
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"))
6242 std::string id = side["save_id"];
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);
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
6257 place_sides_in_preferred_locations();
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);
6266 std::vector<team_builder_ptr> team_builders;
6269 - foreach (const config &side, level_.child_range("side"))
6270 + wes_foreach (const config &side, level_.child_range("side"))
6272 std::string save_id = get_unique_saveid(side, seen_save_ids);
6273 seen_save_ids.insert(save_id);
6275 team_builders.push_back(tb_ptr);
6278 - foreach (team_builder_ptr tb_ptr, team_builders)
6279 + wes_foreach (team_builder_ptr tb_ptr, team_builders)
6281 gamestate_.build_team_stage_two(tb_ptr);
6284 int num_pos = map_.num_valid_starting_positions();
6287 - foreach (const config &side, level_.child_range("side"))
6288 + wes_foreach (const config &side, level_.child_range("side"))
6290 for(int p = 1; p <= num_pos; ++p) {
6291 const map_location& pos = map_.starting_position(p);
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);
6303 case gui::TEXTBOX_SEARCH:
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 @@
6312 case gui::TEXTBOX_MESSAGE:
6314 - foreach(const team& t, teams_) {
6315 + wes_foreach(const team& t, teams_) {
6317 dictionary.insert(t.current_player());
6321 - foreach(const std::string& o, gui_->observers()){
6322 + wes_foreach(const std::string& o, gui_->observers()){
6323 dictionary.insert(o);
6325 //Exclude own nick from tab-completion.
6326 @@ -1341,7 +1341,7 @@
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
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);
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
6351 LOG_NG << "in playsingle_controller::play_scenario()...\n";
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);
6358 sound::commit_music_changes();
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);
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");
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);
6388 int persistent_teams = 0;
6389 - foreach (const team &t, teams_) {
6390 + wes_foreach (const team &t, teams_) {
6391 if (t.persistent()) ++persistent_teams;
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_)
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());
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"]);
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"]);
6421 const config& change = cfg.child_or_empty("change_controller");
6422 const std::string& side_drop = cfg["side_drop"].str();
6424 - foreach (const config &t, turns)
6425 + wes_foreach (const config &t, turns)
6427 handle_turn(turn_end, t, skip_replay, backlog);
6430 options.push_back(_("Abort game"));
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())
6436 t_vars["player"] = ob;
6437 options.push_back(vgettext("Replace with $player", t_vars));
6441 //get all allies in as options to transfer control
6442 - foreach (team &t, *resources::teams)
6443 + wes_foreach (team &t, *resources::teams)
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
6451 bpp = video.modePossible(resolution.first, resolution.second,
6452 DefaultBPP, video_flags, true);
6454 - foreach (const res_t &res, res_list)
6455 + wes_foreach (const res_t &res, res_list)
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
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_) {
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
6475 << nunits << " according to data source. " << units.size() << " locally\n";
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"))
6481 const map_location loc(u, resources::state_of_game);
6487 - foreach (const config &un, cfg.child_range("unit"))
6488 + wes_foreach (const config &un, cfg.child_range("unit"))
6490 const map_location loc(un, resources::state_of_game);
6491 const unit_map::const_iterator u = units.find(loc);
6493 const map_location &src = steps.front();
6494 const map_location &dst = steps.back();
6496 - foreach (const async_cmd &ac, async_cmds)
6497 + wes_foreach (const async_cmd &ac, async_cmds)
6499 if (config &async_child = ac.cfg->child("rename")) {
6500 map_location aloc(async_child, resources::state_of_game);
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)
6508 if (config &async_child = ac.cfg->child("rename"))
6512 void replay::add_config(const config& cfg, MARK_SENT mark)
6514 - foreach (const config &cmd, cfg.child_range("command"))
6515 + wes_foreach (const config &cmd, cfg.child_range("command"))
6517 config &cfg = cfg_.add_child("command", cmd);
6518 if (cfg.child("speak"))
6520 if(! game_config::mp_debug) {
6523 - foreach (const config &ch, cfg.child_range("checksum"))
6524 + wes_foreach (const config &ch, cfg.child_range("checksum"))
6526 map_location loc(ch, resources::state_of_game);
6527 unit_map::const_iterator u = resources::units->find(loc);
6528 @@ -1151,7 +1151,7 @@
6530 else if (const config &child = cfg->child("fire_event"))
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"]);
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
6541 if (!u) return report();
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);
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())
6556 std::ostringstream line;
6557 line << gettext(resist.first.c_str()) << ": ";
6560 tooltip << _("(Att / Def)");
6562 - foreach (const std::string &line, resistances_table) {
6563 + wes_foreach (const std::string &line, resistances_table) {
6566 return text_report(str.str(), tooltip.str());
6568 if (!u) return report();
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);
6577 bool revert = false;
6578 if (underlyings.size() != 1 || underlyings.front() != terrain)
6580 - foreach (const t_translation::t_terrain &t, underlyings)
6581 + wes_foreach (const t_translation::t_terrain &t, underlyings)
6583 if (t == t_translation::MINUS) {
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)
6592 if (!unit_team.is_enemy(enemy.side()))
6595 damage_multiplier += tod_bonus;
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> : "
6607 - foreach(const battle_context& weapon, weapons) {
6608 + wes_foreach(const battle_context& weapon, weapons) {
6610 // Predict the battle outcome.
6611 combatant attacker_combatant(weapon.get_attacker_stats());
6613 map_location displayed_unit_hex = resources::screen->displayed_unit_hex();
6616 - foreach (const attack_type &at, u->attacks())
6617 + wes_foreach (const attack_type &at, u->attacks())
6619 attack_info(at, res, u, displayed_unit_hex);
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;
6630 @@ -1178,7 +1178,7 @@
6632 std::ostringstream str;
6633 str << _("Observers:") << '\n';
6634 - foreach (const std::string &obs, observers) {
6635 + wes_foreach (const std::string &obs, observers) {
6638 return image_report(game_config::images::observer, str.str());
6639 @@ -1250,7 +1250,7 @@
6641 void reports::reset_generators()
6643 - foreach (dynamic_report_generators::value_type &rg, dynamic_generators) {
6644 + wes_foreach (dynamic_report_generators::value_type &rg, dynamic_generators) {
6647 dynamic_generators.clear();
6648 @@ -1283,10 +1283,10 @@
6649 const std::set<std::string> &reports::report_list()
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);
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);
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
6665 bool shrouded = false;
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"))
6671 if (side["controller"] != "human") {
6677 - foreach (const config &u, side.child_range("unit"))
6678 + wes_foreach (const config &u, side.child_range("unit"))
6680 if (u["canrecruit"].to_bool()) {
6681 leader = u["id"].str();
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);
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
6695 void extract_preload_scripts(config const &game_config)
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);
6702 preload_config = game_config.child("game_config");
6707 - foreach (const config::any_child &ch, cfg.all_children_range())
6708 + wes_foreach (const config::any_child &ch, cfg.all_children_range())
6710 lua_createtable(L, 2, 0);
6711 lua_pushstring(L, ch.key.c_str());
6713 lua_rawseti(L, -2, 2);
6714 lua_rawseti(L, -2, k++);
6716 - foreach (const config::attribute &attr, cfg.attribute_range())
6717 + wes_foreach (const config::attribute &attr, cfg.attribute_range())
6719 luaW_pushscalar(L, attr.second);
6720 lua_setfield(L, -2, attr.first.c_str());
6723 if (ptr) return ptr;
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;
6731 if (shallow_literal || strcmp(m, "__shallow_parsed") == 0)
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);
6740 const std::vector<std::string>& vector = accessor; \
6741 lua_createtable(L, vector.size(), 0); \
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); \
6748 @@ -1292,9 +1292,9 @@
6749 lua_rawget(L, LUA_REGISTRYINDEX);
6752 - foreach (team &t, *resources::teams)
6753 + wes_foreach (team &t, *resources::teams)
6755 - foreach (unit &u, t.recall_list())
6756 + wes_foreach (unit &u, t.recall_list())
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);
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++);
6769 @@ -3130,7 +3130,7 @@
6771 lua_createtable(L, res.size(), 0);
6773 - foreach (map_location const &loc, res)
6774 + wes_foreach (map_location const &loc, res)
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);
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)
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);
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())
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)
6812 lua_createtable(L, 0, 1);
6813 char const* id = race.first.c_str();
6814 @@ -3801,10 +3801,10 @@
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);
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);
6827 @@ -3822,7 +3822,7 @@
6829 static bool is_handled_file_tag(const std::string &s)
6831 - foreach (char const *t, handled_file_tags) {
6832 + wes_foreach (char const *t, handled_file_tags) {
6833 if (s == t) return true;
6836 @@ -3841,7 +3841,7 @@
6840 - foreach (const config::any_child &v, level_.all_children_range())
6841 + wes_foreach (const config::any_child &v, level_.all_children_range())
6843 if (is_handled_file_tag(v.key)) continue;
6844 lua_createtable(L, 2, 0);
6845 @@ -3861,7 +3861,7 @@
6847 void LuaKernel::save_game(config &cfg)
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);
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
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));
6866 @@ -503,11 +503,11 @@
6867 if (tab > max_recursion_levels)
6868 throw config::error("Too many recursion levels in config write");
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);
6875 - foreach (const config::any_child &item, cfg.all_children_range())
6876 + wes_foreach (const config::any_child &item, cfg.all_children_range())
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
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){
6893 writer.write_key_val("linenum", lexical_cast<std::string>(linenum));
6894 writer.write_key_val("location", get_location(location));
6896 - foreach (const std::string &arg, arguments)
6897 + wes_foreach (const std::string &arg, arguments)
6898 write_argument(writer, arg);
6900 writer.close_child(key);
6902 linenum = cfg["linenum"];
6903 location = cfg["location"].str();
6905 - foreach (const config &arg, cfg.child_range("argument"))
6906 + wes_foreach (const config &arg, cfg.child_range("argument"))
6910 @@ -1157,14 +1157,14 @@
6911 get_files_in_dir(res_name, &files, &dirs, ENTIRE_FILE_PATH, SKIP_MEDIA_DIR, DO_REORDER);
6914 - foreach(const std::string& dir, dirs)
6915 + wes_foreach(const std::string& dir, dirs)
6917 LOG_PREPROC<<"processing sub-dir: "<<dir<<'\n';
6918 preprocess_resource(dir,defines_map,write_cfg,write_plain_cfg,target_directory);
6921 // files in current directory
6922 - foreach(const std::string& file, files)
6923 + wes_foreach(const std::string& file, files)
6925 preprocess_resource(file,defines_map,write_cfg,write_plain_cfg,target_directory);
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&) {
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);
6943 - foreach (const config &type, g.child_range("type")) {
6944 + wes_foreach (const config &type, g.child_range("type")) {
6946 types_[type["name"].str()] = boost::regex( type["value"].str());
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
6952 scoped_istream ban_file = istream_file(filename_);
6953 read_gz(cfg, *ban_file);
6955 - foreach (const config &b, cfg.child_range("ban"))
6956 + wes_foreach (const config &b, cfg.child_range("ban"))
6959 banned_ptr new_ban(new banned(b));
6962 if (const config &cfg_del = cfg.child("deleted"))
6964 - foreach (const config &b, cfg_del.child_range("ban"))
6965 + wes_foreach (const config &b, cfg_del.child_range("ban"))
6968 banned_ptr new_ban(new banned(b));
6970 void ban_manager::load_config(const config& cfg)
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
6982 // this assumes the server is shutting down, so there's no need to
6983 // send the actual room-quit messages to clients
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_) {
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: "
7000 if (filename_.empty()) return;
7001 LOG_LOBBY << "Writing rooms to " << filename_ << "\n";
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");
7010 void room_manager::enter_lobby(const wesnothd::game &game)
7012 - foreach (network::connection player, game.all_game_users()) {
7013 + wes_foreach (network::connection player, game.all_game_users()) {
7014 enter_lobby(player);
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);
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);
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());
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);
7052 LOG_LOBBY << "Player " << user->second.name() << " unable to rejoin room " << room_name << "\n";
7054 void room_manager::fill_room_list(simple_wml::node& root)
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());
7063 void room_manager::fill_member_list(const room* room, simple_wml::node& root)
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 @@
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;
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;
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()) {
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);
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
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) {
7122 result.push_back(t.side());
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;
7134 if(cfg_.has_child("has_unit")) {
7135 const vconfig& unit_filter = cfg_.child("has_unit");
7137 - foreach (unit &u, *resources::units) {
7138 + wes_foreach (unit &u, *resources::units) {
7139 if (u.side() != t.side()) {
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_)) {
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()))
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()))
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
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)
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);
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
7195 scenario_name(cfg["scenario"])
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);
7203 static stats::str_int_map read_str_int_map(const config& cfg)
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;
7212 static stats::battle_result_map read_battle_result_map(const config& cfg)
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"))
7219 int key = item["_num"];
7222 mid_scenario = cfg["mid_scenario"].to_bool();
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));
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
7233 // caching the scaled backgrounds can take over a decent amount of memory.
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
7245 void part_ui::prepare_floating_images()
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_) );
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];
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
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"))
7272 map_location loc(v, resources::state_of_game);
7273 if (map.is_village(loc)) {
7275 return info_.minimum_recruit_price;
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);
7287 - foreach (const team &t, *teams) {
7288 + wes_foreach (const team &t, *teams) {
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
7296 t_translation::t_list& terrain_list,
7297 std::map<t_translation::t_terrain, terrain_type>& letter_to_terrain)
7299 - foreach (const config &t, cfgs)
7300 + wes_foreach (const config &t, cfgs)
7302 terrain_type terrain(t);
7303 DBG_G << "create_terrain_maps: " << terrain.number() << " "
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;
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
7323 - foreach (const config &cfg, vi.as_array()) {
7324 + wes_foreach (const config &cfg, vi.as_array()) {
7325 if (map_location(cfg, NULL) == loc) {
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
7342 void test_resolutions(const tresolution_list& resolutions)
7344 - foreach(const tresolution& resolution, resolutions) {
7345 + wes_foreach(const tresolution& resolution, resolutions) {
7346 video().make_test_fake(resolution.first, resolution.second);
7348 boost::scoped_ptr<gui2::tdialog> dlg(twrapper<T>::create());
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);
7357 boost::scoped_ptr<gui2::tpopup> dlg(twrapper<T>::create());
7359 void test_tip_resolutions(const tresolution_list& resolutions
7360 , const std::string& id)
7362 - foreach(const tresolution& resolution, resolutions) {
7363 + wes_foreach(const tresolution& resolution, resolutions) {
7364 video().make_test_fake(resolution.first, resolution.second);
7366 std::vector<std::string>& list =
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";
7377 BOOST_REQUIRE_MESSAGE(result, "Failed to create a dialog.");
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) {
7386 BOOST_REQUIRE_MESSAGE(cfg, "No editor time-of-day defined");
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));
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
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"))
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);
7415 - foreach (const config &chg, parent_stack.back()->child_range("change"))
7416 + wes_foreach (const config &chg, parent_stack.back()->child_range("change"))
7418 config &target = find_ref(chg["id"], res_cfgs_.back());
7419 target.merge_attributes(chg);
7421 // cannot add [status] sub-elements, but who cares
7422 if (const config &c = parent_stack.back()->child("add"))
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);
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);
7437 // Add all the resolved resolutions
7439 static void do_resolve_rects(const config& cfg, config& resolved_config, config* resol_cfg = NULL) {
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);
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"))
7454 int width = i["width"];
7455 int height = i["height"];
7458 if (const config &status_cfg = cfg.child("status"))
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)));
7464 if (const config &unit_image_cfg = status_cfg.child("unit_image")) {
7465 @@ -621,19 +621,19 @@
7469 - foreach (const config &p, cfg.child_range("panel")) {
7470 + wes_foreach (const config &p, cfg.child_range("panel")) {
7472 set_object_location(new_panel, p["rect"], p["ref"]);
7473 panels_.push_back(new_panel);
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);
7483 - foreach (const config &m, cfg.child_range("menu"))
7484 + wes_foreach (const config &m, cfg.child_range("menu"))
7487 DBG_DP << "adding menu: " << (new_menu.is_context() ? "is context" : "not context") << "\n";
7491 // Change existing theme objects.
7492 - foreach (const config &c, cfg.child_range("change"))
7493 + wes_foreach (const config &c, cfg.child_range("change"))
7495 std::string id = c["id"];
7496 std::string ref_id = c["ref"];
7497 @@ -709,12 +709,12 @@
7500 // Add new theme objects.
7501 - foreach (const config &c, cfg.child_range("add")) {
7502 + wes_foreach (const config &c, cfg.child_range("add")) {
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"]);
7516 - foreach (const config &thm, cfg->child_range("theme"))
7517 + wes_foreach (const config &thm, cfg->child_range("theme"))
7519 std::string thm_name = thm["name"];
7520 if (!thm["hidden"].to_bool(false))
7523 const theme::menu *theme::get_menu_item(const std::string &key) const
7525 - foreach (const theme::menu &m, menus_) {
7526 + wes_foreach (const theme::menu &m, menus_) {
7527 if (m.get_id() == key) return &m;
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
7535 void time_of_day::parse_times(const config& cfg, std::vector<time_of_day>& normal_times)
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));
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
7546 void tod_manager::set_new_current_times(const int new_current_turn_number)
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(
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
7559 void cutter::load_masks(const config& conf)
7561 - foreach (const config &m, conf.child_range("mask"))
7562 + wes_foreach (const config &m, conf.child_range("mask"))
7564 const std::string name = m["name"];
7565 const std::string image = get_mask_dir() + "/" + std::string(m["image"]);
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);
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
7579 if (cfg.has_attribute("super")){
7580 super_ = cfg["super"].str();
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);
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);
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);
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
7602 bool click(int mousex, int mousey)
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
7614 if (const config &abilities = cfg_.child("abilities"))
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))
7622 const config &adj_abilities = it->cfg_.child("abilities");
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))
7632 if (const config &abilities = cfg_.child("abilities"))
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));
7640 const config &adj_abilities = it->cfg_.child("abilities");
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))
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"];
7658 const config &abilities = cfg_.child("abilities");
7659 if (!abilities) return res;
7661 - foreach (const config::any_child &ab, abilities.all_children_range())
7662 + wes_foreach (const config::any_child &ab, abilities.all_children_range())
7664 if (force_active || ability_active(ab.key, ab.cfg, loc_))
7667 get_adjacent_tiles(loc,adjacent);
7668 const unit_map& units = *resources::units;
7670 - foreach (const config &i, cfg.child_range("filter_adjacent"))
7671 + wes_foreach (const config &i, cfg.child_range("filter_adjacent"))
7673 - foreach (const std::string &j, utils::split(i["adjacent"]))
7674 + wes_foreach (const std::string &j, utils::split(i["adjacent"]))
7676 map_location::DIRECTION index =
7677 map_location::parse_direction(j);
7682 - foreach (const config &i, cfg.child_range("filter_adjacent_location"))
7683 + wes_foreach (const config &i, cfg.child_range("filter_adjacent_location"))
7685 - foreach (const std::string &j, utils::split(i["adjacent"]))
7686 + wes_foreach (const std::string &j, utils::split(i["adjacent"]))
7688 map_location::DIRECTION index = map_location::parse_direction(j);
7689 if (index == map_location::NDIRECTIONS) {
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"))
7697 std::vector<std::string> dirs = utils::split(i["adjacent"]);
7698 if(std::find(dirs.begin(),dirs.end(),adjacent_names[dir]) != dirs.end()) {
7702 typedef std::pair<const config *, map_location> pt;
7703 - foreach (pt const &p, cfgs)
7704 + wes_foreach (pt const &p, cfgs)
7706 int value = (*p.first)[key].to_int(def);
7707 if ((*p.first)["cumulative"].to_bool()) {
7711 typedef std::pair<const config *, map_location> pt;
7712 - foreach (pt const &p, cfgs)
7713 + wes_foreach (pt const &p, cfgs)
7715 int value = (*p.first)[key].to_int(def);
7716 if ((*p.first)["cumulative"].to_bool()) {
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())
7724 if (sp.key == id || sp.cfg["id"] == id) {
7727 unit_ability_list res;
7728 if (const config &specials = cfg_.child("specials"))
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_));
7736 if (!other_attack_) return res;
7737 if (const config &specials = other_attack_->cfg_.child("specials"))
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_));
7745 const config &specials = cfg_.child("specials");
7746 if (!specials) return res;
7748 - foreach (const config::any_child &sp, specials.all_children_range())
7749 + wes_foreach (const config::any_child &sp, specials.all_children_range())
7751 if (force || special_active(sp.cfg, true)) {
7752 const t_string &name = sp.cfg["name"];
7754 const config &specials = cfg_.child("specials");
7755 if (!specials) return res;
7757 - foreach (const config::any_child &sp, specials.all_children_range())
7758 + wes_foreach (const config::any_child &sp, specials.all_children_range())
7760 char const *s = force || special_active(sp.cfg, true) ?
7761 "name" : "name_inactive";
7763 get_adjacent_tiles(dloc_,adjacent);
7766 - foreach (const config &i, cfg.child_range("filter_adjacent"))
7767 + wes_foreach (const config &i, cfg.child_range("filter_adjacent"))
7769 - foreach (const std::string &j, utils::split(i["adjacent"]))
7770 + wes_foreach (const std::string &j, utils::split(i["adjacent"]))
7772 map_location::DIRECTION index =
7773 map_location::parse_direction(j);
7778 - foreach (const config &i, cfg.child_range("filter_adjacent_location"))
7779 + wes_foreach (const config &i, cfg.child_range("filter_adjacent_location"))
7781 - foreach (const std::string &j, utils::split(i["adjacent"]))
7782 + wes_foreach (const std::string &j, utils::split(i["adjacent"]))
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
7790 config merge() const
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);
7799 animation_cursor(const config &cfg, animation_cursor *p):
7800 itors(cfg.all_children_range()), branches(p->branches), parent(p)
7802 - foreach (animation_branch &ab, branches)
7803 + wes_foreach (animation_branch &ab, branches)
7804 ab.attributes.merge_attributes(cfg);
7808 if (ac.itors.first->key != "if")
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);
7817 static animation_branches prepare_animation(const config &cfg, const std::string &animation_tag)
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);
7824 return expanded_animations;
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())
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);
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);
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);
7848 @@ -253,10 +253,10 @@
7849 for(value2=value2_str.begin() ; value2 != value2_str.end() ; ++value2) {
7850 value2_.push_back(atoi(value2->c_str()));
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);
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);
7860 play_offscreen_ = cfg["offscreen"].to_bool(true);
7862 display::tdrawing_layer layer = display::LAYER_UNIT_DEFAULT,
7863 bool offscreen = true)
7865 - foreach (const animation_branch &ab, prepare_animation(cfg, tag_name))
7866 + wes_foreach (const animation_branch &ab, prepare_animation(cfg, tag_name))
7868 config anim = ab.merge();
7869 anim["apply_to"] = apply_to;
7872 void unit_animation::add_anims( std::vector<unit_animation> & animations, const config & cfg)
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()));
7880 add_simple_anim(animations, cfg, "levelin_anim", "levelin");
7881 add_simple_anim(animations, cfg, "levelout_anim", "levelout");
7883 - foreach (const animation_branch &ab, prepare_animation(cfg, "standing_anim"))
7884 + wes_foreach (const animation_branch &ab, prepare_animation(cfg, "standing_anim"))
7886 config anim = ab.merge();
7887 anim["apply_to"] = "default";
7889 if (anim["offscreen"].empty()) anim["offscreen"] = false;
7890 animations.push_back(unit_animation(anim));
7892 - foreach (const animation_branch &ab, prepare_animation(cfg, "standing_anim"))
7893 + wes_foreach (const animation_branch &ab, prepare_animation(cfg, "standing_anim"))
7895 config anim = ab.merge();
7896 anim["apply_to"] = "standing";
7898 if (anim["offscreen"].empty()) anim["offscreen"] = false;
7899 animations.push_back(unit_animation(anim));
7901 - foreach (const animation_branch &ab, prepare_animation(cfg, "healing_anim"))
7902 + wes_foreach (const animation_branch &ab, prepare_animation(cfg, "healing_anim"))
7904 config anim = ab.merge();
7905 anim["apply_to"] = "healing";
7907 animations.push_back(unit_animation(anim));
7910 - foreach (const animation_branch &ab, prepare_animation(cfg, "healed_anim"))
7911 + wes_foreach (const animation_branch &ab, prepare_animation(cfg, "healed_anim"))
7913 config anim = ab.merge();
7914 anim["apply_to"] = "healed";
7916 animations.back().sub_anims_["_healed_sound"].add_frame(1,frame_builder().sound("heal.wav"),true);
7919 - foreach (const animation_branch &ab, prepare_animation(cfg, "poison_anim"))
7920 + wes_foreach (const animation_branch &ab, prepare_animation(cfg, "poison_anim"))
7922 config anim = ab.merge();
7923 anim["apply_to"] ="poisoned";
7926 add_simple_anim(animations, cfg, "pre_movement_anim", "pre_movement", display::LAYER_UNIT_MOVE_DEFAULT);
7928 - foreach (const animation_branch &ab, prepare_animation(cfg, "movement_anim"))
7929 + wes_foreach (const animation_branch &ab, prepare_animation(cfg, "movement_anim"))
7931 config anim = ab.merge();
7932 if (anim["offset"].empty()) {
7935 add_simple_anim(animations, cfg, "post_movement_anim", "post_movement", display::LAYER_UNIT_MOVE_DEFAULT);
7937 - foreach (const animation_branch &ab, prepare_animation(cfg, "defend"))
7938 + wes_foreach (const animation_branch &ab, prepare_animation(cfg, "defend"))
7940 config anim = ab.merge();
7941 anim["apply_to"] = "defend";
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)
7950 tmp["hits"] = hit_type;
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);
7955 - foreach (const animation_branch &ab, prepare_animation(cfg, "attack_anim"))
7956 + wes_foreach (const animation_branch &ab, prepare_animation(cfg, "attack_anim"))
7958 config anim = ab.merge();
7959 anim["apply_to"] = "attack";
7961 animations.push_back(unit_animation(anim));
7964 - foreach (const animation_branch &ab, prepare_animation(cfg, "death"))
7965 + wes_foreach (const animation_branch &ab, prepare_animation(cfg, "death"))
7967 config anim = ab.merge();
7968 anim["apply_to"] = "death";
7971 add_simple_anim(animations, cfg, "victory_anim", "victory");
7973 - foreach (const animation_branch &ab, prepare_animation(cfg, "extra_anim"))
7974 + wes_foreach (const animation_branch &ab, prepare_animation(cfg, "extra_anim"))
7976 config anim = ab.merge();
7977 anim["apply_to"] = anim["flag"];
7979 animations.push_back(unit_animation(anim));
7982 - foreach (const animation_branch &ab, prepare_animation(cfg, "teleport_anim"))
7983 + wes_foreach (const animation_branch &ab, prepare_animation(cfg, "teleport_anim"))
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());
7996 starting_frame_time_ = cfg[frame_string+"start_time"];
7999 - foreach (const config &frame, range)
8000 + wes_foreach (const config &frame, range)
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
8008 filter_recall_ = filter_recall.get_config();
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());
8018 filter_recall_ = cfg.child_or_empty("filter_recall");
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);
8026 formula_vars_ = new game_logic::map_formula_callable;
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);
8036 if (const config &status_flags = cfg.child("status"))
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, "
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);
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);
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);
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";
8075 @@ -715,12 +715,12 @@
8076 config::const_child_itors current_traits = modifications_.child_range("trait");
8077 std::vector<config> candidate_traits;
8079 - foreach (const config &t, type->possible_traits())
8080 + wes_foreach (const config &t, type->possible_traits())
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)
8088 if (mod["id"] == tid) {
8092 std::vector<std::string> res;
8094 - foreach (const config &mod, modifications_.child_range("trait"))
8095 + wes_foreach (const config &mod, modifications_.child_range("trait"))
8097 std::string const &id = mod["id"];
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)) {
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);
8117 @@ -1020,7 +1020,7 @@
8118 const std::vector<std::string> unit::advances_to_translated() const
8120 std::vector<std::string> result;
8121 - foreach (std::string type_id, advances_to_)
8122 + wes_foreach (std::string type_id, advances_to_)
8124 const unit_type *type = unit_types.find(type_id);
8126 @@ -1120,7 +1120,7 @@
8127 const std::map<std::string,std::string> unit::get_states() const
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";
8134 for (std::map<std::string, state_t>::const_iterator i = known_boolean_state_names_.begin(),
8135 @@ -1195,7 +1195,7 @@
8137 if (const config &abil = cfg_.child("abilities"))
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)
8144 @@ -2197,7 +2197,7 @@
8145 if (const config &resistance = cfg_.child("resistance"))
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;
8153 @@ -2222,7 +2222,7 @@
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())
8161 tooltip << s << '\n';
8162 @@ -2230,7 +2230,7 @@
8163 temp[image] = tooltip.str();
8166 - foreach (const config &adv, get_modification_advances())
8167 + wes_foreach (const config &adv, get_modification_advances())
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>
8175 - foreach (const config &adv, get_modification_advances())
8176 + wes_foreach (const config &adv, get_modification_advances())
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
8183 std::vector<config> res;
8184 - foreach (const config &adv, modification_advancements())
8185 + wes_foreach (const config &adv, modification_advancements())
8187 if (adv["strict_amla"].to_bool() && !advances_to_.empty())
8189 @@ -2283,7 +2283,7 @@
8190 std::unique_copy(temp.begin(), temp.end(), std::back_inserter(uniq));
8192 bool requirements_done = true;
8193 - foreach (const std::string &s, uniq)
8194 + wes_foreach (const std::string &s, uniq)
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
8202 - foreach (const config &item, modifications_.child_range(type)) {
8203 + wes_foreach (const config &item, modifications_.child_range(type)) {
8204 if (item["id"] == id) {
8207 @@ -2314,7 +2314,7 @@
8208 /** Helper function for add_modifications */
8209 static void mod_mdr_merge(config& dst, const config& mod, bool delta)
8211 - foreach (const config::attribute &i, mod.attribute_range()) {
8212 + wes_foreach (const config::attribute &i, mod.attribute_range()) {
8214 if (delta) v = dst[i.first];
8215 dst[i.first] = v + i.second.to_int();
8216 @@ -2336,7 +2336,7 @@
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"))
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];
8234 @@ -2551,7 +2551,7 @@
8235 config &ab = cfg_.child_or_add("abilities");
8236 if (const config &ab_effect = effect.child("abilities")) {
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);
8243 @@ -2560,7 +2560,7 @@
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"]);
8252 @@ -2749,7 +2749,7 @@
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);
8261 @@ -2779,7 +2779,7 @@
8262 bool is_inv = !get_state(STATE_UNCOVERED) && get_ability_bool(hides,loc);
8264 const std::vector<team>& teams = *resources::teams;
8265 - foreach (const unit &u, *resources::units)
8266 + wes_foreach (const unit &u, *resources::units)
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)
8274 - foreach (const unit &u, *resources::units) {
8275 + wes_foreach (const unit &u, *resources::units) {
8276 if (u.side() == side) ++res;
8279 @@ -2890,7 +2890,7 @@
8280 int side_units_cost(int side)
8283 - foreach (const unit &u, *resources::units) {
8284 + wes_foreach (const unit &u, *resources::units) {
8285 if (u.side() == side) res += u.cost();
8288 @@ -2899,7 +2899,7 @@
8289 int side_upkeep(int side)
8292 - foreach (const unit &u, *resources::units) {
8293 + wes_foreach (const unit &u, *resources::units) {
8294 if (u.side() == side) res += u.upkeep();
8297 @@ -3029,7 +3029,7 @@
8298 const tportrait* unit::portrait(
8299 const unsigned size, const tportrait::tside side) const
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)) {
8306 @@ -3107,20 +3107,20 @@
8310 - foreach (const config &att, unit_config.child_range("attack"))
8311 + wes_foreach (const config &att, unit_config.child_range("attack"))
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]];
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");
8325 - foreach (const config &abi, unit_config.child_range("abilities"))
8326 + wes_foreach (const config &abi, unit_config.child_range("abilities"))
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");
8334 - foreach (const config &trait, unit_config.child_range("trait"))
8335 + wes_foreach (const config &trait, unit_config.child_range("trait"))
8337 config& child = wcfg.add_child("trait", trait);
8338 child.recursive_clear_value("description");
8339 @@ -3142,7 +3142,7 @@
8341 for (int i = 0; !child_keys[i].empty(); ++i)
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);
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
8352 disp->display_unit_hex(healed_loc);
8353 unit_animator animator;
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
8367 - foreach(const unit_pod& item, ilist_) {
8368 + wes_foreach(const unit_pod& item, ilist_) {
8369 if(item.unit == u) {
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
8377 mutable t_ilist ilist_;
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_;
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
8388 if (config &specials = cfg_.child("specials"))
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()) {
8397 cfg_.clear_children("specials");
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);
8407 if (const config &resistance = cfg_.child("resistance"))
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;
8414 @@ -666,11 +666,11 @@
8415 movementType_ = unit_movement_type(cfg);
8416 alpha_ = ftofxp(1.0);
8418 - foreach (const config &t, traits)
8419 + wes_foreach (const config &t, traits)
8421 possibleTraits_.add_child("trait", t);
8423 - foreach (config &var_cfg, cfg.child_range("variation"))
8424 + wes_foreach (config &var_cfg, cfg.child_range("variation"))
8426 if (var_cfg["inherit"].to_bool()) {
8427 config nvar_cfg(cfg);
8429 if (cfg["ignore_race_traits"].to_bool()) {
8430 possibleTraits_.clear();
8432 - foreach (const config &t, race_->additional_traits())
8433 + wes_foreach (const config &t, race_->additional_traits())
8435 if (alignment_ != NEUTRAL || t["id"] != "fearless")
8436 possibleTraits_.add_child("trait", t);
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"))
8444 possibleTraits_.add_child("trait", trait);
8447 game_config::add_color_info(cfg);
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));
8457 if (const config &abil_cfg = cfg.child("abilities"))
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 @@
8468 - foreach (const config &adv, cfg.child_range("advancement"))
8469 + wes_foreach (const config &adv, cfg.child_range("advancement"))
8471 - foreach (const config &effect, adv.child_range("effect"))
8472 + wes_foreach (const config &effect, adv.child_range("effect"))
8474 const config &abil_cfg = effect.child("abilities");
8475 if (!abil_cfg || effect["apply_to"] != "new_ability") {
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());
8484 std::vector<attack_type> unit_type::attacks() const
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));
8494 if (const config &abil = cfg_.child("abilities"))
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)
8501 @@ -1005,7 +1005,7 @@
8502 const config &abilities = cfg_.child("abilities");
8503 if (!abilities) return res;
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"];
8510 @@ -1077,7 +1077,7 @@
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);
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())
8526 - foreach(const std::string& adv, ut.second.advances_to()) {
8527 + wes_foreach(const std::string& adv, ut.second.advances_to()) {
8529 adv_from.push_back(ut.second.id());
8531 @@ -1127,7 +1127,7 @@
8533 set_unit_config(cfg);
8535 - foreach (const config &mt, cfg.child_range("movetype"))
8536 + wes_foreach (const config &mt, cfg.child_range("movetype"))
8538 const unit_movement_type move_type(mt);
8539 movement_types_.insert(
8540 @@ -1135,14 +1135,14 @@
8541 loadscreen::increment_progress();
8544 - foreach (const config &r, cfg.child_range("race"))
8545 + wes_foreach (const config &r, cfg.child_range("race"))
8547 const unit_race race(r);
8548 races_.insert(std::pair<std::string,unit_race>(race.id(),race));
8549 loadscreen::increment_progress();
8552 - foreach (config &ut, cfg.child_range("unit_type"))
8553 + wes_foreach (config &ut, cfg.child_range("unit_type"))
8555 std::string id = ut["id"];
8556 if (const config &bu = ut.child("base_unit"))
8557 @@ -1195,7 +1195,7 @@
8559 void unit_type_data::check_types(const std::vector<std::string>& types) const
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);
8566 @@ -1279,7 +1279,7 @@
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 @@
8577 const config& cfg = to_unit.get_cfg();
8579 - foreach (const config &af, cfg.child_range("advancefrom"))
8580 + wes_foreach (const config &af, cfg.child_range("advancefrom"))
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())
8591 if (mod["availability"] != "musthave")
8594 - foreach (const config &effect, mod.child_range("effect"))
8595 + wes_foreach (const config &effect, mod.child_range("effect"))
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 @@
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);
8611 - foreach (const config::any_child &child, cfg_->all_children_range())
8612 + wes_foreach (const config::any_child &child, cfg_->all_children_range())
8614 if (child.key == "insert_tag") {
8615 vconfig insert_cfg(child.cfg);
8618 vconfig::child_list res;
8620 - foreach (const config::any_child &child, cfg_->all_children_range())
8621 + wes_foreach (const config::any_child &child, cfg_->all_children_range())
8623 if (child.key == key) {
8624 res.push_back(vconfig(&child.cfg, cache_key_));
8626 if (const config &natural = cfg_->child(key)) {
8627 return vconfig(&natural, cache_key_);
8629 - foreach (const config &ins, cfg_->child_range("insert_tag"))
8630 + wes_foreach (const config &ins, cfg_->child_range("insert_tag"))
8632 vconfig insert_cfg(ins);
8633 if(insert_cfg["name"] == key) {
8635 if (cfg_->child(key)) {
8638 - foreach (const config &ins, cfg_->child_range("insert_tag"))
8639 + wes_foreach (const config &ins, cfg_->child_range("insert_tag"))
8641 vconfig insert_cfg(ins);
8642 if(insert_cfg["name"] == key) {
8645 config &scoped_wml_variable::store(const config &var_value)
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);
8651 repos->clear_variable_cfg(var_name_);
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);
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
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));
8674 int CVideo::bppForMode( int x, int y, int flags)
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) {
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
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_)
8692 if (action_ptr action = weak.lock())
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_)
8701 if (action_ptr action = weak.lock())
8706 //unhide other units if needed
8707 - foreach(map_location hex, exclusive_display_hexes_)
8708 + wes_foreach(map_location hex, exclusive_display_hexes_)
8710 resources::screen->remove_exclusive_draw(hex);
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
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())
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);
8726 static void hide_all_plans()
8728 - foreach(team& t, *resources::teams)
8729 + wes_foreach(team& t, *resources::teams)
8730 t.get_side_actions()->hide();
8735 else //< normal circumstance
8737 - foreach(team& t, *resources::teams)
8738 + wes_foreach(team& t, *resources::teams)
8740 //make sure only appropriate teams are hidden
8741 if(!t.is_network_human())
8743 if (can_modify_game_state() && has_actions())
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_)
8749 unit_map::iterator unit_iter = resources::units->find(unit_id);
8750 assert(unit_iter.valid());
8753 void manager::post_draw()
8755 - foreach(size_t unit_id, units_owning_moves_)
8756 + wes_foreach(size_t unit_id, units_owning_moves_)
8758 unit_map::iterator unit_iter = resources::units->find(unit_id);
8759 if (unit_iter.valid()) {
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)
8767 side_actions& sa = *t.get_side_actions();
8771 void manager::on_mouseover_change(const map_location& hex)
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();
8779 LOG_WB << "Received wb data (" << count << ").\n";
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);
8787 @@ -1138,7 +1138,7 @@
8788 options.push_back(_("HIDE ALL allies’ plans"));
8790 //populate list of networked allies
8791 - foreach(team &t, *resources::teams)
8792 + wes_foreach(team &t, *resources::teams)
8794 //Exclude enemies, AIs, and local players
8795 if(t.is_enemy(v_side) || !t.is_network())
8796 @@ -1164,11 +1164,11 @@
8800 - foreach(team* t, allies)
8801 + wes_foreach(team* t, allies)
8802 team_plans_hidden_[t->side()-1]=false;
8805 - foreach(team* t, allies)
8806 + wes_foreach(team* t, allies)
8807 team_plans_hidden_[t->side()-1]=true;
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
8815 void mapbuilder::pre_build()
8817 - foreach(team& t, *resources::teams)
8818 + wes_foreach(team& t, *resources::teams)
8820 //Reset spent gold to zero, it'll be recalculated during the map building
8821 t.get_side_actions()->reset_gold_spent();
8824 int current_side = resources::controller->current_side();
8825 - foreach(unit& u, *resources::units)
8826 + wes_foreach(unit& u, *resources::units)
8828 bool on_current_side = (u.side() == current_side);
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 @@
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"]));
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"]);
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)
8856 route_cfg.add_child("step",loc_cfg);
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)
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
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())
8874 if(recall_unit.underlying_id()==underlying_id)
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
8881 s << "Content of side_actions:";
8883 - foreach(action_queue const& turn_queue, side_actions.actions())
8884 + wes_foreach(action_queue const& turn_queue, side_actions.actions())
8886 s << "\n Turn " << turn;
8890 - foreach(action_ptr const& action, turn_queue)
8891 + wes_foreach(action_ptr const& action, turn_queue)
8893 s << "\n (" << count << ") " << action;
8896 main_number = index;
8899 - foreach(weak_action_ptr action, highlighter->get_secondary_highlights())
8900 + wes_foreach(weak_action_ptr action, highlighter->get_secondary_highlights())
8902 if (action.lock() == *it)
8905 size_t side_actions::size() const
8908 - foreach(action_queue const& queue, actions_)
8909 + wes_foreach(action_queue const& queue, actions_)
8910 result += queue.size();
8917 - foreach(action_ptr act, *this)
8918 + wes_foreach(action_ptr act, *this)
8921 void side_actions::show()
8926 - foreach(action_ptr act, *this)
8927 + wes_foreach(action_ptr act, *this)
8932 size_t side_actions::count_actions_of(unit const* unit)
8935 - foreach(action_ptr action, *this)
8936 + wes_foreach(action_ptr action, *this)
8938 if (action->get_unit() == unit)
8941 else if(type=="refresh")
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);
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))
8956 unit const* u = act->get_unit();
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();
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
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)
8977 if (unit.can_recruit() &&
8978 resources::game_map->is_keep(unit.get_location()) &&
8980 if(!map.is_castle(hex))
8983 - foreach(unit& u, *resources::units)
8984 + wes_foreach(unit& u, *resources::units)
8986 && u.side() == static_cast<int>(team_index+1)
8987 && can_recruit_on(map,u.get_location(),hex))
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]);
9001 - foreach(team& t, *resources::teams)
9002 + wes_foreach(team& t, *resources::teams)
9003 if (!t.get_side_actions()->empty())
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
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_)
9016 viewer_actions_.remove_action(viewer_actions_.get_position_of(action), false);
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
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());
9029 size_t const current_team = resources::controller->current_side() - 1;