Changeset 3325 for code/trunk
- Timestamp:
- Jul 19, 2009, 3:48:00 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 50 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/core4 merged: 3222-3224,3238
- Property svn:mergeinfo changed
-
code/trunk/src/core/CoreIncludes.h
r3196 r3325 56 56 */ 57 57 #define InternRegisterObject(ClassName, bRootClass) \ 58 this->setIdentifier(orxonox::ClassIdentifier<ClassName>::getIdentifier(#ClassName)); \ 59 if (orxonox::Identifier::isCreatingHierarchy()) \ 60 { \ 61 if (this->getParents()) \ 62 { \ 63 orxonox::ClassIdentifier<ClassName>::getIdentifier(#ClassName)->initializeClassHierarchy(this->getParents(), bRootClass); \ 64 this->getParents()->insert(this->getParents()->end(), this->getIdentifier()); \ 65 } \ 66 this->setConfigValues(); \ 58 if (ClassIdentifier<ClassName>::getIdentifier(#ClassName)->initialiseObject(this, #ClassName, bRootClass)) \ 67 59 return; \ 68 } \ 69 orxonox::ClassIdentifier<ClassName>::getIdentifier()->addObject(this) 70 71 /** 72 @brief Intern macro, containing the specific part of RegisterRootObject. 73 @param ClassName The name of the class 74 */ 75 #define InternRegisterRootObject(ClassName) \ 76 if (orxonox::Identifier::isCreatingHierarchy() && !this->getParents()) \ 77 this->createParents(); \ 78 InternRegisterObject(ClassName, true) 60 else \ 61 ((void)0) 79 62 80 63 /** … … 83 66 */ 84 67 #define RegisterObject(ClassName) \ 85 COUT(5) << "*** Register Object: " << #ClassName << std::endl; \86 68 InternRegisterObject(ClassName, false) 87 69 … … 91 73 */ 92 74 #define RegisterRootObject(ClassName) \ 93 COUT(5) << "*** Register Root-Object: " << #ClassName << std::endl; \ 94 InternRegisterRootObject(ClassName) 75 InternRegisterObject(ClassName, true) 95 76 96 77 /** … … 115 96 orxonox::ClassIdentifier<ClassName>::getIdentifier() 116 97 117 /**118 @brief Returns the Identifier with a given name through the factory.119 @param String The name of the class120 */121 #define ClassByString(String) \122 orxonox::Factory::getIdentifier(String)123 98 124 /** 125 @brief Returns the Identifier with a given network ID through the factory. 126 @param networkID The network ID of the class 127 */ 128 #define ClassByID(networkID) \ 129 orxonox::Factory::getIdentifier(networkID) 99 namespace orxonox 100 { 101 /** 102 @brief Returns the Identifier with a given name through the factory. 103 @param String The name of the class 104 */ 105 inline Identifier* ClassByString(const std::string& name) 106 { 107 return Factory::getIdentifier(name); 108 } 109 110 /** 111 @brief Returns the Identifier with a given network ID through the factory. 112 @param networkID The network ID of the class 113 */ 114 inline Identifier* ClassByID(uint32_t id) 115 { 116 return Factory::getIdentifier(id); 117 } 118 } 130 119 131 120 #endif /* _CoreIncludes_H__ */ -
code/trunk/src/core/EventIncludes.h
r3196 r3325 54 54 this->addEventContainer(eventname, containername); \ 55 55 } \ 56 event.castedOriginator_ = dynamic_cast<subclassname*>(event.originator_); \56 event.castedOriginator_ = orxonox::orxonox_cast<subclassname*>(event.originator_); \ 57 57 containername->process(this, event) 58 58 … … 66 66 this->addEventContainer(eventname, containername); \ 67 67 } \ 68 event.castedOriginator_ = dynamic_cast<subclassname*>(event.originator_); \68 event.castedOriginator_ = orxonox::orxonox_cast<subclassname*>(event.originator_); \ 69 69 containername->process(this, event) 70 70 -
code/trunk/src/core/Identifier.cc
r3280 r3325 47 47 // ### Identifier ### 48 48 // ############################### 49 int Identifier::hierarchyCreatingCounter_s = 0; // Set the static member variable hierarchyCreatingCounter_s to zero (this static member variable is ok: it's used in main(), not before) 49 int Identifier::hierarchyCreatingCounter_s = 0; 50 unsigned int Identifier::classIDCounter_s = 0; 50 51 51 52 /** … … 53 54 */ 54 55 Identifier::Identifier() 56 : classID_(classIDCounter_s++) 55 57 { 56 58 this->objects_ = new ObjectListBase(this); … … 67 69 this->directChildren_ = new std::set<const Identifier*>(); 68 70 69 // Use a static variable because the classID gets created before main() and that's why we should avoid static member variables 70 static unsigned int classIDcounter_s = 0; 71 this->classID_ = classIDcounter_s++; 71 // Default network ID is the class ID 72 this->networkID_ = this->classID_; 72 73 } 73 74 … … 244 245 void Identifier::setNetworkID(uint32_t id) 245 246 { 246 Factory::changeNetworkID(this, this-> classID_, id);247 this-> classID_ = id;247 Factory::changeNetworkID(this, this->networkID_, id); 248 this->networkID_ = id; 248 249 } 249 250 -
code/trunk/src/core/Identifier.h
r3196 r3325 224 224 225 225 /** @brief Returns the network ID to identify a class through the network. @return the network ID */ 226 inline const uint32_t getNetworkID() const { return this-> classID_; }226 inline const uint32_t getNetworkID() const { return this->networkID_; } 227 227 228 228 /** @brief Sets the network ID to a new value. @param id The new value */ 229 229 void setNetworkID(uint32_t id); 230 231 /** @brief Returns the unique ID of the class */ 232 FORCEINLINE unsigned int getClassID() const { return this->classID_; } 230 233 231 234 void addConfigValueContainer(const std::string& varname, ConfigValueContainer* container); … … 305 308 BaseFactory* factory_; //!< The Factory, able to create new objects of the given class (if available) 306 309 static int hierarchyCreatingCounter_s; //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading) 307 uint32_t classID_; //!< The network ID to identify a class through the network 310 uint32_t networkID_; //!< The network ID to identify a class through the network 311 const unsigned int classID_; //!< Uniquely identifies a class (might not be the same as the networkID_) 312 static unsigned int classIDCounter_s; //!< Static counter for the unique classIDs 308 313 309 314 bool bHasConfigValues_; //!< True if this class has at least one assigned config value … … 344 349 static ClassIdentifier<T> *getIdentifier(); 345 350 static ClassIdentifier<T> *getIdentifier(const std::string& name); 346 void addObject(T* object); 351 352 bool initialiseObject(T* object, const std::string& className, bool bRootClass); 347 353 348 354 void updateConfigValues(bool updateChildren = true) const; … … 423 429 */ 424 430 template <class T> 425 inline void ClassIdentifier<T>::addObject(T* object) 426 { 427 COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl; 428 object->getMetaList().add(this->objects_, this->objects_->add(new ObjectListElement<T>(object))); 431 bool ClassIdentifier<T>::initialiseObject(T* object, const std::string& className, bool bRootClass) 432 { 433 if (bRootClass) 434 COUT(5) << "*** Register Root-Object: " << className << std::endl; 435 else 436 COUT(5) << "*** Register Object: " << className << std::endl; 437 438 object->identifier_ = this; 439 if (Identifier::isCreatingHierarchy()) 440 { 441 if (bRootClass && !object->parents_) 442 object->parents_ = new std::set<const Identifier*>(); 443 444 if (object->parents_) 445 { 446 this->initializeClassHierarchy(object->parents_, bRootClass); 447 object->parents_->insert(object->parents_->end(), this); 448 } 449 450 object->setConfigValues(); 451 return true; 452 } 453 else 454 { 455 COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl; 456 object->metaList_->add(this->objects_, this->objects_->add(new ObjectListElement<T>(object))); 457 458 // Add pointer of type T to the map in the OrxonoxClass instance that enables "dynamic_casts" 459 object->objectPointers_.push_back(std::make_pair(this->getClassID(), reinterpret_cast<void*>(object))); 460 return false; 461 } 429 462 } 430 463 … … 444 477 for (std::set<const Identifier*>::const_iterator it = this->getChildrenBegin(); it != this->getChildrenEnd(); ++it) 445 478 (*it)->updateConfigValues(false); 479 } 480 481 482 // ############################### 483 // ### orxonox_cast ### 484 // ############################### 485 //! Helper struct to have orxonox_cast<T*> instead of orxonox_cast<T> 486 template <class T, class U> 487 struct OrxonoxCaster 488 { 489 static T* cast(U* source) 490 { 491 // If you see this function in a compiler error description, it means 492 // you were misusing orxonox_cast. You must always cast to a pointer type! 493 *****T(); 494 } 495 }; 496 497 //! Helper struct to have orxonox_cast<T*> instead of orxonox_cast<T*> 498 template <class T, class U> 499 struct OrxonoxCaster<T*, U> 500 { 501 FORCEINLINE static T* cast(U* source) 502 { 503 #ifdef ORXONOX_COMPILER_MSVC 504 return source->template getDerivedPointer<T>(ClassIdentifier<T>::getIdentifier()->getClassID()); 505 #else 506 return dynamic_cast<T*>(source); 507 #endif 508 } 509 }; 510 511 /** 512 @brief 513 Casts on object of type OrxonoxClass to any derived type that is 514 registered in the class hierarchy. 515 @return 516 Returns NULL if the cast is not possible 517 @note 518 In case of NULL return (and using MSVC), a dynamic_cast might still be possible if 519 a class forgot to register its objects. 520 Also note that the function is implemented differently for GCC/MSVC. 521 */ 522 template <class T, class U> 523 FORCEINLINE T orxonox_cast(U* source) 524 { 525 return OrxonoxCaster<T, U>::cast(source); 446 526 } 447 527 … … 539 619 if (newObject) 540 620 { 541 return dynamic_cast<T*>(newObject);621 return orxonox_cast<T*>(newObject); 542 622 } 543 623 else -
code/trunk/src/core/Iterator.h
r3196 r3325 240 240 { 241 241 if (this->element_) 242 return dynamic_cast<T*>(this->element_->objectBase_);242 return orxonox_cast<T*>(this->element_->objectBase_); 243 243 else 244 244 return 0; … … 252 252 { 253 253 if (this->element_) 254 return dynamic_cast<T*>(this->element_->objectBase_);254 return orxonox_cast<T*>(this->element_->objectBase_); 255 255 else 256 256 return 0; -
code/trunk/src/core/OrxonoxClass.h
r3280 r3325 50 50 class _CoreExport OrxonoxClass 51 51 { 52 template <class T> 53 friend class ClassIdentifier; 54 52 55 public: 53 56 OrxonoxClass(); … … 59 62 /** @brief Returns the Identifier of the object. @return The Identifier */ 60 63 inline Identifier* getIdentifier() const { return this->identifier_; } 61 62 /** @brief Sets the Identifier of the object. Used by the RegisterObject-macro. */63 inline void setIdentifier(Identifier* identifier) { this->identifier_ = identifier; }64 65 /** @brief Returns the list of all parents of the object. @return The list */66 inline std::set<const Identifier*>* getParents() const { return this->parents_; }67 68 /** @brief Creates the parents-list. */69 inline void createParents() { this->parents_ = new std::set<const Identifier*>(); }70 71 /** @brief Returns the MetaObjectList of the object, containing a link to all ObjectLists and ObjectListElements the object is registered in. @return The list */72 inline MetaObjectList& getMetaList() { return (*this->metaList_); }73 74 64 75 65 bool isA(const Identifier* identifier); … … 101 91 bool isDirectParentOf(const OrxonoxClass* object); 102 92 93 /** 94 @brief 95 Returns a valid pointer of any derived type that is 96 registered in the class hierarchy. 97 @return 98 Returns NULL if the no pointer was found. 99 */ 100 template <class T> 101 FORCEINLINE T* getDerivedPointer(unsigned int classID) const 102 { 103 for (int i = this->objectPointers_.size() - 1; i >= 0; --i) 104 { 105 if (this->objectPointers_[i].first == classID) 106 return reinterpret_cast<T*>(this->objectPointers_[i].second); 107 } 108 return NULL; 109 } 110 103 111 private: 104 112 Identifier* identifier_; //!< The Identifier of the object 105 113 std::set<const Identifier*>* parents_; //!< List of all parents of the object 106 114 MetaObjectList* metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in 115 //! 'Fast map' that holds this-pointers of all derived types 116 std::vector<std::pair<unsigned int, void*> > objectPointers_; 107 117 }; 108 118 } -
code/trunk/src/core/Super.h
r3301 r3325 206 206 207 207 // SUPER-macro: Calls Parent::functionname() where Parent is the direct parent of classname 208 #define SUPER(classname, functionname, ...) \ 209 SUPER_##functionname(classname, functionname, __VA_ARGS__) 208 #ifdef ORXONOX_COMPILER_MSVC 209 #define SUPER(classname, functionname, ...) \ 210 __super::functionname(__VA_ARGS__) 211 #else 212 #define SUPER(classname, functionname, ...) \ 213 SUPER_##functionname(classname, functionname, __VA_ARGS__) 214 #endif 210 215 211 216 // helper macro: for functions without arguments -
code/trunk/src/core/XMLPort.h
r3301 r3325 565 565 newObject->setLoaderIndentation(object->getLoaderIndentation() + " "); 566 566 567 O* castedObject = dynamic_cast<O*>(newObject);567 O* castedObject = orxonox_cast<O*>(newObject); 568 568 assert(castedObject); 569 569 -
code/trunk/src/network/NetworkFunction.h
r3304 r3325 39 39 #include <boost/static_assert.hpp> 40 40 41 #include "core/OrxonoxClass.h"42 41 #include "core/Functor.h" 42 #include "core/Identifier.h" 43 43 #include "FunctionCallManager.h" 44 44 #include "synchronisable/Synchronisable.h" … … 153 153 { 154 154 if ( Synchronisable::getSynchronisable(objectID)!=0 ) 155 (*this->functor_)( dynamic_cast<T*>(Synchronisable::getSynchronisable(objectID)));155 (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID))); 156 156 } 157 157 inline void call(uint32_t objectID, const MultiType& mt1) 158 158 { 159 159 if ( Synchronisable::getSynchronisable(objectID)!=0 ) 160 (*this->functor_)( dynamic_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1);160 (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1); 161 161 } 162 162 inline void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2) 163 163 { 164 164 if ( Synchronisable::getSynchronisable(objectID)!=0 ) 165 (*this->functor_)( dynamic_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2);165 (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2); 166 166 } 167 167 inline void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3) 168 168 { 169 169 if ( Synchronisable::getSynchronisable(objectID)!=0 ) 170 (*this->functor_)( dynamic_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3);170 (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3); 171 171 } 172 172 inline void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4) 173 173 { 174 174 if ( Synchronisable::getSynchronisable(objectID)!=0 ) 175 (*this->functor_)( dynamic_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3, mt4);175 (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3, mt4); 176 176 } 177 177 inline void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5) 178 178 { 179 179 if ( Synchronisable::getSynchronisable(objectID)!=0 ) 180 (*this->functor_)( dynamic_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3, mt4, mt5);180 (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3, mt4, mt5); 181 181 } 182 182 -
code/trunk/src/network/synchronisable/Synchronisable.cc
r3304 r3325 73 73 if (creator) 74 74 { 75 Synchronisable* synchronisable_creator = dynamic_cast<Synchronisable*>(creator);75 Synchronisable* synchronisable_creator = orxonox_cast<Synchronisable*>(creator); 76 76 if (synchronisable_creator && synchronisable_creator->objectMode_) 77 77 { … … 161 161 } 162 162 else 163 creator = dynamic_cast<BaseObject*>(synchronisable_creator);163 creator = orxonox_cast<BaseObject*>(synchronisable_creator); 164 164 } 165 165 assert(getSynchronisable(header.getObjectID())==0); //make sure no object with this id exists 166 166 BaseObject *bo = id->fabricate(creator); 167 167 assert(bo); 168 Synchronisable *no = dynamic_cast<Synchronisable*>(bo);168 Synchronisable *no = orxonox_cast<Synchronisable*>(bo); 169 169 assert(no); 170 170 no->objectID=header.getObjectID(); -
code/trunk/src/orxonox/interfaces/Tickable.h
r3196 r3325 57 57 @param dt The time since the last frame in seconds 58 58 */ 59 virtual void tick(float dt) = 0;59 virtual void tick(float dt) { } 60 60 61 61 protected: -
code/trunk/src/orxonox/objects/Level.cc
r3280 r3325 121 121 std::cout << "Load Gametype: " << this->gametype_ << std::endl; 122 122 123 Gametype* rootgametype = dynamic_cast<Gametype*>(identifier->fabricate(this));123 Gametype* rootgametype = orxonox_cast<Gametype*>(identifier->fabricate(this)); 124 124 this->setGametype(rootgametype); 125 125 -
code/trunk/src/orxonox/objects/Scene.cc
r3301 r3325 326 326 // get the WorldEntity pointers 327 327 WorldEntity* object0 = static_cast<WorldEntity*>(colObj0->getUserPointer()); 328 assert( dynamic_cast<WorldEntity*>(object0));328 assert(orxonox_cast<WorldEntity*>(object0)); 329 329 WorldEntity* object1 = static_cast<WorldEntity*>(colObj1->getUserPointer()); 330 assert( dynamic_cast<WorldEntity*>(object1));330 assert(orxonox_cast<WorldEntity*>(object1)); 331 331 332 332 // false means that bullet will assume we didn't modify the contact -
code/trunk/src/orxonox/objects/collisionshapes/CollisionShape.cc
r3280 r3325 85 85 // Parent can either be a WorldEntity or a CompoundCollisionShape. The reason is that the 86 86 // internal collision shape (which is compound) of a WE doesn't get synchronised. 87 CompoundCollisionShape* parentCCS = dynamic_cast<CompoundCollisionShape*>(parent);87 CompoundCollisionShape* parentCCS = orxonox_cast<CompoundCollisionShape*>(parent); 88 88 if (parentCCS) 89 89 parentCCS->attach(this); 90 90 else 91 91 { 92 WorldEntity* parentWE = dynamic_cast<WorldEntity*>(parent);92 WorldEntity* parentWE = orxonox_cast<WorldEntity*>(parent); 93 93 if (parentWE) 94 94 parentWE->attachCollisionShape(this); … … 103 103 this->parent_ = newParent; 104 104 105 WorldEntityCollisionShape* parentWECCS = dynamic_cast<WorldEntityCollisionShape*>(newParent);105 WorldEntityCollisionShape* parentWECCS = orxonox_cast<WorldEntityCollisionShape*>(newParent); 106 106 if (parentWECCS) 107 107 this->parentID_ = parentWECCS->getWorldEntityOwner()->getObjectID(); -
code/trunk/src/orxonox/objects/controllers/ArtificialController.cc
r3280 r3325 181 181 if (entity1->getXMLController()) 182 182 { 183 WaypointPatrolController* wpc = dynamic_cast<WaypointPatrolController*>(entity1->getXMLController());183 WaypointPatrolController* wpc = orxonox_cast<WaypointPatrolController*>(entity1->getXMLController()); 184 184 if (wpc) 185 185 team1 = wpc->getTeam(); … … 187 187 if (entity2->getXMLController()) 188 188 { 189 WaypointPatrolController* wpc = dynamic_cast<WaypointPatrolController*>(entity2->getXMLController());189 WaypointPatrolController* wpc = orxonox_cast<WaypointPatrolController*>(entity2->getXMLController()); 190 190 if (wpc) 191 191 team2 = wpc->getTeam(); 192 192 } 193 193 194 TeamDeathmatch* tdm = dynamic_cast<TeamDeathmatch*>(gametype);194 TeamDeathmatch* tdm = orxonox_cast<TeamDeathmatch*>(gametype); 195 195 if (tdm) 196 196 { … … 203 203 204 204 TeamBaseMatchBase* base = 0; 205 base = dynamic_cast<TeamBaseMatchBase*>(entity1);205 base = orxonox_cast<TeamBaseMatchBase*>(entity1); 206 206 if (base) 207 207 { … … 219 219 } 220 220 } 221 base = dynamic_cast<TeamBaseMatchBase*>(entity2);221 base = orxonox_cast<TeamBaseMatchBase*>(entity2); 222 222 if (base) 223 223 { -
code/trunk/src/orxonox/objects/controllers/HumanController.cc
r3196 r3325 161 161 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 162 162 { 163 Pawn* pawn = dynamic_cast<Pawn*>(HumanController::localController_s->controllableEntity_);163 Pawn* pawn = orxonox_cast<Pawn*>(HumanController::localController_s->controllableEntity_); 164 164 if (pawn) 165 165 pawn->kill(); … … 196 196 { 197 197 if (HumanController::localController_s) 198 return dynamic_cast<Pawn*>(HumanController::localController_s->getControllableEntity());198 return orxonox_cast<Pawn*>(HumanController::localController_s->getControllableEntity()); 199 199 else 200 200 return NULL; -
code/trunk/src/orxonox/objects/gametypes/Pong.cc
r3196 r3325 144 144 if (player && player->getController() && player->getController()->isA(Class(PongAI))) 145 145 { 146 PongAI* ai = dynamic_cast<PongAI*>(player->getController());146 PongAI* ai = orxonox_cast<PongAI*>(player->getController()); 147 147 ai->setPongBall(this->ball_); 148 148 } -
code/trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc
r3280 r3325 54 54 bool TeamBaseMatch::allowPawnDeath(Pawn* victim, Pawn* originator) 55 55 { 56 TeamBaseMatchBase* base = dynamic_cast<TeamBaseMatchBase*>(victim);56 TeamBaseMatchBase* base = orxonox_cast<TeamBaseMatchBase*>(victim); 57 57 if (base) 58 58 { … … 87 87 bool TeamBaseMatch::allowPawnDamage(Pawn* victim, Pawn* originator) 88 88 { 89 TeamBaseMatchBase* base = dynamic_cast<TeamBaseMatchBase*>(victim);89 TeamBaseMatchBase* base = orxonox_cast<TeamBaseMatchBase*>(victim); 90 90 if (base) 91 91 { -
code/trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc
r3301 r3325 126 126 if ((*it)->isA(Class(TeamSpawnPoint))) 127 127 { 128 TeamSpawnPoint* tsp = dynamic_cast<TeamSpawnPoint*>(*it);128 TeamSpawnPoint* tsp = orxonox_cast<TeamSpawnPoint*>(*it); 129 129 if (tsp && static_cast<int>(tsp->getTeamNumber()) != desiredTeamNr) 130 130 { … … 171 171 if ((*it)->isA(Class(TeamColourable))) 172 172 { 173 TeamColourable* tc = dynamic_cast<TeamColourable*>(*it);173 TeamColourable* tc = orxonox_cast<TeamColourable*>(*it); 174 174 tc->setTeamColour(this->teamcolours_[it_player->second]); 175 175 } -
code/trunk/src/orxonox/objects/infos/PlayerInfo.cc
r3280 r3325 186 186 { 187 187 Synchronisable* temp = Synchronisable::getSynchronisable(this->controllableEntityID_); 188 ControllableEntity* entity = dynamic_cast<ControllableEntity*>(temp);188 ControllableEntity* entity = orxonox_cast<ControllableEntity*>(temp); 189 189 this->startControl(entity); 190 190 } … … 199 199 if (this->gtinfoID_ != OBJECTID_UNKNOWN) 200 200 { 201 this->gtinfo_ = dynamic_cast<GametypeInfo*>(Synchronisable::getSynchronisable(this->gtinfoID_));201 this->gtinfo_ = orxonox_cast<GametypeInfo*>(Synchronisable::getSynchronisable(this->gtinfoID_)); 202 202 203 203 if (!this->gtinfo_) -
code/trunk/src/orxonox/objects/items/Engine.cc
r3280 r3325 138 138 Synchronisable* object = Synchronisable::getSynchronisable(this->shipID_); 139 139 if (object) 140 this->addToSpaceShip( dynamic_cast<SpaceShip*>(object));140 this->addToSpaceShip(orxonox_cast<SpaceShip*>(object)); 141 141 } 142 142 } -
code/trunk/src/orxonox/objects/pickup/PickupCollection.cc
r3300 r3325 66 66 Identifier* ident = Class(UsableItem); 67 67 if(this->currentUsable_ == NULL && item->isA(ident)) 68 this->currentUsable_ = dynamic_cast<UsableItem*>(item);68 this->currentUsable_ = orxonox_cast<UsableItem*>(item); 69 69 70 70 this->items_.insert( std::pair<std::string, BaseItem*> (item->getPickupIdentifier(), item) ); … … 336 336 { 337 337 if ((*it).second->isA(ident)) 338 ret.push_back( dynamic_cast<EquipmentItem*>((*it).second));338 ret.push_back(orxonox_cast<EquipmentItem*>((*it).second)); 339 339 } 340 340 … … 353 353 { 354 354 if ((*it).second->isA(ident)) 355 ret.push_back( dynamic_cast<PassiveItem*>((*it).second));355 ret.push_back(orxonox_cast<PassiveItem*>((*it).second)); 356 356 } 357 357 … … 370 370 { 371 371 if ((*it).second->isA(ident)) 372 ret.push_back( dynamic_cast<UsableItem*>((*it).second));372 ret.push_back(orxonox_cast<UsableItem*>((*it).second)); 373 373 } 374 374 -
code/trunk/src/orxonox/objects/pickup/PickupSpawner.cc
r3196 r3325 86 86 // = less delays while running 87 87 BaseObject* newObject = this->itemTemplate_->getBaseclassIdentifier()->fabricate(this); 88 BaseItem* asItem = dynamic_cast<BaseItem*>(newObject);88 BaseItem* asItem = orxonox_cast<BaseItem*>(newObject); 89 89 if (asItem) 90 90 { … … 154 154 { 155 155 BaseObject* newObject = this->itemTemplate_->getBaseclassIdentifier()->fabricate(this); 156 BaseItem* asItem = dynamic_cast<BaseItem*>(newObject);156 BaseItem* asItem = orxonox_cast<BaseItem*>(newObject); 157 157 if (asItem) 158 158 { -
code/trunk/src/orxonox/objects/quest/QuestManager.cc
r3196 r3325 239 239 return NULL; 240 240 } 241 player = dynamic_cast<PlayerInfo*>(obj);241 player = orxonox_cast<PlayerInfo*>(obj); 242 242 243 243 QuestContainer* root = NULL; -
code/trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc
r3196 r3325 126 126 dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false); 127 127 128 Pawn* victim = dynamic_cast<Pawn*>(otherObject);128 Pawn* victim = orxonox_cast<Pawn*>(otherObject); 129 129 if (victim) 130 130 victim->damage(dmg, this->owner_); -
code/trunk/src/orxonox/objects/worldentities/Attacher.cc
r3110 r3325 111 111 return; 112 112 113 WorldEntity* entity = dynamic_cast<WorldEntity*>(object);113 WorldEntity* entity = orxonox_cast<WorldEntity*>(object); 114 114 if (entity && entity->getName() == this->targetname_) 115 115 { -
code/trunk/src/orxonox/objects/worldentities/BigExplosion.cc
r3280 r3325 99 99 Identifier* idDE1 = Class(MovableEntity); 100 100 BaseObject* oDE1 = idDE1->fabricate(this); 101 this->debrisEntity1_ = dynamic_cast<MovableEntity*>(oDE1);101 this->debrisEntity1_ = orxonox_cast<MovableEntity*>(oDE1); 102 102 103 103 Identifier* idDE2 = Class(MovableEntity); 104 104 BaseObject* oDE2 = idDE2->fabricate(this); 105 this->debrisEntity2_ = dynamic_cast<MovableEntity*>(oDE2);105 this->debrisEntity2_ = orxonox_cast<MovableEntity*>(oDE2); 106 106 107 107 Identifier* idDE3 = Class(MovableEntity); 108 108 BaseObject* oDE3 = idDE3 ->fabricate(this); 109 this->debrisEntity3_ = dynamic_cast<MovableEntity*>(oDE3);109 this->debrisEntity3_ = orxonox_cast<MovableEntity*>(oDE3); 110 110 111 111 Identifier* idDE4 = Class(MovableEntity); 112 112 BaseObject* oDE4 = idDE4->fabricate(this); 113 this->debrisEntity4_ = dynamic_cast<MovableEntity*>(oDE4);113 this->debrisEntity4_ = orxonox_cast<MovableEntity*>(oDE4); 114 114 115 115 Identifier* idD1 = Class(Model); 116 116 BaseObject* oD1 = idD1->fabricate(this); 117 this->debris1_ = dynamic_cast<Model*>(oD1);117 this->debris1_ = orxonox_cast<Model*>(oD1); 118 118 119 119 Identifier* idD2 = Class(Model); 120 120 BaseObject* oD2 = idD2->fabricate(this); 121 this->debris2_ = dynamic_cast<Model*>(oD2);121 this->debris2_ = orxonox_cast<Model*>(oD2); 122 122 123 123 Identifier* idD3 = Class(Model); 124 124 BaseObject* oD3 = idD3->fabricate(this); 125 this->debris3_ = dynamic_cast<Model*>(oD3);125 this->debris3_ = orxonox_cast<Model*>(oD3); 126 126 127 127 Identifier* idD4 = Class(Model); 128 128 BaseObject* oD4 = idD4->fabricate(this); 129 this->debris4_ = dynamic_cast<Model*>(oD4);129 this->debris4_ = orxonox_cast<Model*>(oD4); 130 130 131 131 Identifier* id6 = Class(StaticEntity); 132 132 BaseObject* object4 = id6->fabricate(this); 133 this->explosion_ = dynamic_cast<StaticEntity*>(object4);133 this->explosion_ = orxonox_cast<StaticEntity*>(object4); 134 134 135 135 this->debrisSmoke1_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_); … … 202 202 Identifier* idf1 = Class(Model); 203 203 BaseObject* obj1 = idf1->fabricate(this); 204 Model* part1 = dynamic_cast<Model*>(obj1);204 Model* part1 = orxonox_cast<Model*>(obj1); 205 205 206 206 207 207 Identifier* idf2 = Class(Model); 208 208 BaseObject* obj2 = idf2->fabricate(this); 209 Model* part2 = dynamic_cast<Model*>(obj2);209 Model* part2 = orxonox_cast<Model*>(obj2); 210 210 211 211 Identifier* idf3 = Class(MovableEntity); 212 212 BaseObject* obj3 = idf3->fabricate(this); 213 MovableEntity* partEntity1 = dynamic_cast<MovableEntity*>(obj3);213 MovableEntity* partEntity1 = orxonox_cast<MovableEntity*>(obj3); 214 214 215 215 Identifier* idf4 = Class(MovableEntity); 216 216 BaseObject* obj4 = idf4->fabricate(this); 217 MovableEntity* partEntity2 = dynamic_cast<MovableEntity*>(obj4);217 MovableEntity* partEntity2 = orxonox_cast<MovableEntity*>(obj4); 218 218 219 219 partEntity1->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10,100)); -
code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc
r3280 r3325 267 267 if (this->playerID_ != OBJECTID_UNKNOWN) 268 268 { 269 this->player_ = dynamic_cast<PlayerInfo*>(Synchronisable::getSynchronisable(this->playerID_));269 this->player_ = orxonox_cast<PlayerInfo*>(Synchronisable::getSynchronisable(this->playerID_)); 270 270 if (this->player_ && (this->player_->getControllableEntity() != this)) 271 271 this->player_->startControl(this); -
code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc
r3280 r3325 76 76 if (GameMode::isMaster() && enableCollisionDamage_) 77 77 { 78 Pawn* victim = dynamic_cast<Pawn*>(otherObject);78 Pawn* victim = orxonox_cast<Pawn*>(otherObject); 79 79 if (victim) 80 80 { -
code/trunk/src/orxonox/objects/worldentities/PongBall.cc
r3280 r3325 231 231 this->bat_ = new PongBat*[2]; 232 232 if (this->batID_[0] != OBJECTID_UNKNOWN) 233 this->bat_[0] = dynamic_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[0]));233 this->bat_[0] = orxonox_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[0])); 234 234 if (this->batID_[1] != OBJECTID_UNKNOWN) 235 this->bat_[1] = dynamic_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[1]));235 this->bat_[1] = orxonox_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[1])); 236 236 } 237 237 } -
code/trunk/src/orxonox/objects/worldentities/PongCenterpoint.cc
r3110 r3325 73 73 if (this->getGametype() && this->getGametype()->isA(Class(Pong))) 74 74 { 75 Pong* pong_gametype = dynamic_cast<Pong*>(this->getGametype());75 Pong* pong_gametype = orxonox_cast<Pong*>(this->getGametype()); 76 76 pong_gametype->setCenterpoint(this); 77 77 } -
code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc
r3280 r3325 210 210 if (this->parentID_ != OBJECTID_UNKNOWN) 211 211 { 212 WorldEntity* parent = dynamic_cast<WorldEntity*>(Synchronisable::getSynchronisable(this->parentID_));212 WorldEntity* parent = orxonox_cast<WorldEntity*>(Synchronisable::getSynchronisable(this->parentID_)); 213 213 if (parent) 214 214 this->attachToParent(parent); -
code/trunk/src/orxonox/objects/worldentities/pawns/Destroyer.cc
r3110 r3325 40 40 RegisterObject(Destroyer); 41 41 42 UnderAttack* gametype = dynamic_cast<UnderAttack*>(this->getGametype());42 UnderAttack* gametype = orxonox_cast<UnderAttack*>(this->getGametype()); 43 43 if (gametype) 44 44 { -
code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc
r3280 r3325 198 198 { 199 199 BaseObject* object = identifier->fabricate(this); 200 this->engine_ = dynamic_cast<Engine*>(object);200 this->engine_ = orxonox_cast<Engine*>(object); 201 201 202 202 if (this->engine_) -
code/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc
r3280 r3325 45 45 this->state_ = BaseState::Uncontrolled; 46 46 47 TeamBaseMatch* gametype = dynamic_cast<TeamBaseMatch*>(this->getGametype());47 TeamBaseMatch* gametype = orxonox_cast<TeamBaseMatch*>(this->getGametype()); 48 48 if (gametype) 49 49 { … … 58 58 this->fireEvent(); 59 59 60 TeamDeathmatch* gametype = dynamic_cast<TeamDeathmatch*>(this->getGametype());60 TeamDeathmatch* gametype = orxonox_cast<TeamDeathmatch*>(this->getGametype()); 61 61 if (!gametype) 62 62 return; … … 84 84 if ((*it)->isA(Class(TeamColourable))) 85 85 { 86 TeamColourable* tc = dynamic_cast<TeamColourable*>(*it);86 TeamColourable* tc = orxonox_cast<TeamColourable*>(*it); 87 87 tc->setTeamColour(colour); 88 88 } -
code/trunk/src/orxonox/objects/worldentities/triggers/CheckPoint.cc
r3196 r3325 85 85 DistanceTrigger::triggered(bIsTriggered); 86 86 87 Asteroids* gametype = dynamic_cast<Asteroids*>(this->getGametype());87 Asteroids* gametype = orxonox_cast<Asteroids*>(this->getGametype()); 88 88 if (gametype) 89 89 { -
code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
r3280 r3325 120 120 for (ClassTreeMaskObjectIterator it = this->targetMask_.begin(); it != this->targetMask_.end(); ++it) 121 121 { 122 WorldEntity* entity = dynamic_cast<WorldEntity*>(*it);122 WorldEntity* entity = orxonox_cast<WorldEntity*>(*it); 123 123 if (!entity) 124 124 continue; … … 131 131 if(this->isForPlayer()) 132 132 { 133 Pawn* player = dynamic_cast<Pawn*>(entity);133 Pawn* player = orxonox_cast<Pawn*>(entity); 134 134 this->setTriggeringPlayer(player); 135 135 } -
code/trunk/src/orxonox/overlays/hud/AnnounceMessage.cc
r3110 r3325 56 56 SUPER(AnnounceMessage, changedOwner); 57 57 58 this->owner_ = dynamic_cast<PlayerInfo*>(this->getOwner());58 this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner()); 59 59 } 60 60 } -
code/trunk/src/orxonox/overlays/hud/DeathMessage.cc
r3110 r3325 56 56 SUPER(DeathMessage, changedOwner); 57 57 58 this->owner_ = dynamic_cast<PlayerInfo*>(this->getOwner());58 this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner()); 59 59 } 60 60 } -
code/trunk/src/orxonox/overlays/hud/GametypeStatus.cc
r3300 r3325 86 86 SUPER(GametypeStatus, changedOwner); 87 87 88 this->owner_ = dynamic_cast<PlayerInfo*>(this->getOwner());88 this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner()); 89 89 } 90 90 } -
code/trunk/src/orxonox/overlays/hud/HUDHealthBar.cc
r3300 r3325 94 94 SUPER(HUDHealthBar, changedOwner); 95 95 96 this->owner_ = dynamic_cast<Pawn*>(this->getOwner());96 this->owner_ = orxonox_cast<Pawn*>(this->getOwner()); 97 97 } 98 98 -
code/trunk/src/orxonox/overlays/hud/HUDRadar.cc
r3280 r3325 164 164 SUPER(HUDRadar, changedOwner); 165 165 166 this->owner_ = dynamic_cast<Pawn*>(this->getOwner());166 this->owner_ = orxonox_cast<Pawn*>(this->getOwner()); 167 167 } 168 168 } -
code/trunk/src/orxonox/overlays/hud/HUDSpeedBar.cc
r3196 r3325 65 65 SUPER(HUDSpeedBar, changedOwner); 66 66 67 this->owner_ = dynamic_cast<SpaceShip*>(this->getOwner());67 this->owner_ = orxonox_cast<SpaceShip*>(this->getOwner()); 68 68 } 69 69 } -
code/trunk/src/orxonox/overlays/hud/HUDTimer.cc
r3300 r3325 68 68 SUPER(HUDTimer, changedOwner); 69 69 70 this->owner_ = dynamic_cast<ControllableEntity*>(this->getOwner());70 this->owner_ = orxonox_cast<ControllableEntity*>(this->getOwner()); 71 71 } 72 72 } -
code/trunk/src/orxonox/overlays/hud/KillMessage.cc
r3110 r3325 56 56 SUPER(KillMessage, changedOwner); 57 57 58 this->owner_ = dynamic_cast<PlayerInfo*>(this->getOwner());58 this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner()); 59 59 } 60 60 } -
code/trunk/src/orxonox/overlays/hud/PongScore.cc
r3280 r3325 133 133 134 134 if (this->getOwner() && this->getOwner()->getGametype()) 135 this->owner_ = dynamic_cast<Pong*>(this->getOwner()->getGametype());135 this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype()); 136 136 else 137 137 this->owner_ = 0; -
code/trunk/src/orxonox/overlays/hud/TeamBaseMatchScore.cc
r3280 r3325 118 118 119 119 if (this->getOwner() && this->getOwner()->getGametype()) 120 this->owner_ = dynamic_cast<TeamBaseMatch*>(this->getOwner()->getGametype());120 this->owner_ = orxonox_cast<TeamBaseMatch*>(this->getOwner()->getGametype()); 121 121 else 122 122 this->owner_ = 0; -
code/trunk/src/orxonox/overlays/hud/UnderAttackHealthBar.cc
r3196 r3325 73 73 SUPER(UnderAttackHealthBar, changedOwner); 74 74 75 PlayerInfo* player = dynamic_cast<PlayerInfo*>(this->getOwner());75 PlayerInfo* player = orxonox_cast<PlayerInfo*>(this->getOwner()); 76 76 if (player) 77 77 { 78 78 this->owner_ = player; 79 79 80 UnderAttack* ua = dynamic_cast<UnderAttack*>(player->getGametype());80 UnderAttack* ua = orxonox_cast<UnderAttack*>(player->getGametype()); 81 81 if (ua) 82 82 { -
code/trunk/src/orxonox/overlays/map/Map.cc
r3300 r3325 359 359 //COUT(0) << "shipptr" << this->getOwner()->getReverseCamera() << std::endl; 360 360 361 ControllableEntity* entity = dynamic_cast<ControllableEntity*>(this->getOwner());361 ControllableEntity* entity = orxonox_cast<ControllableEntity*>(this->getOwner()); 362 362 if(entity && entity->getReverseCamera()) 363 363 {
Note: See TracChangeset
for help on using the changeset viewer.