[Orxonox-commit 804] r3325 - in trunk: . src/core src/network src/network/synchronisable src/orxonox/interfaces src/orxonox/objects src/orxonox/objects/collisionshapes src/orxonox/objects/controllers src/orxonox/objects/gametypes src/orxonox/objects/infos src/orxonox/objects/items src/orxonox/objects/pickup src/orxonox/objects/quest src/orxonox/objects/weaponsystem/projectiles src/orxonox/objects/worldentities src/orxonox/objects/worldentities/pawns src/orxonox/objects/worldentities/triggers src/orxonox/overlays/hud src/orxonox/overlays/map
rgrieder at orxonox.net
rgrieder at orxonox.net
Sun Jul 19 15:48:01 CEST 2009
Author: rgrieder
Date: 2009-07-19 15:48:00 +0200 (Sun, 19 Jul 2009)
New Revision: 3325
Modified:
trunk/
trunk/src/core/CoreIncludes.h
trunk/src/core/EventIncludes.h
trunk/src/core/Identifier.cc
trunk/src/core/Identifier.h
trunk/src/core/Iterator.h
trunk/src/core/OrxonoxClass.h
trunk/src/core/Super.h
trunk/src/core/XMLPort.h
trunk/src/network/NetworkFunction.h
trunk/src/network/synchronisable/Synchronisable.cc
trunk/src/orxonox/interfaces/Tickable.h
trunk/src/orxonox/objects/Level.cc
trunk/src/orxonox/objects/Scene.cc
trunk/src/orxonox/objects/collisionshapes/CollisionShape.cc
trunk/src/orxonox/objects/controllers/ArtificialController.cc
trunk/src/orxonox/objects/controllers/HumanController.cc
trunk/src/orxonox/objects/gametypes/Pong.cc
trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc
trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc
trunk/src/orxonox/objects/infos/PlayerInfo.cc
trunk/src/orxonox/objects/items/Engine.cc
trunk/src/orxonox/objects/pickup/PickupCollection.cc
trunk/src/orxonox/objects/pickup/PickupSpawner.cc
trunk/src/orxonox/objects/quest/QuestManager.cc
trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc
trunk/src/orxonox/objects/worldentities/Attacher.cc
trunk/src/orxonox/objects/worldentities/BigExplosion.cc
trunk/src/orxonox/objects/worldentities/ControllableEntity.cc
trunk/src/orxonox/objects/worldentities/MovableEntity.cc
trunk/src/orxonox/objects/worldentities/PongBall.cc
trunk/src/orxonox/objects/worldentities/PongCenterpoint.cc
trunk/src/orxonox/objects/worldentities/WorldEntity.cc
trunk/src/orxonox/objects/worldentities/pawns/Destroyer.cc
trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc
trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc
trunk/src/orxonox/objects/worldentities/triggers/CheckPoint.cc
trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
trunk/src/orxonox/overlays/hud/AnnounceMessage.cc
trunk/src/orxonox/overlays/hud/DeathMessage.cc
trunk/src/orxonox/overlays/hud/GametypeStatus.cc
trunk/src/orxonox/overlays/hud/HUDHealthBar.cc
trunk/src/orxonox/overlays/hud/HUDRadar.cc
trunk/src/orxonox/overlays/hud/HUDSpeedBar.cc
trunk/src/orxonox/overlays/hud/HUDTimer.cc
trunk/src/orxonox/overlays/hud/KillMessage.cc
trunk/src/orxonox/overlays/hud/PongScore.cc
trunk/src/orxonox/overlays/hud/TeamBaseMatchScore.cc
trunk/src/orxonox/overlays/hud/UnderAttackHealthBar.cc
trunk/src/orxonox/overlays/map/Map.cc
Log:
Merged orxonox_cast related revisions from core4 back to trunk.
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/buildsystem:1875-2277,2279-2401
/branches/buildsystem2:2507-2659
/branches/buildsystem3:2663-2709
/branches/ceguilua:1803-1809
/branches/core3:1573-1740
/branches/core4:3228,3235-3238,3243,3245-3251,3253-3255,3257,3260-3262,3265-3266,3269,3271,3278
/branches/gametypes:2827-3032
/branches/gcc43:1581
/branches/gui:1636-1724,2796-2895
/branches/input:1630-1637
/branches/lodfinal:2373-2412
/branches/map:2802-3087,3090
/branches/miniprojects:2755-2825
/branches/netp2:2836-2989
/branches/netp3:2989-3083
/branches/netp6:3215-3303
/branches/network:2357
/branches/network64:2211-2356
/branches/objecthierarchy:1912-2086,2101,2111-2170
/branches/objecthierarchy2:2172-2480
/branches/overlay:2118-2386
/branches/particles:2830-3086
/branches/pch:3114-3195
/branches/physics:1913-2056,2108-2440
/branches/physics_merge:2437-2458
/branches/pickups:1927-2087,2128,2828-2916
/branches/pickups2:2108-2498,2916-3072
/branches/presentation:2370-2653,2655-2661
/branches/questsystem:1895-2089
/branches/questsystem2:2108-2260
/branches/questsystem5:2777-2906
/branches/script_trigger:1296-1954,1956
/branches/sound:2830-3011
/branches/weapon:1926-2095
/branches/weapon2:2108-2489
/branches/weapons:2898-3052
/branches/weaponsystem:2743-2891
+ /branches/buildsystem:1875-2277,2279-2401
/branches/buildsystem2:2507-2659
/branches/buildsystem3:2663-2709
/branches/ceguilua:1803-1809
/branches/core3:1573-1740
/branches/core4:3222-3225,3228,3235-3239,3243,3245-3251,3253-3255,3257,3260-3262,3265-3266,3269,3271,3278
/branches/gametypes:2827-3032
/branches/gcc43:1581
/branches/gui:1636-1724,2796-2895
/branches/input:1630-1637
/branches/lodfinal:2373-2412
/branches/map:2802-3087,3090
/branches/miniprojects:2755-2825
/branches/netp2:2836-2989
/branches/netp3:2989-3083
/branches/netp6:3215-3303
/branches/network:2357
/branches/network64:2211-2356
/branches/objecthierarchy:1912-2086,2101,2111-2170
/branches/objecthierarchy2:2172-2480
/branches/overlay:2118-2386
/branches/particles:2830-3086
/branches/pch:3114-3195
/branches/physics:1913-2056,2108-2440
/branches/physics_merge:2437-2458
/branches/pickups:1927-2087,2128,2828-2916
/branches/pickups2:2108-2498,2916-3072
/branches/presentation:2370-2653,2655-2661
/branches/questsystem:1895-2089
/branches/questsystem2:2108-2260
/branches/questsystem5:2777-2906
/branches/script_trigger:1296-1954,1956
/branches/sound:2830-3011
/branches/weapon:1926-2095
/branches/weapon2:2108-2489
/branches/weapons:2898-3052
/branches/weaponsystem:2743-2891
Modified: trunk/src/core/CoreIncludes.h
===================================================================
--- trunk/src/core/CoreIncludes.h 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/core/CoreIncludes.h 2009-07-19 13:48:00 UTC (rev 3325)
@@ -55,34 +55,16 @@
@param bRootClass True if the class is directly derived from OrxonoxClass
*/
#define InternRegisterObject(ClassName, bRootClass) \
- this->setIdentifier(orxonox::ClassIdentifier<ClassName>::getIdentifier(#ClassName)); \
- if (orxonox::Identifier::isCreatingHierarchy()) \
- { \
- if (this->getParents()) \
- { \
- orxonox::ClassIdentifier<ClassName>::getIdentifier(#ClassName)->initializeClassHierarchy(this->getParents(), bRootClass); \
- this->getParents()->insert(this->getParents()->end(), this->getIdentifier()); \
- } \
- this->setConfigValues(); \
+ if (ClassIdentifier<ClassName>::getIdentifier(#ClassName)->initialiseObject(this, #ClassName, bRootClass)) \
return; \
- } \
- orxonox::ClassIdentifier<ClassName>::getIdentifier()->addObject(this)
+ else \
+ ((void)0)
/**
- @brief Intern macro, containing the specific part of RegisterRootObject.
- @param ClassName The name of the class
-*/
-#define InternRegisterRootObject(ClassName) \
- if (orxonox::Identifier::isCreatingHierarchy() && !this->getParents()) \
- this->createParents(); \
- InternRegisterObject(ClassName, true)
-
-/**
@brief RegisterObject - with and without debug output.
@param ClassName The name of the class
*/
#define RegisterObject(ClassName) \
- COUT(5) << "*** Register Object: " << #ClassName << std::endl; \
InternRegisterObject(ClassName, false)
/**
@@ -90,8 +72,7 @@
@param ClassName The name of the class
*/
#define RegisterRootObject(ClassName) \
- COUT(5) << "*** Register Root-Object: " << #ClassName << std::endl; \
- InternRegisterRootObject(ClassName)
+ InternRegisterObject(ClassName, true)
/**
@brief Creates the entry in the Factory.
@@ -114,18 +95,26 @@
#define Class(ClassName) \
orxonox::ClassIdentifier<ClassName>::getIdentifier()
-/**
- @brief Returns the Identifier with a given name through the factory.
- @param String The name of the class
-*/
-#define ClassByString(String) \
- orxonox::Factory::getIdentifier(String)
-/**
- @brief Returns the Identifier with a given network ID through the factory.
- @param networkID The network ID of the class
-*/
-#define ClassByID(networkID) \
- orxonox::Factory::getIdentifier(networkID)
+namespace orxonox
+{
+ /**
+ @brief Returns the Identifier with a given name through the factory.
+ @param String The name of the class
+ */
+ inline Identifier* ClassByString(const std::string& name)
+ {
+ return Factory::getIdentifier(name);
+ }
+ /**
+ @brief Returns the Identifier with a given network ID through the factory.
+ @param networkID The network ID of the class
+ */
+ inline Identifier* ClassByID(uint32_t id)
+ {
+ return Factory::getIdentifier(id);
+ }
+}
+
#endif /* _CoreIncludes_H__ */
Modified: trunk/src/core/EventIncludes.h
===================================================================
--- trunk/src/core/EventIncludes.h 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/core/EventIncludes.h 2009-07-19 13:48:00 UTC (rev 3325)
@@ -53,7 +53,7 @@
containername = new orxonox::EventContainer(std::string(eventname), executor, orxonox::ClassIdentifier<subclassname>::getIdentifier()); \
this->addEventContainer(eventname, containername); \
} \
- event.castedOriginator_ = dynamic_cast<subclassname*>(event.originator_); \
+ event.castedOriginator_ = orxonox::orxonox_cast<subclassname*>(event.originator_); \
containername->process(this, event)
#define ORXONOX_SET_EVENT_GENERIC_TEMPLATE(containername, classname, eventname, functionname, event, subclassname, ...) \
@@ -65,7 +65,7 @@
containername = new orxonox::EventContainer(std::string(eventname), executor, orxonox::ClassIdentifier<subclassname>::getIdentifier()); \
this->addEventContainer(eventname, containername); \
} \
- event.castedOriginator_ = dynamic_cast<subclassname*>(event.originator_); \
+ event.castedOriginator_ = orxonox::orxonox_cast<subclassname*>(event.originator_); \
containername->process(this, event)
#endif /* _EventIncludes_H__ */
Modified: trunk/src/core/Identifier.cc
===================================================================
--- trunk/src/core/Identifier.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/core/Identifier.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -46,12 +46,14 @@
// ###############################
// ### Identifier ###
// ###############################
- 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)
+ int Identifier::hierarchyCreatingCounter_s = 0;
+ unsigned int Identifier::classIDCounter_s = 0;
/**
@brief Constructor: No factory, no object created, new ObjectList and a unique networkID.
*/
Identifier::Identifier()
+ : classID_(classIDCounter_s++)
{
this->objects_ = new ObjectListBase(this);
@@ -66,9 +68,8 @@
this->children_ = new std::set<const Identifier*>();
this->directChildren_ = new std::set<const Identifier*>();
- // Use a static variable because the classID gets created before main() and that's why we should avoid static member variables
- static unsigned int classIDcounter_s = 0;
- this->classID_ = classIDcounter_s++;
+ // Default network ID is the class ID
+ this->networkID_ = this->classID_;
}
/**
@@ -243,8 +244,8 @@
*/
void Identifier::setNetworkID(uint32_t id)
{
- Factory::changeNetworkID(this, this->classID_, id);
- this->classID_ = id;
+ Factory::changeNetworkID(this, this->networkID_, id);
+ this->networkID_ = id;
}
/**
Modified: trunk/src/core/Identifier.h
===================================================================
--- trunk/src/core/Identifier.h 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/core/Identifier.h 2009-07-19 13:48:00 UTC (rev 3325)
@@ -223,11 +223,14 @@
inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }
/** @brief Returns the network ID to identify a class through the network. @return the network ID */
- inline const uint32_t getNetworkID() const { return this->classID_; }
+ inline const uint32_t getNetworkID() const { return this->networkID_; }
/** @brief Sets the network ID to a new value. @param id The new value */
void setNetworkID(uint32_t id);
+ /** @brief Returns the unique ID of the class */
+ FORCEINLINE unsigned int getClassID() const { return this->classID_; }
+
void addConfigValueContainer(const std::string& varname, ConfigValueContainer* container);
ConfigValueContainer* getConfigValueContainer(const std::string& varname);
ConfigValueContainer* getLowercaseConfigValueContainer(const std::string& varname);
@@ -304,7 +307,9 @@
std::string name_; //!< The name of the class the Identifier belongs to
BaseFactory* factory_; //!< The Factory, able to create new objects of the given class (if available)
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)
- uint32_t classID_; //!< The network ID to identify a class through the network
+ uint32_t networkID_; //!< The network ID to identify a class through the network
+ const unsigned int classID_; //!< Uniquely identifies a class (might not be the same as the networkID_)
+ static unsigned int classIDCounter_s; //!< Static counter for the unique classIDs
bool bHasConfigValues_; //!< True if this class has at least one assigned config value
std::map<std::string, ConfigValueContainer*> configValues_; //!< A map to link the string of configurable variables with their ConfigValueContainer
@@ -343,8 +348,9 @@
public:
static ClassIdentifier<T> *getIdentifier();
static ClassIdentifier<T> *getIdentifier(const std::string& name);
- void addObject(T* object);
+ bool initialiseObject(T* object, const std::string& className, bool bRootClass);
+
void updateConfigValues(bool updateChildren = true) const;
private:
@@ -422,10 +428,37 @@
@param object The object to add
*/
template <class T>
- inline void ClassIdentifier<T>::addObject(T* object)
+ bool ClassIdentifier<T>::initialiseObject(T* object, const std::string& className, bool bRootClass)
{
- COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl;
- object->getMetaList().add(this->objects_, this->objects_->add(new ObjectListElement<T>(object)));
+ if (bRootClass)
+ COUT(5) << "*** Register Root-Object: " << className << std::endl;
+ else
+ COUT(5) << "*** Register Object: " << className << std::endl;
+
+ object->identifier_ = this;
+ if (Identifier::isCreatingHierarchy())
+ {
+ if (bRootClass && !object->parents_)
+ object->parents_ = new std::set<const Identifier*>();
+
+ if (object->parents_)
+ {
+ this->initializeClassHierarchy(object->parents_, bRootClass);
+ object->parents_->insert(object->parents_->end(), this);
+ }
+
+ object->setConfigValues();
+ return true;
+ }
+ else
+ {
+ COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl;
+ object->metaList_->add(this->objects_, this->objects_->add(new ObjectListElement<T>(object)));
+
+ // Add pointer of type T to the map in the OrxonoxClass instance that enables "dynamic_casts"
+ object->objectPointers_.push_back(std::make_pair(this->getClassID(), reinterpret_cast<void*>(object)));
+ return false;
+ }
}
/**
@@ -447,6 +480,53 @@
// ###############################
+ // ### orxonox_cast ###
+ // ###############################
+ //! Helper struct to have orxonox_cast<T*> instead of orxonox_cast<T>
+ template <class T, class U>
+ struct OrxonoxCaster
+ {
+ static T* cast(U* source)
+ {
+ // If you see this function in a compiler error description, it means
+ // you were misusing orxonox_cast. You must always cast to a pointer type!
+ *****T();
+ }
+ };
+
+ //! Helper struct to have orxonox_cast<T*> instead of orxonox_cast<T*>
+ template <class T, class U>
+ struct OrxonoxCaster<T*, U>
+ {
+ FORCEINLINE static T* cast(U* source)
+ {
+#ifdef ORXONOX_COMPILER_MSVC
+ return source->template getDerivedPointer<T>(ClassIdentifier<T>::getIdentifier()->getClassID());
+#else
+ return dynamic_cast<T*>(source);
+#endif
+ }
+ };
+
+ /**
+ @brief
+ Casts on object of type OrxonoxClass to any derived type that is
+ registered in the class hierarchy.
+ @return
+ Returns NULL if the cast is not possible
+ @note
+ In case of NULL return (and using MSVC), a dynamic_cast might still be possible if
+ a class forgot to register its objects.
+ Also note that the function is implemented differently for GCC/MSVC.
+ */
+ template <class T, class U>
+ FORCEINLINE T orxonox_cast(U* source)
+ {
+ return OrxonoxCaster<T, U>::cast(source);
+ }
+
+
+ // ###############################
// ### SubclassIdentifier ###
// ###############################
//! The SubclassIdentifier acts almost like an Identifier, but has some prerequisites.
@@ -538,7 +618,7 @@
// Check if the creation was successful
if (newObject)
{
- return dynamic_cast<T*>(newObject);
+ return orxonox_cast<T*>(newObject);
}
else
{
Modified: trunk/src/core/Iterator.h
===================================================================
--- trunk/src/core/Iterator.h 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/core/Iterator.h 2009-07-19 13:48:00 UTC (rev 3325)
@@ -239,7 +239,7 @@
inline T* operator*() const
{
if (this->element_)
- return dynamic_cast<T*>(this->element_->objectBase_);
+ return orxonox_cast<T*>(this->element_->objectBase_);
else
return 0;
}
@@ -251,7 +251,7 @@
inline T* operator->() const
{
if (this->element_)
- return dynamic_cast<T*>(this->element_->objectBase_);
+ return orxonox_cast<T*>(this->element_->objectBase_);
else
return 0;
}
Modified: trunk/src/core/OrxonoxClass.h
===================================================================
--- trunk/src/core/OrxonoxClass.h 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/core/OrxonoxClass.h 2009-07-19 13:48:00 UTC (rev 3325)
@@ -49,6 +49,9 @@
*/
class _CoreExport OrxonoxClass
{
+ template <class T>
+ friend class ClassIdentifier;
+
public:
OrxonoxClass();
virtual ~OrxonoxClass();
@@ -59,19 +62,6 @@
/** @brief Returns the Identifier of the object. @return The Identifier */
inline Identifier* getIdentifier() const { return this->identifier_; }
- /** @brief Sets the Identifier of the object. Used by the RegisterObject-macro. */
- inline void setIdentifier(Identifier* identifier) { this->identifier_ = identifier; }
-
- /** @brief Returns the list of all parents of the object. @return The list */
- inline std::set<const Identifier*>* getParents() const { return this->parents_; }
-
- /** @brief Creates the parents-list. */
- inline void createParents() { this->parents_ = new std::set<const Identifier*>(); }
-
- /** @brief Returns the MetaObjectList of the object, containing a link to all ObjectLists and ObjectListElements the object is registered in. @return The list */
- inline MetaObjectList& getMetaList() { return (*this->metaList_); }
-
-
bool isA(const Identifier* identifier);
bool isExactlyA(const Identifier* identifier);
bool isChildOf(const Identifier* identifier);
@@ -100,10 +90,30 @@
bool isParentOf(const OrxonoxClass* object);
bool isDirectParentOf(const OrxonoxClass* object);
+ /**
+ @brief
+ Returns a valid pointer of any derived type that is
+ registered in the class hierarchy.
+ @return
+ Returns NULL if the no pointer was found.
+ */
+ template <class T>
+ FORCEINLINE T* getDerivedPointer(unsigned int classID) const
+ {
+ for (int i = this->objectPointers_.size() - 1; i >= 0; --i)
+ {
+ if (this->objectPointers_[i].first == classID)
+ return reinterpret_cast<T*>(this->objectPointers_[i].second);
+ }
+ return NULL;
+ }
+
private:
Identifier* identifier_; //!< The Identifier of the object
std::set<const Identifier*>* parents_; //!< List of all parents of the object
MetaObjectList* metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
+ //! 'Fast map' that holds this-pointers of all derived types
+ std::vector<std::pair<unsigned int, void*> > objectPointers_;
};
}
Modified: trunk/src/core/Super.h
===================================================================
--- trunk/src/core/Super.h 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/core/Super.h 2009-07-19 13:48:00 UTC (rev 3325)
@@ -205,8 +205,13 @@
*/
// SUPER-macro: Calls Parent::functionname() where Parent is the direct parent of classname
- #define SUPER(classname, functionname, ...) \
- SUPER_##functionname(classname, functionname, __VA_ARGS__)
+ #ifdef ORXONOX_COMPILER_MSVC
+ #define SUPER(classname, functionname, ...) \
+ __super::functionname(__VA_ARGS__)
+ #else
+ #define SUPER(classname, functionname, ...) \
+ SUPER_##functionname(classname, functionname, __VA_ARGS__)
+ #endif
// helper macro: for functions without arguments
#define SUPER_NOARGS(classname, functionname) \
Modified: trunk/src/core/XMLPort.h
===================================================================
--- trunk/src/core/XMLPort.h 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/core/XMLPort.h 2009-07-19 13:48:00 UTC (rev 3325)
@@ -564,7 +564,7 @@
assert(newObject);
newObject->setLoaderIndentation(object->getLoaderIndentation() + " ");
- O* castedObject = dynamic_cast<O*>(newObject);
+ O* castedObject = orxonox_cast<O*>(newObject);
assert(castedObject);
if (this->bLoadBefore_)
Modified: trunk/src/network/NetworkFunction.h
===================================================================
--- trunk/src/network/NetworkFunction.h 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/network/NetworkFunction.h 2009-07-19 13:48:00 UTC (rev 3325)
@@ -38,8 +38,8 @@
#include <boost/preprocessor/cat.hpp>
#include <boost/static_assert.hpp>
-#include "core/OrxonoxClass.h"
#include "core/Functor.h"
+#include "core/Identifier.h"
#include "FunctionCallManager.h"
#include "synchronisable/Synchronisable.h"
@@ -152,32 +152,32 @@
inline void call(uint32_t objectID)
{
if ( Synchronisable::getSynchronisable(objectID)!=0 )
- (*this->functor_)(dynamic_cast<T*>(Synchronisable::getSynchronisable(objectID)));
+ (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)));
}
inline void call(uint32_t objectID, const MultiType& mt1)
{
if ( Synchronisable::getSynchronisable(objectID)!=0 )
- (*this->functor_)(dynamic_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1);
+ (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1);
}
inline void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2)
{
if ( Synchronisable::getSynchronisable(objectID)!=0 )
- (*this->functor_)(dynamic_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2);
+ (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2);
}
inline void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3)
{
if ( Synchronisable::getSynchronisable(objectID)!=0 )
- (*this->functor_)(dynamic_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3);
+ (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3);
}
inline void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4)
{
if ( Synchronisable::getSynchronisable(objectID)!=0 )
- (*this->functor_)(dynamic_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3, mt4);
+ (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3, mt4);
}
inline void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5)
{
if ( Synchronisable::getSynchronisable(objectID)!=0 )
- (*this->functor_)(dynamic_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3, mt4, mt5);
+ (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3, mt4, mt5);
}
private:
Modified: trunk/src/network/synchronisable/Synchronisable.cc
===================================================================
--- trunk/src/network/synchronisable/Synchronisable.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/network/synchronisable/Synchronisable.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -72,7 +72,7 @@
searchcreatorID:
if (creator)
{
- Synchronisable* synchronisable_creator = dynamic_cast<Synchronisable*>(creator);
+ Synchronisable* synchronisable_creator = orxonox_cast<Synchronisable*>(creator);
if (synchronisable_creator && synchronisable_creator->objectMode_)
{
this->creatorID = synchronisable_creator->getObjectID();
@@ -160,12 +160,12 @@
return 0;
}
else
- creator = dynamic_cast<BaseObject*>(synchronisable_creator);
+ creator = orxonox_cast<BaseObject*>(synchronisable_creator);
}
assert(getSynchronisable(header.getObjectID())==0); //make sure no object with this id exists
BaseObject *bo = id->fabricate(creator);
assert(bo);
- Synchronisable *no = dynamic_cast<Synchronisable *>(bo);
+ Synchronisable *no = orxonox_cast<Synchronisable*>(bo);
assert(no);
no->objectID=header.getObjectID();
no->creatorID=header.getCreatorID(); //TODO: remove this
Modified: trunk/src/orxonox/interfaces/Tickable.h
===================================================================
--- trunk/src/orxonox/interfaces/Tickable.h 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/interfaces/Tickable.h 2009-07-19 13:48:00 UTC (rev 3325)
@@ -56,7 +56,7 @@
@brief Gets called every frame.
@param dt The time since the last frame in seconds
*/
- virtual void tick(float dt) = 0;
+ virtual void tick(float dt) { }
protected:
Tickable();
Modified: trunk/src/orxonox/objects/Level.cc
===================================================================
--- trunk/src/orxonox/objects/Level.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/Level.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -120,7 +120,7 @@
std::cout << "Load Gametype: " << this->gametype_ << std::endl;
- Gametype* rootgametype = dynamic_cast<Gametype*>(identifier->fabricate(this));
+ Gametype* rootgametype = orxonox_cast<Gametype*>(identifier->fabricate(this));
this->setGametype(rootgametype);
std::cout << "root gametype: " << rootgametype->getIdentifier()->getName() << std::endl;
Modified: trunk/src/orxonox/objects/Scene.cc
===================================================================
--- trunk/src/orxonox/objects/Scene.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/Scene.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -325,9 +325,9 @@
{
// get the WorldEntity pointers
WorldEntity* object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
- assert(dynamic_cast<WorldEntity*>(object0));
+ assert(orxonox_cast<WorldEntity*>(object0));
WorldEntity* object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
- assert(dynamic_cast<WorldEntity*>(object1));
+ assert(orxonox_cast<WorldEntity*>(object1));
// false means that bullet will assume we didn't modify the contact
bool modified = false;
Modified: trunk/src/orxonox/objects/collisionshapes/CollisionShape.cc
===================================================================
--- trunk/src/orxonox/objects/collisionshapes/CollisionShape.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/collisionshapes/CollisionShape.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -84,12 +84,12 @@
Synchronisable* parent = Synchronisable::getSynchronisable(this->parentID_);
// Parent can either be a WorldEntity or a CompoundCollisionShape. The reason is that the
// internal collision shape (which is compound) of a WE doesn't get synchronised.
- CompoundCollisionShape* parentCCS = dynamic_cast<CompoundCollisionShape*>(parent);
+ CompoundCollisionShape* parentCCS = orxonox_cast<CompoundCollisionShape*>(parent);
if (parentCCS)
parentCCS->attach(this);
else
{
- WorldEntity* parentWE = dynamic_cast<WorldEntity*>(parent);
+ WorldEntity* parentWE = orxonox_cast<WorldEntity*>(parent);
if (parentWE)
parentWE->attachCollisionShape(this);
}
@@ -102,7 +102,7 @@
this->parent_ = newParent;
- WorldEntityCollisionShape* parentWECCS = dynamic_cast<WorldEntityCollisionShape*>(newParent);
+ WorldEntityCollisionShape* parentWECCS = orxonox_cast<WorldEntityCollisionShape*>(newParent);
if (parentWECCS)
this->parentID_ = parentWECCS->getWorldEntityOwner()->getObjectID();
else
Modified: trunk/src/orxonox/objects/controllers/ArtificialController.cc
===================================================================
--- trunk/src/orxonox/objects/controllers/ArtificialController.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/controllers/ArtificialController.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -180,18 +180,18 @@
if (entity1->getXMLController())
{
- WaypointPatrolController* wpc = dynamic_cast<WaypointPatrolController*>(entity1->getXMLController());
+ WaypointPatrolController* wpc = orxonox_cast<WaypointPatrolController*>(entity1->getXMLController());
if (wpc)
team1 = wpc->getTeam();
}
if (entity2->getXMLController())
{
- WaypointPatrolController* wpc = dynamic_cast<WaypointPatrolController*>(entity2->getXMLController());
+ WaypointPatrolController* wpc = orxonox_cast<WaypointPatrolController*>(entity2->getXMLController());
if (wpc)
team2 = wpc->getTeam();
}
- TeamDeathmatch* tdm = dynamic_cast<TeamDeathmatch*>(gametype);
+ TeamDeathmatch* tdm = orxonox_cast<TeamDeathmatch*>(gametype);
if (tdm)
{
if (entity1->getPlayer())
@@ -202,7 +202,7 @@
}
TeamBaseMatchBase* base = 0;
- base = dynamic_cast<TeamBaseMatchBase*>(entity1);
+ base = orxonox_cast<TeamBaseMatchBase*>(entity1);
if (base)
{
switch (base->getState())
@@ -218,7 +218,7 @@
team1 = -1;
}
}
- base = dynamic_cast<TeamBaseMatchBase*>(entity2);
+ base = orxonox_cast<TeamBaseMatchBase*>(entity2);
if (base)
{
switch (base->getState())
Modified: trunk/src/orxonox/objects/controllers/HumanController.cc
===================================================================
--- trunk/src/orxonox/objects/controllers/HumanController.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/controllers/HumanController.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -160,7 +160,7 @@
{
if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
{
- Pawn* pawn = dynamic_cast<Pawn*>(HumanController::localController_s->controllableEntity_);
+ Pawn* pawn = orxonox_cast<Pawn*>(HumanController::localController_s->controllableEntity_);
if (pawn)
pawn->kill();
else if (HumanController::localController_s->player_)
@@ -195,7 +195,7 @@
Pawn* HumanController::getLocalControllerEntityAsPawn()
{
if (HumanController::localController_s)
- return dynamic_cast<Pawn*>(HumanController::localController_s->getControllableEntity());
+ return orxonox_cast<Pawn*>(HumanController::localController_s->getControllableEntity());
else
return NULL;
}
Modified: trunk/src/orxonox/objects/gametypes/Pong.cc
===================================================================
--- trunk/src/orxonox/objects/gametypes/Pong.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/gametypes/Pong.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -143,7 +143,7 @@
if (player && player->getController() && player->getController()->isA(Class(PongAI)))
{
- PongAI* ai = dynamic_cast<PongAI*>(player->getController());
+ PongAI* ai = orxonox_cast<PongAI*>(player->getController());
ai->setPongBall(this->ball_);
}
}
Modified: trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc
===================================================================
--- trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -53,7 +53,7 @@
// Change the control of the defeated base and respawn it with its initial health
bool TeamBaseMatch::allowPawnDeath(Pawn* victim, Pawn* originator)
{
- TeamBaseMatchBase* base = dynamic_cast<TeamBaseMatchBase*>(victim);
+ TeamBaseMatchBase* base = orxonox_cast<TeamBaseMatchBase*>(victim);
if (base)
{
if (!originator)
@@ -86,7 +86,7 @@
// if the player is in the same team as the base, he can't make any damage to it
bool TeamBaseMatch::allowPawnDamage(Pawn* victim, Pawn* originator)
{
- TeamBaseMatchBase* base = dynamic_cast<TeamBaseMatchBase*>(victim);
+ TeamBaseMatchBase* base = orxonox_cast<TeamBaseMatchBase*>(victim);
if (base)
{
std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.find(base);
Modified: trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc
===================================================================
--- trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -125,7 +125,7 @@
{
if ((*it)->isA(Class(TeamSpawnPoint)))
{
- TeamSpawnPoint* tsp = dynamic_cast<TeamSpawnPoint*>(*it);
+ TeamSpawnPoint* tsp = orxonox_cast<TeamSpawnPoint*>(*it);
if (tsp && static_cast<int>(tsp->getTeamNumber()) != desiredTeamNr)
{
teamSpawnPoints.erase(it++);
@@ -170,7 +170,7 @@
{
if ((*it)->isA(Class(TeamColourable)))
{
- TeamColourable* tc = dynamic_cast<TeamColourable*>(*it);
+ TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
tc->setTeamColour(this->teamcolours_[it_player->second]);
}
}
Modified: trunk/src/orxonox/objects/infos/PlayerInfo.cc
===================================================================
--- trunk/src/orxonox/objects/infos/PlayerInfo.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/infos/PlayerInfo.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -185,7 +185,7 @@
if (this->controllableEntityID_ != OBJECTID_UNKNOWN)
{
Synchronisable* temp = Synchronisable::getSynchronisable(this->controllableEntityID_);
- ControllableEntity* entity = dynamic_cast<ControllableEntity*>(temp);
+ ControllableEntity* entity = orxonox_cast<ControllableEntity*>(temp);
this->startControl(entity);
}
else
@@ -198,7 +198,7 @@
{
if (this->gtinfoID_ != OBJECTID_UNKNOWN)
{
- this->gtinfo_ = dynamic_cast<GametypeInfo*>(Synchronisable::getSynchronisable(this->gtinfoID_));
+ this->gtinfo_ = orxonox_cast<GametypeInfo*>(Synchronisable::getSynchronisable(this->gtinfoID_));
if (!this->gtinfo_)
this->gtinfoID_ = OBJECTID_UNKNOWN;
Modified: trunk/src/orxonox/objects/items/Engine.cc
===================================================================
--- trunk/src/orxonox/objects/items/Engine.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/items/Engine.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -137,7 +137,7 @@
{
Synchronisable* object = Synchronisable::getSynchronisable(this->shipID_);
if (object)
- this->addToSpaceShip(dynamic_cast<SpaceShip*>(object));
+ this->addToSpaceShip(orxonox_cast<SpaceShip*>(object));
}
}
Modified: trunk/src/orxonox/objects/pickup/PickupCollection.cc
===================================================================
--- trunk/src/orxonox/objects/pickup/PickupCollection.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/pickup/PickupCollection.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -65,7 +65,7 @@
{
Identifier* ident = Class(UsableItem);
if(this->currentUsable_ == NULL && item->isA(ident))
- this->currentUsable_ = dynamic_cast<UsableItem*>(item);
+ this->currentUsable_ = orxonox_cast<UsableItem*>(item);
this->items_.insert( std::pair<std::string, BaseItem*> (item->getPickupIdentifier(), item) );
return true;
@@ -335,7 +335,7 @@
for (std::multimap<std::string, BaseItem*>::iterator it = this->items_.begin(); it != this->items_.end(); it++)
{
if ((*it).second->isA(ident))
- ret.push_back(dynamic_cast<EquipmentItem*>((*it).second));
+ ret.push_back(orxonox_cast<EquipmentItem*>((*it).second));
}
return ret;
@@ -352,7 +352,7 @@
for (std::multimap<std::string, BaseItem*>::iterator it = this->items_.begin(); it != this->items_.end(); it++)
{
if ((*it).second->isA(ident))
- ret.push_back(dynamic_cast<PassiveItem*>((*it).second));
+ ret.push_back(orxonox_cast<PassiveItem*>((*it).second));
}
return ret;
@@ -369,7 +369,7 @@
for (std::multimap<std::string, BaseItem*>::iterator it = this->items_.begin(); it != this->items_.end(); it++)
{
if ((*it).second->isA(ident))
- ret.push_back(dynamic_cast<UsableItem*>((*it).second));
+ ret.push_back(orxonox_cast<UsableItem*>((*it).second));
}
return ret;
Modified: trunk/src/orxonox/objects/pickup/PickupSpawner.cc
===================================================================
--- trunk/src/orxonox/objects/pickup/PickupSpawner.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/pickup/PickupSpawner.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -85,7 +85,7 @@
// Load the GUI image as soon as the PickupSpawner gets loaded
// = less delays while running
BaseObject* newObject = this->itemTemplate_->getBaseclassIdentifier()->fabricate(this);
- BaseItem* asItem = dynamic_cast<BaseItem*>(newObject);
+ BaseItem* asItem = orxonox_cast<BaseItem*>(newObject);
if (asItem)
{
asItem->addTemplate(this->itemTemplate_);
@@ -153,7 +153,7 @@
if (this->isActive() && this->itemTemplate_ && this->itemTemplate_->getBaseclassIdentifier())
{
BaseObject* newObject = this->itemTemplate_->getBaseclassIdentifier()->fabricate(this);
- BaseItem* asItem = dynamic_cast<BaseItem*>(newObject);
+ BaseItem* asItem = orxonox_cast<BaseItem*>(newObject);
if (asItem)
{
asItem->setPickupIdentifier(this->itemTemplateName_);
Modified: trunk/src/orxonox/objects/quest/QuestManager.cc
===================================================================
--- trunk/src/orxonox/objects/quest/QuestManager.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/quest/QuestManager.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -238,7 +238,7 @@
COUT(1) << "Error: GUIOverlay has no owner. " << std::endl;
return NULL;
}
- player = dynamic_cast<PlayerInfo*>(obj);
+ player = orxonox_cast<PlayerInfo*>(obj);
QuestContainer* root = NULL;
QuestContainer* current = NULL;
Modified: trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -125,7 +125,7 @@
if (this->owner_)
dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
- Pawn* victim = dynamic_cast<Pawn*>(otherObject);
+ Pawn* victim = orxonox_cast<Pawn*>(otherObject);
if (victim)
victim->damage(dmg, this->owner_);
}
Modified: trunk/src/orxonox/objects/worldentities/Attacher.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/Attacher.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/worldentities/Attacher.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -110,7 +110,7 @@
if (this->target_ || this->targetname_ == "")
return;
- WorldEntity* entity = dynamic_cast<WorldEntity*>(object);
+ WorldEntity* entity = orxonox_cast<WorldEntity*>(object);
if (entity && entity->getName() == this->targetname_)
{
this->target_ = entity;
Modified: trunk/src/orxonox/objects/worldentities/BigExplosion.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/BigExplosion.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/worldentities/BigExplosion.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -98,39 +98,39 @@
{
Identifier* idDE1 = Class(MovableEntity);
BaseObject* oDE1 = idDE1->fabricate(this);
- this->debrisEntity1_ = dynamic_cast<MovableEntity*>(oDE1);
+ this->debrisEntity1_ = orxonox_cast<MovableEntity*>(oDE1);
Identifier* idDE2 = Class(MovableEntity);
BaseObject* oDE2 = idDE2->fabricate(this);
- this->debrisEntity2_ = dynamic_cast<MovableEntity*>(oDE2);
+ this->debrisEntity2_ = orxonox_cast<MovableEntity*>(oDE2);
Identifier* idDE3 = Class(MovableEntity);
BaseObject* oDE3 = idDE3 ->fabricate(this);
- this->debrisEntity3_ = dynamic_cast<MovableEntity*>(oDE3);
+ this->debrisEntity3_ = orxonox_cast<MovableEntity*>(oDE3);
Identifier* idDE4 = Class(MovableEntity);
BaseObject* oDE4 = idDE4->fabricate(this);
- this->debrisEntity4_ = dynamic_cast<MovableEntity*>(oDE4);
+ this->debrisEntity4_ = orxonox_cast<MovableEntity*>(oDE4);
Identifier* idD1 = Class(Model);
BaseObject* oD1 = idD1->fabricate(this);
- this->debris1_ = dynamic_cast<Model*>(oD1);
+ this->debris1_ = orxonox_cast<Model*>(oD1);
Identifier* idD2 = Class(Model);
BaseObject* oD2 = idD2->fabricate(this);
- this->debris2_ = dynamic_cast<Model*>(oD2);
+ this->debris2_ = orxonox_cast<Model*>(oD2);
Identifier* idD3 = Class(Model);
BaseObject* oD3 = idD3->fabricate(this);
- this->debris3_ = dynamic_cast<Model*>(oD3);
+ this->debris3_ = orxonox_cast<Model*>(oD3);
Identifier* idD4 = Class(Model);
BaseObject* oD4 = idD4->fabricate(this);
- this->debris4_ = dynamic_cast<Model*>(oD4);
+ this->debris4_ = orxonox_cast<Model*>(oD4);
Identifier* id6 = Class(StaticEntity);
BaseObject* object4 = id6->fabricate(this);
- this->explosion_ = dynamic_cast<StaticEntity*>(object4);
+ this->explosion_ = orxonox_cast<StaticEntity*>(object4);
this->debrisSmoke1_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
this->debrisSmoke2_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
@@ -201,20 +201,20 @@
{
Identifier* idf1 = Class(Model);
BaseObject* obj1 = idf1->fabricate(this);
- Model* part1 = dynamic_cast<Model*>(obj1);
+ Model* part1 = orxonox_cast<Model*>(obj1);
Identifier* idf2 = Class(Model);
BaseObject* obj2 = idf2->fabricate(this);
- Model* part2 = dynamic_cast<Model*>(obj2);
+ Model* part2 = orxonox_cast<Model*>(obj2);
Identifier* idf3 = Class(MovableEntity);
BaseObject* obj3 = idf3->fabricate(this);
- MovableEntity* partEntity1 = dynamic_cast<MovableEntity*>(obj3);
+ MovableEntity* partEntity1 = orxonox_cast<MovableEntity*>(obj3);
Identifier* idf4 = Class(MovableEntity);
BaseObject* obj4 = idf4->fabricate(this);
- MovableEntity* partEntity2 = dynamic_cast<MovableEntity*>(obj4);
+ MovableEntity* partEntity2 = orxonox_cast<MovableEntity*>(obj4);
partEntity1->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10,100));
partEntity1->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
Modified: trunk/src/orxonox/objects/worldentities/ControllableEntity.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/ControllableEntity.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/worldentities/ControllableEntity.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -266,7 +266,7 @@
// just do this in case the entity wasn't yet synchronized when the corresponding PlayerInfo got our objectID
if (this->playerID_ != OBJECTID_UNKNOWN)
{
- this->player_ = dynamic_cast<PlayerInfo*>(Synchronisable::getSynchronisable(this->playerID_));
+ this->player_ = orxonox_cast<PlayerInfo*>(Synchronisable::getSynchronisable(this->playerID_));
if (this->player_ && (this->player_->getControllableEntity() != this))
this->player_->startControl(this);
}
Modified: trunk/src/orxonox/objects/worldentities/MovableEntity.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/MovableEntity.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/worldentities/MovableEntity.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -75,7 +75,7 @@
{
if (GameMode::isMaster() && enableCollisionDamage_)
{
- Pawn* victim = dynamic_cast<Pawn*>(otherObject);
+ Pawn* victim = orxonox_cast<Pawn*>(otherObject);
if (victim)
{
victim->damage(this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length());
Modified: trunk/src/orxonox/objects/worldentities/PongBall.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/PongBall.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/worldentities/PongBall.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -230,8 +230,8 @@
if (!this->bat_)
this->bat_ = new PongBat*[2];
if (this->batID_[0] != OBJECTID_UNKNOWN)
- this->bat_[0] = dynamic_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[0]));
+ this->bat_[0] = orxonox_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[0]));
if (this->batID_[1] != OBJECTID_UNKNOWN)
- this->bat_[1] = dynamic_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[1]));
+ this->bat_[1] = orxonox_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[1]));
}
}
Modified: trunk/src/orxonox/objects/worldentities/PongCenterpoint.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/PongCenterpoint.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/worldentities/PongCenterpoint.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -72,7 +72,7 @@
{
if (this->getGametype() && this->getGametype()->isA(Class(Pong)))
{
- Pong* pong_gametype = dynamic_cast<Pong*>(this->getGametype());
+ Pong* pong_gametype = orxonox_cast<Pong*>(this->getGametype());
pong_gametype->setCenterpoint(this);
}
}
Modified: trunk/src/orxonox/objects/worldentities/WorldEntity.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/WorldEntity.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/worldentities/WorldEntity.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -209,7 +209,7 @@
{
if (this->parentID_ != OBJECTID_UNKNOWN)
{
- WorldEntity* parent = dynamic_cast<WorldEntity*>(Synchronisable::getSynchronisable(this->parentID_));
+ WorldEntity* parent = orxonox_cast<WorldEntity*>(Synchronisable::getSynchronisable(this->parentID_));
if (parent)
this->attachToParent(parent);
}
Modified: trunk/src/orxonox/objects/worldentities/pawns/Destroyer.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/pawns/Destroyer.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/worldentities/pawns/Destroyer.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -39,7 +39,7 @@
{
RegisterObject(Destroyer);
- UnderAttack* gametype = dynamic_cast<UnderAttack*>(this->getGametype());
+ UnderAttack* gametype = orxonox_cast<UnderAttack*>(this->getGametype());
if (gametype)
{
gametype->addDestroyer(this);
Modified: trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -197,7 +197,7 @@
if (identifier)
{
BaseObject* object = identifier->fabricate(this);
- this->engine_ = dynamic_cast<Engine*>(object);
+ this->engine_ = orxonox_cast<Engine*>(object);
if (this->engine_)
{
Modified: trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -44,7 +44,7 @@
this->state_ = BaseState::Uncontrolled;
- TeamBaseMatch* gametype = dynamic_cast<TeamBaseMatch*>(this->getGametype());
+ TeamBaseMatch* gametype = orxonox_cast<TeamBaseMatch*>(this->getGametype());
if (gametype)
{
gametype->addBase(this);
@@ -57,7 +57,7 @@
{
this->fireEvent();
- TeamDeathmatch* gametype = dynamic_cast<TeamDeathmatch*>(this->getGametype());
+ TeamDeathmatch* gametype = orxonox_cast<TeamDeathmatch*>(this->getGametype());
if (!gametype)
return;
@@ -83,7 +83,7 @@
{
if ((*it)->isA(Class(TeamColourable)))
{
- TeamColourable* tc = dynamic_cast<TeamColourable*>(*it);
+ TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
tc->setTeamColour(colour);
}
}
Modified: trunk/src/orxonox/objects/worldentities/triggers/CheckPoint.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/triggers/CheckPoint.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/worldentities/triggers/CheckPoint.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -84,7 +84,7 @@
{
DistanceTrigger::triggered(bIsTriggered);
- Asteroids* gametype = dynamic_cast<Asteroids*>(this->getGametype());
+ Asteroids* gametype = orxonox_cast<Asteroids*>(this->getGametype());
if (gametype)
{
gametype->addTime(addTime_);
Modified: trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -119,7 +119,7 @@
// Iterate through all objects
for (ClassTreeMaskObjectIterator it = this->targetMask_.begin(); it != this->targetMask_.end(); ++it)
{
- WorldEntity* entity = dynamic_cast<WorldEntity*>(*it);
+ WorldEntity* entity = orxonox_cast<WorldEntity*>(*it);
if (!entity)
continue;
@@ -130,7 +130,7 @@
// If the target is a player (resp. is a, or is derived from a, ControllableEntity) the triggeringPlayer is set to the target entity.
if(this->isForPlayer())
{
- Pawn* player = dynamic_cast<Pawn*>(entity);
+ Pawn* player = orxonox_cast<Pawn*>(entity);
this->setTriggeringPlayer(player);
}
Modified: trunk/src/orxonox/overlays/hud/AnnounceMessage.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/AnnounceMessage.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/overlays/hud/AnnounceMessage.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -55,6 +55,6 @@
{
SUPER(AnnounceMessage, changedOwner);
- this->owner_ = dynamic_cast<PlayerInfo*>(this->getOwner());
+ this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner());
}
}
Modified: trunk/src/orxonox/overlays/hud/DeathMessage.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/DeathMessage.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/overlays/hud/DeathMessage.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -55,6 +55,6 @@
{
SUPER(DeathMessage, changedOwner);
- this->owner_ = dynamic_cast<PlayerInfo*>(this->getOwner());
+ this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner());
}
}
Modified: trunk/src/orxonox/overlays/hud/GametypeStatus.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/GametypeStatus.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/overlays/hud/GametypeStatus.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -85,6 +85,6 @@
{
SUPER(GametypeStatus, changedOwner);
- this->owner_ = dynamic_cast<PlayerInfo*>(this->getOwner());
+ this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner());
}
}
Modified: trunk/src/orxonox/overlays/hud/HUDHealthBar.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/HUDHealthBar.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/overlays/hud/HUDHealthBar.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -93,7 +93,7 @@
{
SUPER(HUDHealthBar, changedOwner);
- this->owner_ = dynamic_cast<Pawn*>(this->getOwner());
+ this->owner_ = orxonox_cast<Pawn*>(this->getOwner());
}
void HUDHealthBar::changedOverlayGroup()
Modified: trunk/src/orxonox/overlays/hud/HUDRadar.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/HUDRadar.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/overlays/hud/HUDRadar.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -163,6 +163,6 @@
{
SUPER(HUDRadar, changedOwner);
- this->owner_ = dynamic_cast<Pawn*>(this->getOwner());
+ this->owner_ = orxonox_cast<Pawn*>(this->getOwner());
}
}
Modified: trunk/src/orxonox/overlays/hud/HUDSpeedBar.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/HUDSpeedBar.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/overlays/hud/HUDSpeedBar.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -64,6 +64,6 @@
{
SUPER(HUDSpeedBar, changedOwner);
- this->owner_ = dynamic_cast<SpaceShip*>(this->getOwner());
+ this->owner_ = orxonox_cast<SpaceShip*>(this->getOwner());
}
}
Modified: trunk/src/orxonox/overlays/hud/HUDTimer.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/HUDTimer.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/overlays/hud/HUDTimer.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -67,6 +67,6 @@
{
SUPER(HUDTimer, changedOwner);
- this->owner_ = dynamic_cast<ControllableEntity*>(this->getOwner());
+ this->owner_ = orxonox_cast<ControllableEntity*>(this->getOwner());
}
}
Modified: trunk/src/orxonox/overlays/hud/KillMessage.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/KillMessage.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/overlays/hud/KillMessage.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -55,6 +55,6 @@
{
SUPER(KillMessage, changedOwner);
- this->owner_ = dynamic_cast<PlayerInfo*>(this->getOwner());
+ this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner());
}
}
Modified: trunk/src/orxonox/overlays/hud/PongScore.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/PongScore.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/overlays/hud/PongScore.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -132,7 +132,7 @@
SUPER(PongScore, changedOwner);
if (this->getOwner() && this->getOwner()->getGametype())
- this->owner_ = dynamic_cast<Pong*>(this->getOwner()->getGametype());
+ this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype());
else
this->owner_ = 0;
}
Modified: trunk/src/orxonox/overlays/hud/TeamBaseMatchScore.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/TeamBaseMatchScore.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/overlays/hud/TeamBaseMatchScore.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -117,7 +117,7 @@
SUPER(TeamBaseMatchScore, changedOwner);
if (this->getOwner() && this->getOwner()->getGametype())
- this->owner_ = dynamic_cast<TeamBaseMatch*>(this->getOwner()->getGametype());
+ this->owner_ = orxonox_cast<TeamBaseMatch*>(this->getOwner()->getGametype());
else
this->owner_ = 0;
}
Modified: trunk/src/orxonox/overlays/hud/UnderAttackHealthBar.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/UnderAttackHealthBar.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/overlays/hud/UnderAttackHealthBar.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -72,12 +72,12 @@
{
SUPER(UnderAttackHealthBar, changedOwner);
- PlayerInfo* player = dynamic_cast<PlayerInfo*>(this->getOwner());
+ PlayerInfo* player = orxonox_cast<PlayerInfo*>(this->getOwner());
if (player)
{
this->owner_ = player;
- UnderAttack* ua = dynamic_cast<UnderAttack*>(player->getGametype());
+ UnderAttack* ua = orxonox_cast<UnderAttack*>(player->getGametype());
if (ua)
{
this->setOwner(ua->getDestroyer());
Modified: trunk/src/orxonox/overlays/map/Map.cc
===================================================================
--- trunk/src/orxonox/overlays/map/Map.cc 2009-07-19 13:37:06 UTC (rev 3324)
+++ trunk/src/orxonox/overlays/map/Map.cc 2009-07-19 13:48:00 UTC (rev 3325)
@@ -358,7 +358,7 @@
SUPER(Map, changedOwner);
//COUT(0) << "shipptr" << this->getOwner()->getReverseCamera() << std::endl;
- ControllableEntity* entity = dynamic_cast<ControllableEntity*>(this->getOwner());
+ ControllableEntity* entity = orxonox_cast<ControllableEntity*>(this->getOwner());
if(entity && entity->getReverseCamera())
{
//COUT(0) << "foo";
More information about the Orxonox-commit
mailing list