diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-26 11:53:35 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-26 11:53:35 +0000 |
commit | 22ef1b77bd3ed31bb6dcfbeda94038ee94f3b77e (patch) | |
tree | fb75791f5e464cbd5ab7c4092f27aadd0a0ab420 | |
parent | 642ff844f06bf57d40323de5a42d3b527c306748 (diff) | |
download | crawl-ref-22ef1b77bd3ed31bb6dcfbeda94038ee94f3b77e.tar.gz crawl-ref-22ef1b77bd3ed31bb6dcfbeda94038ee94f3b77e.zip |
Fix net bug for teleporting/banishment.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.3@2590 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/effects.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/spells1.cc | 22 | ||||
-rw-r--r-- | crawl-ref/source/spells3.cc | 8 | ||||
-rw-r--r-- | crawl-ref/source/traps.cc | 12 | ||||
-rw-r--r-- | crawl-ref/source/traps.h | 1 |
5 files changed, 30 insertions, 17 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 3dc3bd891f..a5da81159f 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -48,6 +48,7 @@ #include "spl-util.h" #include "stuff.h" #include "terrain.h" +#include "traps.h" #include "view.h" // torment_monsters is called with power 0 because torment is @@ -158,6 +159,9 @@ void banished(dungeon_feature_type gate_type, const std::string &who) take_note(Note(NOTE_USER_NOTE, 0, 0, what.c_str()), true); } + // no longer held in net + clear_trapping_net(); + down_stairs(you.your_level, gate_type); // heh heh if (gate_type == DNGN_ENTER_ABYSS || gate_type == DNGN_ENTER_PANDEMONIUM) diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index 69f75555a1..5e3ea61e92 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -121,15 +121,9 @@ int blink(int pow, bool high_level_controlled_blink) } else { - if (you.attribute[ATTR_HELD]) - { - int net = get_trapping_net(you.x_pos, you.y_pos); - if (net != NON_ITEM) - remove_item_stationary(mitm[net]); - - you.attribute[ATTR_HELD] = 0; - } - + // no longer held in net + clear_trapping_net(); + move_player_to_grid(beam.tx, beam.ty, false, true, true); // controlling teleport contaminates the player -- bwr @@ -178,14 +172,8 @@ void random_blink(bool allow_partial_control, bool override_abyss) { mpr("You blink."); - if (you.attribute[ATTR_HELD]) - { - int net = get_trapping_net(you.x_pos, you.y_pos); - if (net != NON_ITEM) - remove_item_stationary(mitm[net]); - - you.attribute[ATTR_HELD] = 0; - } + // no longer held in net + clear_trapping_net(); succ = true; you.moveto(tx, ty); diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 4a102a0ce3..032f3bb2a7 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -679,6 +679,10 @@ static bool teleport_player( bool allow_control, bool new_abyss_area ) if (is_controlled) { + // no longer held in net + if (plox[0] != you.x_pos || plox[1] != you.y_pos) + clear_trapping_net(); + you.moveto(plox[0], plox[1]); if ((grd[you.x_pos][you.y_pos] != DNGN_FLOOR @@ -709,6 +713,10 @@ static bool teleport_player( bool allow_control, bool new_abyss_area ) && grd[newx][newy] != DNGN_SHALLOW_WATER) || mgrd[newx][newy] != NON_MONSTER || env.cgrid[newx][newy] != EMPTY_CLOUD); + + // no longer held in net + if (newx != you.x_pos || newy != you.y_pos) + clear_trapping_net(); if ( newx == you.x_pos && newy == you.y_pos ) mpr("Your surroundings flicker for a moment."); diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc index 7f9b41e7c9..a0d2e68b48 100644 --- a/crawl-ref/source/traps.cc +++ b/crawl-ref/source/traps.cc @@ -717,6 +717,18 @@ void free_self_from_net() } } +void clear_trapping_net() +{ + if (!you.attribute[ATTR_HELD]) + return; + + const int net = get_trapping_net(you.x_pos, you.y_pos); + if (net != NON_ITEM) + remove_item_stationary(mitm[net]); + + you.attribute[ATTR_HELD] = 0; +} + bool trap_item(object_class_type base_type, char sub_type, char beam_x, char beam_y) { diff --git a/crawl-ref/source/traps.h b/crawl-ref/source/traps.h index 76983c27bf..f8cbec2629 100644 --- a/crawl-ref/source/traps.h +++ b/crawl-ref/source/traps.h @@ -39,6 +39,7 @@ int get_trapping_net(int x, int y, bool trapped = true); void mark_net_trapping(int x, int y); void monster_caught_in_net(monsters *mon, bolt &pbolt); void player_caught_in_net(void); +void clear_trapping_net(void); // last updated 12may2000 {dlb} /* *********************************************************************** |