Address bug #13795 (Teleportation runes put units in solid rock)...
...with patch #1183 (Prevent teleporting to impassable terrain). Tested at 2009-07-04T13:38:53Z!koraq@xs4all.nl.
This commit is contained in:
parent
cded3918c7
commit
7b2cdf3bef
5 changed files with 17 additions and 7 deletions
|
@ -6,6 +6,7 @@ Version 1.7.1+svn:
|
|||
* 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:
|
||||
|
|
|
@ -185,6 +185,9 @@
|
|||
comment = "gettext support, tinygui"
|
||||
email = "ydirson_AT_altern.org"
|
||||
[/entry]
|
||||
[entry]
|
||||
name = "Michael Flowers (MJ)"
|
||||
[/entry]
|
||||
[/about]
|
||||
|
||||
[about]
|
||||
|
|
|
@ -626,7 +626,10 @@ WML_HANDLER_FUNCTION(teleport, event_info, cfg)
|
|||
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();
|
||||
|
|
|
@ -41,7 +41,8 @@ static map_location find_vacant(const gamemap& map,
|
|||
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 @@ static map_location find_vacant(const gamemap& map,
|
|||
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 @@ static map_location find_vacant(const gamemap& map,
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,8 @@ enum VACANT_TILE_TYPE { VACANT_CASTLE, VACANT_ANY };
|
|||
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,
|
||||
|
|
Loading…
Add table
Reference in a new issue