Skip to content

Commit 448ad71

Browse files
authored
Merge pull request #273 from zrax/age_load_version_scan_fix
Fix loading .age files where the first page doesn't exist.
2 parents 83c4018 + 83a07d3 commit 448ad71

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

core/ResManager/plResManager.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -338,17 +338,21 @@ plAgeInfo* plResManager::ReadAge(const ST::string& filename, bool readPages)
338338

339339
PlasmaVer ageVer = PlasmaVer::pvUnknown;
340340
bool packed = true;
341-
if (age->getNumPages() > 0) {
342-
ST::string file = ST::format("{}_District_{}",
341+
for (size_t i = 0; i < age->getNumPages(); ++i) {
342+
ST::string base = ST::format("{}_District_{}",
343343
age->getAgeName(),
344-
age->getPage(0).fName);
345-
if (hsFileStream::FileExists(path + file + ".prp")) {
344+
age->getPage(i).fName);
345+
if (hsFileStream::FileExists(path + base + ".prp")) {
346346
ageVer = MAKE_VERSION(2, 0, 63, 12);
347-
} else if (hsFileStream::FileExists(path + file + ".prx")) {
347+
break;
348+
} else if (hsFileStream::FileExists(path + base + ".prx")) {
348349
ageVer = MAKE_VERSION(2, 0, 63, 12);
349350
packed = false;
350-
} else {
351+
break;
352+
} else if (hsFileStream::FileExists(path +
353+
ST::format("{}_{}.prp", age->getAgeName(), age->getPage(i).fName))) {
351354
ageVer = MAKE_VERSION(2, 1, 6, 10);
355+
break;
352356
}
353357
}
354358

0 commit comments

Comments
 (0)