From 76a5cc5049290770249b6661a2f4558b7fbb645e Mon Sep 17 00:00:00 2001 From: ennewalker Date: Thu, 12 Feb 2009 05:05:43 +0000 Subject: Mousing over monsters, items, and features will now show their description in the message window. This inadvertantly fixes [2469950], where some lines would appear off screen. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9030 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/directn.cc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'crawl-ref/source/directn.cc') diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 3bfc704e25..4ba3d94528 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -1658,8 +1658,38 @@ void terse_describe_square(const coord_def &c, bool in_range) _describe_cell(c, in_range); } +void get_square_desc(const coord_def &c, describe_info &inf) +{ + // NOTE: Keep this function in sync with full_describe_square. + + // Don't give out information for things outside LOS + if (!see_grid(c.x, c.y)) + return; + + const int mid = mgrd(c); + const int oid = igrd(c); + + if (mid != NON_MONSTER && player_monster_visible(&menv[mid])) + { + // First priority: monsters. + get_monster_desc(menv[mid], inf); + } + else if (oid != NON_ITEM) + { + // Second priority: objects. + get_item_desc(mitm[oid], inf); + } + else + { + // Third priority: features. + get_feature_desc(c, inf); + } +} + void full_describe_square(const coord_def &c) { + // NOTE: Keep this function in sync with get_square_desc. + // Don't give out information for things outside LOS if (!see_grid(c.x, c.y)) return; -- cgit v1.2.3-54-g00ecf