diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-08-13 15:54:31 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-08-13 15:54:31 +0000 |
commit | 9b663069fe25975eadd0c85ea7a3af08dea32937 (patch) | |
tree | 027ce75a02900323bdda3f2d10673d1db387533d /crawl-ref/source | |
parent | a9ce7ae8b24aa41d98b331f10fa68dbfad90fd46 (diff) | |
download | crawl-ref-9b663069fe25975eadd0c85ea7a3af08dea32937.tar.gz crawl-ref-9b663069fe25975eadd0c85ea7a3af08dea32937.zip |
Allow inscription when viewing items.
This also works in shops which I think is okay.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1994 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/describe.cc | 20 | ||||
-rw-r--r-- | crawl-ref/source/describe.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/stash.cc | 7 |
3 files changed, 21 insertions, 8 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 25ef73103e..8d081759a9 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -34,6 +34,7 @@ #include "externs.h" #include "abl-show.h" +#include "cio.h" #include "debug.h" #include "decks.h" #include "fight.h" @@ -3360,7 +3361,7 @@ static bool describe_spells(const item_def &item) // Describes all items in the game. // //--------------------------------------------------------------- -void describe_item( const item_def &item ) +void describe_item( item_def &item ) { for (;;) { @@ -3371,14 +3372,25 @@ void describe_item( const item_def &item ) textcolor(LIGHTGREY); cprintf("Select a spell to read its description."); if (!describe_spells(item)) - return; + break; continue; } break; } - if (getch() == 0) - getch(); + gotoxy(1, wherey() + 2); + formatted_string::parse_string("<cyan>Do you wish to inscribe this item? ").display(); + + if (toupper(getch()) == 'Y') + { + char buf[79]; + cprintf("\nInscribe with what? "); + if (!cancelable_get_line(buf, sizeof buf)) + { + item.inscription = std::string(buf); + } + } + } diff --git a/crawl-ref/source/describe.h b/crawl-ref/source/describe.h index efef39a872..d2dcf9edb3 100644 --- a/crawl-ref/source/describe.h +++ b/crawl-ref/source/describe.h @@ -43,7 +43,7 @@ void describe_feature_wide(int x, int y); /* *********************************************************************** * called from: item_use - shopping * *********************************************************************** */ -void describe_item( const item_def &item ); +void describe_item( item_def &item ); /* *********************************************************************** * called from: direct diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc index c5146a6d6e..a6aa55ecb9 100644 --- a/crawl-ref/source/stash.cc +++ b/crawl-ref/source/stash.cc @@ -460,8 +460,8 @@ bool Stash::show_menu(const std::string &prefix, bool can_travel) const if (sel.size() != 1) break; - const item_def *item = - static_cast<const item_def *>( sel[0]->data ); + item_def *item = + static_cast<item_def *>( sel[0]->data ); describe_item(*item); } return false; @@ -745,7 +745,8 @@ void ShopInfo::describe_shop_item(const shop_item &si) const if (shoptype_identifies_stock(static_cast<shop_type>(this->shoptype))) const_cast<shop_item&>(si).item.flags |= ISFLAG_IDENT_MASK; - describe_item( si.item ); + item_def it = static_cast<item_def>(si.item); + describe_item( it ); if ( oldflags != si.item.flags ) const_cast<shop_item&>(si).item.flags = oldflags; |