diff options
author | pauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-14 07:35:39 +0000 |
---|---|---|
committer | pauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-14 07:35:39 +0000 |
commit | 94ceb87517474ac372a41a52a3448104f51435bf (patch) | |
tree | 9a39e73ebab7856f7da8ea68aa6e6c1a15ee4713 /crawl-ref/source/quiver.h | |
parent | bfeb59ed40adef39b01dcb1fb9a8e6a500eec1b9 (diff) | |
download | crawl-ref-94ceb87517474ac372a41a52a3448104f51435bf.tar.gz crawl-ref-94ceb87517474ac372a41a52a3448104f51435bf.zip |
Quiver work:
+ bug: if wield sling and no quiver, then pick up stones: should quiver
+ implement: save and load (does not break saves)
+ remove: fire_quiver_best
+ remove: you.quiver
+ bug: identifying items doesn't update quiver properly
+ rename: you.quiver_change -> you.redraw_quiver
+ test no item because of =f
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4227 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/quiver.h')
-rw-r--r-- | crawl-ref/source/quiver.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/crawl-ref/source/quiver.h b/crawl-ref/source/quiver.h index dd76319e1a..4b0e7f8993 100644 --- a/crawl-ref/source/quiver.h +++ b/crawl-ref/source/quiver.h @@ -11,6 +11,10 @@ #include "externs.h" /* item_def */ #include <vector> +class reader; +class writer; +class preserve_quiver_slots; + enum ammo_t { AMMO_THROW, // no launcher wielded -> darts, stones, ... @@ -25,23 +29,31 @@ enum ammo_t class player_quiver { + friend class preserve_quiver_slots; public: player_quiver(); + // Queries from engine -- don't affect state void get_desired_item(const item_def** item_out, int* slot_out) const; int get_fire_item(std::string* no_item_reason=0) const; void get_fire_order(std::vector<int>& v) const; + // Callbacks from engine void on_item_fired(const item_def&); void on_item_fired_fi(const item_def&); - void on_inv_quantity_change(int slot, int amt); + void on_inv_quantity_changed(int slot, int amt); void on_weapon_changed(); + // save/load + void save(writer&) const; + void load(reader&); + private: void _get_fire_order(std::vector<int>&, bool ignore_inscription_etc, const item_def* launcher) const; void _maybe_fill_empty_slot(); + private: item_def m_last_weapon; @@ -49,4 +61,21 @@ class player_quiver item_def m_last_used_of_type[NUM_AMMO]; }; +// Quiver tracks items, which in most cases is the Right Thing. But +// when a quivered item is identified, the quiver doesn't change to +// match. We would like the quiver to store the identified item. +// +// This class saves off the quiver item slots, and restores them when +// destroyed. The expected use is to create one of these around code +// that identifies items in inv. +class preserve_quiver_slots +{ + public: + preserve_quiver_slots(); + ~preserve_quiver_slots(); + + private: + int m_last_used_of_type[NUM_AMMO]; +}; + #endif |