mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-07-04 20:26:05 +00:00
CGameProject: Mark vars as const where applicable
This commit is contained in:
parent
811447a387
commit
bf9be7f2ad
@ -26,10 +26,10 @@ CGameProject::~CGameProject()
|
|||||||
bool CGameProject::Save()
|
bool CGameProject::Save()
|
||||||
{
|
{
|
||||||
mProjFileLock.Release();
|
mProjFileLock.Release();
|
||||||
TString ProjPath = ProjectPath();
|
const TString ProjPath = ProjectPath();
|
||||||
CXMLWriter Writer(ProjPath, "GameProject", (int) EProjectVersion::Current, mGame);
|
CXMLWriter Writer(ProjPath, "GameProject", static_cast<int>(EProjectVersion::Current), mGame);
|
||||||
Serialize(Writer);
|
Serialize(Writer);
|
||||||
bool SaveSuccess = Writer.Save();
|
const bool SaveSuccess = Writer.Save();
|
||||||
mProjFileLock.Lock(*ProjPath);
|
mProjFileLock.Lock(*ProjPath);
|
||||||
return SaveSuccess;
|
return SaveSuccess;
|
||||||
}
|
}
|
||||||
@ -46,8 +46,8 @@ bool CGameProject::Serialize(IArchive& rArc)
|
|||||||
|
|
||||||
if (!rArc.IsReader())
|
if (!rArc.IsReader())
|
||||||
{
|
{
|
||||||
for (uint32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
for (auto& package : mPackages)
|
||||||
PackageList.push_back( mPackages[iPkg]->DefinitionPath(true) );
|
PackageList.push_back(package->DefinitionPath(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
rArc << SerialParameter("Packages", PackageList);
|
rArc << SerialParameter("Packages", PackageList);
|
||||||
@ -78,16 +78,16 @@ bool CGameProject::Serialize(IArchive& rArc)
|
|||||||
|
|
||||||
bool CGameProject::BuildISO(const TString& rkIsoPath, IProgressNotifier *pProgress)
|
bool CGameProject::BuildISO(const TString& rkIsoPath, IProgressNotifier *pProgress)
|
||||||
{
|
{
|
||||||
ASSERT( FileUtil::IsValidPath(rkIsoPath, false) );
|
ASSERT(FileUtil::IsValidPath(rkIsoPath, false));
|
||||||
ASSERT( !IsWiiDeAsobu() && !IsTrilogy() );
|
ASSERT(!IsWiiDeAsobu() && !IsTrilogy());
|
||||||
|
|
||||||
auto ProgressCallback = [&](float ProgressPercent, const nod::SystemStringView& rkInfoString, size_t)
|
const auto ProgressCallback = [&](float ProgressPercent, const nod::SystemStringView& rkInfoString, size_t)
|
||||||
{
|
{
|
||||||
pProgress->Report((int) (ProgressPercent * 10000), 10000, nod::SystemUTF8Conv(rkInfoString).c_str());
|
pProgress->Report(static_cast<int>(ProgressPercent * 10000), 10000, nod::SystemUTF8Conv(rkInfoString).c_str());
|
||||||
};
|
};
|
||||||
|
|
||||||
pProgress->SetTask(0, "Building " + rkIsoPath.GetFileName());
|
pProgress->SetTask(0, "Building " + rkIsoPath.GetFileName());
|
||||||
TString DiscRoot = DiscDir(false);
|
const TString DiscRoot = DiscDir(false);
|
||||||
|
|
||||||
if (!IsWiiBuild())
|
if (!IsWiiBuild())
|
||||||
{
|
{
|
||||||
@ -103,18 +103,18 @@ bool CGameProject::BuildISO(const TString& rkIsoPath, IProgressNotifier *pProgre
|
|||||||
|
|
||||||
bool CGameProject::MergeISO(const TString& rkIsoPath, nod::DiscWii *pOriginalIso, IProgressNotifier *pProgress)
|
bool CGameProject::MergeISO(const TString& rkIsoPath, nod::DiscWii *pOriginalIso, IProgressNotifier *pProgress)
|
||||||
{
|
{
|
||||||
ASSERT( FileUtil::IsValidPath(rkIsoPath, false) );
|
ASSERT(FileUtil::IsValidPath(rkIsoPath, false));
|
||||||
ASSERT( IsWiiDeAsobu() || IsTrilogy() );
|
ASSERT(IsWiiDeAsobu() || IsTrilogy());
|
||||||
ASSERT( pOriginalIso != nullptr );
|
ASSERT(pOriginalIso != nullptr);
|
||||||
|
|
||||||
auto ProgressCallback = [&](float ProgressPercent, const nod::SystemStringView& rkInfoString, size_t)
|
const auto ProgressCallback = [&](float ProgressPercent, const nod::SystemStringView& rkInfoString, size_t)
|
||||||
{
|
{
|
||||||
pProgress->Report((int) (ProgressPercent * 10000), 10000, nod::SystemUTF8Conv(rkInfoString).c_str());
|
pProgress->Report(static_cast<int>(ProgressPercent * 10000), 10000, nod::SystemUTF8Conv(rkInfoString).c_str());
|
||||||
};
|
};
|
||||||
|
|
||||||
pProgress->SetTask(0, "Building " + rkIsoPath.GetFileName());
|
pProgress->SetTask(0, "Building " + rkIsoPath.GetFileName());
|
||||||
|
|
||||||
TString DiscRoot = DiscFilesystemRoot(false);
|
const TString DiscRoot = DiscFilesystemRoot(false);
|
||||||
|
|
||||||
nod::DiscMergerWii Merger(TStringToNodString(rkIsoPath), *pOriginalIso, IsTrilogy(), ProgressCallback);
|
nod::DiscMergerWii Merger(TStringToNodString(rkIsoPath), *pOriginalIso, IsTrilogy(), ProgressCallback);
|
||||||
return Merger.mergeFromDirectory(TStringToNodString(DiscRoot)) == nod::EBuildResult::Success;
|
return Merger.mergeFromDirectory(TStringToNodString(DiscRoot)) == nod::EBuildResult::Success;
|
||||||
@ -210,7 +210,7 @@ std::unique_ptr<CGameProject> CGameProject::LoadProject(const TString& rkProjPat
|
|||||||
pProgress->Report("Loading project settings");
|
pProgress->Report("Loading project settings");
|
||||||
bool LoadSuccess = false;
|
bool LoadSuccess = false;
|
||||||
|
|
||||||
TString ProjPath = rkProjPath;
|
const TString ProjPath = rkProjPath;
|
||||||
CXMLReader Reader(ProjPath);
|
CXMLReader Reader(ProjPath);
|
||||||
|
|
||||||
if (!Reader.IsValid())
|
if (!Reader.IsValid())
|
||||||
@ -263,7 +263,7 @@ std::unique_ptr<CGameProject> CGameProject::LoadProject(const TString& rkProjPat
|
|||||||
pProj->mpGameInfo->LoadGameInfo(pProj->mGame);
|
pProj->mpGameInfo->LoadGameInfo(pProj->mGame);
|
||||||
|
|
||||||
// Perform update
|
// Perform update
|
||||||
if (Reader.FileVersion() < (uint16) EProjectVersion::Current)
|
if (Reader.FileVersion() < static_cast<uint16>(EProjectVersion::Current))
|
||||||
{
|
{
|
||||||
pProgress->Report("Updating project");
|
pProgress->Report("Updating project");
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ std::unique_ptr<CGameProject> CGameProject::LoadProject(const TString& rkProjPat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create hidden files directory, if needed
|
// Create hidden files directory, if needed
|
||||||
TString HiddenDir = pProj->HiddenFilesDir();
|
const TString HiddenDir = pProj->HiddenFilesDir();
|
||||||
|
|
||||||
if (!FileUtil::Exists(HiddenDir))
|
if (!FileUtil::Exists(HiddenDir))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user