Author: fendrin
Date: Fri Jan 15 02:49:37 2010
New Revision: 40702

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40702&view=rev
Log:
Check for pointers validity and import the tunnels in a reference.

Modified:
    branches/fendrin_pathfind/src/astarsearch.cpp
    branches/fendrin_pathfind/src/pathfind.cpp

Modified: branches/fendrin_pathfind/src/astarsearch.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/fendrin_pathfind/src/astarsearch.cpp?rev=40702&r1=40701&r2=40702&view=diff
==============================================================================
--- branches/fendrin_pathfind/src/astarsearch.cpp (original)
+++ branches/fendrin_pathfind/src/astarsearch.cpp Fri Jan 15 02:49:37 2010
@@ -82,7 +82,7 @@
                g(s), h(heuristic(c, dst)), t(g + h), curr(c), prev(p), 
in(search_counter + i)
                {
                //TODO move to heuristic
-               if (!teleports->empty()) {
+               if (teleports && !teleports->empty()) {
 
                        double new_srch = 1.0;
                        const std::vector<std::set<map_location> > &sources = 
teleports->get_sources();
@@ -192,7 +192,7 @@
                std::vector<map_location> locs;
 
                int i;
-               if (!teleports->empty()) {
+               if (teleports && !teleports->empty()) {
 
                        const std::set<map_location>& allowed_teleports = 
teleports->get_adjacents(n.curr);
 

Modified: branches/fendrin_pathfind/src/pathfind.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/fendrin_pathfind/src/pathfind.cpp?rev=40702&r1=40701&r2=40702&view=diff
==============================================================================
--- branches/fendrin_pathfind/src/pathfind.cpp (original)
+++ branches/fendrin_pathfind/src/pathfind.cpp Fri Jan 15 02:49:37 2010
@@ -194,7 +194,7 @@
 
        groups.push_back(village_group);
 
-       std::vector<teleport_group> custom_groups = 
resources::game_map->tunnels();
+       std::vector<teleport_group>& custom_groups = 
resources::game_map->tunnels();
 
        groups.insert(groups.end(), custom_groups.begin(), custom_groups.end());
 
@@ -268,7 +268,7 @@
                bool see_all, bool ignore_units)
 {
        const team& current_team = teams[u.side() - 1];
-       teleport_map teleports;
+       teleport_map teleports = teleport_map();
        if (allow_teleport) {
                teleports = get_teleport_locations(u, units, viewing_team, 
see_all, ignore_units);
        }


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to