diff options
author | Neil Moore <neil@s-z.org> | 2011-12-28 16:47:36 -0500 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2011-12-28 17:19:54 -0500 |
commit | 9cea761547996da7a63a26daaa3fcf4d43f5ec4c (patch) | |
tree | 3cd3f679cf5906ddac9d7edbb167c60f8881f0da /crawl-ref/source/teleport.cc | |
parent | a8af7f392eff2778e587a57c980d0728b038e099 (diff) | |
download | crawl-ref-9cea761547996da7a63a26daaa3fcf4d43f5ec4c.tar.gz crawl-ref-9cea761547996da7a63a26daaa3fcf4d43f5ec4c.zip |
Do not lose constriction when teleporting.
Add a flag (default true) to actor::move_to_pos(), actor::moveto(), and
move_player_to_grid() indication whether clear_far_constrictions()
should be called. When teleporting or blinking, pass false as that
flag, pull along constrictors/constrictees, and only then call
clear_far_constrictions().
Eronarn points out that it would be better to use an enum for the type
of motion, rather than the (now two) boolean flags. I agree, but this
is a much bigger change so I have not done so yet.
It is still possible to get "comes along for the ride x2" if the
teleporter is contricting and constricted by the same actor.
Diffstat (limited to 'crawl-ref/source/teleport.cc')
-rw-r--r-- | crawl-ref/source/teleport.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crawl-ref/source/teleport.cc b/crawl-ref/source/teleport.cc index 83b289efa1..12da6f094f 100644 --- a/crawl-ref/source/teleport.cc +++ b/crawl-ref/source/teleport.cc @@ -66,7 +66,7 @@ bool monster::blink_to(const coord_def& dest, bool quiet) seen_context = SC_TELEPORT_IN; const coord_def oldplace = pos(); - if (!move_to_pos(dest)) + if (!move_to_pos(dest, true, false)) return (false); // handle constriction, if any @@ -83,6 +83,9 @@ bool monster::blink_to(const coord_def& dest, bool quiet) else if (constricting[i] != NON_ENTITY) monster_teleport_to_player(constricting[i], dest); + // Now break our nonadjacent constrictions. + clear_far_constrictions(); + // Leave a purple cloud. if (!jump) place_cloud(CLOUD_TLOC_ENERGY, oldplace, 1 + random2(3), this); |