From 9ea95681bd75dd7bbc55a5d96a98e360247028c2 Mon Sep 17 00:00:00 2001 From: pauldubois Date: Wed, 9 Apr 2008 08:08:51 +0000 Subject: 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 --- crawl-ref/source/quiver.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 crawl-ref/source/quiver.h (limited to 'crawl-ref/source/quiver.h') 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 + +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& 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&, bool ignore_inscription_etc) const; + private: + ammo_t m_last_used_type; + item_def m_last_used_of_type[NUM_AMMO]; +}; + +#endif -- cgit v1.2.3-54-g00ecf