| 1 | /* | 
|---|
| 2 | *   ORXONOX - the hottest 3D action shooter ever to exist | 
|---|
| 3 | *                    > www.orxonox.net < | 
|---|
| 4 | * | 
|---|
| 5 | * | 
|---|
| 6 | *   License notice: | 
|---|
| 7 | * | 
|---|
| 8 | *   This program is free software; you can redistribute it and/or | 
|---|
| 9 | *   modify it under the terms of the GNU General Public License | 
|---|
| 10 | *   as published by the Free Software Foundation; either version 2 | 
|---|
| 11 | *   of the License, or (at your option) any later version. | 
|---|
| 12 | * | 
|---|
| 13 | *   This program is distributed in the hope that it will be useful, | 
|---|
| 14 | *   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 15 | *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 16 | *   GNU General Public License for more details. | 
|---|
| 17 | * | 
|---|
| 18 | *   You should have received a copy of the GNU General Public License | 
|---|
| 19 | *   along with this program; if not, write to the Free Software | 
|---|
| 20 | *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | 
|---|
| 21 | * | 
|---|
| 22 | *   Author: | 
|---|
| 23 | *      Fabian 'x3n' Landau | 
|---|
| 24 | *   Co-authors: | 
|---|
| 25 | *      ... | 
|---|
| 26 | * | 
|---|
| 27 | */ | 
|---|
| 28 |  | 
|---|
| 29 | /** | 
|---|
| 30 | @file BaseObject.h | 
|---|
| 31 | @brief Definition of the BaseObject class. | 
|---|
| 32 |  | 
|---|
| 33 | The BaseObject is the parent of all classes representing an instance in the game. | 
|---|
| 34 | */ | 
|---|
| 35 |  | 
|---|
| 36 | #ifndef _BaseObject_H__ | 
|---|
| 37 | #define _BaseObject_H__ | 
|---|
| 38 |  | 
|---|
| 39 | #include "CorePrereqs.h" | 
|---|
| 40 |  | 
|---|
| 41 | #include "util/XMLIncludes.h" | 
|---|
| 42 | #include "OrxonoxClass.h" | 
|---|
| 43 |  | 
|---|
| 44 | namespace orxonox | 
|---|
| 45 | { | 
|---|
| 46 | //! The BaseObject is the parent of all classes representing an instance in the game. | 
|---|
| 47 | class _CoreExport BaseObject : virtual public OrxonoxClass | 
|---|
| 48 | { | 
|---|
| 49 | public: | 
|---|
| 50 | BaseObject(); | 
|---|
| 51 | virtual ~BaseObject(); | 
|---|
| 52 | virtual void loadParams(TiXmlElement* xmlElem); | 
|---|
| 53 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); | 
|---|
| 54 |  | 
|---|
| 55 | /** @brief Sets the name of the object. @param name The name */ | 
|---|
| 56 | inline void setName(const std::string& name) { this->name_ = name; this->changedName(); } | 
|---|
| 57 | /** @brief Returns the name of the object. @return The name */ | 
|---|
| 58 | inline const std::string& getName() const { return this->name_; } | 
|---|
| 59 | /** @brief This function gets called if the name of the object changes. */ | 
|---|
| 60 | virtual void changedName() {} | 
|---|
| 61 |  | 
|---|
| 62 | /** @brief Sets the state of the objects activity. @param bActive True = active */ | 
|---|
| 63 | inline void setActivity(bool bActive) { this->bActive_ = bActive; this->changedActivity(); } | 
|---|
| 64 | /** @brief Returns the state of the objects activity. @return The state of the activity */ | 
|---|
| 65 | inline const bool isActive() const { return this->bActive_; } | 
|---|
| 66 | /** @brief This function gets called if the activity of the object changes. */ | 
|---|
| 67 | virtual void changedActivity() {} | 
|---|
| 68 |  | 
|---|
| 69 | /** @brief Sets the state of the objects visibility. @param bVisible True = visible */ | 
|---|
| 70 | inline void setVisibility(bool bVisible) { this->bVisible_ = bVisible; this->changedVisibility(); } | 
|---|
| 71 | /** @brief Returns the state of the objects visibility. @return The state of the visibility */ | 
|---|
| 72 | inline const bool isVisible() const { return this->bVisible_; } | 
|---|
| 73 | /** @brief This function gets called if the visibility of the object changes. */ | 
|---|
| 74 | virtual void changedVisibility() {} | 
|---|
| 75 |  | 
|---|
| 76 | /** @brief Sets a pointer to the level that loaded this object. @param level The pointer to the level */ | 
|---|
| 77 | inline void setLevel(const Level* level) { this->level_ = level; } | 
|---|
| 78 | /** @brief Returns a pointer to the level that loaded this object. @return The level */ | 
|---|
| 79 | inline const Level* getLevel() const { return this->level_; } | 
|---|
| 80 | const std::string& getLevelfile() const; | 
|---|
| 81 |  | 
|---|
| 82 | virtual inline void setNamespace(Namespace* ns) { this->namespace_ = ns; } | 
|---|
| 83 | inline Namespace* getNamespace() const { return this->namespace_; } | 
|---|
| 84 |  | 
|---|
| 85 | /** @brief Sets the indentation of the debug output in the Loader. @param indentation The indentation */ | 
|---|
| 86 | inline void setLoaderIndentation(const std::string& indentation) { this->loaderIndentation_ = indentation; } | 
|---|
| 87 | /** @brief Returns the indentation of the debug output in the Loader. @return The indentation */ | 
|---|
| 88 | inline const std::string& getLoaderIndentation() const { return this->loaderIndentation_; } | 
|---|
| 89 |  | 
|---|
| 90 | private: | 
|---|
| 91 | std::string name_;                          //!< The name of the object | 
|---|
| 92 | bool bActive_;                              //!< True = the object is active | 
|---|
| 93 | bool bVisible_;                             //!< True = the object is visible | 
|---|
| 94 | const Level* level_;                        //!< The level that loaded this object | 
|---|
| 95 | std::string loaderIndentation_;             //!< Indentation of the debug output in the Loader | 
|---|
| 96 | Namespace* namespace_; | 
|---|
| 97 | }; | 
|---|
| 98 | } | 
|---|
| 99 |  | 
|---|
| 100 | #endif /* _BaseObject_H__ */ | 
|---|