Changeset 2662 for code/trunk/src/core/BaseObject.h
- Timestamp:
- Feb 14, 2009, 10:17:35 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/core/BaseObject.h
r2171 r2662 36 36 #ifndef _BaseObject_H__ 37 37 #define _BaseObject_H__ 38 39 #define SetMainState(classname, statename, setfunction, getfunction) \ 40 if (this->getMainStateName() == statename) \ 41 { \ 42 this->functorSetMainState_ = createFunctor(&classname::setfunction)->setObject(this); \ 43 this->functorGetMainState_ = createFunctor(&classname::getfunction)->setObject(this); \ 44 } 38 45 39 46 #include <map> … … 55 62 class _CoreExport BaseObject : virtual public OrxonoxClass 56 63 { 64 template <class T> friend class XMLPortClassParamContainer; 65 57 66 public: 58 67 BaseObject(BaseObject* creator); … … 100 109 virtual void changedVisibility() {} 101 110 111 void setMainState(bool state); 112 bool getMainState() const; 113 114 void setMainStateName(const std::string& name); 115 inline const std::string& getMainStateName() const { return this->mainStateName_; } 116 virtual void changedMainState(); 117 102 118 /** @brief Sets a pointer to the xml file that loaded this object. @param file The pointer to the XMLFile */ 103 119 inline void setFile(const XMLFile* file) { this->file_ = file; } … … 121 137 inline Scene* getScene() const { return this->scene_; } 122 138 123 inline void setGametype(Gametype* gametype) { this->oldGametype_ = this->gametype_; this->gametype_ = gametype; this->changedGametype(); } 139 inline void setGametype(Gametype* gametype) 140 { 141 if (gametype != this->gametype_) 142 { 143 this->oldGametype_ = this->gametype_; 144 this->gametype_ = gametype; 145 this->changedGametype(); 146 } 147 } 124 148 inline Gametype* getGametype() const { return this->gametype_; } 125 149 inline Gametype* getOldGametype() const { return this->oldGametype_; } 126 virtual inlinevoid changedGametype() {}150 virtual void changedGametype() {} 127 151 128 152 void fireEvent(); … … 151 175 152 176 protected: 153 std::string name_; //!< The name of the object 154 std::string oldName_; //!< The old name of the object 155 mbool bActive_; //!< True = the object is active 156 mbool bVisible_; //!< True = the object is visible 177 std::string name_; //!< The name of the object 178 std::string oldName_; //!< The old name of the object 179 mbool bActive_; //!< True = the object is active 180 mbool bVisible_; //!< True = the object is visible 181 std::string mainStateName_; 182 Functor* functorSetMainState_; 183 Functor* functorGetMainState_; 157 184 158 185 private: … … 160 187 Template* getTemplate(unsigned int index) const; 161 188 162 bool bInitialized_; //!< True if the object was initialized (passed the object registration) 163 const XMLFile* file_; //!< The XMLFile that loaded this object 164 std::string loaderIndentation_; //!< Indentation of the debug output in the Loader 165 Namespace* namespace_; 166 BaseObject* creator_; 167 Scene* scene_; 168 Gametype* gametype_; 169 Gametype* oldGametype_; 170 std::set<Template*> templates_; 171 std::map<BaseObject*, std::string> eventListeners_; 189 bool bInitialized_; //!< True if the object was initialized (passed the object registration) 190 const XMLFile* file_; //!< The XMLFile that loaded this object 191 Element* lastLoadedXMLElement_; //!< Non 0 if the TinyXML attributes have already been copied to our own lowercase map 192 std::map<std::string, std::string> xmlAttributes_; //!< Lowercase XML attributes 193 std::string loaderIndentation_; //!< Indentation of the debug output in the Loader 194 Namespace* namespace_; 195 BaseObject* creator_; 196 Scene* scene_; 197 Gametype* gametype_; 198 Gametype* oldGametype_; 199 std::set<Template*> templates_; 200 std::map<BaseObject*, std::string> eventListeners_; 172 201 std::list<BaseObject*> events_; 173 202 std::map<std::string, EventContainer*> eventContainers_; … … 178 207 SUPER_FUNCTION(3, BaseObject, changedVisibility, false); 179 208 SUPER_FUNCTION(4, BaseObject, processEvent, false); 209 SUPER_FUNCTION(6, BaseObject, changedMainState, false); 210 SUPER_FUNCTION(9, BaseObject, changedName, false); 211 SUPER_FUNCTION(10, BaseObject, changedGametype, false); 180 212 } 181 213
Note: See TracChangeset
for help on using the changeset viewer.