summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-10-29 01:06:07 -0700
committerMatthew Cline <zelgadis@sourceforge.net>2009-10-29 01:06:07 -0700
commit66d9bbd8356dca3d0b07145d1eea21de2d4789cc (patch)
treedbc78a23e474a38b0927e749442698c6d4b96d55 /crawl-ref/source/player.cc
parentaefbb02ff564f3b513476f82d144c7c92b2bbb05 (diff)
downloadcrawl-ref-66d9bbd8356dca3d0b07145d1eea21de2d4789cc.tar.gz
crawl-ref-66d9bbd8356dca3d0b07145d1eea21de2d4789cc.zip
FR 2839627: notify when player has enough gold
The basics of a wish-list/shopping-list. While in a shop the shopping-list can be modified, and the player is notified as soon as they have enough money to buy things on the shopping-list.
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 007a679cfc..b71d610898 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -48,6 +48,7 @@
#include "output.h"
#include "quiver.h"
#include "religion.h"
+#include "shopping.h"
#include "skills.h"
#include "skills2.h"
#include "species.h"
@@ -7587,3 +7588,24 @@ void player::reset_escaped_death()
escaped_death_cause = NUM_KILLBY;
escaped_death_aux = "";
}
+
+void player::add_gold(int delta)
+{
+ set_gold(gold + delta);
+}
+
+void player::del_gold(int delta)
+{
+ add_gold(gold - delta);
+}
+
+void player::set_gold(int amount)
+{
+ ASSERT(amount >= 0);
+
+ if (amount != gold)
+ {
+ shopping_list.gold_changed(gold, amount);
+ gold = amount;
+ }
+}