Attached Files:
|
8261_patch_3.patch [^] (4,665 bytes) 2014-04-04 16:19 [Show Content] [Hide Content]From ef9ad00b553b43d089c1b800fa5a1fbb48662316 Mon Sep 17 00:00:00 2001
From: blackcustard <peterwicksstringfield@gmail.com>
Date: Sun, 16 Mar 2014 13:14:17 -0500
Subject: [PATCH 1/2] Clarify _corrupt_square.
_corrupt_square is not called on stairs/branch entries/portals, so
preserve_feat has nothing to do with them. The code has not changed, the
comment was just wrong. Also rename preserve_feat to preserve_features to match
the argument in dungeon_terrain_changed.
---
crawl-ref/source/abyss.cc | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index 5fc5e75..984ab1e 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -1780,13 +1780,20 @@ static bool _is_sealed_square(const coord_def &c)
static void _corrupt_square(const corrupt_env &cenv, const coord_def &c)
{
- // To prevent the destruction of, say, branch entries.
- bool preserve_feat = true;
+ // Ask dungeon_change_terrain to preserve things that are not altars.
+ // This only actually matters for malign gateways and features that happen
+ // to be on squares that happen to contain map markers (e.g. sealed doors,
+ // which come with their own markers). MAT_CORRUPTION_NEXUS is a marker,
+ // and some of those are certainly nearby, but they only appear on
+ // DNGN_FLOOR. preserve_features=true would ordinarily cause
+ // dungeon_terrain_changed to protect stairs/branch entries/portals as
+ // well, but _corrupt_square is not called on squares containing those
+ // features.
+ bool preserve_features = true;
dungeon_feature_type feat = DNGN_UNSEEN;
if (feat_altar_god(grd(c)) != GOD_NO_GOD)
{
- // altars may be safely overwritten, ha!
- preserve_feat = false;
+ preserve_features = false;
if (!one_chance_in(3))
feat = DNGN_ALTAR_LUGONU;
}
@@ -1833,7 +1840,7 @@ static void _corrupt_square(const corrupt_env &cenv, const coord_def &c)
feat = DNGN_FLOOR;
}
- dungeon_terrain_changed(c, feat, true, preserve_feat, true);
+ dungeon_terrain_changed(c, feat, true, preserve_features, true);
if (feat == DNGN_ROCK_WALL)
env.grid_colours(c) = cenv.rock_colour;
else if (feat == DNGN_FLOOR)
--
1.7.9.5
From 5276c67bc725b7ce79f370c7b33b07d67a424473 Mon Sep 17 00:00:00 2001
From: blackcustard <peterwicksstringfield@gmail.com>
Date: Sun, 16 Mar 2014 12:41:08 -0500
Subject: [PATCH 2/2] Fix a corruption / terrain change crash.
When corrupting a level, the contents of certain squares are
sometimes moved to a nearby square instead of being deleted. Sometimes,
dgn_shift_feature would decide to move things onto a square that contained an
actor. This was wrong.
This bug could manifest as a crash in at least one way: using corruption
near a sealed door could displace the contents of the sealed door's square
(including the door itself) on top of the player; because sealed doors are
accompanied by a temporary terrain change marker (MAT_TERRAIN_CHANGE). The
game would crash on the next turn when _move_player detected that the
player was inside a solid object (the door).
Also, in dgn_move_entities_at, assert that the destination square does not
contain an actor.
---
crawl-ref/source/terrain.cc | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc
index bf1f9fe..66f241e 100644
--- a/crawl-ref/source/terrain.cc
+++ b/crawl-ref/source/terrain.cc
@@ -766,12 +766,13 @@ bool feat_cannot_be_mimic(dungeon_feature_type feat)
static bool _is_feature_shift_target(const coord_def &pos, void*)
{
- return grd(pos) == DNGN_FLOOR && !dungeon_events.has_listeners_at(pos);
+ return grd(pos) == DNGN_FLOOR && !dungeon_events.has_listeners_at(pos)
+ && !actor_at(pos);
}
-// Moves everything at src to dst. This is not a swap operation: src
-// will be left with the same feature it started with, and should be
-// overwritten with something new.
+// Moves everything at src to dst. This is not a swap operation: src will be
+// left with the same feature it started with, and should be overwritten with
+// something new. Assumes there are no actors in the destination square.
//
// Things that are moved:
// 1. Dungeon terrain (set to DNGN_UNSEEN)
@@ -826,6 +827,9 @@ void dgn_move_entities_at(coord_def src, coord_def dst,
grd(dst) = dfeat;
+ if (move_monster || move_player)
+ ASSERT(!actor_at(dst));
+
if (move_monster)
{
if (monster* mon = monster_at(src))
--
1.7.9.5
|