summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/view.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-13 12:49:42 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-13 13:06:25 +0100
commit79a08c38a64269fa3bcd0f175b8add71538d24a7 (patch)
tree64b0da608e59bc7e9288b7f0487f726447969753 /crawl-ref/source/view.cc
parent3da2a539cae5cd1838f45b598355ab58d039fa6b (diff)
downloadcrawl-ref-79a08c38a64269fa3bcd0f175b8add71538d24a7.tar.gz
crawl-ref-79a08c38a64269fa3bcd0f175b8add71538d24a7.zip
Leave viewwindow early when not drawing.
viewwindow has code to not draw if the player is travelling (depending on travel_delay etc). This check is now moved before the code that updates buffy for non-tiles builds. I'm not sure whether the tiles drawing code doesn't have important side-effects -- if not, the tiles check could be moved before the main loop as well.
Diffstat (limited to 'crawl-ref/source/view.cc')
-rw-r--r--crawl-ref/source/view.cc39
1 files changed, 21 insertions, 18 deletions
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index d2e10b1d05..0e6b1cf85b 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -909,6 +909,13 @@ void viewwindow(bool do_updates)
tiles.clear_overlays();
#endif
+ bool run_dont_draw = you.running && Options.travel_delay < 0
+ && (!you.running.is_explore() || Options.explore_delay < 0);
+#ifndef USE_TILE
+ if (run_dont_draw || you.asleep())
+ return;
+#endif
+
cursor_control cs(false);
int flash_colour = you.flash_colour;
@@ -961,28 +968,24 @@ void viewwindow(bool do_updates)
// and this simply works without requiring a stack.
you.flash_colour = BLACK;
- // TODO: move this before the loop
- if ((!you.running || Options.travel_delay > -1
- || you.running.is_explore() && Options.explore_delay > -1)
- && !you.asleep())
- {
+#ifdef USE_TILE
+ if (run_dont_draw || you.asleep() || is_resting())
+ return;
+#endif
+
#ifndef USE_TILE
- you.last_view_update = you.num_turns;
- puttext(crawl_view.viewp.x, crawl_view.viewp.y,
- crawl_view.viewp.x + crawl_view.viewsz.x - 1,
- crawl_view.viewp.y + crawl_view.viewsz.y - 1,
- buffy);
+ you.last_view_update = you.num_turns;
+ puttext(crawl_view.viewp.x, crawl_view.viewp.y,
+ crawl_view.viewp.x + crawl_view.viewsz.x - 1,
+ crawl_view.viewp.y + crawl_view.viewsz.y - 1,
+ buffy);
- update_monster_pane();
+ update_monster_pane();
#else
- if (!is_resting())
- {
- tiles.set_need_redraw();
- tiles.load_dungeon(&buffy[0], crawl_view.vgrdc);
- tiles.update_inventory();
- }
+ tiles.set_need_redraw();
+ tiles.load_dungeon(&buffy[0], crawl_view.vgrdc);
+ tiles.update_inventory();
#endif
- }
_debug_pane_bounds();
}