00001 #ifndef ARENAELEMENTTYPE_H 00002 #define ARENAELEMENTTYPE_H 00003 00004 #include <QString> 00005 #include <QPixmap> 00006 #include <QDomElement> 00007 #include <QDir> 00008 #include <QFileInfo> 00009 #include <QPair> 00010 00011 #include "xmlloadingexception.h" 00012 00013 typedef QPair<QString, QString> QStringPair; 00014 typedef QPair<QString, QPointF> ItemMountPoint; 00015 00016 class ArenaElement; 00017 00018 class ArenaElementType 00019 { 00020 friend class ArenaElementTypeRegistry; 00021 00022 public: 00023 enum Type 00024 { 00025 FloorType, 00026 WallType, 00028 ItemType, 00030 MountableItemType 00031 }; 00032 00033 ArenaElementType(); 00034 00040 bool load(const QDir &folderDir); 00041 00042 ArenaElement* createInstance() const; 00043 00044 QString name() const { return m_name; } 00045 QPixmap pixmap() const { return m_pixmap; } 00046 QString mesh() const { return m_mesh; } 00047 Type type() const { return m_type; } 00048 QVector<QStringPair> metaInfos() const { return m_metaInfos; } 00049 00051 QString humanReadableName() const; 00052 00055 QList<ItemMountPoint> itemMountPoints() const { return m_itemMountPoints; } 00056 00057 private: 00058 QList<ItemMountPoint> m_itemMountPoints; 00059 QVector<QStringPair> m_metaInfos; 00060 QString m_name; 00061 QString m_mesh; 00062 QPixmap m_pixmap; 00063 Type m_type; 00064 mutable int m_instanceCount; 00065 }; 00066 00067 #endif // ARENAELEMENTTYPE_H