From 85bbfb39bdc272614a2a1526c96f757cb58335d9 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 30 Nov 2012 21:20:08 +0000 Subject: Save weapon slot positions. --- src/core/slots.h | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/slots.h b/src/core/slots.h index aefffb7..6ac9eb8 100644 --- a/src/core/slots.h +++ b/src/core/slots.h @@ -38,16 +38,34 @@ public: void clear(); /** - * @brief found a mounted item + * @brief find a mounted item * */ Slot *find(Item *item); + /** + * @brief return the slot at the specified index + * */ + inline Slot *operator[](size_t index) + { + if (index < slots_container.size()) { + return slots_container[index]; + } else { + return 0; + } + } + + inline size_t size() const + { + return slots_container.size(); + } - inline iterator begin() { + inline iterator begin() + { return slots_container.begin(); } - inline iterator end() { + inline iterator end() + { return slots_container.end(); } -- cgit v1.2.3