mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-18 01:15:26 +00:00
CWorld: Make use of size_t where applicable
Plays nicer with standard types and prevents type truncations.
This commit is contained in:
@@ -13,7 +13,7 @@ public:
|
||||
|
||||
void Clear() { mDependencies.clear(); }
|
||||
uint32 NumDependencies() const { return mDependencies.size(); }
|
||||
CAssetID DependencyByIndex(uint32 Index) const { return mDependencies[Index]; }
|
||||
CAssetID DependencyByIndex(size_t Index) const { return mDependencies[Index]; }
|
||||
|
||||
void AddDependency(const CAssetID& rkID)
|
||||
{
|
||||
|
||||
@@ -115,16 +115,16 @@ public:
|
||||
CModel* DefaultSkybox() const { return mpDefaultSkybox; }
|
||||
CResource* MapWorld() const { return mpMapWorld; }
|
||||
|
||||
uint32 NumAreas() const { return mAreas.size(); }
|
||||
CAssetID AreaResourceID(uint32 AreaIndex) const { return mAreas[AreaIndex].AreaResID; }
|
||||
uint32 AreaAttachedCount(uint32 AreaIndex) const { return mAreas[AreaIndex].AttachedAreaIDs.size(); }
|
||||
uint32 AreaAttachedID(uint32 AreaIndex, uint32 AttachedIndex) const { return mAreas[AreaIndex].AttachedAreaIDs[AttachedIndex]; }
|
||||
TString AreaInternalName(uint32 AreaIndex) const { return mAreas[AreaIndex].InternalName; }
|
||||
CStringTable* AreaName(uint32 AreaIndex) const { return mAreas[AreaIndex].pAreaName; }
|
||||
bool DoesAreaAllowPakDuplicates(uint32 AreaIndex) const { return mAreas[AreaIndex].AllowPakDuplicates; }
|
||||
size_t NumAreas() const { return mAreas.size(); }
|
||||
CAssetID AreaResourceID(size_t AreaIndex) const { return mAreas[AreaIndex].AreaResID; }
|
||||
uint32 AreaAttachedCount(size_t AreaIndex) const { return mAreas[AreaIndex].AttachedAreaIDs.size(); }
|
||||
uint32 AreaAttachedID(size_t AreaIndex, size_t AttachedIndex) const { return mAreas[AreaIndex].AttachedAreaIDs[AttachedIndex]; }
|
||||
TString AreaInternalName(size_t AreaIndex) const { return mAreas[AreaIndex].InternalName; }
|
||||
CStringTable* AreaName(size_t AreaIndex) const { return mAreas[AreaIndex].pAreaName; }
|
||||
bool DoesAreaAllowPakDuplicates(size_t AreaIndex) const { return mAreas[AreaIndex].AllowPakDuplicates; }
|
||||
|
||||
void SetName(TString rkName) { mName = std::move(rkName); }
|
||||
void SetAreaAllowsPakDuplicates(uint32 AreaIndex, bool Allow) { mAreas[AreaIndex].AllowPakDuplicates = Allow; }
|
||||
void SetAreaAllowsPakDuplicates(size_t AreaIndex, bool Allow) { mAreas[AreaIndex].AllowPakDuplicates = Allow; }
|
||||
};
|
||||
|
||||
#endif // CWORLD_H
|
||||
|
||||
@@ -434,13 +434,13 @@ std::unique_ptr<CMapArea> CUnsupportedFormatLoader::LoadMAPA(IInputStream& /*rMA
|
||||
|
||||
// Find a MapWorld that contains this MapArea
|
||||
CAssetID MapWorldID;
|
||||
uint32 WorldIndex = -1;
|
||||
size_t WorldIndex = SIZE_MAX;
|
||||
|
||||
for (TResourceIterator<EResourceType::MapWorld> It; It; ++It)
|
||||
{
|
||||
CDependencyGroup *pGroup = (CDependencyGroup*) It->Load();
|
||||
|
||||
for (uint32 AreaIdx = 0; AreaIdx < pGroup->NumDependencies(); AreaIdx++)
|
||||
for (size_t AreaIdx = 0; AreaIdx < pGroup->NumDependencies(); AreaIdx++)
|
||||
{
|
||||
if (pGroup->DependencyByIndex(AreaIdx) == MapAreaID)
|
||||
{
|
||||
@@ -450,12 +450,12 @@ std::unique_ptr<CMapArea> CUnsupportedFormatLoader::LoadMAPA(IInputStream& /*rMA
|
||||
}
|
||||
}
|
||||
|
||||
if (WorldIndex != -1)
|
||||
if (WorldIndex != SIZE_MAX)
|
||||
break;
|
||||
}
|
||||
|
||||
// Find a world that contains this MapWorld
|
||||
if (WorldIndex != -1)
|
||||
if (WorldIndex != SIZE_MAX)
|
||||
{
|
||||
for (TResourceIterator<EResourceType::World> It; It; ++It)
|
||||
{
|
||||
|
||||
@@ -263,16 +263,16 @@ void CWorldLoader::LoadReturnsMLVL(IInputStream& rMLVL)
|
||||
|
||||
void CWorldLoader::GenerateEditorData()
|
||||
{
|
||||
CGameInfo *pGameInfo = mpWorld->Entry()->ResourceStore()->Project()->GameInfo();
|
||||
const CGameInfo *pGameInfo = mpWorld->Entry()->ResourceStore()->Project()->GameInfo();
|
||||
|
||||
if (mVersion <= EGame::Prime)
|
||||
if (mVersion > EGame::Prime)
|
||||
return;
|
||||
|
||||
for (size_t iArea = 0; iArea < mpWorld->NumAreas(); iArea++)
|
||||
{
|
||||
for (uint32 iArea = 0; iArea < mpWorld->NumAreas(); iArea++)
|
||||
{
|
||||
CWorld::SArea& rArea = mpWorld->mAreas[iArea];
|
||||
rArea.InternalName = pGameInfo->GetAreaName(rArea.AreaResID);
|
||||
ASSERT(!rArea.InternalName.IsEmpty());
|
||||
}
|
||||
CWorld::SArea& rArea = mpWorld->mAreas[iArea];
|
||||
rArea.InternalName = pGameInfo->GetAreaName(rArea.AreaResID);
|
||||
ASSERT(!rArea.InternalName.IsEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user