summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-02 04:36:18 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-02 04:36:18 +0000
commitfa6393b63b270a07e02ce4c8333b23013b5ded75 (patch)
tree043489a6bc83f6fa827ccb34bd574a4aa18ba7ee /crawl-ref
parent20c98d67894a6fe8c8fac01e841108b5878160db (diff)
downloadcrawl-ref-fa6393b63b270a07e02ce4c8333b23013b5ded75.tar.gz
crawl-ref-fa6393b63b270a07e02ce4c8333b23013b5ded75.zip
Fix broken sewer messaging (dpeg).
Fixed bad bounds checks for minivaults placed by dgn_place_map. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7716 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/dat/clua/lm_tmsg.lua5
-rw-r--r--crawl-ref/source/dungeon.cc2
-rw-r--r--crawl-ref/source/maps.cc29
-rw-r--r--crawl-ref/source/maps.h3
4 files changed, 24 insertions, 15 deletions
diff --git a/crawl-ref/source/dat/clua/lm_tmsg.lua b/crawl-ref/source/dat/clua/lm_tmsg.lua
index 42e0246cfa..7ffecddc21 100644
--- a/crawl-ref/source/dat/clua/lm_tmsg.lua
+++ b/crawl-ref/source/dat/clua/lm_tmsg.lua
@@ -34,7 +34,7 @@ function TimedMessaging:channel()
end
function TimedMessaging:init(tmarker, cm, verbose)
- self.entity = tmarker.props.entity or tmarker.props.desc
+ self.entity = self.entity or tmarker.props.entity or tmarker.props.desc
if not self.ranges and not self.visible and not self.messages then
self.ranges = {
@@ -141,7 +141,8 @@ function TimedMessaging:say_message(cm, dur)
return
end
- local noisemaker = self:range_adjective(cm, self.noisemaker)
+ local noisemaker =
+ self.noisemaker and self:range_adjective(cm, self.noisemaker)
self:proc_ranges(self.ranges, dur,
function (chk)
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 56c37fc72e..27bd66304e 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -3711,7 +3711,7 @@ static bool _build_minivaults(int level_number, const map_def *vault,
if (in_bounds(where))
{
coord_def tl(where - place.size / 2);
- fit_region_into_map_bounds(tl, place.size);
+ fit_region_into_map_bounds(tl, place.size, 1);
v1 = tl;
}
else if (!_find_minivault_place(place, v1, clobber))
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc
index adc4df3f09..1e35bed17e 100644
--- a/crawl-ref/source/maps.cc
+++ b/crawl-ref/source/maps.cc
@@ -195,17 +195,24 @@ static bool bad_map_place(const map_def &map, const coord_def &c,
return (false);
}
-void fit_region_into_map_bounds(coord_def &pos, const coord_def &size)
-{
- ASSERT(size.x <= GXM && size.y <= GYM);
- if (pos.x < X_BOUND_1)
- pos.x = X_BOUND_1;
- if (pos.y < Y_BOUND_1)
- pos.y = Y_BOUND_1;
- if (pos.x + size.x - 1 > X_BOUND_2)
- pos.x = X_BOUND_2 - size.x + 1;
- if (pos.y + size.y - 1 > Y_BOUND_2)
- pos.y = Y_BOUND_2 - size.y + 1;
+void fit_region_into_map_bounds(coord_def &pos, const coord_def &size,
+ int margin)
+{
+ const int X_1(X_BOUND_1 + margin);
+ const int X_2(X_BOUND_2 - margin);
+ const int Y_1(Y_BOUND_1 + margin);
+ const int Y_2(Y_BOUND_2 - margin);
+
+ ASSERT(size.x <= (X_2 - X_1 + 1) && size.y <= (Y_2 - Y_1 + 1));
+
+ if (pos.x < X_1)
+ pos.x = X_1;
+ if (pos.y < Y_1)
+ pos.y = Y_1;
+ if (pos.x + size.x - 1 > X_2)
+ pos.x = X_2 - size.x + 1;
+ if (pos.y + size.y - 1 > Y_2)
+ pos.y = Y_2 - size.y + 1;
}
static bool apply_vault_grid(map_def &def,
diff --git a/crawl-ref/source/maps.h b/crawl-ref/source/maps.h
index ba1e9257f2..0bba9445c9 100644
--- a/crawl-ref/source/maps.h
+++ b/crawl-ref/source/maps.h
@@ -23,7 +23,8 @@ int vault_main(vault_placement &vp,
// Given a rectangular region, slides it to fit into the map. size must be
// smaller than (GXM,GYM).
-void fit_region_into_map_bounds(coord_def &pos, const coord_def &size);
+void fit_region_into_map_bounds(coord_def &pos, const coord_def &size,
+ int margin = 0);
const map_def *map_by_index(int index);
int map_count();