mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-22 06:23:04 +01:00
Allow loading images from .pob files (#15122)
This commit is contained in:
committed by
GitHub
parent
87007ba2a3
commit
71ff9bf6d6
@@ -270,15 +270,32 @@ std::string ImageTable::FindLegacyObject(const std::string& name)
|
||||
const auto env = GetContext()->GetPlatformEnvironment();
|
||||
auto objectsPath = env->GetDirectoryPath(DIRBASE::RCT2, DIRID::OBJECT);
|
||||
auto objectPath = Path::Combine(objectsPath, name);
|
||||
if (File::Exists(objectPath))
|
||||
{
|
||||
return objectPath;
|
||||
}
|
||||
|
||||
std::string altName = name;
|
||||
auto rangeStart = name.find(".DAT");
|
||||
if (rangeStart != std::string::npos)
|
||||
{
|
||||
altName.replace(rangeStart, 4, ".POB");
|
||||
}
|
||||
objectPath = Path::Combine(objectsPath, altName);
|
||||
if (File::Exists(objectPath))
|
||||
{
|
||||
return objectPath;
|
||||
}
|
||||
|
||||
if (!File::Exists(objectPath))
|
||||
{
|
||||
// Search recursively for any file with the target name (case insensitive)
|
||||
auto filter = Path::Combine(objectsPath, "*.dat");
|
||||
auto filter = Path::Combine(objectsPath, "*.dat;*.pob");
|
||||
auto scanner = Path::ScanDirectory(filter, true);
|
||||
while (scanner->Next())
|
||||
{
|
||||
auto currentName = Path::GetFileName(scanner->GetPathRelative());
|
||||
if (String::Equals(currentName, name, true))
|
||||
if (String::Equals(currentName, name, true) || String::Equals(currentName, altName, true))
|
||||
{
|
||||
objectPath = scanner->GetPath();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user