mail[Wesnoth-commits] r36577 - in /trunk: changelog data/core/about.cfg src/game_events.cpp src/pathfind.cpp src/pathfind.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by esr on July 04, 2009 - 23:20:
Author: esr
Date: Sat Jul  4 16:23:49 2009
New Revision: 36577

URL: http://svn.gna.org/viewcvs/wesnoth?rev=36577&view=rev
Log:
Address bug #13795 (Teleportation runes put units in solid rock) with patch 
#1183 (Prevent teleporting to impassable terrain). Tested at r36576.

Modified:
    trunk/changelog
    trunk/data/core/about.cfg
    trunk/src/game_events.cpp
    trunk/src/pathfind.cpp
    trunk/src/pathfind.hpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=36577&r1=36576&r2=36577&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sat Jul  4 16:23:49 2009
@@ -6,6 +6,7 @@
    * Updated translations: Finnish, German, Lithuanian, Polish, Serbian
  * Miscellaneous and bugfixes:
    * Fixed language switch not affecting unit descriptions (bug #13827)
+   * Fixed teleporting to impassable terrain (bug #13795)
 
 Version 1.7.1:
  * AI:

Modified: trunk/data/core/about.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/about.cfg?rev=36577&r1=36576&r2=36577&view=diff
==============================================================================
--- trunk/data/core/about.cfg (original)
+++ trunk/data/core/about.cfg Sat Jul  4 16:23:49 2009
@@ -185,6 +185,9 @@
         comment = "gettext support, tinygui"
         email = "ydirson_AT_altern.org"
     [/entry]
+    [entry]
+        name = "Michael Flowers (MJ)"
+    [/entry]
 [/about]
 
 [about]

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=36577&r1=36576&r2=36577&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Sat Jul  4 16:23:49 2009
@@ -626,7 +626,10 @@
        const map_location dst = cfg_to_loc(cfg);
        if (dst == u->first || !rsrc.game_map->on_board(dst)) return;
 
-       const map_location vacant_dst = find_vacant_tile(*rsrc.game_map, 
*rsrc.units, dst);
+       const unit *pass_check = &u->second;
+       if (utils::string_bool(cfg["ignore_passability"]))
+               pass_check = NULL;
+       const map_location vacant_dst = find_vacant_tile(*rsrc.game_map, 
*rsrc.units, dst, VACANT_ANY, pass_check);
        if (!rsrc.game_map->on_board(vacant_dst)) return;
 
        const int side = u->second.side();

Modified: trunk/src/pathfind.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/pathfind.cpp?rev=36577&r1=36576&r2=36577&view=diff
==============================================================================
--- trunk/src/pathfind.cpp (original)
+++ trunk/src/pathfind.cpp Sat Jul  4 16:23:49 2009
@@ -41,7 +41,8 @@
                const unit_map& units,
                const map_location& loc, int depth,
                VACANT_TILE_TYPE vacancy,
-               std::set<map_location>& touched)
+               std::set<map_location>& touched,
+               const unit* pass_check)
        {
                if(touched.count(loc))
                        return map_location();
@@ -57,11 +58,11 @@
                        map_location adj[6];
                        get_adjacent_tiles(loc,adj);
                        for(int i = 0; i != 6; ++i) {
-                               if(!map.on_board(adj[i]) || (vacancy == 
VACANT_CASTLE && !map.is_castle(adj[i])))
+                               if(!map.on_board(adj[i]) || (vacancy == 
VACANT_CASTLE && !map.is_castle(adj[i])) || (pass_check && 
pass_check->movement_cost(map[adj[i]]) == unit_movement_type::UNREACHABLE))
                                        continue;
 
                                const map_location res =
-                                       find_vacant(map, units, adj[i], depth 
- 1, vacancy, touched);
+                                       find_vacant(map, units, adj[i], depth 
- 1, vacancy, touched, pass_check);
 
                                if (map.on_board(res))
                                        return res;
@@ -74,11 +75,12 @@
 map_location find_vacant_tile(const gamemap& map,
                                                                   const 
unit_map& units,
                                                                   const 
map_location& loc,
-                                                                  
VACANT_TILE_TYPE vacancy)
+                                                                  
VACANT_TILE_TYPE vacancy,
+                                                                  const 
unit* pass_check)
 {
        for(int i = 1; i != 50; ++i) {
                std::set<map_location> touch;
-               const map_location res = 
find_vacant(map,units,loc,i,vacancy,touch);
+               const map_location res = 
find_vacant(map,units,loc,i,vacancy,touch,pass_check);
                if(map.on_board(res))
                        return res;
        }

Modified: trunk/src/pathfind.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/pathfind.hpp?rev=36577&r1=36576&r2=36577&view=diff
==============================================================================
--- trunk/src/pathfind.hpp (original)
+++ trunk/src/pathfind.hpp Sat Jul  4 16:23:49 2009
@@ -62,7 +62,8 @@
 map_location find_vacant_tile(const gamemap& map,
                                    const unit_map& un,
                                    const map_location& loc,
-                                   VACANT_TILE_TYPE vacancy=VACANT_ANY);
+                                   VACANT_TILE_TYPE vacancy=VACANT_ANY,
+                                   const unit* pass_check=NULL);
 
 /** Function which determines if a given location is in an enemy zone of 
control. */
 bool enemy_zoc(gamemap const &map,




Related Messages


Powered by MHonArc, Updated Sun Jul 05 00:20:28 2009