1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-25 15:54:31 +01:00

Append scenario text object on S4/S6 park load

This commit is contained in:
Aaron van Geffen
2024-10-28 18:45:34 +01:00
parent 263b73cb31
commit e13dfc1741
3 changed files with 19 additions and 1 deletions

View File

@@ -1516,6 +1516,15 @@ namespace OpenRCT2::RCT1
AppendRequiredObjects(result, ObjectType::FootpathRailings, _footpathRailingsEntries);
AppendRequiredObjects(result, ObjectType::PeepNames, std::vector<std::string>({ "rct2.peep_names.original" }));
RCT12AddDefaultObjects(result);
// Normalise the name to make the scenario as recognisable as possible
auto normalisedName = ScenarioSources::NormaliseName(_s4.ScenarioName);
// Infer what scenario text object to use, if any
SourceDescriptor desc;
if (ScenarioSources::TryGetByName(normalisedName.c_str(), &desc) && desc.textObjectId != nullptr)
AppendRequiredObjects(result, ObjectType::ScenarioText, std::vector<std::string>({ desc.textObjectId }));
return result;
}

View File

@@ -1883,6 +1883,15 @@ namespace OpenRCT2::RCT2
AppendRequiredObjects(objectList, ObjectType::TerrainEdge, _terrainEdgeEntries);
AppendRequiredObjects(objectList, ObjectType::PeepNames, std::vector<std::string>({ "rct2.peep_names.original" }));
RCT12AddDefaultObjects(objectList);
// Normalise the name to make the scenario as recognisable as possible
auto normalisedName = ScenarioSources::NormaliseName(_s6.Info.Name);
// Infer what scenario text object to use, if any
SourceDescriptor desc;
if (ScenarioSources::TryGetByName(normalisedName.c_str(), &desc) && desc.textObjectId != nullptr)
AppendRequiredObjects(objectList, ObjectType::ScenarioText, std::vector<std::string>({ desc.textObjectId }));
return objectList;
}
};

View File

@@ -109,7 +109,7 @@ void ScenarioReset(GameState_t& gameState)
gameState.Cash = gameState.InitialCash;
auto& objManager = GetContext()->GetObjectManager();
if (auto* object = objManager.GetLoadedObject(ObjectType::ScenarioText, 0))
if (auto* object = objManager.GetLoadedObject(ObjectType::ScenarioText, 0); object != nullptr)
{
auto* textObject = reinterpret_cast<ScenarioTextObject*>(object);