Spore ModAPI/Spore/Object.h file

Classes

class IVirtual
A default interface that provides a virtual destructor, it should only be used internally.
class Object
This class represents a basic reference counted object.
class DefaultObject
A default implementation of the Object class.
class DefaultRefCounted
The default implementation of a reference counted class.
class MultithreadObject
class RefCountTemplate
class RefCountTemplateAtomic
class BasicLockRefCounted

Functions

template<class Type, class CallerType>
auto object_cast(const CallerType pObject) -> Type*
Dynamically casts one instance of an Object into another type.

Defines

#define ObjectPtr
#define DefaultRefCountedPtr
#define CLASS_CAST(c)
#define PARENT_CAST(c)

Function documentation

template<class Type, class CallerType>
Type* object_cast(const CallerType pObject)

Dynamically casts one instance of an Object into another type.

The type you are casting to must have a static member called 'TYPE', but it does not need to be an Object. If the object cannot be casted to the given type, nullptr is returned. Example usage:

cGameData* pCreature = GetCreature();
cModelObject* pModel = object_cast<cModelObject>(pCreature);