Colobot
Public Member Functions | List of all members
CObjectManager Class Reference

Manages CObject instances. More...

#include <src/object/object_manager.h>

Inheritance diagram for CObjectManager:
Inheritance graph
[legend]

Public Member Functions

 CObjectManager (Gfx::CEngine *engine, Gfx::CTerrain *terrain, Gfx::COldModelManager *oldModelManager, Gfx::CModelManager *modelManager, Gfx::CParticle *particle)
 
bool DeleteObject (CObject *instance)
 Deletes the object. More...
 
void DeleteAllObjects ()
 Deletes all objects. More...
 
CObjectGetObjectById (unsigned int id)
 Finds object by id (CObject::GetID()) More...
 
CObjectGetObjectByRank (unsigned int id)
 Gets object by id in range <0; number of objects - 1> More...
 
std::vector< CObject * > GetObjectsOfTeam (int team)
 Gets all objects of given team. More...
 
bool TeamExists (int team)
 Checks if any of team's objects exist. More...
 
void DestroyTeam (int team, DestructionType destructionType=DestructionType::Explosion)
 Destroy all objects of team. More...
 
int CountObjectsImplementing (ObjectInterfaceType interface)
 Counts all objects implementing given interface. More...
 
CObjectContainerProxy GetAllObjects ()
 Returns all objects. More...
 
CObjectCreateObject (ObjectCreateParams params)
 Creates an object. More...
 
CObjectCreateObject (Math::Vector pos, float angle, ObjectType type, float power=-1.0f)
 Creates an object. More...
 
std::vector< CObject * > RadarAll (CObject *pThis, ObjectType type=OBJECT_NULL, float angle=0.0f, float focus=Math::PI *2.0f, float minDist=0.0f, float maxDist=1000.0f, bool furthest=false, RadarFilter filter=FILTER_NONE, bool cbotTypes=false)
 Finds an object, like radar() in CBot. More...
 
std::vector< CObject * > RadarAll (CObject *pThis, std::vector< ObjectType > type=std::vector< ObjectType >(), float angle=0.0f, float focus=Math::PI *2.0f, float minDist=0.0f, float maxDist=1000.0f, bool furthest=false, RadarFilter filter=FILTER_NONE, bool cbotTypes=false)
 Finds an object, like radar() in CBot. More...
 
std::vector< CObject * > RadarAll (CObject *pThis, Math::Vector thisPosition, float thisAngle, ObjectType type=OBJECT_NULL, float angle=0.0f, float focus=Math::PI *2.0f, float minDist=0.0f, float maxDist=1000.0f, bool furthest=false, RadarFilter filter=FILTER_NONE, bool cbotTypes=false)
 Finds an object, like radar() in CBot. More...
 
std::vector< CObject * > RadarAll (CObject *pThis, Math::Vector thisPosition, float thisAngle, std::vector< ObjectType > type=std::vector< ObjectType >(), float angle=0.0f, float focus=Math::PI *2.0f, float minDist=0.0f, float maxDist=1000.0f, bool furthest=false, RadarFilter filter=FILTER_NONE, bool cbotTypes=false)
 Finds an object, like radar() in CBot. More...
 
CObjectRadar (CObject *pThis, ObjectType type=OBJECT_NULL, float angle=0.0f, float focus=Math::PI *2.0f, float minDist=0.0f, float maxDist=1000.0f, bool furthest=false, RadarFilter filter=FILTER_NONE, bool cbotTypes=false)
 Finds an object, like radar() in CBot. More...
 
CObjectRadar (CObject *pThis, std::vector< ObjectType > type=std::vector< ObjectType >(), float angle=0.0f, float focus=Math::PI *2.0f, float minDist=0.0f, float maxDist=1000.0f, bool furthest=false, RadarFilter filter=FILTER_NONE, bool cbotTypes=false)
 Finds an object, like radar() in CBot. More...
 
CObjectRadar (CObject *pThis, Math::Vector thisPosition, float thisAngle, ObjectType type=OBJECT_NULL, float angle=0.0f, float focus=Math::PI *2.0f, float minDist=0.0f, float maxDist=1000.0f, bool furthest=false, RadarFilter filter=FILTER_NONE, bool cbotTypes=false)
 Finds an object, like radar() in CBot. More...
 
CObjectRadar (CObject *pThis, Math::Vector thisPosition, float thisAngle, std::vector< ObjectType > type=std::vector< ObjectType >(), float angle=0.0f, float focus=Math::PI *2.0f, float minDist=0.0f, float maxDist=1000.0f, bool furthest=false, RadarFilter filter=FILTER_NONE, bool cbotTypes=false)
 Finds an object, like radar() in CBot. More...
 
CObjectFindNearest (CObject *pThis, ObjectType type=OBJECT_NULL, float maxDist=1000.0f, bool cbotTypes=false)
 Returns nearest object that's closer than maxDist. More...
 
CObjectFindNearest (CObject *pThis, std::vector< ObjectType > type=std::vector< ObjectType >(), float maxDist=1000.0f, bool cbotTypes=false)
 Returns nearest object that's closer than maxDist. More...
 
CObjectFindNearest (CObject *pThis, Math::Vector thisPosition, ObjectType type=OBJECT_NULL, float maxDist=1000.0f, bool cbotTypes=false)
 Returns nearest object that's closer than maxDist. More...
 
CObjectFindNearest (CObject *pThis, Math::Vector thisPosition, std::vector< ObjectType > type=std::vector< ObjectType >(), float maxDist=1000.0f, bool cbotTypes=false)
 Returns nearest object that's closer than maxDist. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from CSingleton< CObjectManager >
static CObjectManagerGetInstance ()
 
static CObjectManagerGetInstancePointer ()
 
static bool IsCreated ()
 
- Protected Member Functions inherited from CSingleton< CObjectManager >
Gfx::CEnginem_instance
 
- Static Protected Attributes inherited from CSingleton< CObjectManager >
static CObjectManagerm_instance
 

Detailed Description

Manages CObject instances.

Member Function Documentation

◆ CreateObject() [1/2]

CObject * CObjectManager::CreateObject ( ObjectCreateParams  params)

Creates an object.

◆ CreateObject() [2/2]

CObject * CObjectManager::CreateObject ( Math::Vector  pos,
float  angle,
ObjectType  type,
float  power = -1.0f 
)

Creates an object.

◆ DeleteObject()

bool CObjectManager::DeleteObject ( CObject instance)

Deletes the object.

◆ DeleteAllObjects()

void CObjectManager::DeleteAllObjects ( )

Deletes all objects.

◆ GetObjectById()

CObject * CObjectManager::GetObjectById ( unsigned int  id)

Finds object by id (CObject::GetID())

◆ GetObjectByRank()

CObject * CObjectManager::GetObjectByRank ( unsigned int  id)

Gets object by id in range <0; number of objects - 1>

◆ GetObjectsOfTeam()

std::vector< CObject * > CObjectManager::GetObjectsOfTeam ( int  team)

Gets all objects of given team.

◆ TeamExists()

bool CObjectManager::TeamExists ( int  team)

Checks if any of team's objects exist.

◆ DestroyTeam()

void CObjectManager::DestroyTeam ( int  team,
DestructionType  destructionType = DestructionType::Explosion 
)

Destroy all objects of team.

◆ CountObjectsImplementing()

int CObjectManager::CountObjectsImplementing ( ObjectInterfaceType  interface)

Counts all objects implementing given interface.

◆ GetAllObjects()

CObjectContainerProxy CObjectManager::GetAllObjects ( )
inline

Returns all objects.

◆ RadarAll() [1/4]

std::vector< CObject * > CObjectManager::RadarAll ( CObject pThis,
ObjectType  type = OBJECT_NULL,
float  angle = 0.0f,
float  focus = Math::PI*2.0f,
float  minDist = 0.0f,
float  maxDist = 1000.0f,
bool  furthest = false,
RadarFilter  filter = FILTER_NONE,
bool  cbotTypes = false 
)

Finds an object, like radar() in CBot.

◆ RadarAll() [2/4]

std::vector< CObject * > CObjectManager::RadarAll ( CObject pThis,
std::vector< ObjectType type = std::vector<ObjectType>(),
float  angle = 0.0f,
float  focus = Math::PI*2.0f,
float  minDist = 0.0f,
float  maxDist = 1000.0f,
bool  furthest = false,
RadarFilter  filter = FILTER_NONE,
bool  cbotTypes = false 
)

Finds an object, like radar() in CBot.

◆ RadarAll() [3/4]

std::vector< CObject * > CObjectManager::RadarAll ( CObject pThis,
Math::Vector  thisPosition,
float  thisAngle,
ObjectType  type = OBJECT_NULL,
float  angle = 0.0f,
float  focus = Math::PI*2.0f,
float  minDist = 0.0f,
float  maxDist = 1000.0f,
bool  furthest = false,
RadarFilter  filter = FILTER_NONE,
bool  cbotTypes = false 
)

Finds an object, like radar() in CBot.

◆ RadarAll() [4/4]

std::vector< CObject * > CObjectManager::RadarAll ( CObject pThis,
Math::Vector  thisPosition,
float  thisAngle,
std::vector< ObjectType type = std::vector<ObjectType>(),
float  angle = 0.0f,
float  focus = Math::PI*2.0f,
float  minDist = 0.0f,
float  maxDist = 1000.0f,
bool  furthest = false,
RadarFilter  filter = FILTER_NONE,
bool  cbotTypes = false 
)

Finds an object, like radar() in CBot.

◆ Radar() [1/4]

CObject * CObjectManager::Radar ( CObject pThis,
ObjectType  type = OBJECT_NULL,
float  angle = 0.0f,
float  focus = Math::PI*2.0f,
float  minDist = 0.0f,
float  maxDist = 1000.0f,
bool  furthest = false,
RadarFilter  filter = FILTER_NONE,
bool  cbotTypes = false 
)

Finds an object, like radar() in CBot.

◆ Radar() [2/4]

CObject * CObjectManager::Radar ( CObject pThis,
std::vector< ObjectType type = std::vector<ObjectType>(),
float  angle = 0.0f,
float  focus = Math::PI*2.0f,
float  minDist = 0.0f,
float  maxDist = 1000.0f,
bool  furthest = false,
RadarFilter  filter = FILTER_NONE,
bool  cbotTypes = false 
)

Finds an object, like radar() in CBot.

◆ Radar() [3/4]

CObject * CObjectManager::Radar ( CObject pThis,
Math::Vector  thisPosition,
float  thisAngle,
ObjectType  type = OBJECT_NULL,
float  angle = 0.0f,
float  focus = Math::PI*2.0f,
float  minDist = 0.0f,
float  maxDist = 1000.0f,
bool  furthest = false,
RadarFilter  filter = FILTER_NONE,
bool  cbotTypes = false 
)

Finds an object, like radar() in CBot.

◆ Radar() [4/4]

CObject * CObjectManager::Radar ( CObject pThis,
Math::Vector  thisPosition,
float  thisAngle,
std::vector< ObjectType type = std::vector<ObjectType>(),
float  angle = 0.0f,
float  focus = Math::PI*2.0f,
float  minDist = 0.0f,
float  maxDist = 1000.0f,
bool  furthest = false,
RadarFilter  filter = FILTER_NONE,
bool  cbotTypes = false 
)

Finds an object, like radar() in CBot.

◆ FindNearest() [1/4]

CObject * CObjectManager::FindNearest ( CObject pThis,
ObjectType  type = OBJECT_NULL,
float  maxDist = 1000.0f,
bool  cbotTypes = false 
)

Returns nearest object that's closer than maxDist.

◆ FindNearest() [2/4]

CObject * CObjectManager::FindNearest ( CObject pThis,
std::vector< ObjectType type = std::vector<ObjectType>(),
float  maxDist = 1000.0f,
bool  cbotTypes = false 
)

Returns nearest object that's closer than maxDist.

◆ FindNearest() [3/4]

CObject * CObjectManager::FindNearest ( CObject pThis,
Math::Vector  thisPosition,
ObjectType  type = OBJECT_NULL,
float  maxDist = 1000.0f,
bool  cbotTypes = false 
)

Returns nearest object that's closer than maxDist.

◆ FindNearest() [4/4]

CObject * CObjectManager::FindNearest ( CObject pThis,
Math::Vector  thisPosition,
std::vector< ObjectType type = std::vector<ObjectType>(),
float  maxDist = 1000.0f,
bool  cbotTypes = false 
)

Returns nearest object that's closer than maxDist.


The documentation for this class was generated from the following files: