summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-30 12:57:58 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-30 12:57:58 +0000
commita3f51c4dbac537dfddbd90d4a8129fd82db8c9c5 (patch)
tree4392b3949623d69af5617c05e134ad56c30a6317 /crawl-ref
parent262b8e18ed8cb58afb40a816ac0fdedfe3a7db5f (diff)
downloadcrawl-ref-a3f51c4dbac537dfddbd90d4a8129fd82db8c9c5.tar.gz
crawl-ref-a3f51c4dbac537dfddbd90d4a8129fd82db8c9c5.zip
Fix 2029792: drop menu lets you choose more than the amount of the item.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6734 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/invent.cc7
-rw-r--r--crawl-ref/source/invent.h1
-rw-r--r--crawl-ref/source/items.cc2
3 files changed, 9 insertions, 1 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 513a09685e..90adbfb0ef 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -173,6 +173,13 @@ const int InvEntry::item_freshness() const
return freshness;
}
+void InvEntry::select(int qty)
+{
+ if ( item && item->quantity < qty )
+ qty = item->quantity;
+ MenuEntry::select(qty);
+}
+
std::string InvEntry::get_text() const
{
std::ostringstream tstr;
diff --git a/crawl-ref/source/invent.h b/crawl-ref/source/invent.h
index 4f6bffc642..357092b879 100644
--- a/crawl-ref/source/invent.h
+++ b/crawl-ref/source/invent.h
@@ -100,6 +100,7 @@ public:
tag );
}
+ virtual void select( int qty = -1 );
private:
void add_class_hotkeys(const item_def &i);
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 7f735bb83a..c4a3c61682 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -2019,7 +2019,7 @@ static bool _drop_item_order(const SelItem &first, const SelItem &second)
// Prompts the user for an item to drop
//
//---------------------------------------------------------------
-void drop(void)
+void drop()
{
if (inv_count() < 1 && you.gold == 0)
{