summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/decks.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-13 21:20:39 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-13 21:20:39 +0000
commitefe0deac4423c1e54ae28e681017ec14cd038645 (patch)
tree5aefde9d0763e692e6063df11d797fc322366067 /crawl-ref/source/decks.cc
parentfe5647c376e6492945e28ddc5e4c4d97888e24d4 (diff)
downloadcrawl-ref-efe0deac4423c1e54ae28e681017ec14cd038645.tar.gz
crawl-ref-efe0deac4423c1e54ae28e681017ec14cd038645.zip
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
Diffstat (limited to 'crawl-ref/source/decks.cc')
-rw-r--r--crawl-ref/source/decks.cc10
1 files changed, 10 insertions, 0 deletions
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)