diff options
author | pauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-09 08:08:51 +0000 |
---|---|---|
committer | pauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-09 08:08:51 +0000 |
commit | 9ea95681bd75dd7bbc55a5d96a98e360247028c2 (patch) | |
tree | d7626f601cac746589fd6b06f0dbf28c35a3c810 /crawl-ref/source/quiver.h | |
parent | 26f9ceaeb4fbfe64f099a8f17f61ecc7429d16a1 (diff) | |
download | crawl-ref-9ea95681bd75dd7bbc55a5d96a98e360247028c2.tar.gz crawl-ref-9ea95681bd75dd7bbc55a5d96a98e360247028c2.zip |
Freshly-rewritten quiver code. This is just a checkpoint, and it's
used from anywhere yet. It should compile. Let me know if it doesn't,
or if I've modified the makefiles incorrectly.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4161 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/quiver.h')
-rw-r--r-- | crawl-ref/source/quiver.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/crawl-ref/source/quiver.h b/crawl-ref/source/quiver.h new file mode 100644 index 0000000000..aee70e74fe --- /dev/null +++ b/crawl-ref/source/quiver.h @@ -0,0 +1,47 @@ +/* + * File: quiver.h + * Summary: Player quiver functionality + * + * Last modified by $Author: $ on $Date: $ + */ + +#ifndef QUIVER_H +#define QUIVER_H + +#include "externs.h" /* item_def */ +#include <vector> + +enum ammo_t +{ + AMMO_THROW, // no launcher wielded -> darts, stones, ... + AMMO_BOW, // wielded bow -> arrows + AMMO_SLING, // wielded sling -> stones, sling bullets + AMMO_CROSSBOW, // wielded crossbow -> bolts + AMMO_HAND_CROSSBOW, // wielded hand crossbow -> darts + AMMO_BLOWGUN, // wielded blowgun -> needles + NUM_AMMO, + AMMO_INVALID=-1 +}; + +class player_quiver +{ + public: + player_quiver(); + + void get_desired_item(const item_def** item_out, int* slot_out) const; + // Returns an item, or a reason why we returned an invalid item + int get_default_slot(std::string& no_item_reason) const; + void get_fire_order(std::vector<int>& v) const { _get_fire_order(v, false); } + + void on_item_fired(const item_def&); + void on_item_thrown(const item_def&); + void on_weapon_changed(); + + private: + void _get_fire_order(std::vector<int>&, bool ignore_inscription_etc) const; + private: + ammo_t m_last_used_type; + item_def m_last_used_of_type[NUM_AMMO]; +}; + +#endif |