Skip to content

Commit

Permalink
Merge pull request #273 from zrax/age_load_version_scan_fix
Browse files Browse the repository at this point in the history
Fix loading .age files where the first page doesn't exist.
  • Loading branch information
zrax authored May 8, 2023
2 parents 83c4018 + 83a07d3 commit 448ad71
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions core/ResManager/plResManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,17 +338,21 @@ plAgeInfo* plResManager::ReadAge(const ST::string& filename, bool readPages)

PlasmaVer ageVer = PlasmaVer::pvUnknown;
bool packed = true;
if (age->getNumPages() > 0) {
ST::string file = ST::format("{}_District_{}",
for (size_t i = 0; i < age->getNumPages(); ++i) {
ST::string base = ST::format("{}_District_{}",
age->getAgeName(),
age->getPage(0).fName);
if (hsFileStream::FileExists(path + file + ".prp")) {
age->getPage(i).fName);
if (hsFileStream::FileExists(path + base + ".prp")) {
ageVer = MAKE_VERSION(2, 0, 63, 12);
} else if (hsFileStream::FileExists(path + file + ".prx")) {
break;
} else if (hsFileStream::FileExists(path + base + ".prx")) {
ageVer = MAKE_VERSION(2, 0, 63, 12);
packed = false;
} else {
break;
} else if (hsFileStream::FileExists(path +
ST::format("{}_{}.prp", age->getAgeName(), age->getPage(i).fName))) {
ageVer = MAKE_VERSION(2, 1, 6, 10);
break;
}
}

Expand Down

0 comments on commit 448ad71

Please sign in to comment.