BVB Source Codes

CRYENGINE Show AIObjectManager.h Source code

Return Download CRYENGINE: download AIObjectManager.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #ifndef AIOBJECTMANAGER
  4. #define AIOBJECTMANAGER
  5.  
  6. #if _MSC_VER > 1000
  7.         #pragma once
  8. #endif
  9.  
  10. #include <CryAISystem/IAIObjectManager.h>
  11.  
  12. #include <CryMemory/PoolAllocator.h>
  13.  
  14. typedef std::multimap<short, CCountedRef<CAIObject>> AIObjectOwners;
  15. typedef std::multimap<short, CWeakRef<CAIObject>>    AIObjects;
  16.  
  17. enum EAIClass
  18. {
  19.         eAIC_Invalid         = 0,
  20.  
  21.         eAIC_FIRST           = 1,
  22.  
  23.         eAIC_AIObject        = 1,
  24.         eAIC_AIActor         = 2,
  25.         eAIC_Leader          = 3,
  26.         eAIC_AIPlayer        = 4,
  27.         eAIC_PipeUser        = 5,
  28.         eAIC_Puppet          = 6,
  29.         eAIC_AIVehicle       = 7,
  30.         eAIC_AIFlyingVehicle = 8,
  31.  
  32.         eAIC_LAST            = eAIC_AIVehicle
  33. };
  34.  
  35. struct SAIObjectCreationHelper
  36. {
  37.         SAIObjectCreationHelper(CAIObject* pObject);
  38.         void       Serialize(TSerialize ser);
  39.         CAIObject* RecreateObject(void* alloc = NULL);
  40.  
  41.         string      name;
  42.         EAIClass    aiClass;
  43.         tAIObjectID objectId;
  44. };
  45.  
  46. class CAIObjectManager : public IAIObjectManager
  47. {
  48. public:
  49.  
  50.         CAIObjectManager();
  51.         virtual ~CAIObjectManager();
  52.  
  53.         void Init();
  54.         void Reset(bool includingPooled = true);
  55.  
  56.         ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  57.         //IAIObjectManager/////////////////////////////////////////////////////////////////////////////////////////////
  58.  
  59.         virtual IAIObject* CreateAIObject(const AIObjectParams& params);
  60.         virtual void       RemoveObject(tAIObjectID objectID);
  61.  
  62.         virtual IAIObject* GetAIObject(tAIObjectID aiObjectID);
  63.         virtual IAIObject* GetAIObjectByName(unsigned short type, const char* pName) const;
  64.  
  65.         // Returns AIObject iterator for first match, see EGetFirstFilter for the filter options.
  66.         // The parameter 'n' specifies the type, group id or species based on the selected filter.
  67.         // It is possible to iterate over all objects by setting the filter to OBJFILTER_TYPE
  68.         // passing zero to 'n'.
  69.         virtual IAIObjectIter* GetFirstAIObject(EGetFirstFilter filter, short n);
  70.         // Iterates over AI objects within specified range.
  71.         // Parameter 'pos' and 'rad' specify the enclosing sphere, for other parameters see GetFirstAIObject.
  72.         virtual IAIObjectIter* GetFirstAIObjectInRange(EGetFirstFilter filter, short n, const Vec3& pos, float rad, bool check2D);
  73.  
  74.         //IAIObjectManager/////////////////////////////////////////////////////////////////////////////////////////////
  75.         ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  76.  
  77.         // callback from CObjectContainer: notify the rest of the system that the object is disappearing
  78.         void OnObjectRemoved(CAIObject* pObject);
  79.  
  80.         //// it removes all references to this object from all objects of the specified type
  81.         //// (MATT) Note that is does not imply deletion - vehicles use it when they lose their driver {2009/02/05}
  82.         void       RemoveObjectFromAllOfType(int nType, CAIObject* pRemovedObject);
  83.  
  84.         void       CreateDummyObject(CCountedRef<CAIObject>& ref, const char* name = "", CAIObject::ESubType type = CAIObject::STP_NONE, tAIObjectID requiredID = INVALID_AIOBJECTID);
  85.         void       CreateDummyObject(CStrongRef<CAIObject>& ref, const char* name = "", CAIObject::ESubType type = CAIObject::STP_NONE, tAIObjectID requiredID = INVALID_AIOBJECTID);
  86.  
  87.         CAIObject* GetAIObjectByName(const char* pName) const;
  88.  
  89.         // todo: ideally not public
  90.         AIObjectOwners m_Objects;// m_RootObjects or EntityObjects might be better names
  91.         AIObjects      m_mapDummyObjects;
  92. };
  93.  
  94. #endif
  95.  
downloadAIObjectManager.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top