diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-04 06:30:41 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-04 06:30:41 +0000 |
commit | d5c69c9f285d371b0625de75b9a71055ec220061 (patch) | |
tree | 0ec078bad93eadb5c3cc680b617e6b5a6f82e42a /crawl-ref/source/decks.cc | |
parent | 9031dab3a7fd207c9d6ac99fc16874b959c51f8c (diff) | |
download | crawl-ref-d5c69c9f285d371b0625de75b9a71055ec220061.tar.gz crawl-ref-d5c69c9f285d371b0625de75b9a71055ec220061.zip |
[1956565] Fix issues with monster names.
Monster names are now stored in the monster struct and saved.
Changed some monster-finding functions to return monsters* instead of monster index for type-safety.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4859 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/decks.cc')
-rw-r--r-- | crawl-ref/source/decks.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index c64eca497e..14c67f1a8e 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -1346,24 +1346,24 @@ static void _swap_monster_card(int power, deck_rarity_type rarity) // Swap between you and another monster. // Don't choose yourself unless there are no other monsters // nearby. - const int mon_to_swap = choose_random_nearby_monster(0); - if ( mon_to_swap == NON_MONSTER ) + monsters *mon_to_swap = choose_random_nearby_monster(0); + if ( !mon_to_swap ) { mpr("You spin around."); } else { - monsters& mon = menv[mon_to_swap]; - const coord_def newpos = menv[mon_to_swap].pos(); + monsters& mon(*mon_to_swap); + const coord_def newpos = mon.pos(); // pick the monster up - mgrd[mon.x][mon.y] = NON_MONSTER; + mgrd(newpos) = NON_MONSTER; mon.x = you.x_pos; mon.y = you.y_pos; // plunk it down - mgrd[mon.x][mon.y] = mon_to_swap; + mgrd(mon.pos()) = monster_index(mon_to_swap); // move you to its previous location you.moveto(newpos); @@ -1403,19 +1403,19 @@ static void _damnation_card(int power, deck_rarity_type rarity) for ( int i = 0; i < 1 + extra_targets; ++i ) { // pick a random monster nearby to banish (or yourself) - const int mon_to_banish = choose_random_nearby_monster(1); + monsters *mon_to_banish = choose_random_nearby_monster(1); // bonus banishments only banish monsters - if ( i != 0 && mon_to_banish == NON_MONSTER ) + if ( i != 0 && !mon_to_banish ) continue; - if ( mon_to_banish == NON_MONSTER ) // banish yourself! + if ( !mon_to_banish ) // banish yourself! { banished(DNGN_ENTER_ABYSS, "drawing a card"); break; // don't banish anything else } else - menv[mon_to_banish].banish(); + mon_to_banish->banish(); } } |