From efe0deac4423c1e54ae28e681017ec14cd038645 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Tue, 13 Jan 2009 21:20:39 +0000 Subject: Update 0.4 branch to 0.4.5 including change log. Also integrate Haran's fix for the Swap card (r8434). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@8445 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/decks.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'crawl-ref/source/decks.cc') diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index fdcf348bf8..6797a503ed 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -1362,6 +1362,15 @@ static void _swap_monster_card(int power, deck_rarity_type rarity) { monsters& mon(*mon_to_swap); const coord_def newpos = mon.pos(); + + // Be nice: no swapping into uninhabitable environments. + if (is_grid_dangerous(grd(newpos)) + || !monster_habitable_grid(mon_to_swap, grd(you.pos()))) + { + mpr("You spin around."); + return; + } + bool mon_caught = mons_is_caught(&mon); bool you_caught = you.attribute[ATTR_HELD]; @@ -1382,6 +1391,7 @@ static void _swap_monster_card(int power, deck_rarity_type rarity) } // Move you to its previous location. + // FIXME: this should also handle merfolk swimming, etc. you.moveto(newpos); if (mon_caught) -- cgit v1.2.3-54-g00ecf