Author: alink
Date: Sat Apr 25 05:46:22 2009
New Revision: 35172

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35172&view=rev
Log:
Remove compatibility code for 1.6RC1 replay

Modified:
    trunk/src/replay.cpp

Modified: trunk/src/replay.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/replay.cpp?rev=35172&r1=35171&r2=35172&view=diff
==============================================================================
--- trunk/src/replay.cpp (original)
+++ trunk/src/replay.cpp Sat Apr 25 05:46:22 2009
@@ -1005,40 +1005,17 @@
                }
                else if (const config &child = cfg->child("move"))
                {
-                       map_location src, dst;
-                       std::vector<map_location> steps;
-                       bool need_pathfinding = false;
-
                        const std::string& x = child["x"];
                        const std::string& y = child["y"];
-
-                       if(!x.empty() && !y.empty()) {
-                               // Normal [move] format, we just parse the path
-                               steps = parse_location_range(x,y);
-
-                               if(steps.empty()) {
-                                       replay::throw_error("incorrect path 
data found in [move]\n");
-                               }
-
-                               src = steps.front();
-                               dst = steps.back();
-                       }
-                       else {
-                               // This is 1.5.12-1.6RC1 [move] format, parse 
the old data
-                               const config &destination = 
child.child("destination");
-                               const config &source = child.child("source");
-
-                               if (!source || !destination) {
-                                       replay::throw_error("no path or 
destination/source found in movement\n");
-                               }
-
-                               src = map_location(source, 
game_events::get_state_of_game());
-                               dst = map_location(destination, 
game_events::get_state_of_game());
-
-                               // 1.6RC1 needed pathfinding to generate the 
path data
-                               need_pathfinding = true;
-                       }
-
+                       std::vector<map_location> steps = 
parse_location_range(x,y);
+
+                       if(steps.empty()) {
+                               WRN_REPLAY << "Warning: Missing path data found 
in [move]\n";
+                               continue;
+                       }
+
+                       map_location src = steps.front();
+                       map_location dst = steps.back();
 
                        if (src == dst) {
                                WRN_REPLAY << "Warning: Move with identical 
source and destination. Skipping...";
@@ -1058,36 +1035,6 @@
                                errbuf << "unfound location for source of 
movement: "
                                       << src << " -> " << dst << '\n';
                                replay::throw_error(errbuf.str());
-                       }
-
-                       // backwards compatibility code for 1.6RC1
-                       // NOTE: This will still OOS sometimes when ambushing AI
-                       // but if the RC1 replay worked before,
-                       // then it will continue to work with RC2
-                       if(need_pathfinding) {
-                               // search path assuming current_team as viewing 
team
-                               const shortest_path_calculator calc(u->second, 
current_team, units, teams, map);
-                               std::set<map_location> allowed_teleports;
-                               if(u->second.get_ability_bool("teleport",src)) {
-                                       // search all known empty friendly 
villages
-                                       
for(std::set<map_location>::const_iterator i = current_team.villages().begin();
-                                               i != 
current_team.villages().end(); ++i) {
-                                               if 
(current_team.is_enemy(u->second.side()) && current_team.fogged(*i))
-                                               continue;
-
-                                               unit_map::const_iterator 
occupant = find_visible_unit(units, *i, map,teams, current_team);
-                                               if (occupant != units.end() && 
occupant != u)
-                                                       continue;
-
-                                               allowed_teleports.insert(*i);
-                                       }
-                               }
-
-                               steps = a_star_search(src, dst, 10000.0, &calc, 
map.w(), map.h(), &allowed_teleports).steps;
-
-                               if (steps.empty()) {
-                                       replay::throw_error("Pathfinding fails 
in the backwards compatibility code for 1.6RC1");
-                               }
                        }
 
                        ::move_unit(&disp, map, units, teams, steps, NULL, 
NULL, NULL, true, true, true);


_______________________________________________
Wesnoth-commits mailing list
Wesnoth-commits@gna.org
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to