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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user