mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-16 16:37:02 +00:00
CGameArea: Make use of size_t where applicable
Plays nicer with the standard library and avoids truncation warnings.
This commit is contained in:
@@ -78,11 +78,12 @@ public:
|
||||
uint32 TotalInstanceCount() const;
|
||||
CScriptObject* InstanceByID(uint32 InstanceID);
|
||||
uint32 FindUnusedInstanceID() const;
|
||||
CScriptObject* SpawnInstance(CScriptTemplate *pTemplate, CScriptLayer *pLayer,
|
||||
CScriptObject* SpawnInstance(CScriptTemplate* pTemplate, CScriptLayer* pLayer,
|
||||
const CVector3f& rkPosition = CVector3f::Zero(),
|
||||
const CQuaternion& rkRotation = CQuaternion::Identity(),
|
||||
const CVector3f& rkScale = CVector3f::One(),
|
||||
uint32 SuggestedID = -1, uint32 SuggestedLayerIndex = -1);
|
||||
uint32 SuggestedID = UINT32_MAX,
|
||||
uint32 SuggestedLayerIndex = UINT32_MAX);
|
||||
void AddInstanceToArea(CScriptObject *pInstance);
|
||||
void DeleteInstance(CScriptObject *pInstance);
|
||||
void ClearExtraDependencies();
|
||||
@@ -91,16 +92,16 @@ public:
|
||||
uint32 WorldIndex() const { return mWorldIndex; }
|
||||
CTransform4f Transform() const { return mTransform; }
|
||||
CMaterialSet* Materials() const { return mpMaterialSet; }
|
||||
uint32 NumWorldModels() const { return mWorldModels.size(); }
|
||||
uint32 NumStaticModels() const { return mStaticWorldModels.size(); }
|
||||
CModel* TerrainModel(uint32 iMdl) const { return mWorldModels[iMdl].get(); }
|
||||
CStaticModel* StaticModel(uint32 iMdl) const { return mStaticWorldModels[iMdl].get(); }
|
||||
size_t NumWorldModels() const { return mWorldModels.size(); }
|
||||
size_t NumStaticModels() const { return mStaticWorldModels.size(); }
|
||||
CModel* TerrainModel(size_t iMdl) const { return mWorldModels[iMdl].get(); }
|
||||
CStaticModel* StaticModel(size_t iMdl) const { return mStaticWorldModels[iMdl].get(); }
|
||||
CCollisionMeshGroup* Collision() const { return mpCollision.get(); }
|
||||
uint32 NumScriptLayers() const { return mScriptLayers.size(); }
|
||||
CScriptLayer* ScriptLayer(uint32 Index) const { return mScriptLayers[Index].get(); }
|
||||
uint32 NumLightLayers() const { return mLightLayers.size(); }
|
||||
uint32 NumLights(uint32 LayerIndex) const { return (LayerIndex < mLightLayers.size() ? mLightLayers[LayerIndex].size() : 0); }
|
||||
CLight* Light(uint32 LayerIndex, uint32 LightIndex) { return &mLightLayers[LayerIndex][LightIndex]; }
|
||||
size_t NumScriptLayers() const { return mScriptLayers.size(); }
|
||||
CScriptLayer* ScriptLayer(size_t Index) const { return mScriptLayers[Index].get(); }
|
||||
size_t NumLightLayers() const { return mLightLayers.size(); }
|
||||
size_t NumLights(size_t LayerIndex) const { return (LayerIndex < mLightLayers.size() ? mLightLayers[LayerIndex].size() : 0); }
|
||||
CLight* Light(size_t LayerIndex, size_t LightIndex) { return &mLightLayers[LayerIndex][LightIndex]; }
|
||||
CAssetID PathID() const { return mPathID; }
|
||||
CPoiToWorld* PoiToWorldMap() const { return mpPoiToWorldMap; }
|
||||
CAssetID PortalAreaID() const { return mPortalAreaID; }
|
||||
|
||||
@@ -41,7 +41,7 @@ void CWorld::SetAreaLayerInfo(CGameArea *pArea)
|
||||
|
||||
SArea& AreaInfo = mAreas[pArea->WorldIndex()];
|
||||
|
||||
for (uint32 iLyr = 0; iLyr < pArea->NumScriptLayers(); iLyr++)
|
||||
for (size_t iLyr = 0; iLyr < pArea->NumScriptLayers(); iLyr++)
|
||||
{
|
||||
if (AreaInfo.Layers.size() <= iLyr)
|
||||
break;
|
||||
|
||||
@@ -642,15 +642,15 @@ void CAreaLoader::ReadEGMC()
|
||||
void CAreaLoader::SetUpObjects(CScriptLayer *pGenLayer)
|
||||
{
|
||||
// Create instance map
|
||||
for (uint32 LayerIdx = 0; LayerIdx < mpArea->NumScriptLayers(); LayerIdx++)
|
||||
for (size_t LayerIdx = 0; LayerIdx < mpArea->NumScriptLayers(); LayerIdx++)
|
||||
{
|
||||
auto& pLayer = mpArea->mScriptLayers[LayerIdx];
|
||||
|
||||
for (uint32 InstIdx = 0; InstIdx < pLayer->NumInstances(); InstIdx++)
|
||||
for (size_t InstIdx = 0; InstIdx < pLayer->NumInstances(); InstIdx++)
|
||||
{
|
||||
CScriptObject *pInst = pLayer->InstanceByIndex(InstIdx);
|
||||
uint32 InstanceID = pInst->InstanceID();
|
||||
CScriptObject *pExisting = mpArea->InstanceByID(InstanceID);
|
||||
const uint32 InstanceID = pInst->InstanceID();
|
||||
[[maybe_unused]] CScriptObject *pExisting = mpArea->InstanceByID(InstanceID);
|
||||
ASSERT(pExisting == nullptr);
|
||||
mpArea->mObjectMap[InstanceID] = pInst;
|
||||
}
|
||||
@@ -673,11 +673,10 @@ void CAreaLoader::SetUpObjects(CScriptLayer *pGenLayer)
|
||||
pGenLayer->RemoveInstance(pInst);
|
||||
delete pInst;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
uint32 LayerIdx = (InstanceID >> 26) & 0x3F;
|
||||
pInst->SetLayer( mpArea->ScriptLayer(LayerIdx) );
|
||||
const uint32 LayerIdx = (InstanceID >> 26) & 0x3F;
|
||||
pInst->SetLayer(mpArea->ScriptLayer(LayerIdx));
|
||||
mpArea->mObjectMap[InstanceID] = pInst;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
return iLyr;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return UINT32_MAX;
|
||||
}
|
||||
|
||||
// Operators
|
||||
|
||||
Reference in New Issue
Block a user