00001
00002
00003
00004
00005
00006 #ifndef QUIVER_H
00007 #define QUIVER_H
00008
00009 #include "externs.h"
00010 #include <vector>
00011
00012 class reader;
00013 class writer;
00014 class preserve_quiver_slots;
00015
00016 enum ammo_t
00017 {
00018 AMMO_THROW,
00019 AMMO_BOW,
00020 AMMO_SLING,
00021 AMMO_CROSSBOW,
00022
00023 AMMO_BLOWGUN,
00024 NUM_AMMO
00025 };
00026
00027 class player_quiver
00028 {
00029 friend class preserve_quiver_slots;
00030 public:
00031 player_quiver();
00032
00033
00034 void get_desired_item(const item_def** item_out, int* slot_out) const;
00035 int get_fire_item(std::string* no_item_reason = 0) const;
00036 void get_fire_order(std::vector<int>& v) const;
00037
00038
00039 void set_quiver(const item_def &item, ammo_t ammo_type);
00040 void empty_quiver(ammo_t ammo_type);
00041 void on_item_fired(const item_def &item, bool explicitly_chosen = false);
00042 void on_item_fired_fi(const item_def &item);
00043 void on_inv_quantity_changed(int slot, int amt);
00044 void on_weapon_changed();
00045
00046
00047 void save(writer&) const;
00048 void load(reader&);
00049
00050 private:
00051 void _get_fire_order(std::vector<int>&,
00052 bool ignore_inscription_etc,
00053 const item_def* launcher) const;
00054 void _maybe_fill_empty_slot();
00055
00056 private:
00057 item_def m_last_weapon;
00058
00059 ammo_t m_last_used_type;
00060 item_def m_last_used_of_type[NUM_AMMO];
00061 };
00062
00063
00064
00065
00066
00067
00068
00069
00070 class preserve_quiver_slots
00071 {
00072 public:
00073 preserve_quiver_slots();
00074 ~preserve_quiver_slots();
00075
00076 private:
00077 int m_last_used_of_type[NUM_AMMO];
00078 };
00079
00080 void quiver_item(int slot);
00081 void choose_item_for_quiver(void);
00082
00083 #endif