diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-09-22 22:53:21 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-09-22 22:53:21 +0000 |
commit | 5fd3618ccad71d9063f4c57621214ad783731525 (patch) | |
tree | b5c85ed981be8dafc1f57f89ff0b67ecae8624e6 | |
parent | 6ada0ad30b4a6a9374e7255cea9725f16a68ab3f (diff) | |
download | crawl-ref-5fd3618ccad71d9063f4c57621214ad783731525.tar.gz crawl-ref-5fd3618ccad71d9063f4c57621214ad783731525.zip |
Made ';' do a better job.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup@82 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/acr.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/invent.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/invent.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/items.cc | 49 | ||||
-rw-r--r-- | crawl-ref/source/items.h | 2 |
5 files changed, 45 insertions, 16 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index f6f1a2c4a2..2f1a0c4652 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1177,7 +1177,8 @@ static void do_action( command_type cmd ) { pickup(); break; - case CMD_INSPECT_FLOOR: item_check(';'); + case CMD_INSPECT_FLOOR: + show_items(); break; case CMD_WIELD_WEAPON: diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index dae6894d2a..92d333e4d5 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -341,7 +341,7 @@ void populate_item_menu( Menu *menu, const std::vector<item_def> &items, } std::vector<SelItem> select_items( std::vector<item_def*> &items, - const char *title ) + const char *title, bool noselect ) { std::vector<SelItem> selected; @@ -390,7 +390,8 @@ std::vector<SelItem> select_items( std::vector<item_def*> &items, ckey + 1; } } - menu.set_flags( MF_MULTISELECT | MF_SELECT_ANY_PAGE ); + menu.set_flags( noselect ? MF_NOSELECT : + (MF_MULTISELECT | MF_SELECT_ANY_PAGE) ); std::vector< MenuEntry * > sel = menu.show(); for (int i = 0, count = sel.size(); i < count; ++i) { diff --git a/crawl-ref/source/invent.h b/crawl-ref/source/invent.h index 0bde6b0bed..40c1e4874a 100644 --- a/crawl-ref/source/invent.h +++ b/crawl-ref/source/invent.h @@ -43,7 +43,7 @@ int prompt_invent_item( const char *prompt, int type_expect, operation_types oper = OPER_ANY ); std::vector<SelItem> select_items( std::vector<item_def*> &items, - const char *title ); + const char *title, bool noselect = false ); std::vector<SelItem> prompt_invent_items( const char *prompt, diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 13cc34ac2e..4d2b08a548 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -521,18 +521,7 @@ void destroy_item_stack( int x, int y ) } } - -/* - * Takes keyin as an argument because it will only display a long list of items - * if ; is pressed. - */ -void item_check(char keyin) -{ - char item_show[50][50]; - char temp_quant[10]; - - int counter = 0; - int counter_max = 0; +static void describe_floor() { const int grid = grd[you.x_pos][you.y_pos]; @@ -714,6 +703,23 @@ void item_check(char keyin) } } } +} + +/* + * Takes keyin as an argument because it will only display a long list of items + * if ; is pressed. + * Not anymore - but leaving in the old code for a bit, will clean up + * later -- haranp + */ +void item_check(char keyin) +{ + char item_show[50][50]; + char temp_quant[10]; + + int counter = 0; + int counter_max = 0; + + describe_floor(); if (igrd[you.x_pos][you.y_pos] == NON_ITEM && keyin == ';') { @@ -790,6 +796,25 @@ void item_check(char keyin) mpr("There are several objects here."); } +void show_items() +{ + const int o = igrd[you.x_pos][you.y_pos]; + + if (o == NON_ITEM) { + mpr("There are no items here."); + } + else { + std::vector<item_def*> items; + + for (int i = o; i != NON_ITEM; i = mitm[i].link) + items.push_back( &mitm[i] ); + + select_items( items, "Things that are here:", true ); + redraw_screen(); + } + + describe_floor(); +} void pickup_menu(int item_link) { diff --git a/crawl-ref/source/items.h b/crawl-ref/source/items.h index c4bca72527..17ca05a214 100644 --- a/crawl-ref/source/items.h +++ b/crawl-ref/source/items.h @@ -121,6 +121,8 @@ void handle_time( long time_delta ); * *********************************************************************** */ int inv_count(void); +void show_items(); + void cmd_destroy_item( void ); bool pickup_single_item(int link, int qty); |