summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/stash.cc2
-rw-r--r--crawl-ref/source/travel.cc13
-rw-r--r--crawl-ref/source/travel.h1
3 files changed, 13 insertions, 3 deletions
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc
index 8068af9c6f..0889f3006b 100644
--- a/crawl-ref/source/stash.cc
+++ b/crawl-ref/source/stash.cc
@@ -53,7 +53,7 @@ std::string userdef_annotate_item(const char *s, const item_def *item,
if (exclusive)
lua_set_exclusive_item(item);
std::string ann;
- if (!clua.callfn(s, "u>s", item, &ann))
+ if (!clua.callfn(s, "u>s", item, &ann) && !clua.error.empty())
mprf(MSGCH_WARN, "Lua error: %s", clua.error.c_str());
if (exclusive)
lua_set_exclusive_item(NULL);
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 8c1c8e9324..130d74451c 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -2018,7 +2018,8 @@ static level_id find_deepest_explored(level_id curr)
for (int i = branches[curr.branch].depth; i > 0; --i)
{
const level_id lid(curr.branch, i);
- if (travel_cache.find_level_info(lid))
+ const LevelInfo *linf = travel_cache.find_level_info(lid);
+ if (linf && !linf->empty())
return (lid);
}
return (curr);
@@ -2175,8 +2176,11 @@ travel_target prompt_translevel_target(int prompt_flags)
// User's chosen a branch, so now we ask for a level.
target = prompt_travel_depth(target.p.id);
- if (target.p.id.depth < 1 || target.p.id.depth >= MAX_LEVELS)
+ if (target.p.id.depth < 1 ||
+ target.p.id.depth > branches[target.p.id.branch].depth)
+ {
target.p.id.depth = -1;
+ }
if (target.p.id.depth > -1 && remember_targ)
trans_travel_dest = get_trans_travel_dest(target);
@@ -2791,6 +2795,11 @@ void LevelInfo::set_level_excludes()
curr_excludes = excludes;
}
+bool LevelInfo::empty() const
+{
+ return (stairs.empty() && excludes.empty());
+}
+
void LevelInfo::update()
{
// First, set excludes, so that stair distances will be correctly populated.
diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h
index 4aeac12c68..a2e5bc328a 100644
--- a/crawl-ref/source/travel.h
+++ b/crawl-ref/source/travel.h
@@ -399,6 +399,7 @@ struct LevelInfo
stair_info *get_stair(int x, int y);
stair_info *get_stair(const coord_def &pos);
+ bool empty() const;
bool know_stair(const coord_def &pos) const;
int get_stair_index(const coord_def &pos) const;