diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-12 23:00:19 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-12 23:00:19 +0000 |
commit | 3e24519612ee58f23e76a3ecd1506bbe099630aa (patch) | |
tree | f2a178d25dc0c04505384ef12aa58cf338b380e7 /crawl-ref/source/decks.cc | |
parent | 0af5a8f293622c17331596d8868a664c8dad9bd0 (diff) | |
download | crawl-ref-3e24519612ee58f23e76a3ecd1506bbe099630aa.tar.gz crawl-ref-3e24519612ee58f23e76a3ecd1506bbe099630aa.zip |
Try a bit harder not to make unreasonable Swaps.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8434 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/decks.cc')
-rw-r--r-- | crawl-ref/source/decks.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 92b7c130cf..0b0fe786f7 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -1368,6 +1368,14 @@ 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 (!you.is_habitable(newpos) || !mon.is_habitable(you.pos())) + { + mpr("You spin around."); + return; + } + bool mon_caught = mons_is_caught(&mon); bool you_caught = you.attribute[ATTR_HELD]; @@ -1387,6 +1395,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) |