diff options
author | gammafunk <gammafunk@gmail.com> | 2014-06-25 01:57:15 -0500 |
---|---|---|
committer | gammafunk <gammafunk@gmail.com> | 2014-06-25 20:50:43 -0500 |
commit | 495a01740e368372c789418819cef18d0ab3d6fb (patch) | |
tree | 3b286417ca82a7103bc3cc1d24bf08adb0ec1b59 /crawl-ref/source/dbg-maps.cc | |
parent | 0840c16e4d6386d93aa7e44eb99852f0903d0c61 (diff) | |
download | crawl-ref-495a01740e368372c789418819cef18d0ab3d6fb.tar.gz crawl-ref-495a01740e368372c789418819cef18d0ab3d6fb.zip |
Properly handle map build failures in objstat
Previously an additional check on a level that builder() had accepted
could cause both mapstat and objstat to abort. We now only abort
mapstat in this case, because these failures aren't very relevant to
objstat. We also fail in objstat if builder() fails, since such levels
might be very problematic for object statistics, but continue on with
mapstat in this case.
Diffstat (limited to 'crawl-ref/source/dbg-maps.cc')
-rw-r--r-- | crawl-ref/source/dbg-maps.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/crawl-ref/source/dbg-maps.cc b/crawl-ref/source/dbg-maps.cc index 2bf2b44456..c4cf56b745 100644 --- a/crawl-ref/source/dbg-maps.cc +++ b/crawl-ref/source/dbg-maps.cc @@ -18,6 +18,7 @@ #include "message.h" #include "ng-init.h" #include "player.h" +#include "state.h" #include "view.h" #ifdef DEBUG_DIAGNOSTICS @@ -87,6 +88,14 @@ static bool _do_build_level() if (!builder()) { ++levels_failed; + // A level build failure can't be backed out of easily for + // objstat. + if (crawl_state.obj_stat_gen) + { + fprintf(stderr, "Level build failed on %s, aborting.", + level_id::current().describe().c_str()); + return false; + } return true; } @@ -111,7 +120,9 @@ static bool _do_build_level() magic_mapping(1000, 100, true, true, false, coord_def(GXM/2, GYM/2)); } - if (_is_disconnected_level()) + // This kind of error didn't cause builder() to reject the level, so it + // should be fine for objstat purposes. + if (_is_disconnected_level() && !crawl_state.obj_stat_gen) { string vaults; for (int j = 0, size = env.level_vaults.size(); j < size; ++j) |