summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/abyss.cc2
-rw-r--r--crawl-ref/source/dat/clua/lm_timed.lua4
-rw-r--r--crawl-ref/source/dat/clua/lm_tmsg.lua4
-rw-r--r--crawl-ref/source/dgnevent.cc2
-rw-r--r--crawl-ref/source/externs.h2
-rw-r--r--crawl-ref/source/mapmark.cc13
-rw-r--r--crawl-ref/source/mapmark.h4
-rw-r--r--crawl-ref/source/travel.cc38
8 files changed, 37 insertions, 32 deletions
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index 5d1302cfb7..6530860575 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -651,6 +651,8 @@ bool lugonu_corrupt_level(int power)
std::auto_ptr<crawl_environment> abyssal(new crawl_environment(env));
env = *backup;
backup.reset(NULL);
+ dungeon_events.clear();
+ env.markers.activate_all(false);
corrupt_level_features(*abyssal);
run_corruption_effects(100);
diff --git a/crawl-ref/source/dat/clua/lm_timed.lua b/crawl-ref/source/dat/clua/lm_timed.lua
index 769db38ac5..6ad010de75 100644
--- a/crawl-ref/source/dat/clua/lm_timed.lua
+++ b/crawl-ref/source/dat/clua/lm_timed.lua
@@ -42,8 +42,8 @@ function TimedMarker:new(pars)
return tmarker
end
-function TimedMarker:activate(marker)
- self.msg:init(self, marker)
+function TimedMarker:activate(marker, verbose)
+ self.msg:init(self, marker, verbose)
dgn.register_listener(dgn.dgn_event_type('turn'), marker)
dgn.register_listener(dgn.dgn_event_type('player_climb'),
diff --git a/crawl-ref/source/dat/clua/lm_tmsg.lua b/crawl-ref/source/dat/clua/lm_tmsg.lua
index 1448e7ade0..55d934281a 100644
--- a/crawl-ref/source/dat/clua/lm_tmsg.lua
+++ b/crawl-ref/source/dat/clua/lm_tmsg.lua
@@ -23,7 +23,7 @@ function TimedMessaging.new(pars)
return m
end
-function TimedMessaging:init(tmarker, cm)
+function TimedMessaging:init(tmarker, cm, verbose)
local lab = dgn.grid(cm:pos()) == dgn.feature_number('enter_labyrinth')
if not self.noisemaker then
self.noisemaker = lab and "an ancient clock" or "a massive bell"
@@ -47,7 +47,7 @@ function TimedMessaging:init(tmarker, cm)
self.check = 50
end
- if #self.initmsg > 0 and you.hear_pos(cm:pos()) then
+ if verbose and #self.initmsg > 0 and you.hear_pos(cm:pos()) then
crawl.mpr(self.initmsg, "sound")
end
end
diff --git a/crawl-ref/source/dgnevent.cc b/crawl-ref/source/dgnevent.cc
index b0c24c5fb1..96d87fecc4 100644
--- a/crawl-ref/source/dgnevent.cc
+++ b/crawl-ref/source/dgnevent.cc
@@ -66,7 +66,7 @@ void dgn_event_dispatcher::fire_event(const dgn_event &e)
if (i->eventmask & e.type)
i->listener->notify_dgn_event(e);
}
- }
+ }
}
void dgn_event_dispatcher::fire_event(dgn_event_type et)
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index e38f79546d..840d03f09c 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1253,7 +1253,7 @@ public:
map_markers &operator = (const map_markers &);
~map_markers();
- void activate_all();
+ void activate_all(bool verbose = true);
void add(map_marker *marker);
void remove(map_marker *marker);
void remove_markers_at(const coord_def &c, map_marker_type type = MAT_ANY);
diff --git a/crawl-ref/source/mapmark.cc b/crawl-ref/source/mapmark.cc
index ea8325f264..a761568772 100644
--- a/crawl-ref/source/mapmark.cc
+++ b/crawl-ref/source/mapmark.cc
@@ -43,7 +43,7 @@ map_marker::~map_marker()
{
}
-void map_marker::activate()
+void map_marker::activate(bool)
{
}
@@ -184,6 +184,7 @@ map_lua_marker::~map_lua_marker()
map_marker *map_lua_marker::clone() const
{
map_lua_marker *copy = new map_lua_marker();
+ copy->pos = pos;
if (get_table())
copy->check_register_table();
return copy;
@@ -309,10 +310,12 @@ bool map_lua_marker::callfn(const char *fn, bool warn_err, int args) const
return (res);
}
-void map_lua_marker::activate()
+void map_lua_marker::activate(bool verbose)
{
lua_stack_cleaner clean(dlua);
- callfn("activate", true);
+ push_fn_args("activate");
+ lua_pushboolean(dlua, verbose);
+ callfn("activate", true, 4);
}
void map_lua_marker::notify_dgn_event(const dgn_event &e)
@@ -456,12 +459,12 @@ void map_markers::init_from(const map_markers &c)
}
}
-void map_markers::activate_all()
+void map_markers::activate_all(bool verbose)
{
for (dgn_marker_map::iterator i = markers.begin();
i != markers.end(); ++i)
{
- i->second->activate();
+ i->second->activate(verbose);
}
}
diff --git a/crawl-ref/source/mapmark.h b/crawl-ref/source/mapmark.h
index af4c40e536..79099c5842 100644
--- a/crawl-ref/source/mapmark.h
+++ b/crawl-ref/source/mapmark.h
@@ -18,7 +18,7 @@ public:
map_marker_type get_type() const { return type; }
virtual map_marker *clone() const = 0;
- virtual void activate();
+ virtual void activate(bool verbose = true);
virtual void write(tagHeader &) const;
virtual void read(tagHeader &);
virtual std::string debug_describe() const = 0;
@@ -86,7 +86,7 @@ public:
map_lua_marker(const std::string &s, const std::string &ctx);
~map_lua_marker();
- void activate();
+ void activate(bool verbose);
void write(tagHeader &) const;
void read(tagHeader &);
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 9f6525ebbb..2e0dc0ac2a 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -18,6 +18,7 @@
#include "clua.h"
#include "delay.h"
#include "describe.h"
+#include "dgnevent.h"
#include "direct.h"
#include "itemname.h"
#include "items.h"
@@ -2488,32 +2489,31 @@ static int find_transtravel_stair( const level_id &cur,
static bool loadlev_populate_stair_distances(const level_pos &target)
{
- // Copy the current crawl_environment. Note that this is a shallow
- // copy so tmp holds references to map markers.
std::auto_ptr<crawl_environment> tmp(new crawl_environment(env));
- // Clear markers. The tmp env still points at the markers, so we
- // don't leak. XXX: Make crawl_environment fully assignable.
- env.markers.clear();
-
- if (!travel_load_map(target.id.branch,
- absdungeon_depth(target.id.branch, target.id.depth)))
+ bool loaded = false;
+ if (travel_load_map(target.id.branch,
+ absdungeon_depth(target.id.branch, target.id.depth)))
{
- env = *tmp;
- return false;
- }
+ std::vector<travel_exclude> old_excludes = curr_excludes;
- std::vector<travel_exclude> old_excludes = curr_excludes;
+ curr_excludes.clear();
+ LevelInfo &li = travel_cache.get_level_info(target.id);
+ li.set_level_excludes();
- curr_excludes.clear();
- LevelInfo &li = travel_cache.get_level_info(target.id);
- li.set_level_excludes();
-
- populate_stair_distances(target);
+ populate_stair_distances(target);
+
+ curr_excludes = old_excludes;
+ loaded = !curr_stairs.empty();
+ }
env = *tmp;
- curr_excludes = old_excludes;
- return !curr_stairs.empty();
+ // Clear references to freed markers.
+ dungeon_events.clear();
+ // Reactivate cloned markers.
+ env.markers.activate_all(false);
+
+ return (loaded);
}
static void populate_stair_distances(const level_pos &target)