CGameProject: Make use of size_t where applicable

Plays nicely with standard containers.
This commit is contained in:
Lioncash
2020-06-18 05:34:56 -04:00
parent 6a0a20e3fa
commit 5ce6b972a0
6 changed files with 18 additions and 17 deletions

View File

@@ -109,11 +109,11 @@ void GenerateAssetNames(CGameProject *pProj)
// Generate names for package named resources
debugf("Processing packages");
for (uint32 iPkg = 0; iPkg < pProj->NumPackages(); iPkg++)
for (size_t iPkg = 0; iPkg < pProj->NumPackages(); iPkg++)
{
CPackage *pPkg = pProj->PackageByIndex(iPkg);
for (uint32 iRes = 0; iRes < pPkg->NumNamedResources(); iRes++)
for (size_t iRes = 0; iRes < pPkg->NumNamedResources(); iRes++)
{
const SNamedResource& rkRes = pPkg->NamedResourceByIndex(iRes);
if (rkRes.Name.EndsWith("NODEPEND")) continue;

View File

@@ -669,11 +669,11 @@ TString CGameExporter::MakeWorldName(CAssetID WorldID)
// Find the original world name in the package resource names
TString WorldName;
for (uint32 iPkg = 0; iPkg < mpProject->NumPackages(); iPkg++)
for (size_t iPkg = 0; iPkg < mpProject->NumPackages(); iPkg++)
{
CPackage *pPkg = mpProject->PackageByIndex(iPkg);
for (uint32 iRes = 0; iRes < pPkg->NumNamedResources(); iRes++)
for (size_t iRes = 0; iRes < pPkg->NumNamedResources(); iRes++)
{
const SNamedResource& rkRes = pPkg->NamedResourceByIndex(iRes);

View File

@@ -87,8 +87,8 @@ public:
void SetProjectName(TString name) { mProjectName = std::move(name); }
TString Name() const { return mProjectName; }
uint32 NumPackages() const { return mPackages.size(); }
CPackage* PackageByIndex(uint32 Index) const { return mPackages[Index].get(); }
size_t NumPackages() const { return mPackages.size(); }
CPackage* PackageByIndex(size_t Index) const { return mPackages[Index].get(); }
void AddPackage(std::unique_ptr<CPackage>&& package) { mPackages.push_back(std::move(package)); }
CResourceStore* ResourceStore() const { return mpResourceStore.get(); }
CGameInfo* GameInfo() const { return mpGameInfo.get(); }

View File

@@ -330,7 +330,7 @@ bool CResourceEntry::Save(bool SkipCacheSave /*= false*/, bool FlagForRecook /*=
// Flag dirty any packages that contain this resource.
if (FlagForRecook)
{
for (uint32 iPkg = 0; iPkg < mpStore->Project()->NumPackages(); iPkg++)
for (size_t iPkg = 0; iPkg < mpStore->Project()->NumPackages(); iPkg++)
{
CPackage *pPkg = mpStore->Project()->PackageByIndex(iPkg);