实体
对象池 CPools
句柄互转与池指针
CPools.h
跨帧存 handle,再用 Get* 取指针。池满会创建失败。
句柄转指针
GetPed / GetVehicle / GetObject
脚本句柄 → 指针。无效 null。
static CPed* GetPed(int handle);
static CVehicle* GetVehicle(int handle);
static CObject* GetObject(int handle);指针转句柄
GetPedRef / GetVehicleRef / GetObjectRef
static int GetPedRef(CPed* ped);
static int GetVehicleRef(CVehicle* vehicle);
static int GetObjectRef(CObject* object);主对象池
ms_pPedPool / ms_pVehiclePool / ms_pObjectPool
static CPool<CPed, CCopPed*>& ms_pPedPool;
static CPool<CVehicle, CHeli*>& ms_pVehiclePool;
static CPool<CObject, CCutsceneObject*>& ms_pObjectPool;
static CPool<CBuilding*>& ms_pBuildingPool;
static CPool<CDummy*>& ms_pDummyPool;任务与其它池
ms_pTaskPool / ms_pPedIntelligencePool
任务槽紧,别泄漏 Task。
static CPool<CTask, char[128]*>& ms_pTaskPool;
static CPool<CPedIntelligence*>& ms_pPedIntelligencePool;
static CPool<CColModel*>& ms_pColModelPool;
static CPool<CPtrNodeSingleLink*>& ms_pPtrNodeSingleLinkPool;
static CPool<CPtrNodeDoubleLink*>& ms_pPtrNodeDoubleLinkPool;存档与槽位
Save / Load / MakeSureSlotInObjectPoolIsEmpty
一般只读;改存档流程要极谨慎。
static bool Save();
static bool Load();
static bool SavePedPool();
static bool LoadPedPool();
// Vehicle / Object 同理
static void MakeSureSlotInObjectPoolIsEmpty(int slot);