summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/directn.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-08-09 12:27:44 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-08-09 12:27:44 +0000
commite2d1b5dfa2a106a40db5ab6a23e6eb19e3aae8ca (patch)
tree1d43038d0854d8178360c12ffe2f1684fb3ffcde /crawl-ref/source/directn.cc
parentcf8808bec66f666af120b9c4fad666a558d0e989 (diff)
downloadcrawl-ref-e2d1b5dfa2a106a40db5ab6a23e6eb19e3aae8ca.tar.gz
crawl-ref-e2d1b5dfa2a106a40db5ab6a23e6eb19e3aae8ca.zip
Rework xx and V to use monster_pane_info() to benefit from the
difficulty comparison and sorting functions. Make V work as a shortcut for xx, but keep the original monster listing (now repaired) for the dump. Most of the monster_pane_function struct and functions are now also included in Tiles compiles, even though the monster list itself is still not available. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6800 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/directn.cc')
-rw-r--r--crawl-ref/source/directn.cc31
1 files changed, 14 insertions, 17 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 095f917f1d..8a7cdd856d 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -448,34 +448,27 @@ static void _direction_again(dist& moves, targeting_type restricts,
static void _describe_monster(const monsters *mon);
// Lists all the monsters and items currently in view by the player.
-// Internals:
-// Menu items have meaningful tags. 'i' means item and 'm' means monster.
-//
-void _full_describe_view()
+// TODO: Allow sorting of items lists.
+void full_describe_view()
{
const coord_def start = view2grid(coord_def(1,1));
const coord_def end(start.x + crawl_view.viewsz.x,
start.y + crawl_view.viewsz.y);
- std::vector<monsters*> list_mons;
+ std::vector<const monsters*> list_mons;
std::vector<const item_def*> list_items;
coord_def p;
- // Iterate over viewport and get all the items and monsters in view.
- // TODO: Allow sorting of monster and items lists.
+ // Iterate over viewport and get all the itemsin view.
for (p.x = start.x; p.x < end.x; p.x++)
for (p.y = start.y; p.y < end.y; p.y++)
{
if (!in_bounds(p.x,p.y) || !see_grid(p.x,p.y))
continue;
- const int mid = mgrd(p);
const int oid = igrd(p);
- if (mid != NON_MONSTER && player_monster_visible(&menv[mid]))
- list_mons.push_back(&menv[mid]);
-
if (oid != NON_ITEM)
{
std::vector<const item_def*> items;
@@ -484,6 +477,14 @@ void _full_describe_view()
}
}
+ // Get monsters via the monster_pane_info, sorted by difficulty.
+ std::vector<monster_pane_info> mons;
+ get_monster_pane_info(mons);
+ std::sort(mons.begin(), mons.end(), monster_pane_info::less_than_wrapper);
+
+ for (unsigned int i = 0; i < mons.size(); i++)
+ list_mons.push_back(mons[i].m_mon);
+
if (!list_mons.size() && !list_items.size())
{
mprf("Neither monsters nor items are visible.");
@@ -508,7 +509,7 @@ void _full_describe_view()
for (unsigned int i = 0; i < list_mons.size(); ++i)
{
// List monsters in the form
- // (g) A goblin (hostile) wielding an orcish dagger
+ // (A) An angel (neutral), wielding a glowing long sword
++menu_index;
const char letter = index_to_letter(menu_index);
@@ -1316,9 +1317,7 @@ void direction(dist& moves, targeting_type restricts,
break;
case CMD_TARGET_ALL_DESCRIBE:
- _full_describe_view();
- //TODO: Check if this is neccesary
- //force_redraw = true;
+ full_describe_view();
break;
case CMD_TARGET_HELP:
@@ -2796,8 +2795,6 @@ std::string get_monster_desc(const monsters *mon, bool full_desc,
desc += " (friendly)";
else if (mons_neutral(mon))
desc += " (neutral)";
- else
- desc += " (hostile)";
}
}