/* core/slots.h This file is part of the Osirion project and is distributed under the terms of the GNU General Public License version 2. */ #ifndef __INCLUDED_CORE_SLOTS_H__ #define __INCLUDED_CORE_SLOTS_H__ #include #include "model/model.h" #include "core/slot.h" namespace core { /** * @brief a collection of entity equipment and weapon slots * */ class Slots { public: Slots(); ~Slots(); typedef std::vector Container; typedef Container::iterator iterator; typedef Container::const_iterator const_iterator; /** * @brief initialize slots collection from model properties * */ void load(model::Model *model, const float modelscale); /** * @brief remove all slots * */ void clear(); /** * @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() { return slots_container.begin(); } inline iterator end() { return slots_container.end(); } private: Container slots_container; }; } // namespace core #endif // __INCLUDED_CORE_SLOTS_H__