diff options
-rw-r--r-- | crawl-ref/source/tilereg.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/tilesdl.cc | 9 |
2 files changed, 11 insertions, 5 deletions
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc index 4d9ff8645e..0fff45c4d7 100644 --- a/crawl-ref/source/tilereg.cc +++ b/crawl-ref/source/tilereg.cc @@ -1164,14 +1164,13 @@ bool DungeonRegion::update_tip_text(std::string& tip) if (!grid_is_solid(m_cursor[CURSOR_MOUSE])) { int mon_num = mgrd(m_cursor[CURSOR_MOUSE]); - const monsters *mons = &menv[mon_num]; - if (mon_num == NON_MONSTER || mons_friendly(mons)) + if (mon_num == NON_MONSTER || mons_friendly(&menv[mon_num])) { tip = "[L-Click] Move\n"; } else if (mon_num != NON_MONSTER) { - tip = mons->name(DESC_CAP_A); + tip = menv[mon_num].name(DESC_CAP_A); tip += "\n[L-Click] Attack\n"; } } @@ -1454,7 +1453,7 @@ unsigned int InventoryRegion::cursor_index() const void InventoryRegion::place_cursor(const coord_def &cursor) { - if (m_cursor != NO_CURSOR) + if (m_cursor != NO_CURSOR && cursor_index() < m_items.size()) { m_items[cursor_index()].flag &= ~TILEI_FLAG_CURSOR; m_need_to_pack = true; diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc index fda5f26320..df3f7b7d34 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -502,6 +502,9 @@ int TilesFramework::getch_ck() SDL_Event event; int key = 0; + + const unsigned int ticks_per_redraw = 16; // 60 FPS = 16.6 ms/frame + unsigned int last_redraw_tick = 0; while (!key) { @@ -603,7 +606,11 @@ int TilesFramework::getch_ck() m_tooltip.clear(); } - redraw(); + if (ticks - last_redraw_tick > ticks_per_redraw) + { + redraw(); + last_redraw_tick = ticks; + } } return key; |