/* entityproperties.h This file is part of the Project::OSiRiON world editor and is distributed under the terms and conditions of the GNU General Public License version 2 */ #ifndef __INCLUDED_EDITOR_ENTITYPROPERTIES__ #define __INCLUDED_EDITOR_ENTITYPROPERTIES__ #include "properties.h" namespace editor { /** * @brief contains the game properties for an entity * */ class EntityProperties : public Properties { public: EntityProperties(); EntityProperties(const EntityProperties &other); virtual ~EntityProperties(); /** * @brief save ini formatted entity properties to a textstream * */ virtual void save(QTextStream &textstream); /* ---- inspectors ---- */ /** * @brief returns the type string of this object * */ inline const QString & type() const { return properties_type; } /** * @brief returns the object radius * */ inline const float radius() const { return properties_radius; } /** * @brief returns the angles of this object * */ inline const Vector3f &angles() const { return properties_angles; } /** * @brief returns the yaw angle of this object * */ inline const float yaw() const { return properties_angles[0]; } /** * @brief returns the subsections string of this object * */ inline const QString & subsections() const { return properties_subsections; } /** * @brief returns the template type of this object * 0 = normal template from templates.ini * 1 = ship templatefrom ships.ini * */ inline const int template_type() const { return properties_template_type; } /** * @brief returns the template label of this object * */ inline const QString &template_label() const { return properties_template_label; } /* ---- mutators ---- */ /** * @brief assignment operator * */ void assign(const EntityProperties & other); /** * @brief assignment operator * */ inline EntityProperties & operator=(const EntityProperties & other) { assign(other); return *this; } /** * @brief set the subsection string of this object * */ void set_subsections(const QString &text) { properties_subsections = text; } /** * @brief add a header to the subsection string of this object * */ void add_subsection_header(const QString &header, const QString &comment); /** * @brief add a value key pair to the subsection string of this object * */ void add_subsection_value(const QString &key, const QString &value,const QString &comment); /** * @brief set the type string of this object * */ inline void set_type(const QString &type) { properties_type = type; } /** * @brief set the object radius * */ inline void set_radius(const float radius) { properties_radius = radius; } /** * @brief set the object angles * */ inline void set_angles(const Vector3f &angles) { properties_angles.assign(angles); } /** * @brief set the object yaw angle * */ inline void set_yaw(const float yaw) { properties_angles[0] = yaw; } /** * @brief set the object pitch angle * */ inline void set_pitch(const float pitch) { properties_angles[1] = pitch; } /** * @brief set the object roll angle * */ inline void set_roll (const float roll ) { properties_angles[2] = roll ; } /** * @brief set the object angles * */ inline void set_angles(const float yaw, const float pitch, const float roll) { properties_angles.assign(yaw, pitch, roll); } /** * @brief set the object template * @param template_type 0 = template, 1 = ship * @param template_label label of the template to be used * */ inline void set_template(const int template_type, const QString &template_label) { properties_template_type = template_type; properties_template_label = template_label; } inline void set_template_type(const int template_type) { properties_template_type = template_type; } inline void set_template_label(const QString &template_label) { properties_template_label = template_label; } private: float properties_radius; QString properties_subsections; QString properties_type; Vector3f properties_angles; int properties_template_type; QString properties_template_label; }; } // namespace editor #endif // __INCLUDED_EDITOR_ENTITYPROPERTIES__