From 66d9bbd8356dca3d0b07145d1eea21de2d4789cc Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Thu, 29 Oct 2009 01:06:07 -0700 Subject: 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. --- crawl-ref/source/player.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'crawl-ref/source/player.cc') 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; + } +} -- cgit v1.2.3-54-g00ecf