|
From: <gi...@cr...> - 2013-07-28 16:45:19
|
via f61e71f529e8ec9710ddd2fe4b89d64ca5481858 (commit)
from cc0fb03b9eee93cd3fbfb7b9ea40c8b1bfa7a872 (commit)
-----------------------------------------------------------------------
commit f61e71f529e8ec9710ddd2fe4b89d64ca5481858
Author: Neil Moore <ne...@s-...>
Date: Sun Jul 28 12:16:33 2013 -0400
Don't crash when returning to an level with scrying active (#7387)
The player position is (0,0) in this case, while vlos still uses the
location from the last level. This caused tile_draw_map_cell (called
from level load) to refer to locations far outside the show area.
Rather than forcing you.pos() and vlos to be in sync at this point
during level load (which could e.g. reveal the upper left corner of the
map), we take the easy way out and prevent a player at (0,0) from seeing
anything (outside arena of course).
-----------------------------------------------------------------------
Summary of changes:
crawl-ref/source/actor-los.cc | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/crawl-ref/source/actor-los.cc b/crawl-ref/source/actor-los.cc
index d8dfe30..d00b34d 100644
--- a/crawl-ref/source/actor-los.cc
+++ b/crawl-ref/source/actor-los.cc
@@ -24,9 +24,11 @@ bool actor::see_cell(const coord_def &p) const
bool player::see_cell(const coord_def &p) const
{
if (!map_bounds(p))
- return false;
+ return false; // Players can't see (-1,-1) but maybe can see (0,0).
if (crawl_state.game_is_arena() && is_player())
return true;
+ if (!in_bounds(pos()))
+ return false; // A non-arena player at (0,0) can't see anything.
if (xray_vision)
return ((pos() - p).abs() <= dist_range(current_vision));
return actor::see_cell(p);
--
Dungeon Crawl Stone Soup
|