You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/apps/openmw/mwgui/spellmodel.hpp

63 lines
1.4 KiB
C++

#ifndef OPENMW_GUI_SPELLMODEL_H
#define OPENMW_GUI_SPELLMODEL_H
#include "../mwworld/ptr.hpp"
namespace MWGui
{
struct Spell
{
enum Type
{
Type_Power,
Type_Spell,
Type_EnchantedItem
};
Type mType;
std::string mName;
std::string mCostColumn; // Cost/chance or Cost/charge
std::string mId; // Item ID or spell ID
MWWorld::Ptr mItem; // Only for Type_EnchantedItem
int mCount; // Only for Type_EnchantedItem
bool mSelected; // Is this the currently selected spell/item (only one can be selected at a time)
bool mActive; // (Items only) is the item equipped?
Spell()
: mType(Type_Spell)
, mCount(0)
, mSelected(false)
, mActive(false)
{
}
};
///@brief Model that lists all usable powers, spells and enchanted items for an actor.
class SpellModel
{
public:
SpellModel(const MWWorld::Ptr& actor, const std::string& filter);
SpellModel(const MWWorld::Ptr& actor);
typedef int ModelIndex;
void update();
Spell getItem (ModelIndex index) const;
///< throws for invalid index
size_t getItemCount() const;
private:
MWWorld::Ptr mActor;
std::vector<Spell> mSpells;
std::string mFilter;
};
}
#endif