From b77aa9a956c5b920aaa930ff4af58c64c24456b1 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek <1478678+Gymnasiast@users.noreply.github.com> Date: Fri, 4 Jul 2025 18:52:58 +0200 Subject: [PATCH 01/95] Small cleanup of sound range parameters --- src/openrct2/audio/Audio.h | 2 +- src/openrct2/object/RideObject.cpp | 6 +-- src/openrct2/ride/CarEntry.h | 4 +- src/openrct2/ride/RideData.cpp | 2 +- src/openrct2/ride/Vehicle.cpp | 38 ++++++++++--------- src/openrct2/ride/Vehicle.h | 14 +++---- .../scripting/bindings/object/ScObject.hpp | 2 +- 7 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/openrct2/audio/Audio.h b/src/openrct2/audio/Audio.h index 758c83dc1e..3edac36578 100644 --- a/src/openrct2/audio/Audio.h +++ b/src/openrct2/audio/Audio.h @@ -121,7 +121,7 @@ namespace OpenRCT2::Audio LiftWildMouse, LiftBM, TrackFrictionBM, - Scream8, + Scream8, // Blood-curdling, Haunted House-like scream Tram, DoorOpen, DoorClose, diff --git a/src/openrct2/object/RideObject.cpp b/src/openrct2/object/RideObject.cpp index 03032ea46b..5d3ac6fe86 100644 --- a/src/openrct2/object/RideObject.cpp +++ b/src/openrct2/object/RideObject.cpp @@ -417,7 +417,7 @@ void RideObject::ReadLegacyCar([[maybe_unused]] IReadObjectContext* context, ISt car->spinning_friction = stream->ReadValue(); car->friction_sound_id = stream->ReadValue(); car->ReversedCarIndex = stream->ReadValue(); - car->sound_range = stream->ReadValue(); + car->soundRange = stream->ReadValue(); car->double_sound_frequency = stream->ReadValue(); car->powered_acceleration = stream->ReadValue(); car->powered_max_speed = stream->ReadValue(); @@ -561,7 +561,7 @@ void RideObject::ReadJson(IReadObjectContext* context, json_t& root) car.flags = CAR_ENTRY_FLAG_SPINNING; car.PaintStyle = VEHICLE_VISUAL_FLAT_RIDE_OR_CAR_RIDE; car.friction_sound_id = OpenRCT2::Audio::SoundId::Null; - car.sound_range = 0xFF; + car.soundRange = SoundRange::none; car.draw_order = 6; // Shop item @@ -719,7 +719,7 @@ CarEntry RideObject::ReadJsonCar([[maybe_unused]] IReadObjectContext* context, j car.spinning_friction = Json::GetNumber(jCar["spinningFriction"]); car.friction_sound_id = Json::GetEnum(jCar["frictionSoundId"], OpenRCT2::Audio::SoundId::Null); car.ReversedCarIndex = Json::GetNumber(jCar["logFlumeReverserVehicleType"]); - car.sound_range = Json::GetNumber(jCar["soundRange"], 255); + car.soundRange = Json::GetEnum(jCar["soundRange"], SoundRange::none); car.double_sound_frequency = Json::GetNumber(jCar["doubleSoundFrequency"]); car.powered_acceleration = Json::GetNumber(jCar["poweredAcceleration"]); car.powered_max_speed = Json::GetNumber(jCar["poweredMaxSpeed"]); diff --git a/src/openrct2/ride/CarEntry.h b/src/openrct2/ride/CarEntry.h index 3e7322792f..7abc6007df 100644 --- a/src/openrct2/ride/CarEntry.h +++ b/src/openrct2/ride/CarEntry.h @@ -23,6 +23,8 @@ namespace OpenRCT2::Audio enum class SoundId : uint8_t; } +enum class SoundRange : uint8_t; + enum class CarEntryAnimation : uint8_t { None = 0, @@ -213,7 +215,7 @@ struct CarEntry uint8_t spinning_friction; OpenRCT2::Audio::SoundId friction_sound_id; // Only valid for front/default car of train uint8_t ReversedCarIndex; // When the car is reversed (using a turntable or reverser), it will be changed to this car. - uint8_t sound_range; + SoundRange soundRange; uint8_t double_sound_frequency; // (Doubles the velocity when working out the sound frequency {used on go karts}) uint8_t powered_acceleration; uint8_t powered_max_speed; diff --git a/src/openrct2/ride/RideData.cpp b/src/openrct2/ride/RideData.cpp index 08ae7a49b1..382c7d189c 100644 --- a/src/openrct2/ride/RideData.cpp +++ b/src/openrct2/ride/RideData.cpp @@ -190,7 +190,7 @@ const CarEntry kCableLiftVehicle = { .spinning_friction = 255, .friction_sound_id = Audio::SoundId::LiftClassic, .ReversedCarIndex = 0, - .sound_range = 0, + .soundRange = SoundRange::screamsMisc, .double_sound_frequency = 0, .powered_acceleration = 0, .powered_max_speed = 0, diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index d2937d7ac4..07c5a61bc9 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -94,16 +94,16 @@ uint8_t _vehicleF64E2C; Vehicle* _vehicleFrontVehicle; CoordsXYZ _vehicleCurPosition; -static constexpr OpenRCT2::Audio::SoundId _screamSet0[] = { +static constexpr OpenRCT2::Audio::SoundId _screamSetMisc[] = { OpenRCT2::Audio::SoundId::Scream8, OpenRCT2::Audio::SoundId::Scream1, }; -static constexpr OpenRCT2::Audio::SoundId _screamSet1Wooden[] = { +static constexpr OpenRCT2::Audio::SoundId _screamSetWooden[] = { OpenRCT2::Audio::SoundId::Scream3, OpenRCT2::Audio::SoundId::Scream1, OpenRCT2::Audio::SoundId::Scream5, OpenRCT2::Audio::SoundId::Scream6, OpenRCT2::Audio::SoundId::Scream7, OpenRCT2::Audio::SoundId::Scream2, OpenRCT2::Audio::SoundId::Scream4, }; -static constexpr OpenRCT2::Audio::SoundId _screamSet2[] = { +static constexpr OpenRCT2::Audio::SoundId _screamSetSteel[] = { OpenRCT2::Audio::SoundId::Scream1, OpenRCT2::Audio::SoundId::Scream6, }; @@ -2528,8 +2528,8 @@ void Vehicle::UpdateDeparting() if (rideEntry->flags & RIDE_ENTRY_FLAG_PLAY_DEPART_SOUND) { - auto soundId = (rideEntry->Cars[0].sound_range == 4) ? OpenRCT2::Audio::SoundId::Tram - : OpenRCT2::Audio::SoundId::TrainDeparting; + auto soundId = (rideEntry->Cars[0].soundRange == SoundRange::tramBell) ? OpenRCT2::Audio::SoundId::Tram + : OpenRCT2::Audio::SoundId::TrainDeparting; OpenRCT2::Audio::Play3D(soundId, GetLocation()); } @@ -4884,9 +4884,9 @@ void Vehicle::UpdateSound() } const auto currentTicks = getGameState().currentTicks; - switch (carEntry.sound_range) + switch (carEntry.soundRange) { - case SOUND_RANGE_WHISTLE: + case SoundRange::steamWhistle: screamSound.id = scream_sound_id; if (!(currentTicks & 0x7F)) { @@ -4908,7 +4908,7 @@ void Vehicle::UpdateSound() screamSound.volume = 255; break; - case SOUND_RANGE_BELL: + case SoundRange::tramBell: screamSound.id = scream_sound_id; if (!(currentTicks & 0x7F)) { @@ -5032,16 +5032,16 @@ OpenRCT2::Audio::SoundId Vehicle::ProduceScreamSound(const int32_t totalNumPeeps auto r = ScenarioRand(); if (totalNumPeeps >= static_cast(r % 16)) { - switch (carEntry.sound_range) + switch (carEntry.soundRange) { - case SOUND_RANGE_SCREAMS_0: - scream_sound_id = _screamSet0[r % std::size(_screamSet0)]; + case SoundRange::screamsMisc: + scream_sound_id = _screamSetMisc[r % std::size(_screamSetMisc)]; break; - case SOUND_RANGE_SCREAMS_1_WOODEN_COASTERS: - scream_sound_id = _screamSet1Wooden[r % std::size(_screamSet1Wooden)]; + case SoundRange::screamsWoodenRollerCoaster: + scream_sound_id = _screamSetWooden[r % std::size(_screamSetWooden)]; break; - case SOUND_RANGE_SCREAMS_2: - scream_sound_id = _screamSet2[r % std::size(_screamSet2)]; + case SoundRange::screamSteelRollerCoaster: + scream_sound_id = _screamSetSteel[r % std::size(_screamSetSteel)]; break; default: scream_sound_id = OpenRCT2::Audio::SoundId::NoScream; @@ -8919,14 +8919,16 @@ void Vehicle::UpdateCrossings() const void Vehicle::Claxon() const { const auto* rideEntry = GetRideEntry(); - switch (rideEntry->Cars[vehicle_type].sound_range) + switch (rideEntry->Cars[vehicle_type].soundRange) { - case SOUND_RANGE_WHISTLE: + case SoundRange::steamWhistle: OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::TrainWhistle, { x, y, z }); break; - case SOUND_RANGE_BELL: + case SoundRange::tramBell: OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Tram, { x, y, z }); break; + default: + break; } } diff --git a/src/openrct2/ride/Vehicle.h b/src/openrct2/ride/Vehicle.h index a842d3dc14..d0b641671a 100644 --- a/src/openrct2/ride/Vehicle.h +++ b/src/openrct2/ride/Vehicle.h @@ -535,14 +535,14 @@ enum FRICTION_SOUND_NONE = 255 }; -enum +enum class SoundRange : uint8_t { - SOUND_RANGE_SCREAMS_0 = 0, - SOUND_RANGE_SCREAMS_1_WOODEN_COASTERS = 1, - SOUND_RANGE_SCREAMS_2 = 2, - SOUND_RANGE_WHISTLE = 3, - SOUND_RANGE_BELL = 4, - SOUND_RANGE_NONE = 255 + screamsMisc = 0, // Used by rides where the screams should not include rolling sounds. + screamsWoodenRollerCoaster = 1, + screamSteelRollerCoaster = 2, + steamWhistle = 3, + tramBell = 4, + none = 255, }; constexpr uint8_t kVehicleSeatPairFlag = 0x80; diff --git a/src/openrct2/scripting/bindings/object/ScObject.hpp b/src/openrct2/scripting/bindings/object/ScObject.hpp index e11bf731cd..e81c2e7a41 100644 --- a/src/openrct2/scripting/bindings/object/ScObject.hpp +++ b/src/openrct2/scripting/bindings/object/ScObject.hpp @@ -398,7 +398,7 @@ namespace OpenRCT2::Scripting auto entry = GetEntry(); if (entry != nullptr) { - return entry->sound_range; + return EnumValue(entry->soundRange); } return 0; } From 31d2092b69f354ea203b94f9c600f422dbe7a7ee Mon Sep 17 00:00:00 2001 From: Michael Steenbeek <1478678+Gymnasiast@users.noreply.github.com> Date: Fri, 4 Jul 2025 18:54:18 +0200 Subject: [PATCH 02/95] Always try mapping footpaths for .park files --- src/openrct2/object/ObjectList.cpp | 4 +++- src/openrct2/object/ObjectList.h | 2 +- src/openrct2/park/Legacy.cpp | 19 ++++++++---------- src/openrct2/park/Legacy.h | 3 +-- src/openrct2/park/ParkFile.cpp | 32 +++++++++++++++++------------- src/openrct2/park/ParkFile.h | 3 ++- 6 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/openrct2/object/ObjectList.cpp b/src/openrct2/object/ObjectList.cpp index 397bfaa7bc..bd5e35a15c 100644 --- a/src/openrct2/object/ObjectList.cpp +++ b/src/openrct2/object/ObjectList.cpp @@ -148,10 +148,12 @@ const ObjectEntryDescriptor& ObjectList::GetObject(ObjectType type, ObjectEntryI return placeholder; } -void ObjectList::Add(const ObjectEntryDescriptor& entry) +ObjectEntryIndex ObjectList::Add(const ObjectEntryDescriptor& entry) { auto& subList = GetList(entry.GetType()); + auto index = subList.size(); subList.push_back(entry); + return static_cast(index); } void ObjectList::SetObject(ObjectEntryIndex index, const ObjectEntryDescriptor& entry) diff --git a/src/openrct2/object/ObjectList.h b/src/openrct2/object/ObjectList.h index 6695420886..15307c6e87 100644 --- a/src/openrct2/object/ObjectList.h +++ b/src/openrct2/object/ObjectList.h @@ -19,7 +19,7 @@ private: std::vector> _subLists; public: - void Add(const ObjectEntryDescriptor& entry); + ObjectEntryIndex Add(const ObjectEntryDescriptor& entry); std::vector& GetList(ObjectType type); std::vector& GetList(ObjectType type) const; const ObjectEntryDescriptor& GetObject(ObjectType type, ObjectEntryIndex index) const; diff --git a/src/openrct2/park/Legacy.cpp b/src/openrct2/park/Legacy.cpp index afb3356b43..4c577e29c9 100644 --- a/src/openrct2/park/Legacy.cpp +++ b/src/openrct2/park/Legacy.cpp @@ -2248,30 +2248,27 @@ const RCT2::FootpathMapping* GetFootpathMapping(const ObjectEntryDescriptor& des void UpdateFootpathsFromMapping( ObjectEntryIndex* pathToSurfaceMap, ObjectEntryIndex* pathToQueueSurfaceMap, ObjectEntryIndex* pathToRailingsMap, - ObjectList& requiredObjects, ObjectEntryIndex& surfaceCount, ObjectEntryIndex& railingCount, ObjectEntryIndex entryIndex, - const RCT2::FootpathMapping* footpathMapping) + ObjectList& requiredObjects, ObjectEntryIndex entryIndex, const RCT2::FootpathMapping* footpathMapping) { auto surfaceIndex = requiredObjects.Find(ObjectType::footpathSurface, footpathMapping->NormalSurface); if (surfaceIndex == kObjectEntryIndexNull) { - requiredObjects.SetObject(ObjectType::footpathSurface, surfaceCount, footpathMapping->NormalSurface); - surfaceIndex = surfaceCount++; + surfaceIndex = requiredObjects.Add(ObjectEntryDescriptor(ObjectType::footpathSurface, footpathMapping->NormalSurface)); } pathToSurfaceMap[entryIndex] = surfaceIndex; - surfaceIndex = requiredObjects.Find(ObjectType::footpathSurface, footpathMapping->QueueSurface); - if (surfaceIndex == kObjectEntryIndexNull) + auto queueSurfaceIndex = requiredObjects.Find(ObjectType::footpathSurface, footpathMapping->QueueSurface); + if (queueSurfaceIndex == kObjectEntryIndexNull) { - requiredObjects.SetObject(ObjectType::footpathSurface, surfaceCount, footpathMapping->QueueSurface); - surfaceIndex = surfaceCount++; + queueSurfaceIndex = requiredObjects.Add( + ObjectEntryDescriptor(ObjectType::footpathSurface, footpathMapping->QueueSurface)); } - pathToQueueSurfaceMap[entryIndex] = surfaceIndex; + pathToQueueSurfaceMap[entryIndex] = queueSurfaceIndex; auto railingIndex = requiredObjects.Find(ObjectType::footpathRailings, footpathMapping->Railing); if (railingIndex == kObjectEntryIndexNull) { - requiredObjects.SetObject(ObjectType::footpathRailings, railingCount, footpathMapping->Railing); - railingIndex = railingCount++; + railingIndex = requiredObjects.Add(ObjectEntryDescriptor(ObjectType::footpathRailings, footpathMapping->Railing)); } pathToRailingsMap[entryIndex] = railingIndex; } diff --git a/src/openrct2/park/Legacy.h b/src/openrct2/park/Legacy.h index 54d857e324..809196d357 100644 --- a/src/openrct2/park/Legacy.h +++ b/src/openrct2/park/Legacy.h @@ -45,8 +45,7 @@ std::optional GetDATPathName(std::string_view newPathName); const OpenRCT2::RCT2::FootpathMapping* GetFootpathMapping(const ObjectEntryDescriptor& desc); void UpdateFootpathsFromMapping( ObjectEntryIndex* pathToSurfaceMap, ObjectEntryIndex* pathToQueueSurfaceMap, ObjectEntryIndex* pathToRailingsMap, - ObjectList& requiredObjects, ObjectEntryIndex& surfaceCount, ObjectEntryIndex& railingCount, ObjectEntryIndex entryIndex, - const OpenRCT2::RCT2::FootpathMapping* footpathMapping); + ObjectList& requiredObjects, ObjectEntryIndex entryIndex, const OpenRCT2::RCT2::FootpathMapping* footpathMapping); std::span GetLegacyPeepAnimationObjects(); void ConvertPeepAnimationTypeToObjects(OpenRCT2::GameState_t& gameState); diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index b2fa45831a..33178d2f6d 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -44,6 +44,7 @@ #include "../object/ObjectManager.h" #include "../object/ObjectRepository.h" #include "../peep/RideUseSystem.h" +#include "../rct2/RCT2.h" #include "../ride/RideManager.hpp" #include "../ride/ShopItem.h" #include "../ride/Vehicle.h" @@ -313,12 +314,14 @@ namespace OpenRCT2 const auto version = os.GetHeader().TargetVersion; ObjectList requiredObjects; + struct LegacyFootpathMapping + { + ObjectEntryIndex originalEntryIndex; + const RCT2::FootpathMapping& mapping; + }; + std::vector legacyPathMappings; os.ReadWriteChunk( - ParkFileChunkType::OBJECTS, - [&requiredObjects, pathToSurfaceMap, pathToQueueSurfaceMap, pathToRailingsMap, - version](OrcaStream::ChunkStream& cs) { - ObjectEntryIndex surfaceCount = 0; - ObjectEntryIndex railingsCount = 0; + ParkFileChunkType::OBJECTS, [&requiredObjects, version, &legacyPathMappings](OrcaStream::ChunkStream& cs) { auto numSubLists = cs.Read(); for (size_t i = 0; i < numSubLists; i++) { @@ -337,15 +340,12 @@ namespace OpenRCT2 RCTObjectEntry datEntry; cs.Read(&datEntry, sizeof(datEntry)); ObjectEntryDescriptor desc(datEntry); - if (version <= 2 && datEntry.GetType() == ObjectType::paths) + if (version < kFixedObsoleteFootpathsVersion && datEntry.GetType() == ObjectType::paths) { auto footpathMapping = GetFootpathMapping(desc); if (footpathMapping != nullptr) { - UpdateFootpathsFromMapping( - pathToSurfaceMap, pathToQueueSurfaceMap, pathToRailingsMap, requiredObjects, - surfaceCount, railingsCount, j, footpathMapping); - + legacyPathMappings.push_back(LegacyFootpathMapping{ j, *footpathMapping }); continue; } } @@ -392,10 +392,7 @@ namespace OpenRCT2 auto footpathMapping = GetFootpathMapping(desc); if (footpathMapping != nullptr) { - // We have surface objects for this footpath - UpdateFootpathsFromMapping( - pathToSurfaceMap, pathToQueueSurfaceMap, pathToRailingsMap, requiredObjects, - surfaceCount, railingsCount, j, footpathMapping); + legacyPathMappings.push_back(LegacyFootpathMapping{ j, *footpathMapping }); continue; } @@ -411,6 +408,13 @@ namespace OpenRCT2 } }); + for (const auto& mapping : legacyPathMappings) + { + UpdateFootpathsFromMapping( + pathToSurfaceMap, pathToQueueSurfaceMap, pathToRailingsMap, requiredObjects, mapping.originalEntryIndex, + &mapping.mapping); + } + if (version < kPeepNamesObjectsVersion) { AppendRequiredObjects( diff --git a/src/openrct2/park/ParkFile.h b/src/openrct2/park/ParkFile.h index 4799386e28..d432103f30 100644 --- a/src/openrct2/park/ParkFile.h +++ b/src/openrct2/park/ParkFile.h @@ -20,7 +20,7 @@ namespace OpenRCT2 struct GameState_t; // Current version that is saved. - constexpr uint32_t kParkFileCurrentVersion = 55; + constexpr uint32_t kParkFileCurrentVersion = 56; // The minimum version that is forwards compatible with the current version. constexpr uint32_t kParkFileMinVersion = 55; @@ -53,6 +53,7 @@ namespace OpenRCT2 constexpr uint16_t kClimateObjectsVersion = 53; constexpr uint16_t kExtendedGoKartsVersion = 54; constexpr uint16_t kHigherInversionsHolesHelicesStatsVersion = 55; + constexpr uint16_t kFixedObsoleteFootpathsVersion = 56; } // namespace OpenRCT2 class ParkFileExporter From 4101fb65a982f00367b010fa0eff7845a2217308 Mon Sep 17 00:00:00 2001 From: LRFLEW Date: Fri, 4 Jul 2025 11:55:17 -0500 Subject: [PATCH 03/95] Refactor Compression and Streams, and Add IStream Direct Interface --- src/openrct2/ReplayManager.cpp | 144 ++++------- src/openrct2/core/ChecksumStream.cpp | 23 +- src/openrct2/core/ChecksumStream.h | 76 +++--- src/openrct2/core/Compression.cpp | 197 +++++++-------- src/openrct2/core/Compression.h | 24 +- src/openrct2/core/DataSerialiserTraits.h | 201 +++++++--------- src/openrct2/core/FileStream.cpp | 5 - src/openrct2/core/FileStream.h | 1 - src/openrct2/core/IStream.cpp | 44 ++-- src/openrct2/core/IStream.hpp | 125 +++++----- src/openrct2/core/MemoryStream.cpp | 237 +++++++------------ src/openrct2/core/MemoryStream.h | 132 +++++++---- src/openrct2/core/OrcaStream.hpp | 96 ++++---- src/openrct2/core/StreamBuffer.cpp | 161 +++++++++++++ src/openrct2/core/StreamBuffer.hpp | 78 ++++++ src/openrct2/core/Zip.cpp | 5 - src/openrct2/core/ZipStream.hpp | 15 ++ src/openrct2/libopenrct2.vcxproj | 2 + src/openrct2/network/ServerList.cpp | 6 +- src/openrct2/object/StringTable.cpp | 2 +- src/openrct2/platform/Crash.cpp | 9 +- src/openrct2/rct12/SawyerChunkReader.cpp | 7 +- src/openrct2/scenario/ScenarioRepository.cpp | 4 +- test/tests/IniWriterTest.cpp | 18 +- 24 files changed, 892 insertions(+), 720 deletions(-) create mode 100644 src/openrct2/core/StreamBuffer.cpp create mode 100644 src/openrct2/core/StreamBuffer.hpp diff --git a/src/openrct2/ReplayManager.cpp b/src/openrct2/ReplayManager.cpp index 9ac73ae5b6..fab261ad5a 100644 --- a/src/openrct2/ReplayManager.cpp +++ b/src/openrct2/ReplayManager.cpp @@ -25,7 +25,10 @@ #include "actions/TileModifyAction.h" #include "actions/TrackPlaceAction.h" #include "config/Config.h" +#include "core/Compression.h" #include "core/DataSerialiser.h" +#include "core/FileStream.h" +#include "core/FileSystem.hpp" #include "core/Path.hpp" #include "entity/EntityRegistry.h" #include "entity/EntityTweener.h" @@ -35,7 +38,6 @@ #include "object/ObjectRepository.h" #include "park/ParkFile.h" #include "world/Park.h" -#include "zlib.h" #include #include @@ -103,7 +105,7 @@ namespace OpenRCT2 { static constexpr uint16_t kReplayVersion = 10; static constexpr uint32_t kReplayMagic = 0x5243524F; // ORCR. - static constexpr int kReplayCompressionLevel = 9; + static constexpr int kReplayCompressionLevel = Compression::kZlibMaxCompressionLevel; static constexpr int kNormalRecordingChecksumTicks = 1; static constexpr int kSilentRecordingChecksumTicks = 40; // Same as network server @@ -307,44 +309,24 @@ namespace OpenRCT2 // Serialise Body. DataSerialiser recSerialiser(true); Serialise(recSerialiser, *_currentRecording); + auto& stream = recSerialiser.GetStream(); - const auto& stream = recSerialiser.GetStream(); - unsigned long streamLength = static_cast(stream.GetLength()); - unsigned long compressLength = compressBound(streamLength); - - MemoryStream data(compressLength); - - ReplayRecordFile file{ _currentRecording->magic, _currentRecording->version, streamLength, data }; - - auto compressBuf = std::make_unique(compressLength); - compress2( - compressBuf.get(), &compressLength, static_cast(stream.GetData()), stream.GetLength(), + MemoryStream compressed; + bool compressStatus = Compression::zlibCompress( + stream, static_cast(stream.GetLength()), compressed, Compression::ZlibHeaderType::zlib, kReplayCompressionLevel); - file.data.Write(compressBuf.get(), compressLength); + if (!compressStatus) + throw IOException("Compression Error"); - DataSerialiser fileSerialiser(true); - fileSerialiser << file.magic; - fileSerialiser << file.version; - fileSerialiser << file.uncompressedSize; - fileSerialiser << file.data; - - bool result = false; - - const std::string& outFile = _currentRecording->filePath; - - FILE* fp = fopen(outFile.c_str(), "wb"); - if (fp != nullptr) { - const auto& fileStream = fileSerialiser.GetStream(); - fwrite(fileStream.GetData(), 1, fileStream.GetLength(), fp); - fclose(fp); + ReplayRecordFile file{ _currentRecording->magic, _currentRecording->version, stream.GetLength(), compressed }; - result = true; - } - else - { - LOG_ERROR("Unable to write to file '%s'", outFile.c_str()); - result = false; + FileStream filestream(_currentRecording->filePath, FileMode::write); + DataSerialiser fileSerialiser(true, filestream); + fileSerialiser << file.magic; + fileSerialiser << file.version; + fileSerialiser << file.uncompressedSize; + fileSerialiser << file.data; } // When normalizing the output we don't touch the mode. @@ -356,7 +338,7 @@ namespace OpenRCT2 News::Item* news = News::AddItemToQueue(News::ItemType::blank, "Replay recording stopped", 0); news->setFlags(News::ItemFlags::hasButton); // Has no subject. - return result; + return true; } virtual bool GetCurrentReplayInfo(ReplayRecordInfo& info) const override @@ -561,35 +543,16 @@ namespace OpenRCT2 return true; } - bool ReadReplayFromFile(const std::string& file, MemoryStream& stream) - { - FILE* fp = fopen(file.c_str(), "rb"); - if (fp == nullptr) - return false; - - char buffer[128]; - while (feof(fp) == 0) - { - size_t numBytesRead = fread(buffer, 1, 128, fp); - if (numBytesRead == 0) - break; - stream.Write(buffer, numBytesRead); - } - - fclose(fp); - return true; - } - /** * Returns true if decompression was not needed or succeeded * @param stream * @return */ - bool TryDecompress(MemoryStream& stream) + MemoryStream DecompressFile(FileStream& fileStream) { ReplayRecordFile recFile; - stream.SetPosition(0); - DataSerialiser fileSerializer(false, stream); + fileStream.SetPosition(0); + DataSerialiser fileSerializer(false, fileStream); fileSerializer << recFile.magic; fileSerializer << recFile.version; @@ -598,52 +561,49 @@ namespace OpenRCT2 fileSerializer << recFile.uncompressedSize; fileSerializer << recFile.data; - auto buff = std::make_unique(recFile.uncompressedSize); - unsigned long outSize = recFile.uncompressedSize; - uncompress( - static_cast(buff.get()), &outSize, - static_cast(recFile.data.GetData()), recFile.data.GetLength()); - if (outSize != recFile.uncompressedSize) - { - return false; - } - stream.SetPosition(0); - stream.Write(buff.get(), outSize); + MemoryStream decompressed; + bool decompressStatus = true; + + recFile.data.SetPosition(0); + decompressStatus = Compression::zlibDecompress( + recFile.data, static_cast(recFile.data.GetLength()), decompressed, + static_cast(recFile.uncompressedSize), Compression::ZlibHeaderType::zlib); + + if (!decompressStatus) + throw IOException("Decompression Error"); + + recFile.data = std::move(decompressed); + } + else + { + // Read whole file into memory + fileStream.SetPosition(0); + recFile.data.CopyFromStream(fileStream, fileStream.GetLength()); } - return true; + return recFile.data; } bool ReadReplayData(const std::string& file, ReplayRecordData& data) { - MemoryStream stream; + fs::path filePath = file; + if (filePath.extension() != ".parkrep") + filePath += ".parkrep"; - std::string fileName = file; - if (fileName.size() < 5 || fileName.substr(fileName.size() - 5) != ".parkrep") + if (filePath.is_relative()) { - fileName += ".parkrep"; + fs::path replayPath = GetContext()->GetPlatformEnvironment().GetDirectoryPath( + DirBase::user, DirId::replayRecordings) + / filePath; + if (fs::is_regular_file(replayPath)) + filePath = replayPath; } - std::string outPath = GetContext()->GetPlatformEnvironment().GetDirectoryPath( - DirBase::user, DirId::replayRecordings); - std::string outFile = Path::Combine(outPath, fileName); - - bool loaded = false; - if (ReadReplayFromFile(outFile, stream)) - { - data.filePath = outFile; - loaded = true; - } - else if (ReadReplayFromFile(file, stream)) - { - data.filePath = file; - loaded = true; - } - if (!loaded) + if (!fs::is_regular_file(filePath)) return false; - if (!TryDecompress(stream)) - return false; + FileStream fileStream(filePath, FileMode::open); + MemoryStream stream = DecompressFile(fileStream); stream.SetPosition(0); DataSerialiser serialiser(false, stream); diff --git a/src/openrct2/core/ChecksumStream.cpp b/src/openrct2/core/ChecksumStream.cpp index 77a4c54391..477acb8eb0 100644 --- a/src/openrct2/core/ChecksumStream.cpp +++ b/src/openrct2/core/ChecksumStream.cpp @@ -11,8 +11,6 @@ #include "Endianness.h" -#include - namespace OpenRCT2 { #ifndef DISABLE_NETWORK @@ -25,23 +23,24 @@ namespace OpenRCT2 void ChecksumStream::Write(const void* buffer, uint64_t length) { - uint64_t* hash = reinterpret_cast(_checksum.data()); for (size_t i = 0; i < length; i += sizeof(uint64_t)) { const auto maxLen = std::min(sizeof(uint64_t), length - i); - uint64_t temp{}; - std::memcpy(&temp, reinterpret_cast(buffer) + i, maxLen); + uint64_t value{}; + std::memcpy(&value, reinterpret_cast(buffer) + i, maxLen); - // Always use value as little endian, most common systems are little. - #if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) - temp = ByteSwapBE(temp); - #endif - - *hash ^= temp; - *hash *= kPrime; + Step(value); } } + void ChecksumStream::Step(uint64_t value) + { + uint64_t* hash = reinterpret_cast(_checksum.data()); + + *hash ^= value; + *hash *= kPrime; + } + #endif } // namespace OpenRCT2 diff --git a/src/openrct2/core/ChecksumStream.h b/src/openrct2/core/ChecksumStream.h index f9064e6c92..248e9fbc00 100644 --- a/src/openrct2/core/ChecksumStream.h +++ b/src/openrct2/core/ChecksumStream.h @@ -11,7 +11,9 @@ #include "IStream.hpp" +#include #include +#include namespace OpenRCT2 { @@ -34,7 +36,7 @@ namespace OpenRCT2 const void* GetData() const override { return _checksum.data(); - }; + } /////////////////////////////////////////////////////////////////////////// // ISteam methods @@ -72,41 +74,61 @@ namespace OpenRCT2 void Write(const void* buffer, uint64_t length) override; - void Write1(const void* buffer) override - { - Write<1>(buffer); - } - - void Write2(const void* buffer) override - { - Write<2>(buffer); - } - - void Write4(const void* buffer) override - { - Write<4>(buffer); - } - - void Write8(const void* buffer) override - { - Write<8>(buffer); - } - - void Write16(const void* buffer) override - { - Write<16>(buffer); - } - template void Write(const void* buffer) { - Write(buffer, N); + for (size_t i = 0; i < N; i += sizeof(uint64_t)) + { + const auto maxLen = std::min(sizeof(uint64_t), N - i); + + uint64_t value{}; + std::memcpy(&value, reinterpret_cast(buffer) + i, maxLen); + + Step(value); + } } uint64_t TryRead(void* buffer, uint64_t length) override { return 0; } + + private: + void Write1(const void* buffer) override + { + Step(*static_cast(buffer)); + } + + void Write2(const void* buffer) override + { + WriteUnaligned(buffer); + } + + void Write4(const void* buffer) override + { + WriteUnaligned(buffer); + } + + void Write8(const void* buffer) override + { + WriteUnaligned(buffer); + } + + void Write16(const void* buffer) override + { + WriteUnaligned(static_cast(buffer) + 0); + WriteUnaligned(static_cast(buffer) + 8); + } + + template + void WriteUnaligned(const void* buffer) + { + T value; + std::memcpy(&value, buffer, sizeof(T)); + Step(value); + } + + void Step(uint64_t value); }; } // namespace OpenRCT2 diff --git a/src/openrct2/core/Compression.cpp b/src/openrct2/core/Compression.cpp index 03b78aebbf..c0e0990850 100644 --- a/src/openrct2/core/Compression.cpp +++ b/src/openrct2/core/Compression.cpp @@ -10,167 +10,132 @@ #include "Compression.h" #include "../Diagnostic.h" -#include "zlib.h" +#include "Guard.hpp" +#include "StreamBuffer.hpp" -#include -#include -#include +#ifndef ZLIB_CONST + #define ZLIB_CONST +#endif + +#include +#include namespace OpenRCT2::Compression { - constexpr size_t kChunkSize = 128 * 1024; + constexpr size_t kZlibChunkSize = 128 * 1024; + constexpr size_t kZlibMaxChunkSize = static_cast(std::numeric_limits::max()); + constexpr int kZlibWindowBits[] = { -15, 15, 15 + 16 }; - // Compress the source to gzip-compatible stream, write to dest. - // Mainly used for compressing the crashdumps - bool gzipCompress(FILE* source, FILE* dest) + /* + * Modified copy of compressBound() from zlib 1.3.1, with the argument type changed from ULong + * (which may be only 32 bits) to uint64_t, and adds space for the default gzip header, + */ + static uint64_t zlibCompressBound(uint64_t length) { - if (source == nullptr || dest == nullptr) - { - return false; - } - int ret, flush; - size_t have; + return length + (length >> 12) + (length >> 14) + (length >> 25) + 13 + (18 - 6); + } + + bool zlibCompress(IStream& source, uint64_t sourceLength, IStream& dest, ZlibHeaderType header, int16_t level) + { + Guard::Assert(sourceLength <= source.GetLength() - source.GetPosition()); + + int ret; + StreamReadBuffer sourceBuf(source, sourceLength, kZlibChunkSize); + StreamWriteBuffer destBuf(dest, zlibCompressBound(sourceLength), kZlibChunkSize); + z_stream strm{}; - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - unsigned char in[kChunkSize]; - unsigned char out[kChunkSize]; - int windowBits = 15; - int GZIP_ENCODING = 16; - ret = deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, windowBits | GZIP_ENCODING, 8, Z_DEFAULT_STRATEGY); + ret = deflateInit2(&strm, level, Z_DEFLATED, kZlibWindowBits[static_cast(header)], 8, Z_DEFAULT_STRATEGY); if (ret != Z_OK) { LOG_ERROR("Failed to initialise stream"); return false; } + do { - strm.avail_in = uInt(fread(in, 1, kChunkSize, source)); - if (ferror(source)) - { - deflateEnd(&strm); - LOG_ERROR("Failed to read data from source"); - return false; - } - flush = feof(source) ? Z_FINISH : Z_NO_FLUSH; - strm.next_in = in; + auto readBlock = sourceBuf.ReadBlock(source, kZlibMaxChunkSize); + strm.next_in = static_cast(readBlock.first); + strm.avail_in = static_cast(readBlock.second); + do { - strm.avail_out = kChunkSize; - strm.next_out = out; - ret = deflate(&strm, flush); + Guard::Assert(destBuf, "Compression Overruns Ouput Size"); + + auto writeBlock = destBuf.WriteBlockStart(kZlibMaxChunkSize); + strm.next_out = static_cast(writeBlock.first); + strm.avail_out = static_cast(writeBlock.second); + + ret = deflate(&strm, sourceBuf ? Z_NO_FLUSH : Z_FINISH); if (ret == Z_STREAM_ERROR) { LOG_ERROR("Failed to compress data"); - return false; - } - have = kChunkSize - strm.avail_out; - if (fwrite(out, 1, have, dest) != have || ferror(dest)) - { deflateEnd(&strm); - LOG_ERROR("Failed to write data to destination"); return false; } - } while (strm.avail_out == 0); - } while (flush != Z_FINISH); + + destBuf.WriteBlockCommit(dest, writeBlock.second - strm.avail_out); + } while (strm.avail_in > 0); + } while (sourceBuf); + deflateEnd(&strm); return true; } - std::vector gzip(const void* data, const size_t dataLen) + bool zlibDecompress(IStream& source, uint64_t sourceLength, IStream& dest, uint64_t decompressLength, ZlibHeaderType header) { - assert(data != nullptr); + Guard::Assert(sourceLength <= source.GetLength() - source.GetPosition()); + + int ret; + StreamReadBuffer sourceBuf(source, sourceLength, kZlibChunkSize); + StreamWriteBuffer destBuf(dest, decompressLength, kZlibChunkSize); - std::vector output; z_stream strm{}; - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - + ret = inflateInit2(&strm, kZlibWindowBits[static_cast(header)]); + if (ret != Z_OK) { - const auto ret = deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15 | 16, 8, Z_DEFAULT_STRATEGY); - if (ret != Z_OK) - { - throw std::runtime_error("deflateInit2 failed with error " + std::to_string(ret)); - } + LOG_ERROR("Failed to initialise stream"); + return false; } - int flush = 0; - const auto* src = static_cast(data); - size_t srcRemaining = dataLen; do { - const auto nextBlockSize = std::min(srcRemaining, kChunkSize); - srcRemaining -= nextBlockSize; + auto readBlock = sourceBuf.ReadBlock(source, kZlibMaxChunkSize); + strm.next_in = static_cast(readBlock.first); + strm.avail_in = static_cast(readBlock.second); - flush = srcRemaining == 0 ? Z_FINISH : Z_NO_FLUSH; - strm.avail_in = static_cast(nextBlockSize); - strm.next_in = const_cast(src); do { - output.resize(output.size() + nextBlockSize); - strm.avail_out = static_cast(nextBlockSize); - strm.next_out = &output[output.size() - nextBlockSize]; - const auto ret = deflate(&strm, flush); + if (!destBuf) + { + LOG_ERROR("Decompressed data larger than expected"); + inflateEnd(&strm); + return false; + } + + auto writeBlock = destBuf.WriteBlockStart(kZlibMaxChunkSize); + strm.next_out = static_cast(writeBlock.first); + strm.avail_out = static_cast(writeBlock.second); + + ret = inflate(&strm, sourceBuf ? Z_NO_FLUSH : Z_FINISH); if (ret == Z_STREAM_ERROR) { - throw std::runtime_error("deflate failed with error " + std::to_string(ret)); + LOG_ERROR("Failed to decompress data"); + inflateEnd(&strm); + return false; } - output.resize(output.size() - strm.avail_out); - } while (strm.avail_out == 0); - src += nextBlockSize; - } while (flush != Z_FINISH); - deflateEnd(&strm); - return output; - } - - std::vector ungzip(const void* data, const size_t dataLen) - { - assert(data != nullptr); - - std::vector output; - z_stream strm{}; - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; + destBuf.WriteBlockCommit(dest, writeBlock.second - strm.avail_out); + } while (strm.avail_in > 0); + } while (sourceBuf); + if (destBuf) { - const auto ret = inflateInit2(&strm, 15 | 16); - if (ret != Z_OK) - { - throw std::runtime_error("inflateInit2 failed with error " + std::to_string(ret)); - } + LOG_ERROR("Decompressed data smaller than expected"); + inflateEnd(&strm); + return false; } - int flush = 0; - const auto* src = static_cast(data); - size_t srcRemaining = dataLen; - do - { - const auto nextBlockSize = std::min(srcRemaining, kChunkSize); - srcRemaining -= nextBlockSize; - - flush = srcRemaining == 0 ? Z_FINISH : Z_NO_FLUSH; - strm.avail_in = static_cast(nextBlockSize); - strm.next_in = const_cast(src); - do - { - output.resize(output.size() + nextBlockSize); - strm.avail_out = static_cast(nextBlockSize); - strm.next_out = &output[output.size() - nextBlockSize]; - const auto ret = inflate(&strm, flush); - if (ret == Z_STREAM_ERROR) - { - throw std::runtime_error("deflate failed with error " + std::to_string(ret)); - } - output.resize(output.size() - strm.avail_out); - } while (strm.avail_out == 0); - - src += nextBlockSize; - } while (flush != Z_FINISH); inflateEnd(&strm); - return output; + return true; } } // namespace OpenRCT2::Compression diff --git a/src/openrct2/core/Compression.h b/src/openrct2/core/Compression.h index d66946f4e1..8ab7b2eea5 100644 --- a/src/openrct2/core/Compression.h +++ b/src/openrct2/core/Compression.h @@ -9,13 +9,31 @@ #pragma once +#include "IStream.hpp" + #include #include #include namespace OpenRCT2::Compression { - bool gzipCompress(FILE* source, FILE* dest); - std::vector gzip(const void* data, const size_t dataLen); - std::vector ungzip(const void* data, const size_t dataLen); + // zlib doesn't use 0 as a real compression level, so use it to mean no compression + constexpr int16_t kNoCompressionLevel = 0; + + // Zlib methods, using the DEFLATE compression algorithm + constexpr int16_t kZlibDefaultCompressionLevel = -1; // zlib value for "default level" + constexpr int16_t kZlibMaxCompressionLevel = 9; + + enum class ZlibHeaderType + { + none = 0, + zlib = 1, + gzip = 2, + }; + + bool zlibCompress( + IStream& source, uint64_t sourceLength, IStream& dest, ZlibHeaderType header, + int16_t level = kZlibDefaultCompressionLevel); + bool zlibDecompress( + IStream& source, uint64_t sourceLength, IStream& dest, uint64_t decompressLength, ZlibHeaderType header); } // namespace OpenRCT2::Compression diff --git a/src/openrct2/core/DataSerialiserTraits.h b/src/openrct2/core/DataSerialiserTraits.h index b6ae77ea6f..fceac73229 100644 --- a/src/openrct2/core/DataSerialiserTraits.h +++ b/src/openrct2/core/DataSerialiserTraits.h @@ -45,14 +45,11 @@ struct DataSerializerTraitsEnum static void encode(OpenRCT2::IStream* stream, const T& val) { - TUnderlying temp = ByteSwapBE(static_cast(val)); - stream->Write(&temp); + stream->WriteValue(ByteSwapBE(static_cast(val))); } static void decode(OpenRCT2::IStream* stream, T& val) { - TUnderlying temp; - stream->Read(&temp); - val = static_cast(ByteSwapBE(temp)); + val = static_cast(ByteSwapBE(stream->ReadValue())); } static void log(OpenRCT2::IStream* stream, const T& val) { @@ -72,14 +69,11 @@ struct DataSerializerTraitsIntegral { static void encode(OpenRCT2::IStream* stream, const T& val) { - T temp = ByteSwapBE(val); - stream->Write(&temp); + stream->WriteValue(ByteSwapBE(val)); } static void decode(OpenRCT2::IStream* stream, T& val) { - T temp; - stream->Read(&temp); - val = ByteSwapBE(temp); + val = ByteSwapBE(stream->ReadValue()); } static void log(OpenRCT2::IStream* stream, const T& val) { @@ -96,11 +90,11 @@ struct DataSerializerTraitsT { static void encode(OpenRCT2::IStream* stream, const bool& val) { - stream->Write(&val); + stream->WriteValue(val); } static void decode(OpenRCT2::IStream* stream, bool& val) { - stream->Read(&val); + stream->ReadValue(val); } static void log(OpenRCT2::IStream* stream, const bool& val) { @@ -162,19 +156,16 @@ struct DataSerializerTraitsT static void encode(OpenRCT2::IStream* stream, const std::string& str) { uint16_t len = static_cast(str.size()); - uint16_t swapped = ByteSwapBE(len); - stream->Write(&swapped); + stream->WriteValue(ByteSwapBE(len)); if (len == 0) { return; } - stream->WriteArray(str.c_str(), len); + stream->Write(str.c_str(), len); } static void decode(OpenRCT2::IStream* stream, std::string& res) { - uint16_t len; - stream->Read(&len); - len = ByteSwapBE(len); + uint16_t len = ByteSwapBE(stream->ReadValue()); if (len == 0) { res.clear(); @@ -199,15 +190,11 @@ struct DataSerializerTraitsT { static void encode(OpenRCT2::IStream* stream, const NetworkPlayerId_t& val) { - uint32_t temp = static_cast(val.id); - temp = ByteSwapBE(temp); - stream->Write(&temp); + stream->WriteValue(ByteSwapBE(val.id)); } static void decode(OpenRCT2::IStream* stream, NetworkPlayerId_t& val) { - uint32_t temp; - stream->Read(&temp); - val.id = static_cast(ByteSwapBE(temp)); + val.id = ByteSwapBE(stream->ReadValue()); } static void log(OpenRCT2::IStream* stream, const NetworkPlayerId_t& val) { @@ -288,9 +275,7 @@ struct DataSerializerTraitsPODArray { static void encode(OpenRCT2::IStream* stream, const _Ty (&val)[_Size]) { - uint16_t len = static_cast(_Size); - uint16_t swapped = ByteSwapBE(len); - stream->Write(&swapped); + stream->WriteValue(ByteSwapBE(static_cast(_Size))); DataSerializerTraits<_Ty> s; for (auto&& sub : val) @@ -300,9 +285,7 @@ struct DataSerializerTraitsPODArray } static void decode(OpenRCT2::IStream* stream, _Ty (&val)[_Size]) { - uint16_t len; - stream->Read(&len); - len = ByteSwapBE(len); + uint16_t len = ByteSwapBE(stream->ReadValue()); if (len != _Size) throw std::runtime_error("Invalid size, can't decode"); @@ -362,9 +345,7 @@ struct DataSerializerTraitsT> { static void encode(OpenRCT2::IStream* stream, const std::array<_Ty, _Size>& val) { - uint16_t len = static_cast(_Size); - uint16_t swapped = ByteSwapBE(len); - stream->Write(&swapped); + stream->WriteValue(ByteSwapBE(static_cast(_Size))); DataSerializerTraits<_Ty> s; for (auto&& sub : val) @@ -374,9 +355,7 @@ struct DataSerializerTraitsT> } static void decode(OpenRCT2::IStream* stream, std::array<_Ty, _Size>& val) { - uint16_t len; - stream->Read(&len); - len = ByteSwapBE(len); + uint16_t len = ByteSwapBE(stream->ReadValue()); if (len != _Size) throw std::runtime_error("Invalid size, can't decode"); @@ -405,9 +384,7 @@ struct DataSerializerTraitsT> { static void encode(OpenRCT2::IStream* stream, const std::vector<_Ty>& val) { - uint16_t len = static_cast(val.size()); - uint16_t swapped = ByteSwapBE(len); - stream->Write(&swapped); + stream->WriteValue(ByteSwapBE(static_cast(val.size()))); DataSerializerTraits<_Ty> s; for (auto&& sub : val) @@ -417,9 +394,7 @@ struct DataSerializerTraitsT> } static void decode(OpenRCT2::IStream* stream, std::vector<_Ty>& val) { - uint16_t len; - stream->Read(&len); - len = ByteSwapBE(len); + uint16_t len = ByteSwapBE(stream->ReadValue()); DataSerializerTraits<_Ty> s; for (auto i = 0; i < len; ++i) @@ -620,14 +595,11 @@ struct DataSerializerTraitsT { static void encode(OpenRCT2::IStream* stream, const NetworkCheatType_t& val) { - uint32_t temp = ByteSwapBE(val.id); - stream->Write(&temp); + stream->WriteValue(ByteSwapBE(val.id)); } static void decode(OpenRCT2::IStream* stream, NetworkCheatType_t& val) { - uint32_t temp; - stream->Read(&temp); - val.id = ByteSwapBE(temp); + val.id = ByteSwapBE(stream->ReadValue()); } static void log(OpenRCT2::IStream* stream, const NetworkCheatType_t& val) { @@ -641,15 +613,12 @@ struct DataSerializerTraitsT { static void encode(OpenRCT2::IStream* stream, const RCTObjectEntry& val) { - uint32_t temp = ByteSwapBE(val.flags); - stream->Write(&temp); + stream->WriteValue(ByteSwapBE(val.flags)); stream->WriteArray(val.nameWOC, 12); } static void decode(OpenRCT2::IStream* stream, RCTObjectEntry& val) { - uint32_t temp; - stream->Read(&temp); - val.flags = ByteSwapBE(temp); + val.flags = ByteSwapBE(stream->ReadValue()); auto str = stream->ReadArray(12); memcpy(val.nameWOC, str.get(), 12); } @@ -690,7 +659,7 @@ struct DataSerializerTraitsT else { auto type = static_cast(stream->ReadValue()); - auto identifier = stream->ReadStdString(); + auto identifier = stream->ReadString(); val = ObjectEntryDescriptor(type, identifier); } } @@ -709,21 +678,21 @@ struct DataSerializerTraitsT { static void encode(OpenRCT2::IStream* stream, const TrackDesignTrackElement& val) { - stream->Write(&val.type); - stream->Write(&val.flags); - stream->Write(&val.colourScheme); - stream->Write(&val.stationIndex); - stream->Write(&val.brakeBoosterSpeed); - stream->Write(&val.seatRotation); + stream->WriteValue(val.type); + stream->WriteValue(val.flags); + stream->WriteValue(val.colourScheme); + stream->WriteValue(val.stationIndex); + stream->WriteValue(val.brakeBoosterSpeed); + stream->WriteValue(val.seatRotation); } static void decode(OpenRCT2::IStream* stream, TrackDesignTrackElement& val) { - stream->Read(&val.type); - stream->Read(&val.flags); - stream->Read(&val.colourScheme); - stream->Read(&val.stationIndex); - stream->Read(&val.brakeBoosterSpeed); - stream->Read(&val.seatRotation); + stream->ReadValue(val.type); + stream->ReadValue(val.flags); + stream->ReadValue(val.colourScheme); + stream->ReadValue(val.stationIndex); + stream->ReadValue(val.brakeBoosterSpeed); + stream->ReadValue(val.seatRotation); } static void log(OpenRCT2::IStream* stream, const TrackDesignTrackElement& val) { @@ -738,13 +707,13 @@ struct DataSerializerTraitsT { static void encode(OpenRCT2::IStream* stream, const TrackDesignMazeElement& val) { - stream->Write(&val.location); - stream->Write(&val.mazeEntry); + stream->WriteValue(val.location); + stream->WriteValue(val.mazeEntry); } static void decode(OpenRCT2::IStream* stream, TrackDesignMazeElement& val) { - stream->Read(&val.location); - stream->Read(&val.mazeEntry); + stream->ReadValue(val.location); + stream->ReadValue(val.mazeEntry); } static void log(OpenRCT2::IStream* stream, const TrackDesignMazeElement& val) { @@ -761,13 +730,13 @@ struct DataSerializerTraitsT { static void encode(OpenRCT2::IStream* stream, const TrackDesignEntranceElement& val) { - stream->Write(&val.location); - stream->Write(&val.isExit); + stream->WriteValue(val.location); + stream->WriteValue(val.isExit); } static void decode(OpenRCT2::IStream* stream, TrackDesignEntranceElement& val) { - stream->Read(&val.location); - stream->Read(&val.isExit); + stream->ReadValue(val.location); + stream->ReadValue(val.isExit); } static void log(OpenRCT2::IStream* stream, const TrackDesignEntranceElement& val) { @@ -784,21 +753,21 @@ struct DataSerializerTraitsT { static void encode(OpenRCT2::IStream* stream, const TrackDesignSceneryElement& val) { - stream->Write(&val.loc); - stream->Write(&val.flags); - stream->Write(&val.primaryColour); - stream->Write(&val.secondaryColour); - stream->Write(&val.tertiaryColour); + stream->WriteValue(val.loc); + stream->WriteValue(val.flags); + stream->WriteValue(val.primaryColour); + stream->WriteValue(val.secondaryColour); + stream->WriteValue(val.tertiaryColour); DataSerializerTraits s; s.encode(stream, val.sceneryObject); } static void decode(OpenRCT2::IStream* stream, TrackDesignSceneryElement& val) { - stream->Read(&val.loc); - stream->Read(&val.flags); - stream->Read(&val.primaryColour); - stream->Read(&val.secondaryColour); - stream->Read(&val.tertiaryColour); + stream->ReadValue(val.loc); + stream->ReadValue(val.flags); + stream->ReadValue(val.primaryColour); + stream->ReadValue(val.secondaryColour); + stream->ReadValue(val.tertiaryColour); DataSerializerTraits s; s.decode(stream, val.sceneryObject); } @@ -821,15 +790,15 @@ struct DataSerializerTraitsT { static void encode(OpenRCT2::IStream* stream, const TrackColour& val) { - stream->Write(&val.main); - stream->Write(&val.additional); - stream->Write(&val.supports); + stream->WriteValue(val.main); + stream->WriteValue(val.additional); + stream->WriteValue(val.supports); } static void decode(OpenRCT2::IStream* stream, TrackColour& val) { - stream->Read(&val.main); - stream->Read(&val.additional); - stream->Read(&val.supports); + stream->ReadValue(val.main); + stream->ReadValue(val.additional); + stream->ReadValue(val.supports); } static void log(OpenRCT2::IStream* stream, const TrackColour& val) { @@ -845,15 +814,15 @@ struct DataSerializerTraitsT { static void encode(OpenRCT2::IStream* stream, const VehicleColour& val) { - stream->Write(&val.Body); - stream->Write(&val.Trim); - stream->Write(&val.Tertiary); + stream->WriteValue(val.Body); + stream->WriteValue(val.Trim); + stream->WriteValue(val.Tertiary); } static void decode(OpenRCT2::IStream* stream, VehicleColour& val) { - stream->Read(&val.Body); - stream->Read(&val.Trim); - stream->Read(&val.Tertiary); + stream->ReadValue(val.Body); + stream->ReadValue(val.Trim); + stream->ReadValue(val.Tertiary); } static void log(OpenRCT2::IStream* stream, const VehicleColour& val) { @@ -868,15 +837,15 @@ struct DataSerializerTraitsT { static void encode(OpenRCT2::IStream* stream, const RatingTuple& val) { - stream->Write(&val.excitement); - stream->Write(&val.intensity); - stream->Write(&val.nausea); + stream->WriteValue(val.excitement); + stream->WriteValue(val.intensity); + stream->WriteValue(val.nausea); } static void decode(OpenRCT2::IStream* stream, RatingTuple& val) { - stream->Read(&val.excitement); - stream->Read(&val.intensity); - stream->Read(&val.nausea); + stream->ReadValue(val.excitement); + stream->ReadValue(val.intensity); + stream->ReadValue(val.nausea); } static void log(OpenRCT2::IStream* stream, const RatingTuple& val) { @@ -893,13 +862,11 @@ struct DataSerializerTraitsT { static void encode(OpenRCT2::IStream* stream, const IntensityRange& val) { - uint8_t temp = uint8_t(val); - stream->Write(&temp); + stream->WriteValue(static_cast(val)); } static void decode(OpenRCT2::IStream* stream, IntensityRange& val) { - auto temp = stream->ReadValue(); - val = IntensityRange(temp); + val = static_cast(stream->ReadValue()); } static void log(OpenRCT2::IStream* stream, const IntensityRange& val) { @@ -914,17 +881,17 @@ struct DataSerializerTraitsT { static void encode(OpenRCT2::IStream* stream, const PeepThought& val) { - stream->Write(&val.type); - stream->Write(&val.item); - stream->Write(&val.freshness); - stream->Write(&val.fresh_timeout); + stream->WriteValue(val.type); + stream->WriteValue(val.item); + stream->WriteValue(val.freshness); + stream->WriteValue(val.fresh_timeout); } static void decode(OpenRCT2::IStream* stream, PeepThought& val) { - stream->Read(&val.type); - stream->Read(&val.item); - stream->Read(&val.freshness); - stream->Read(&val.fresh_timeout); + stream->ReadValue(val.type); + stream->ReadValue(val.item); + stream->ReadValue(val.freshness); + stream->ReadValue(val.fresh_timeout); } static void log(OpenRCT2::IStream* stream, const PeepThought& val) { @@ -1007,11 +974,11 @@ struct DataSerializerTraitsT { DataSerializerTraits().decode(stream, banner.id); DataSerializerTraits().decode(stream, banner.type); - stream->Read(&banner.flags); - banner.text = stream->ReadStdString(); - stream->Read(&banner.colour); + stream->ReadValue(banner.flags); + banner.text = stream->ReadString(); + stream->ReadValue(banner.colour); DataSerializerTraits().decode(stream, banner.rideIndex); - stream->Read(&banner.textColour); + stream->ReadValue(banner.textColour); DataSerializerTraits().decode(stream, banner.position); } diff --git a/src/openrct2/core/FileStream.cpp b/src/openrct2/core/FileStream.cpp index 2a432cb5d9..7a0c551ddb 100644 --- a/src/openrct2/core/FileStream.cpp +++ b/src/openrct2/core/FileStream.cpp @@ -195,9 +195,4 @@ namespace OpenRCT2 return readBytes; } - const void* FileStream::GetData() const - { - return nullptr; - } - } // namespace OpenRCT2 diff --git a/src/openrct2/core/FileStream.h b/src/openrct2/core/FileStream.h index 2eff04acdd..ca11d8ac83 100644 --- a/src/openrct2/core/FileStream.h +++ b/src/openrct2/core/FileStream.h @@ -52,7 +52,6 @@ namespace OpenRCT2 void Read(void* buffer, uint64_t length) override; void Write(const void* buffer, uint64_t length) override; uint64_t TryRead(void* buffer, uint64_t length) override; - const void* GetData() const override; }; } // namespace OpenRCT2 diff --git a/src/openrct2/core/IStream.cpp b/src/openrct2/core/IStream.cpp index 733f858433..9824a3a202 100644 --- a/src/openrct2/core/IStream.cpp +++ b/src/openrct2/core/IStream.cpp @@ -9,13 +9,26 @@ #include "IStream.hpp" +#include "StreamBuffer.hpp" #include "String.hpp" #include namespace OpenRCT2 { - std::string IStream::ReadStdString() + constexpr size_t kIStreamCopyBufferLength = 16 * 1024; + + void IStream::CopyFromStream(IStream& stream, uint64_t length) + { + StreamReadBuffer buffer(stream, length, kIStreamCopyBufferLength); + while (buffer) + { + auto block = buffer.ReadBlock(stream); + this->Write(block.first, block.second); + } + } + + std::string IStream::ReadString() { std::string result; uint8_t ch; @@ -26,32 +39,11 @@ namespace OpenRCT2 return result; } - void IStream::WriteString(const utf8* str) + void IStream::WriteString(std::string_view str) { - if (str == nullptr) - { - WriteValue(0); - } - else - { - size_t numBytes = String::sizeOf(str) + 1; - Write(str, numBytes); - } - } - - void IStream::WriteString(const std::string_view str) - { - for (const auto c : str) - { - if (c == '\0') - break; - WriteValue(c); - } + // if the string contains any null characters, then stop the write at the first one + str = String::toStringView(str.data(), str.size()); + Write(str.data(), str.size()); WriteValue(0); } - - void IStream::WriteString(const std::string& str) - { - WriteString(str.c_str()); - } } // namespace OpenRCT2 diff --git a/src/openrct2/core/IStream.hpp b/src/openrct2/core/IStream.hpp index 60a1034fa3..fd0135d804 100644 --- a/src/openrct2/core/IStream.hpp +++ b/src/openrct2/core/IStream.hpp @@ -59,11 +59,34 @@ namespace OpenRCT2 virtual uint64_t TryRead(void* buffer, uint64_t length) = 0; - virtual const void* GetData() const = 0; + virtual const void* GetData() const + { + return nullptr; + } + + virtual void CopyFromStream(IStream& stream, uint64_t length); + + /////////////////////////////////////////////////////////////////////////// + // Direct Read/Write methods, class can override them if they're memory-backed. + /////////////////////////////////////////////////////////////////////////// + virtual const void* ReadDirect(size_t length) + { + return nullptr; + } + + virtual void* WriteDirectStart(size_t maxLength) + { + return nullptr; + } + + virtual void WriteDirectCommit(size_t length) + { + } /////////////////////////////////////////////////////////////////////////// // Fast path methods, class can override them to use specialised copies. /////////////////////////////////////////////////////////////////////////// + private: virtual void Read1(void* buffer) { Read(buffer, 1); @@ -109,90 +132,88 @@ namespace OpenRCT2 /////////////////////////////////////////////////////////////////////////// // Helper methods /////////////////////////////////////////////////////////////////////////// + public: /** - * Reads the size of the given type from the stream directly into the given address. + * Reads the given type from the stream */ template - void Read(T* value) + void ReadValue(T& value) { // Selects the best path at compile time if constexpr (sizeof(T) == 1) { - Read1(value); + Read1(&value); } else if constexpr (sizeof(T) == 2) { - Read2(value); + Read2(&value); } else if constexpr (sizeof(T) == 4) { - Read4(value); + Read4(&value); } else if constexpr (sizeof(T) == 8) { - Read8(value); + Read8(&value); } else if constexpr (sizeof(T) == 16) { - Read16(value); + Read16(&value); } else { - Read(value, sizeof(T)); + Read(&value, sizeof(T)); } } /** - * Writes the size of the given type to the stream directly from the given address. - */ - template - void Write(const T* value) - { - // Selects the best path at compile time - if constexpr (sizeof(T) == 1) - { - Write1(value); - } - else if constexpr (sizeof(T) == 2) - { - Write2(value); - } - else if constexpr (sizeof(T) == 4) - { - Write4(value); - } - else if constexpr (sizeof(T) == 8) - { - Write8(value); - } - else if constexpr (sizeof(T) == 16) - { - Write16(value); - } - else - { - Write(value, sizeof(T)); - } - } - - /** - * Reads the given type from the stream. Use this only for small types (e.g. int8_t, int64_t, double) + * Reads the given type from the stream and returns the value directly */ template T ReadValue() { - T buffer; - Read(&buffer); - return buffer; + T value; + ReadValue(value); + return value; } /** - * Writes the given type to the stream. Use this only for small types (e.g. int8_t, int64_t, double) + * Writes the given type to the stream */ template - void WriteValue(const T value) + void WriteValue(const T& value) { - Write(&value); + // Selects the best path at compile time + if constexpr (sizeof(T) == 1) + { + Write1(&value); + } + else if constexpr (sizeof(T) == 2) + { + Write2(&value); + } + else if constexpr (sizeof(T) == 4) + { + Write4(&value); + } + else if constexpr (sizeof(T) == 8) + { + Write8(&value); + } + else if constexpr (sizeof(T) == 16) + { + Write16(&value); + } + else + { + Write(&value, sizeof(T)); + } + } + + template + void ReadArray(T* buffer, size_t count) + { + Read(buffer, sizeof(T) * count); } template @@ -209,10 +230,8 @@ namespace OpenRCT2 Write(buffer, sizeof(T) * count); } - std::string ReadStdString(); - void WriteString(const utf8* str); - void WriteString(const std::string_view string); - void WriteString(const std::string& string); + std::string ReadString(); + void WriteString(std::string_view string); }; } // namespace OpenRCT2 diff --git a/src/openrct2/core/MemoryStream.cpp b/src/openrct2/core/MemoryStream.cpp index cda05e4aec..527409c288 100644 --- a/src/openrct2/core/MemoryStream.cpp +++ b/src/openrct2/core/MemoryStream.cpp @@ -9,6 +9,7 @@ #include "MemoryStream.h" +#include "Guard.hpp" #include "Memory.hpp" #include @@ -23,17 +24,23 @@ namespace OpenRCT2 if (_access & MEMORY_ACCESS::OWNER) { - _data = Memory::Allocate(_dataCapacity); + _data = Memory::Allocate(_dataCapacity); std::memcpy(_data, copy._data, _dataCapacity); - _position = reinterpret_cast(reinterpret_cast(_data) + copy.GetPosition()); } } MemoryStream::MemoryStream(size_t capacity) { _dataCapacity = capacity; - _data = Memory::Allocate(capacity); - _position = _data; + _data = Memory::Allocate(capacity); + } + + MemoryStream::MemoryStream(const std::vector& v) + { + _dataCapacity = v.size(); + _dataSize = v.size(); + _data = Memory::Allocate(v.size()); + std::memcpy(_data, v.data(), v.size()); } MemoryStream::MemoryStream(void* data, size_t dataSize, uint8_t access) @@ -41,23 +48,7 @@ namespace OpenRCT2 _access = access; _dataCapacity = dataSize; _dataSize = dataSize; - _data = data; - _position = _data; - } - - MemoryStream::MemoryStream(const void* data, size_t dataSize) - : MemoryStream(const_cast(data), dataSize, MEMORY_ACCESS::READ) - { - } - - MemoryStream::MemoryStream(std::vector&& v) - { - _access = MEMORY_ACCESS::OWNER; - _dataCapacity = v.size(); - _dataSize = v.size(); - _data = Memory::Allocate(v.size()); - _position = _data; - std::memcpy(_data, v.data(), v.size()); + _data = static_cast(data); } MemoryStream::MemoryStream(MemoryStream&& mv) noexcept @@ -68,7 +59,7 @@ namespace OpenRCT2 , _position(mv._position) { mv._data = nullptr; - mv._position = nullptr; + mv._position = 0; mv._dataCapacity = 0; mv._dataSize = 0; } @@ -76,18 +67,21 @@ namespace OpenRCT2 MemoryStream::~MemoryStream() { if (_access & MEMORY_ACCESS::OWNER) - { Memory::Free(_data); - } + + _data = nullptr; + _position = 0; _dataCapacity = 0; _dataSize = 0; - _data = nullptr; } MemoryStream& MemoryStream::operator=(MemoryStream&& mv) noexcept { if (this != &mv) { + if (_access & MEMORY_ACCESS::OWNER) + Memory::Free(_data); + _access = mv._access; _dataCapacity = mv._dataCapacity; _data = mv._data; @@ -95,7 +89,7 @@ namespace OpenRCT2 _position = mv._position; mv._data = nullptr; - mv._position = nullptr; + mv._position = 0; mv._dataCapacity = 0; mv._dataSize = 0; } @@ -103,172 +97,111 @@ namespace OpenRCT2 return *this; } - const void* MemoryStream::GetData() const - { - return _data; - } - - bool MemoryStream::CanRead() const - { - return (_access & MEMORY_ACCESS::READ) != 0; - } - - bool MemoryStream::CanWrite() const - { - return (_access & MEMORY_ACCESS::WRITE) != 0; - } - - uint64_t MemoryStream::GetLength() const - { - return _dataSize; - } - - uint64_t MemoryStream::GetPosition() const - { - return static_cast(reinterpret_cast(_position) - reinterpret_cast(_data)); - } - void MemoryStream::SetPosition(uint64_t position) { - Seek(position, STREAM_SEEK_BEGIN); + if (position > _dataSize) + throw IOException("New position out of bounds."); + _position = static_cast(position); } void MemoryStream::Seek(int64_t offset, int32_t origin) { - uint64_t newPosition; switch (origin) { default: case STREAM_SEEK_BEGIN: - newPosition = offset; + SetPosition(offset); break; case STREAM_SEEK_CURRENT: - newPosition = GetPosition() + offset; + SetPosition(_position + offset); break; case STREAM_SEEK_END: - newPosition = _dataSize + offset; + SetPosition(_dataSize + offset); break; } - - if (newPosition > _dataSize) - { - throw IOException("New position out of bounds."); - } - _position = reinterpret_cast(reinterpret_cast(_data) + static_cast(newPosition)); } void MemoryStream::Read(void* buffer, uint64_t length) { - uint64_t position = GetPosition(); - if (position + length > _dataSize) - { + if (_position + length > _dataSize) throw IOException("Attempted to read past end of stream."); - } - std::memcpy(buffer, _position, length); - _position = reinterpret_cast(reinterpret_cast(_position) + length); - } - - void MemoryStream::Read1(void* buffer) - { - Read<1>(buffer); - } - - void MemoryStream::Read2(void* buffer) - { - Read<2>(buffer); - } - - void MemoryStream::Read4(void* buffer) - { - Read<4>(buffer); - } - - void MemoryStream::Read8(void* buffer) - { - Read<8>(buffer); - } - - void MemoryStream::Read16(void* buffer) - { - Read<16>(buffer); + std::memcpy(buffer, _data + _position, length); + _position += static_cast(length); } uint64_t MemoryStream::TryRead(void* buffer, uint64_t length) { - uint64_t remainingBytes = GetLength() - GetPosition(); - uint64_t bytesToRead = std::min(length, remainingBytes); - Read(buffer, bytesToRead); + uint64_t bytesToRead = std::min(length, static_cast(_dataSize - _position)); + std::memcpy(buffer, _data + _position, static_cast(bytesToRead)); + _position += static_cast(bytesToRead); return bytesToRead; } void MemoryStream::Write(const void* buffer, uint64_t length) { - uint64_t position = GetPosition(); - uint64_t nextPosition = position + length; - if (nextPosition > _dataCapacity) + EnsureWriteCapacity(length); + std::memcpy(_data + _position, buffer, length); + _position += static_cast(length); + _dataSize = std::max(_dataSize, _position); + } + + void MemoryStream::Clear() + { + _dataSize = 0; + _position = 0; + } + + const void* MemoryStream::ReadDirect(size_t length) + { + if (_position + length > _dataSize) + throw IOException("Attempted to read past end of stream."); + + const void* readPosition = _data + _position; + _position += length; + return readPosition; + } + + void* MemoryStream::WriteDirectStart(size_t maxLength) + { + EnsureWriteCapacity(maxLength); + return _data + _position; + } + + void MemoryStream::WriteDirectCommit(size_t length) + { + Guard::Assert(_dataCapacity >= _position + length); + _position += length; + _dataSize = std::max(_dataSize, _position); + } + + void MemoryStream::CopyFromStream(IStream& stream, uint64_t length) + { + EnsureWriteCapacity(length); + // Copy directly into storage to avoid intermediate buffer + stream.Read(_data + _position, length); + _position += static_cast(length); + _dataSize = std::max(_dataSize, _position); + } + + void MemoryStream::EnsureWriteCapacity(uint64_t length) + { + if (_position + static_cast(length) > _dataCapacity) { if (_access & MEMORY_ACCESS::OWNER) { - EnsureCapacity(static_cast(nextPosition)); + // resize to the larger of the requested capacity and double the current capacity, with a minimum of 8. + size_t newCapacity = std::max(_position + static_cast(length), _dataCapacity * 2); + newCapacity = std::max(newCapacity, 8); + + _dataCapacity = newCapacity; + _data = Memory::Reallocate(_data, _dataCapacity); } else { throw IOException("Attempted to write past end of stream."); } } - - std::memcpy(_position, buffer, length); - _position = reinterpret_cast(reinterpret_cast(_position) + length); - _dataSize = std::max(_dataSize, static_cast(nextPosition)); - } - - void MemoryStream::Write1(const void* buffer) - { - Write<1>(buffer); - } - - void MemoryStream::Write2(const void* buffer) - { - Write<2>(buffer); - } - - void MemoryStream::Write4(const void* buffer) - { - Write<4>(buffer); - } - - void MemoryStream::Write8(const void* buffer) - { - Write<8>(buffer); - } - - void MemoryStream::Write16(const void* buffer) - { - Write<16>(buffer); - } - - void MemoryStream::Clear() - { - _dataSize = 0; - SetPosition(0); - } - - void MemoryStream::EnsureCapacity(size_t capacity) - { - if (_dataCapacity < capacity) - { - size_t newCapacity = std::max(8, _dataCapacity); - while (newCapacity < capacity) - { - newCapacity *= 2; - } - - uint64_t position = GetPosition(); - _dataCapacity = newCapacity; - _data = Memory::Reallocate(_data, _dataCapacity); - _position = reinterpret_cast(reinterpret_cast(_data) + static_cast(position)); - } } } // namespace OpenRCT2 diff --git a/src/openrct2/core/MemoryStream.h b/src/openrct2/core/MemoryStream.h index 71e3e48315..212afecf46 100644 --- a/src/openrct2/core/MemoryStream.h +++ b/src/openrct2/core/MemoryStream.h @@ -11,6 +11,7 @@ #include "IStream.hpp" +#include #include #include @@ -32,89 +33,130 @@ namespace OpenRCT2 uint8_t _access = MEMORY_ACCESS::READ | MEMORY_ACCESS::WRITE | MEMORY_ACCESS::OWNER; size_t _dataCapacity = 0; size_t _dataSize = 0; - void* _data = nullptr; - void* _position = nullptr; + uint8_t* _data = nullptr; + size_t _position = 0; public: MemoryStream() = default; MemoryStream(const MemoryStream& copy); MemoryStream(MemoryStream&& mv) noexcept; explicit MemoryStream(size_t capacity); + MemoryStream(const std::vector& v); MemoryStream(void* data, size_t dataSize, uint8_t access = MEMORY_ACCESS::READ); - MemoryStream(const void* data, size_t dataSize); - MemoryStream(std::vector&& v); + MemoryStream(const void* data, size_t dataSize) + : MemoryStream(const_cast(data), dataSize, MEMORY_ACCESS::READ) + { + } virtual ~MemoryStream(); MemoryStream& operator=(MemoryStream&& mv) noexcept; - const void* GetData() const override; - /////////////////////////////////////////////////////////////////////////// // ISteam methods /////////////////////////////////////////////////////////////////////////// - bool CanRead() const override; - bool CanWrite() const override; - uint64_t GetLength() const override; - uint64_t GetPosition() const override; + const void* GetData() const override + { + return _data; + } + + bool CanRead() const override + { + return (_access & MEMORY_ACCESS::READ) != 0; + } + bool CanWrite() const override + { + return (_access & MEMORY_ACCESS::WRITE) != 0; + } + + uint64_t GetLength() const override + { + return _dataSize; + } + uint64_t GetPosition() const override + { + return _position; + } + void SetPosition(uint64_t position) override; void Seek(int64_t offset, int32_t origin) override; void Read(void* buffer, uint64_t length) override; - void Read1(void* buffer) override; - void Read2(void* buffer) override; - void Read4(void* buffer) override; - void Read8(void* buffer) override; - void Read16(void* buffer) override; + uint64_t TryRead(void* buffer, uint64_t length) override; template void Read(void* buffer) { - uint64_t position = GetPosition(); - if (position + N > _dataSize) - { + if (_position + N > _dataSize) throw IOException("Attempted to read past end of stream."); - } - std::memcpy(buffer, _position, N); - _position = reinterpret_cast(reinterpret_cast(_position) + N); + std::memcpy(buffer, _data + _position, N); + _position += static_cast(N); } void Write(const void* buffer, uint64_t length) override; - void Write1(const void* buffer) override; - void Write2(const void* buffer) override; - void Write4(const void* buffer) override; - void Write8(const void* buffer) override; - void Write16(const void* buffer) override; template void Write(const void* buffer) { - uint64_t position = GetPosition(); - uint64_t nextPosition = position + N; - if (nextPosition > _dataCapacity) - { - if (_access & MEMORY_ACCESS::OWNER) - { - EnsureCapacity(static_cast(nextPosition)); - } - else - { - throw IOException("Attempted to write past end of stream."); - } - } - - std::memcpy(_position, buffer, N); - _position = reinterpret_cast(reinterpret_cast(_position) + N); - _dataSize = std::max(_dataSize, static_cast(nextPosition)); + EnsureWriteCapacity(N); + std::memcpy(_data + _position, buffer, N); + _position += static_cast(N); + _dataSize = std::max(_dataSize, _position); } - uint64_t TryRead(void* buffer, uint64_t length) override; + const void* ReadDirect(size_t length) override; + void* WriteDirectStart(size_t maxLength) override; + void WriteDirectCommit(size_t length) override; + + void CopyFromStream(IStream& stream, uint64_t length) override; void Clear(); private: - void EnsureCapacity(size_t capacity); + void Read1(void* buffer) override + { + Read<1>(buffer); + } + void Read2(void* buffer) override + { + Read<2>(buffer); + } + void Read4(void* buffer) override + { + Read<4>(buffer); + } + void Read8(void* buffer) override + { + Read<8>(buffer); + } + void Read16(void* buffer) override + { + Read<16>(buffer); + } + + void Write1(const void* buffer) override + { + Write<1>(buffer); + } + void Write2(const void* buffer) override + { + Write<2>(buffer); + } + void Write4(const void* buffer) override + { + Write<4>(buffer); + } + void Write8(const void* buffer) override + { + Write<8>(buffer); + } + void Write16(const void* buffer) override + { + Write<16>(buffer); + } + + void EnsureWriteCapacity(uint64_t length); }; } // namespace OpenRCT2 diff --git a/src/openrct2/core/OrcaStream.hpp b/src/openrct2/core/OrcaStream.hpp index 701a4a18d9..bbeb8b0ef8 100644 --- a/src/openrct2/core/OrcaStream.hpp +++ b/src/openrct2/core/OrcaStream.hpp @@ -90,35 +90,46 @@ namespace OpenRCT2 _chunks.push_back(entry); } - // Read compressed data into buffer (read in blocks) - _buffer = MemoryStream{}; - uint8_t temp[2048]; - uint64_t bytesLeft = _header.CompressedSize; - do - { - auto readLen = std::min(size_t(bytesLeft), sizeof(temp)); - _stream->Read(temp, readLen); - _buffer.Write(temp, readLen); - bytesLeft -= readLen; - } while (bytesLeft > 0); - // Uncompress - if (_header.Compression == CompressionType::gzip) + if (_header.Compression != CompressionType::none) { - auto uncompressedData = Compression::ungzip(_buffer.GetData(), _buffer.GetLength()); - if (_header.UncompressedSize != uncompressedData.size()) + size_t compressedSize = static_cast(_header.CompressedSize); + size_t uncompressedSize = static_cast(_header.UncompressedSize); + bool decompressStatus = false; + + switch (_header.Compression) { - // Warning? + case CompressionType::gzip: + decompressStatus = Compression::zlibDecompress( + *_stream, compressedSize, _buffer, uncompressedSize, Compression::ZlibHeaderType::gzip); + break; + default: + throw IOException("Unknown Park Compression Type"); } - _buffer.Clear(); - _buffer.Write(uncompressedData.data(), uncompressedData.size()); + + if (!decompressStatus) + throw IOException("Decompression Error"); + } + else + { + if (_header.UncompressedSize != _header.CompressedSize) + throw IOException("None Compression Sizes Don't Match"); + _buffer.CopyFromStream(*_stream, _header.UncompressedSize); + } + + // early in-dev versions used SHA1 instead of FNV1a, so just assume any file + // with a verison number of 0 may be one of these, and don't check their hashes. + if (_header.TargetVersion > 0) + { + auto checksum = Crypt::FNV1a(_buffer.GetData(), _buffer.GetLength()); + if (checksum != _header.FNV1a) + throw IOException("Checksum Is Not Valid"); } } else { _header = {}; _header.Compression = CompressionType::gzip; - _buffer = MemoryStream{}; } } @@ -129,26 +140,37 @@ namespace OpenRCT2 { if (_mode == Mode::WRITING) { - const void* uncompressedData = _buffer.GetData(); - const uint64_t uncompressedSize = _buffer.GetLength(); - _header.NumChunks = static_cast(_chunks.size()); - _header.UncompressedSize = uncompressedSize; - _header.CompressedSize = uncompressedSize; - _header.FNV1a = Crypt::FNV1a(uncompressedData, uncompressedSize); + _header.UncompressedSize = _buffer.GetLength(); + _header.CompressedSize = _buffer.GetLength(); + _header.FNV1a = Crypt::FNV1a(_buffer.GetData(), _buffer.GetLength()); // Compress data - std::optional> compressedBytes; - if (_header.Compression == CompressionType::gzip) + if (_header.Compression != CompressionType::none) { - compressedBytes = Compression::gzip(uncompressedData, uncompressedSize); - if (compressedBytes) + MemoryStream compressed; + size_t bufferLength = static_cast(_buffer.GetLength()); + bool compressStatus = false; + + _buffer.SetPosition(0); + switch (_header.Compression) { - _header.CompressedSize = compressedBytes->size(); + case CompressionType::gzip: + compressStatus = Compression::zlibCompress( + _buffer, bufferLength, compressed, Compression::ZlibHeaderType::gzip); + break; + default: + break; + } + + if (compressStatus && compressed.GetLength() < _buffer.GetLength()) + { + _buffer = std::move(compressed); + _header.CompressedSize = _buffer.GetLength(); } else { - // Compression failed + // Compression increases filesize, so just store uncompressed data _header.Compression = CompressionType::none; } } @@ -156,19 +178,9 @@ namespace OpenRCT2 // Write header and chunk table _stream->WriteValue(_header); for (const auto& chunk : _chunks) - { _stream->WriteValue(chunk); - } - // Write chunk data - if (compressedBytes) - { - _stream->Write(compressedBytes->data(), compressedBytes->size()); - } - else - { - _stream->Write(uncompressedData, uncompressedSize); - } + _stream->Write(_buffer.GetData(), _buffer.GetLength()); } } diff --git a/src/openrct2/core/StreamBuffer.cpp b/src/openrct2/core/StreamBuffer.cpp new file mode 100644 index 0000000000..9378bee940 --- /dev/null +++ b/src/openrct2/core/StreamBuffer.cpp @@ -0,0 +1,161 @@ +/***************************************************************************** + * Copyright (c) 2014-2025 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "StreamBuffer.hpp" + +#include "Guard.hpp" +#include "Memory.hpp" + +namespace OpenRCT2 +{ + StreamReadBuffer::StreamReadBuffer(IStream& stream, uint64_t length, size_t bufferLength) + { + OpenRCT2::Guard::Assert(bufferLength > 0); + + _remaining = length; + if (length <= std::numeric_limits::max()) + _buffer = static_cast(stream.ReadDirect(static_cast(length))); + + if (_buffer == nullptr) + { + if (length > stream.GetLength() - stream.GetPosition()) + throw IOException("Buffer Will Read Past the End of the Stream"); + + _bufferLength = bufferLength; + _buffer = OpenRCT2::Memory::Allocate(_bufferLength); + } + } + + StreamReadBuffer::~StreamReadBuffer() + { + if (_bufferLength > 0) + OpenRCT2::Memory::Free(_buffer); + + _buffer = nullptr; + _bufferLength = 0; + _remaining = 0; + } + + StreamReadBuffer::StreamReadBuffer(StreamReadBuffer&& other) noexcept + { + _buffer = other._buffer; + _bufferLength = other._bufferLength; + _remaining = other._remaining; + + other._buffer = nullptr; + other._bufferLength = 0; + other._remaining = 0; + } + + StreamReadBuffer& StreamReadBuffer::operator=(StreamReadBuffer&& other) noexcept + { + if (&other != this) + { + _buffer = other._buffer; + _bufferLength = other._bufferLength; + _remaining = other._remaining; + + other._buffer = nullptr; + other._bufferLength = 0; + other._remaining = 0; + } + return *this; + } + + std::pair StreamReadBuffer::ReadBlock(IStream& stream, size_t maxLength) + { + const uint8_t* ptr = _buffer; + size_t len = static_cast(std::min(_remaining, maxLength)); + if (_bufferLength == 0) + { + _buffer += len; + } + else + { + len = static_cast(std::min(len, _bufferLength)); + stream.Read(const_cast(ptr), len); + } + _remaining -= len; + return { ptr, len }; + } + + StreamWriteBuffer::StreamWriteBuffer(IStream& stream, uint64_t length, size_t bufferLength) + { + OpenRCT2::Guard::Assert(bufferLength > 0); + + _remaining = length; + if (length <= std::numeric_limits::max()) + _buffer = static_cast(stream.WriteDirectStart(static_cast(length))); + + if (_buffer == nullptr) + { + _bufferLength = bufferLength; + _buffer = OpenRCT2::Memory::Allocate(_bufferLength); + } + } + + StreamWriteBuffer::~StreamWriteBuffer() + { + if (_bufferLength > 0) + OpenRCT2::Memory::Free(_buffer); + + _buffer = nullptr; + _bufferLength = 0; + _remaining = 0; + } + + StreamWriteBuffer::StreamWriteBuffer(StreamWriteBuffer&& other) noexcept + { + _buffer = other._buffer; + _bufferLength = other._bufferLength; + _remaining = other._remaining; + + other._buffer = nullptr; + other._bufferLength = 0; + other._remaining = 0; + } + + StreamWriteBuffer& StreamWriteBuffer::operator=(StreamWriteBuffer&& other) noexcept + { + if (&other != this) + { + _buffer = other._buffer; + _bufferLength = other._bufferLength; + _remaining = other._remaining; + + other._buffer = nullptr; + other._bufferLength = 0; + other._remaining = 0; + } + return *this; + } + + std::pair StreamWriteBuffer::WriteBlockStart(size_t maxLength) + { + size_t len = static_cast(std::min(_remaining, maxLength)); + if (_bufferLength > 0) + len = std::min(len, _bufferLength); + + return { _buffer, len }; + } + + void StreamWriteBuffer::WriteBlockCommit(IStream& stream, size_t length) + { + if (_bufferLength == 0) + { + stream.WriteDirectCommit(length); + _buffer += length; + } + else + { + stream.Write(_buffer, length); + } + _remaining -= length; + } +} // namespace OpenRCT2 diff --git a/src/openrct2/core/StreamBuffer.hpp b/src/openrct2/core/StreamBuffer.hpp new file mode 100644 index 0000000000..48d0a89732 --- /dev/null +++ b/src/openrct2/core/StreamBuffer.hpp @@ -0,0 +1,78 @@ +/***************************************************************************** + * Copyright (c) 2014-2025 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include "IStream.hpp" + +#include +#include +#include + +namespace OpenRCT2 +{ + struct StreamReadBuffer + { + StreamReadBuffer(IStream& stream, uint64_t length, size_t bufferLength); + + ~StreamReadBuffer(); + // not copyable + StreamReadBuffer(const StreamReadBuffer&) = delete; + StreamReadBuffer& operator=(const StreamReadBuffer&) = delete; + // moveable + StreamReadBuffer(StreamReadBuffer&&) noexcept; + StreamReadBuffer& operator=(StreamReadBuffer&&) noexcept; + + std::pair ReadBlock(IStream& stream, size_t maxLength = std::numeric_limits::max()); + + uint64_t GetRemaining() const + { + return _remaining; + } + operator bool() const + { + return _remaining > 0; + } + + private: + const uint8_t* _buffer = nullptr; + size_t _bufferLength = 0; + uint64_t _remaining = 0; + }; + + struct StreamWriteBuffer + { + StreamWriteBuffer(IStream& stream, uint64_t length, size_t bufferLength); + + ~StreamWriteBuffer(); + // not copyable + StreamWriteBuffer(const StreamWriteBuffer&) = delete; + StreamWriteBuffer& operator=(const StreamWriteBuffer&) = delete; + // moveable + StreamWriteBuffer(StreamWriteBuffer&&) noexcept; + StreamWriteBuffer& operator=(StreamWriteBuffer&&) noexcept; + + std::pair WriteBlockStart(size_t maxLength = std::numeric_limits::max()); + void WriteBlockCommit(IStream& stream, size_t length); + + uint64_t GetRemaining() const + { + return _remaining; + } + operator bool() const + { + return _remaining > 0; + } + + private: + uint8_t* _buffer = nullptr; + size_t _bufferLength = 0; + uint64_t _remaining = 0; + }; +} // namespace OpenRCT2 diff --git a/src/openrct2/core/Zip.cpp b/src/openrct2/core/Zip.cpp index 30a5e065d3..a8baf7756c 100644 --- a/src/openrct2/core/Zip.cpp +++ b/src/openrct2/core/Zip.cpp @@ -319,11 +319,6 @@ private: return static_cast(readBytes); } - const void* GetData() const override - { - return nullptr; - } - private: void Close() { diff --git a/src/openrct2/core/ZipStream.hpp b/src/openrct2/core/ZipStream.hpp index 88bda263ad..aada34d302 100644 --- a/src/openrct2/core/ZipStream.hpp +++ b/src/openrct2/core/ZipStream.hpp @@ -81,6 +81,21 @@ namespace OpenRCT2 { return _base->GetData(); } + + const void* ReadDirect(size_t length) override + { + return _base->ReadDirect(length); + } + + void* WriteDirectStart(size_t maxLength) override + { + return _base->WriteDirectStart(maxLength); + } + + void WriteDirectCommit(size_t length) override + { + _base->WriteDirectCommit(length); + } }; } // namespace OpenRCT2 diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index 61d9945d55..5fe918158a 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -229,6 +229,7 @@ + @@ -790,6 +791,7 @@ + diff --git a/src/openrct2/network/ServerList.cpp b/src/openrct2/network/ServerList.cpp index d68179bc32..1d56884d8d 100644 --- a/src/openrct2/network/ServerList.cpp +++ b/src/openrct2/network/ServerList.cpp @@ -198,10 +198,10 @@ std::vector ServerList::ReadFavourites() const for (size_t i = 0; i < numEntries; i++) { ServerListEntry serverInfo; - serverInfo.Address = fs.ReadStdString(); - serverInfo.Name = fs.ReadStdString(); + serverInfo.Address = fs.ReadString(); + serverInfo.Name = fs.ReadString(); serverInfo.RequiresPassword = false; - serverInfo.Description = fs.ReadStdString(); + serverInfo.Description = fs.ReadString(); serverInfo.Version.clear(); serverInfo.Favourite = true; serverInfo.Players = 0; diff --git a/src/openrct2/object/StringTable.cpp b/src/openrct2/object/StringTable.cpp index 179d011cbc..7957780d26 100644 --- a/src/openrct2/object/StringTable.cpp +++ b/src/openrct2/object/StringTable.cpp @@ -60,7 +60,7 @@ void StringTable::Read(IReadObjectContext* context, OpenRCT2::IStream* stream, O uint8_t languageId = (EnumValue(rct2LanguageId) <= EnumValue(RCT2LanguageId::Portuguese)) ? RCT2ToOpenRCT2LanguageId[EnumValue(rct2LanguageId)] : static_cast(LANGUAGE_UNDEFINED); - std::string stringAsWin1252 = stream->ReadStdString(); + std::string stringAsWin1252 = stream->ReadString(); auto stringAsUtf8 = RCT2StringToUTF8(stringAsWin1252, rct2LanguageId); if (!StringIsBlank(stringAsUtf8.data())) diff --git a/src/openrct2/platform/Crash.cpp b/src/openrct2/platform/Crash.cpp index 521aab5192..8a2bf0b89f 100644 --- a/src/openrct2/platform/Crash.cpp +++ b/src/openrct2/platform/Crash.cpp @@ -33,6 +33,7 @@ #include "../config/Config.h" #include "../core/Compression.h" #include "../core/Console.hpp" + #include "../core/FileStream.h" #include "../core/Guard.hpp" #include "../core/Path.hpp" #include "../core/SawyerCoding.h" @@ -134,10 +135,10 @@ static bool OnCrash( // Compress the dump { - FILE* input = _wfopen(dumpFilePath, L"rb"); - FILE* dest = _wfopen(dumpFilePathGZIP, L"wb"); + FileStream source(dumpFilePath, FileMode::open); + FileStream dest(dumpFilePathGZIP, FileMode::write); - if (Compression::gzipCompress(input, dest)) + if (Compression::zlibCompress(source, source.GetLength(), dest, Compression::ZlibHeaderType::gzip)) { // TODO: enable upload of gzip-compressed dumps once supported on // backtrace.io (uncomment the line below). For now leave compression @@ -148,8 +149,6 @@ static bool OnCrash( _uploadFiles[L"upload_file_minidump"] = dumpFilePathGZIP; */ } - fclose(input); - fclose(dest); } bool with_record = StopSilentRecord(); diff --git a/src/openrct2/rct12/SawyerChunkReader.cpp b/src/openrct2/rct12/SawyerChunkReader.cpp index e6cf481417..ac70de20bf 100644 --- a/src/openrct2/rct12/SawyerChunkReader.cpp +++ b/src/openrct2/rct12/SawyerChunkReader.cpp @@ -169,7 +169,7 @@ namespace OpenRCT2 for (size_t n = 0; n < count; n++) { - buf.Write1(src8 + i); + buf.WriteValue(src8[i]); } } else @@ -213,7 +213,7 @@ namespace OpenRCT2 throw SawyerChunkException(EXCEPTION_MSG_CORRUPT_RLE); } i++; - buf.Write1(src8 + i); + buf.WriteValue(src8[i]); } else { @@ -253,8 +253,7 @@ namespace OpenRCT2 uint8_t code = 1; for (size_t i = 0; i < srcLength; i++) { - uint8_t temp = Numerics::ror8(src8[i], code); - buf.Write1(&temp); + buf.WriteValue(Numerics::ror8(src8[i], code)); code = (code + 2) % 8; } diff --git a/src/openrct2/scenario/ScenarioRepository.cpp b/src/openrct2/scenario/ScenarioRepository.cpp index 1ce622101e..b480eb9529 100644 --- a/src/openrct2/scenario/ScenarioRepository.cpp +++ b/src/openrct2/scenario/ScenarioRepository.cpp @@ -537,8 +537,8 @@ private: for (uint32_t i = 0; i < numHighscores; i++) { ScenarioHighscoreEntry* highscore = InsertHighscore(); - highscore->fileName = fs.ReadStdString(); - highscore->name = fs.ReadStdString(); + highscore->fileName = fs.ReadString(); + highscore->name = fs.ReadString(); highscore->company_value = fileVersion == 1 ? fs.ReadValue() : fs.ReadValue(); highscore->timestamp = fs.ReadValue(); } diff --git a/test/tests/IniWriterTest.cpp b/test/tests/IniWriterTest.cpp index 760ed6dde8..8283baf1fd 100644 --- a/test/tests/IniWriterTest.cpp +++ b/test/tests/IniWriterTest.cpp @@ -47,7 +47,7 @@ TEST_F(IniWriterTest, create_one_section) ASSERT_LE(ms.GetPosition(), 13); // Accommodate for varying-sized newline (Windows) ASSERT_EQ(ms.GetLength(), ms.GetPosition()); ms.SetPosition(0); - auto ini = ms.ReadStdString(); + auto ini = ms.ReadString(); ASSERT_STREQ(ini.c_str(), "[OpenRCT2]" PLATFORM_NEWLINE); } @@ -66,7 +66,7 @@ TEST_F(IniWriterTest, create_multiple_sections) ASSERT_LE(ms.GetPosition(), 55); // Accommodate for varying-sized newline (Windows) ASSERT_EQ(ms.GetLength(), ms.GetPosition()); ms.SetPosition(0); - auto ini = ms.ReadStdString(); + auto ini = ms.ReadString(); ASSERT_STREQ( ini.c_str(), "[OpenRCT1]" PLATFORM_NEWLINE PLATFORM_NEWLINE "[OpenRCT2]" PLATFORM_NEWLINE PLATFORM_NEWLINE @@ -85,7 +85,7 @@ TEST_F(IniWriterTest, create_loose_bool_entry) ASSERT_LE(ms.GetPosition(), 17); // Accommodate for varying-sized newline (Windows) ASSERT_EQ(ms.GetLength(), ms.GetPosition()); ms.SetPosition(0); - auto ini = ms.ReadStdString(); + auto ini = ms.ReadString(); ASSERT_STREQ(ini.c_str(), "boolval = true" PLATFORM_NEWLINE); } @@ -102,7 +102,7 @@ TEST_F(IniWriterTest, create_loose_enum_entry) ASSERT_LE(ms.GetPosition(), 37); // Accommodate for varying-sized newline (Windows) ASSERT_EQ(ms.GetLength(), ms.GetPosition()); ms.SetPosition(0); - auto ini = ms.ReadStdString(); + auto ini = ms.ReadString(); ASSERT_STREQ(ini.c_str(), "by_string = stringval" PLATFORM_NEWLINE "int32_t = 0" PLATFORM_NEWLINE); } @@ -118,7 +118,7 @@ TEST_F(IniWriterTest, create_loose_float_entry) ASSERT_LE(ms.GetPosition(), 17); // Accommodate for varying-sized newline (Windows) ASSERT_EQ(ms.GetLength(), ms.GetPosition()); ms.SetPosition(0); - auto ini = ms.ReadStdString(); + auto ini = ms.ReadString(); // This will be non-fatal due to float. EXPECT_STREQ(ini.c_str(), "one = 1.000000" PLATFORM_NEWLINE); } @@ -139,7 +139,7 @@ TEST_F(IniWriterTest, create_loose_int32_t_entry) ASSERT_LE(ms.GetPosition(), 78); // Accommodate for varying-sized newline (Windows) ASSERT_EQ(ms.GetLength(), ms.GetPosition()); ms.SetPosition(0); - auto ini = ms.ReadStdString(); + auto ini = ms.ReadString(); ASSERT_STREQ( ini.c_str(), "one = 1" PLATFORM_NEWLINE "zero = 0" PLATFORM_NEWLINE "minusone = -1" PLATFORM_NEWLINE @@ -158,7 +158,7 @@ TEST_F(IniWriterTest, create_loose_string_entry) ASSERT_LE(ms.GetPosition(), 44); // Accommodate for varying-sized newline (Windows) ASSERT_EQ(ms.GetLength(), ms.GetPosition()); ms.SetPosition(0); - auto ini = ms.ReadStdString(); + auto ini = ms.ReadString(); ASSERT_STREQ( ini.c_str(), "path = \"C:'\\\\some/dir\\\\here/\xE7\xA5\x9E\xE9\xB7\xB9\xE6\x9A\xA2\xE9\x81\x8A\"" PLATFORM_NEWLINE); } @@ -181,7 +181,7 @@ TEST_F(IniWriterTest, create_multiple_section_with_values) ASSERT_LE(ms.GetPosition(), 108); // Accommodate for varying-sized newline (Windows) ASSERT_EQ(ms.GetLength(), ms.GetPosition()); ms.SetPosition(0); - auto ini = ms.ReadStdString(); + auto ini = ms.ReadString(); ASSERT_STREQ( ini.c_str(), "[bool]" PLATFORM_NEWLINE "boolval = true" PLATFORM_NEWLINE PLATFORM_NEWLINE "[int]" PLATFORM_NEWLINE @@ -203,7 +203,7 @@ TEST_F(IniWriterTest, create_duplicate_sections) ASSERT_LE(ms.GetPosition(), 43); // Accommodate for varying-sized newline (Windows) ASSERT_EQ(ms.GetLength(), ms.GetPosition()); ms.SetPosition(0); - auto ini = ms.ReadStdString(); + auto ini = ms.ReadString(); ASSERT_STREQ( ini.c_str(), "[section]" PLATFORM_NEWLINE PLATFORM_NEWLINE "[section]" PLATFORM_NEWLINE PLATFORM_NEWLINE From ad7b8b5496bf045a5497bf139c4435e101959e55 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 19:26:58 +0200 Subject: [PATCH 04/95] Rename RCT1_LIGHT_OFFSET to kRCT1LightOffset --- src/openrct2-ui/windows/Ride.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 4a51eed907..0c06b42b37 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -239,7 +239,7 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - constexpr int32_t RCT1_LIGHT_OFFSET = 4; + constexpr int32_t kRCT1LightOffset = 4; static constexpr auto kMainRideWidgets = makeWidgets( makeWindowShim(kWindowTitle, kWindowSize), @@ -1684,7 +1684,7 @@ namespace OpenRCT2::Ui::Windows int32_t minHeight = 180; if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE) { - minHeight += 20 + RCT1_LIGHT_OFFSET; + minHeight += 20 + kRCT1LightOffset; auto ride = GetRide(rideId); if (ride != nullptr) @@ -2423,7 +2423,7 @@ namespace OpenRCT2::Ui::Windows } widgets[WIDX_OPEN_LIGHT].top = widgetHeight; widgets[WIDX_OPEN_LIGHT].bottom = widgetHeight + 13; - widgetHeight += 14 - 24 + RCT1_LIGHT_OFFSET; + widgetHeight += 14 - 24 + kRCT1LightOffset; } else { From 0f346b6d559f0ae8f3871003b6350b34a2630bae Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 19:28:13 +0200 Subject: [PATCH 05/95] Rename EXPENDITURE_COLUMN_WIDTH to kExpenditureColumnWidth --- src/openrct2-ui/windows/Finances.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 5f73605e5f..7fc5ba29bb 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -197,7 +197,7 @@ namespace OpenRCT2::Ui::Windows }; static_assert(std::size(_windowFinancesTabAnimationFrames) == WINDOW_FINANCES_PAGE_COUNT); - static constexpr int32_t EXPENDITURE_COLUMN_WIDTH = 80; + static constexpr int32_t kExpenditureColumnWidth = 80; static constexpr uint32_t _windowFinancesPageHoldDownWidgets[] = { (1uLL << WIDX_LOAN_INCREASE) | (1uLL << WIDX_LOAN_DECREASE), // WINDOW_FINANCES_PAGE_SUMMARY @@ -387,7 +387,7 @@ namespace OpenRCT2::Ui::Windows { if (page == WINDOW_FINANCES_PAGE_SUMMARY) { - return { EXPENDITURE_COLUMN_WIDTH * (SummaryMaxAvailableMonth() + 1), 0 }; + return { kExpenditureColumnWidth * (SummaryMaxAvailableMonth() + 1), 0 }; } return {}; @@ -431,7 +431,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(STR_FINANCES_SUMMARY_MONTH_HEADING); ft.Add(monthyear); DrawTextBasic( - rt, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 }, + rt, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, 0 }, monthyear == currentMonthYear ? STR_WINDOW_COLOUR_2_STRINGID : STR_BLACK_STRING, ft, { TextUnderline::On, TextAlignment::RIGHT }); screenCoords.y += 14; @@ -449,7 +449,7 @@ namespace OpenRCT2::Ui::Windows ft = Formatter(); ft.Add(expenditure); DrawTextBasic( - rt, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 }, format, ft, + rt, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, 0 }, format, ft, { TextAlignment::RIGHT }); } screenCoords.y += kTableCellHeight; @@ -461,14 +461,14 @@ namespace OpenRCT2::Ui::Windows ft = Formatter(); ft.Add(profit); DrawTextBasic( - rt, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 }, format, ft, { TextAlignment::RIGHT }); + rt, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, 0 }, format, ft, { TextAlignment::RIGHT }); GfxFillRect( rt, - { screenCoords + ScreenCoordsXY{ 10, -2 }, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, -2 } }, + { screenCoords + ScreenCoordsXY{ 10, -2 }, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, -2 } }, PaletteIndex::pi10); - screenCoords.x += EXPENDITURE_COLUMN_WIDTH; + screenCoords.x += kExpenditureColumnWidth; } _lastPaintedMonth = currentMonthYear; From af406b9ba6a3bfd04ed7da4a137de17556459eb9 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 19:28:44 +0200 Subject: [PATCH 06/95] Rename TRACK_DESIGN_INDEX_UNLOADED to kTrackDesignIndexUnloaded --- src/openrct2-ui/windows/TrackList.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index bea890cea4..47132212f2 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -66,7 +66,7 @@ namespace OpenRCT2::Ui::Windows ); // clang-format on - constexpr uint16_t TRACK_DESIGN_INDEX_UNLOADED = UINT16_MAX; + constexpr uint16_t kTrackDesignIndexUnloaded = UINT16_MAX; RideSelection _window_track_list_item; @@ -151,7 +151,7 @@ namespace OpenRCT2::Ui::Windows } else { - if (_loadedTrackDesignIndex != TRACK_DESIGN_INDEX_UNLOADED + if (_loadedTrackDesignIndex != kTrackDesignIndexUnloaded && (_loadedTrackDesign->gameStateData.hasFlag(TrackDesignGameStateFlag::VehicleUnavailable))) { ContextShowError(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, kStringIdNone, {}); @@ -236,7 +236,7 @@ namespace OpenRCT2::Ui::Windows _trackDesignPreviewPixels.resize(4 * kTrackPreviewImageSize); _loadedTrackDesign = nullptr; - _loadedTrackDesignIndex = TRACK_DESIGN_INDEX_UNLOADED; + _loadedTrackDesignIndex = kTrackDesignIndexUnloaded; } void ReopenTrackManager() @@ -282,7 +282,7 @@ namespace OpenRCT2::Ui::Windows break; case WIDX_TOGGLE_SCENERY: gTrackDesignSceneryToggle = !gTrackDesignSceneryToggle; - _loadedTrackDesignIndex = TRACK_DESIGN_INDEX_UNLOADED; + _loadedTrackDesignIndex = kTrackDesignIndexUnloaded; Invalidate(); break; case WIDX_BACK: @@ -492,7 +492,7 @@ namespace OpenRCT2::Ui::Windows } else { - _loadedTrackDesignIndex = TRACK_DESIGN_INDEX_UNLOADED; + _loadedTrackDesignIndex = kTrackDesignIndexUnloaded; } } From 48b0fb52859f2fb207daada3221544ee7576e17a Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 19:29:24 +0200 Subject: [PATCH 07/95] Rename VIEWPORT_BUTTON to kButtonSize --- src/openrct2-ui/windows/Viewport.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index f5f9c94177..b9ffa372e8 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -38,7 +38,7 @@ namespace OpenRCT2::Ui::Windows static constexpr StringId kWindowTitle = STR_VIEWPORT_NO; static constexpr ScreenSize kWindowSize = { 200, 200 }; - static constexpr ScreenSize VIEWPORT_BUTTON = { 24, 24 }; + static constexpr ScreenSize kButtonSize = { 24, 24 }; #pragma endregion @@ -47,10 +47,10 @@ namespace OpenRCT2::Ui::Windows makeWindowShim(kWindowTitle, kWindowSize), makeWidget({ 0, 14}, kWindowSize - ScreenSize( 1, 1), WidgetType::resize, WindowColour::secondary ), // resize makeWidget({ 3, 17}, kWindowSize - ScreenSize(26, 3), WidgetType::viewport, WindowColour::primary ), // viewport - makeWidget({kWindowSize.width - 25, 17}, VIEWPORT_BUTTON, WidgetType::flatBtn, WindowColour::primary , ImageId(SPR_G2_ZOOM_IN), STR_ZOOM_IN_TIP ), // zoom in - makeWidget({kWindowSize.width - 25, 41}, VIEWPORT_BUTTON, WidgetType::flatBtn, WindowColour::primary , ImageId(SPR_G2_ZOOM_OUT), STR_ZOOM_OUT_TIP ), // zoom out - makeWidget({kWindowSize.width - 25, 65}, VIEWPORT_BUTTON, WidgetType::flatBtn, WindowColour::primary , ImageId(SPR_LOCATE), STR_LOCATE_SUBJECT_TIP), // locate - makeWidget({kWindowSize.width - 25, 89}, VIEWPORT_BUTTON, WidgetType::flatBtn, WindowColour::primary , ImageId(SPR_ROTATE_ARROW),STR_LOCATE_SUBJECT_TIP) // rotate + makeWidget({kWindowSize.width - 25, 17}, kButtonSize, WidgetType::flatBtn, WindowColour::primary , ImageId(SPR_G2_ZOOM_IN), STR_ZOOM_IN_TIP ), // zoom in + makeWidget({kWindowSize.width - 25, 41}, kButtonSize, WidgetType::flatBtn, WindowColour::primary , ImageId(SPR_G2_ZOOM_OUT), STR_ZOOM_OUT_TIP ), // zoom out + makeWidget({kWindowSize.width - 25, 65}, kButtonSize, WidgetType::flatBtn, WindowColour::primary , ImageId(SPR_LOCATE), STR_LOCATE_SUBJECT_TIP), // locate + makeWidget({kWindowSize.width - 25, 89}, kButtonSize, WidgetType::flatBtn, WindowColour::primary , ImageId(SPR_ROTATE_ARROW),STR_LOCATE_SUBJECT_TIP) // rotate ); // clang-format on From 8820659a3d7a3004c1caa7457f373325826ae425 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 19:31:52 +0200 Subject: [PATCH 08/95] Rename SZ_{PRIVATE,PUBLIC}_{BEGIN,END}_TOKEN to k{Private,Public}Key{Begin,End}Token --- src/openrct2/core/Crypt.CNG.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/openrct2/core/Crypt.CNG.cpp b/src/openrct2/core/Crypt.CNG.cpp index 891a775506..dc1b096598 100644 --- a/src/openrct2/core/Crypt.CNG.cpp +++ b/src/openrct2/core/Crypt.CNG.cpp @@ -421,7 +421,7 @@ public: void SetPrivate(std::string_view pem) override { - auto der = ReadPEM(pem, SZ_PRIVATE_BEGIN_TOKEN, SZ_PRIVATE_END_TOKEN); + auto der = ReadPEM(pem, kPrivateKeyBeginToken, kPrivateKeyEndToken); DerReader derReader(der); RsaKeyParams params; derReader.ReadSequenceHeader(); @@ -439,7 +439,7 @@ public: void SetPublic(std::string_view pem) override { - auto der = ReadPEM(pem, SZ_PUBLIC_BEGIN_TOKEN, SZ_PUBLIC_END_TOKEN); + auto der = ReadPEM(pem, kPublicKeyBeginToken, kPublicKeyEndToken); DerReader derReader(der); RsaKeyParams params; derReader.ReadSequenceHeader(); @@ -465,9 +465,9 @@ public: auto b64 = EncodeBase64(derBytes); std::ostringstream sb; - sb << std::string(SZ_PRIVATE_BEGIN_TOKEN) << std::endl; + sb << std::string(kPrivateKeyBeginToken) << std::endl; sb << b64; - sb << std::string(SZ_PRIVATE_END_TOKEN) << std::endl; + sb << std::string(kPrivateKeyEndToken) << std::endl; return sb.str(); } @@ -481,9 +481,9 @@ public: auto b64 = EncodeBase64(derBytes); std::ostringstream sb; - sb << std::string(SZ_PUBLIC_BEGIN_TOKEN) << std::endl; + sb << std::string(kPublicKeyBeginToken) << std::endl; sb << b64; - sb << std::string(SZ_PUBLIC_END_TOKEN) << std::endl; + sb << std::string(kPublicKeyEndToken) << std::endl; return sb.str(); } @@ -506,10 +506,10 @@ public: } private: - static constexpr const char* SZ_PUBLIC_BEGIN_TOKEN = "-----BEGIN RSA PUBLIC KEY-----"; - static constexpr const char* SZ_PUBLIC_END_TOKEN = "-----END RSA PUBLIC KEY-----"; - static constexpr const char* SZ_PRIVATE_BEGIN_TOKEN = "-----BEGIN RSA PRIVATE KEY-----"; - static constexpr const char* SZ_PRIVATE_END_TOKEN = "-----END RSA PRIVATE KEY-----"; + static constexpr const char* kPublicKeyBeginToken = "-----BEGIN RSA PUBLIC KEY-----"; + static constexpr const char* kPublicKeyEndToken = "-----END RSA PUBLIC KEY-----"; + static constexpr const char* kPrivateKeyBeginToken = "-----BEGIN RSA PRIVATE KEY-----"; + static constexpr const char* kPrivateKeyEndToken = "-----END RSA PRIVATE KEY-----"; BCRYPT_KEY_HANDLE _hKey{}; BCRYPT_KEY_HANDLE _hAlg{}; From 96e5d124b9502f1f6ee7071f3f1aa8be753340c4 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 19:41:26 +0200 Subject: [PATCH 09/95] Refactor MEMORY_ACCESS into a FlagHolder --- src/openrct2/Context.cpp | 4 ++-- src/openrct2/core/MemoryStream.cpp | 10 +++++----- src/openrct2/core/MemoryStream.h | 22 ++++++++++++---------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 0eb9d15942..23fb133900 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -739,7 +739,7 @@ namespace OpenRCT2 if (String::iequals(Path::GetExtension(path), ".sea")) { auto data = DecryptSea(fs::u8path(path)); - auto ms = MemoryStream(data.data(), data.size(), MEMORY_ACCESS::READ); + auto ms = MemoryStream(data.data(), data.size(), MemoryAccess::read); if (!LoadParkFromStream(&ms, path, loadTitleScreenOnFail, asScenario)) { throw std::runtime_error(".sea file may have been renamed."); @@ -1088,7 +1088,7 @@ namespace OpenRCT2 break; } - auto ms = MemoryStream(data.data(), data.size(), MEMORY_ACCESS::READ); + auto ms = MemoryStream(data.data(), data.size(), MemoryAccess::read); if (!LoadParkFromStream(&ms, gOpenRCT2StartupActionPath, true)) { Console::Error::WriteLine("Failed to load '%s'", gOpenRCT2StartupActionPath); diff --git a/src/openrct2/core/MemoryStream.cpp b/src/openrct2/core/MemoryStream.cpp index 527409c288..c3ad06a8e7 100644 --- a/src/openrct2/core/MemoryStream.cpp +++ b/src/openrct2/core/MemoryStream.cpp @@ -22,7 +22,7 @@ namespace OpenRCT2 _dataCapacity = copy._dataCapacity; _dataSize = copy._dataSize; - if (_access & MEMORY_ACCESS::OWNER) + if (_access.has(MemoryAccess::owner)) { _data = Memory::Allocate(_dataCapacity); std::memcpy(_data, copy._data, _dataCapacity); @@ -43,7 +43,7 @@ namespace OpenRCT2 std::memcpy(_data, v.data(), v.size()); } - MemoryStream::MemoryStream(void* data, size_t dataSize, uint8_t access) + MemoryStream::MemoryStream(void* data, size_t dataSize, AccessFlags access) { _access = access; _dataCapacity = dataSize; @@ -66,7 +66,7 @@ namespace OpenRCT2 MemoryStream::~MemoryStream() { - if (_access & MEMORY_ACCESS::OWNER) + if (_access.has(MemoryAccess::owner)) Memory::Free(_data); _data = nullptr; @@ -79,7 +79,7 @@ namespace OpenRCT2 { if (this != &mv) { - if (_access & MEMORY_ACCESS::OWNER) + if (_access.has(MemoryAccess::owner)) Memory::Free(_data); _access = mv._access; @@ -188,7 +188,7 @@ namespace OpenRCT2 { if (_position + static_cast(length) > _dataCapacity) { - if (_access & MEMORY_ACCESS::OWNER) + if (_access.has(MemoryAccess::owner)) { // resize to the larger of the requested capacity and double the current capacity, with a minimum of 8. size_t newCapacity = std::max(_position + static_cast(length), _dataCapacity * 2); diff --git a/src/openrct2/core/MemoryStream.h b/src/openrct2/core/MemoryStream.h index 212afecf46..ee5af581b8 100644 --- a/src/openrct2/core/MemoryStream.h +++ b/src/openrct2/core/MemoryStream.h @@ -9,6 +9,7 @@ #pragma once +#include "../core/FlagHolder.hpp" #include "IStream.hpp" #include @@ -17,12 +18,13 @@ namespace OpenRCT2 { - namespace MEMORY_ACCESS + enum class MemoryAccess : uint8_t { - constexpr uint8_t READ = 1 << 0; - constexpr uint8_t WRITE = 1 << 1; - constexpr uint8_t OWNER = 1 << 2; - }; // namespace MEMORY_ACCESS + read, + write, + owner, + }; + using AccessFlags = FlagHolder; /** * A stream for reading and writing to a buffer in memory. By default this buffer can grow. @@ -30,7 +32,7 @@ namespace OpenRCT2 class MemoryStream final : public IStream { private: - uint8_t _access = MEMORY_ACCESS::READ | MEMORY_ACCESS::WRITE | MEMORY_ACCESS::OWNER; + AccessFlags _access = { MemoryAccess::read, MemoryAccess::write, MemoryAccess::owner }; size_t _dataCapacity = 0; size_t _dataSize = 0; uint8_t* _data = nullptr; @@ -42,9 +44,9 @@ namespace OpenRCT2 MemoryStream(MemoryStream&& mv) noexcept; explicit MemoryStream(size_t capacity); MemoryStream(const std::vector& v); - MemoryStream(void* data, size_t dataSize, uint8_t access = MEMORY_ACCESS::READ); + MemoryStream(void* data, size_t dataSize, AccessFlags access = { MemoryAccess::read }); MemoryStream(const void* data, size_t dataSize) - : MemoryStream(const_cast(data), dataSize, MEMORY_ACCESS::READ) + : MemoryStream(const_cast(data), dataSize, MemoryAccess::read) { } virtual ~MemoryStream(); @@ -62,11 +64,11 @@ namespace OpenRCT2 bool CanRead() const override { - return (_access & MEMORY_ACCESS::READ) != 0; + return _access.has(MemoryAccess::read); } bool CanWrite() const override { - return (_access & MEMORY_ACCESS::WRITE) != 0; + return _access.has(MemoryAccess::write); } uint64_t GetLength() const override From 719eb0c6d31a2ed52e44631f45962ff1c5d43b57 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 19:42:20 +0200 Subject: [PATCH 10/95] Rename CS_SPRITE_FONT_OFFSET to kCSSpriteFontOffset --- src/openrct2/drawing/Font.cpp | 152 +++++++++++++++++----------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/src/openrct2/drawing/Font.cpp b/src/openrct2/drawing/Font.cpp index 1352e4819e..41744bd777 100644 --- a/src/openrct2/drawing/Font.cpp +++ b/src/openrct2/drawing/Font.cpp @@ -37,7 +37,7 @@ static uint8_t _spriteFontCharacterWidths[FontStyleCount][SPR_FONTS_GLYPH_COUNT] TTFFontSetDescriptor* gCurrentTTFFontSet; #endif // DISABLE_TTF -constexpr uint8_t CS_SPRITE_FONT_OFFSET = 32; +constexpr uint8_t kCSSpriteFontOffset = 32; static const std::unordered_map codepointOffsetMap = { { UnicodeChar::ae_uc, SPR_FONTS_AE_UPPER - SPR_FONTS_BEGIN }, @@ -47,38 +47,38 @@ static const std::unordered_map codepointOffsetMap = { { UnicodeChar::o_stroke, SPR_FONTS_O_STROKE_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::y_acute, SPR_FONTS_Y_ACUTE_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::a_breve_uc, SPR_FONTS_A_BREVE_UPPER - SPR_FONTS_BEGIN }, - { UnicodeChar::a_breve, 226 - CS_SPRITE_FONT_OFFSET }, // Render as â, no visual difference in the RCT font - { UnicodeChar::a_ogonek_uc, CSChar::a_ogonek_uc - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::a_ogonek, CSChar::a_ogonek - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::c_acute_uc, CSChar::c_acute_uc - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::c_acute, CSChar::c_acute - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::a_breve, 226 - kCSSpriteFontOffset }, // Render as â, no visual difference in the RCT font + { UnicodeChar::a_ogonek_uc, CSChar::a_ogonek_uc - kCSSpriteFontOffset }, + { UnicodeChar::a_ogonek, CSChar::a_ogonek - kCSSpriteFontOffset }, + { UnicodeChar::c_acute_uc, CSChar::c_acute_uc - kCSSpriteFontOffset }, + { UnicodeChar::c_acute, CSChar::c_acute - kCSSpriteFontOffset }, { UnicodeChar::c_caron_uc, SPR_FONTS_C_CARON_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::c_caron, SPR_FONTS_C_CARON_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::d_caron_uc, SPR_FONTS_D_CARON_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::d_caron, SPR_FONTS_D_CARON_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::e_ogonek_uc, CSChar::e_ogonek_uc - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::e_ogonek, CSChar::e_ogonek - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::e_ogonek_uc, CSChar::e_ogonek_uc - kCSSpriteFontOffset }, + { UnicodeChar::e_ogonek, CSChar::e_ogonek - kCSSpriteFontOffset }, { UnicodeChar::e_caron_uc, SPR_FONTS_E_CARON_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::e_caron, SPR_FONTS_E_CARON_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::g_breve_uc, SPR_FONTS_G_BREVE_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::g_breve, SPR_FONTS_G_BREVE_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::i_with_dot_uc, SPR_FONTS_I_WITH_DOT_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::i_without_dot, SPR_FONTS_I_WITHOUT_DOT_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::l_stroke_uc, CSChar::l_stroke_uc - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::l_stroke, CSChar::l_stroke - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::n_acute_uc, CSChar::n_acute_uc - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::n_acute, CSChar::n_acute - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::l_stroke_uc, CSChar::l_stroke_uc - kCSSpriteFontOffset }, + { UnicodeChar::l_stroke, CSChar::l_stroke - kCSSpriteFontOffset }, + { UnicodeChar::n_acute_uc, CSChar::n_acute_uc - kCSSpriteFontOffset }, + { UnicodeChar::n_acute, CSChar::n_acute - kCSSpriteFontOffset }, { UnicodeChar::n_caron_uc, SPR_FONTS_N_CARON_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::n_caron, SPR_FONTS_N_CARON_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::o_macron, CSChar::o_circumflex - CS_SPRITE_FONT_OFFSET }, // No visual difference + { UnicodeChar::o_macron, CSChar::o_circumflex - kCSSpriteFontOffset }, // No visual difference { UnicodeChar::o_double_acute_uc, SPR_FONTS_O_DOUBLE_ACUTE_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::o_double_acute, SPR_FONTS_O_DOUBLE_ACUTE_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::oe_uc, SPR_FONTS_OE_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::oe, SPR_FONTS_OE_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::r_caron_uc, SPR_FONTS_R_CARON_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::r_caron, SPR_FONTS_R_CARON_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::s_acute_uc, CSChar::s_acute_uc - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::s_acute, CSChar::s_acute - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::s_acute_uc, CSChar::s_acute_uc - kCSSpriteFontOffset }, + { UnicodeChar::s_acute, CSChar::s_acute - kCSSpriteFontOffset }, { UnicodeChar::s_cedilla_uc, SPR_FONTS_S_CEDILLA_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::s_cedilla, SPR_FONTS_S_CEDILLA_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::s_caron_uc, SPR_FONTS_S_CARON_UPPER - SPR_FONTS_BEGIN }, @@ -93,18 +93,18 @@ static const std::unordered_map codepointOffsetMap = { { UnicodeChar::w_circumflex, SPR_FONTS_W_CIRCUMFLEX_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::y_circumflex_uc, SPR_FONTS_Y_CIRCUMFLEX_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::y_circumflex, SPR_FONTS_Y_CIRCUMFLEX_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::z_acute_uc, CSChar::z_acute_uc - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::z_acute, CSChar::z_acute - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::z_dot_uc, CSChar::z_dot_uc - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::z_dot, CSChar::z_dot - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::z_acute_uc, CSChar::z_acute_uc - kCSSpriteFontOffset }, + { UnicodeChar::z_acute, CSChar::z_acute - kCSSpriteFontOffset }, + { UnicodeChar::z_dot_uc, CSChar::z_dot_uc - kCSSpriteFontOffset }, + { UnicodeChar::z_dot, CSChar::z_dot - kCSSpriteFontOffset }, { UnicodeChar::z_caron_uc, SPR_FONTS_Z_CARON_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::z_caron, SPR_FONTS_Z_CARON_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::f_with_hook_uc, 'F' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::f_with_hook_uc, 'F' - kCSSpriteFontOffset }, { UnicodeChar::s_comma_uc, SPR_FONTS_S_CEDILLA_UPPER - SPR_FONTS_BEGIN }, // No visual difference { UnicodeChar::s_comma, SPR_FONTS_S_CEDILLA_LOWER - SPR_FONTS_BEGIN }, // Ditto { UnicodeChar::t_comma_uc, SPR_FONTS_T_COMMA_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::t_comma, SPR_FONTS_T_COMMA_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::sharp_s_uc, 223 - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::sharp_s_uc, 223 - kCSSpriteFontOffset }, { UnicodeChar::c_circumflex_uc, SPR_FONTS_C_CIRCUMFLEX_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::c_circumflex, SPR_FONTS_C_CIRCUMFLEX_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::g_circumflex_uc, SPR_FONTS_G_CIRCUMFLEX_UPPER - SPR_FONTS_BEGIN }, @@ -119,34 +119,34 @@ static const std::unordered_map codepointOffsetMap = { { UnicodeChar::u_breve, SPR_FONTS_U_BREVE_LOWER - SPR_FONTS_BEGIN }, // Cyrillic alphabet - { UnicodeChar::cyrillic_io_uc, 203 - CS_SPRITE_FONT_OFFSET }, // Looks just like Ë + { UnicodeChar::cyrillic_io_uc, 203 - kCSSpriteFontOffset }, // Looks just like Ë { UnicodeChar::cyrillic_ukrainian_ie_uc, SPR_FONTS_CYRILLIC_UKRAINIAN_IE_UPPER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_dze_uc, 'S' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::cyrillic_dotted_i_uc, 'I' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::cyrillic_yi_uc, 207 - CS_SPRITE_FONT_OFFSET }, // Looks just like Ï - { UnicodeChar::cyrillic_je_uc, 'J' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::cyrillic_a_uc, 'A' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_dze_uc, 'S' - kCSSpriteFontOffset }, + { UnicodeChar::cyrillic_dotted_i_uc, 'I' - kCSSpriteFontOffset }, + { UnicodeChar::cyrillic_yi_uc, 207 - kCSSpriteFontOffset }, // Looks just like Ï + { UnicodeChar::cyrillic_je_uc, 'J' - kCSSpriteFontOffset }, + { UnicodeChar::cyrillic_a_uc, 'A' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_be_uc, SPR_FONTS_CYRILLIC_BE_UPPER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_ve_uc, 'B' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_ve_uc, 'B' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_ghe_uc, SPR_FONTS_CYRILLIC_GHE_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_de_uc, SPR_FONTS_CYRILLIC_DE_UPPER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_ie_uc, 'E' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_ie_uc, 'E' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_zhe_uc, SPR_FONTS_CYRILLIC_ZHE_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_ze_uc, SPR_FONTS_CYRILLIC_ZE_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_i_uc, SPR_FONTS_CYRILLIC_I_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_short_i_uc, SPR_FONTS_CYRILLIC_SHORT_I_UPPER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_ka_uc, 'K' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_ka_uc, 'K' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_el_uc, SPR_FONTS_CYRILLIC_EL_UPPER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_em_uc, 'M' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::cyrillic_en_uc, 'H' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::cyrillic_o_uc, 'O' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_em_uc, 'M' - kCSSpriteFontOffset }, + { UnicodeChar::cyrillic_en_uc, 'H' - kCSSpriteFontOffset }, + { UnicodeChar::cyrillic_o_uc, 'O' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_pe_uc, SPR_FONTS_CYRILLIC_PE_UPPER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_er_uc, 'P' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::cyrillic_es_uc, 'C' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::cyrillic_te_uc, 'T' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_er_uc, 'P' - kCSSpriteFontOffset }, + { UnicodeChar::cyrillic_es_uc, 'C' - kCSSpriteFontOffset }, + { UnicodeChar::cyrillic_te_uc, 'T' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_u_uc, SPR_FONTS_CYRILLIC_U_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_ef_uc, SPR_FONTS_CYRILLIC_EF_UPPER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_ha_uc, 'X' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_ha_uc, 'X' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_tse_uc, SPR_FONTS_CYRILLIC_TSE_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_che_uc, SPR_FONTS_CYRILLIC_CHE_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_sha_uc, SPR_FONTS_CYRILLIC_SHA_UPPER - SPR_FONTS_BEGIN }, @@ -158,12 +158,12 @@ static const std::unordered_map codepointOffsetMap = { { UnicodeChar::cyrillic_yu_uc, SPR_FONTS_CYRILLIC_YU_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_ya_uc, SPR_FONTS_CYRILLIC_YA_UPPER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_a, 'a' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_a, 'a' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_be, SPR_FONTS_CYRILLIC_BE_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_ve, SPR_FONTS_CYRILLIC_VE_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_ghe, SPR_FONTS_CYRILLIC_GHE_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_de, SPR_FONTS_CYRILLIC_DE_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_ie, 'e' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_ie, 'e' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_zhe, SPR_FONTS_CYRILLIC_ZHE_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_ze, SPR_FONTS_CYRILLIC_ZE_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_i, SPR_FONTS_CYRILLIC_I_LOWER - SPR_FONTS_BEGIN }, @@ -172,14 +172,14 @@ static const std::unordered_map codepointOffsetMap = { { UnicodeChar::cyrillic_el, SPR_FONTS_CYRILLIC_EL_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_em, SPR_FONTS_CYRILLIC_EM_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_en, SPR_FONTS_CYRILLIC_EN_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_o, 'o' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_o, 'o' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_pe, SPR_FONTS_CYRILLIC_PE_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_er, 'p' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::cyrillic_es, 'c' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_er, 'p' - kCSSpriteFontOffset }, + { UnicodeChar::cyrillic_es, 'c' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_te, SPR_FONTS_CYRILLIC_TE_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_u, 'y' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_u, 'y' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_ef, SPR_FONTS_CYRILLIC_EF_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_ha, 'x' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_ha, 'x' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_tse, SPR_FONTS_CYRILLIC_TSE_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_che, SPR_FONTS_CYRILLIC_CHE_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_sha, SPR_FONTS_CYRILLIC_SHA_LOWER - SPR_FONTS_BEGIN }, @@ -190,12 +190,12 @@ static const std::unordered_map codepointOffsetMap = { { UnicodeChar::cyrillic_e, SPR_FONTS_CYRILLIC_E_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_yu, SPR_FONTS_CYRILLIC_YU_LOWER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_ya, SPR_FONTS_CYRILLIC_YA_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_io, 235 - CS_SPRITE_FONT_OFFSET }, // Looks just like ë + { UnicodeChar::cyrillic_io, 235 - kCSSpriteFontOffset }, // Looks just like ë { UnicodeChar::cyrillic_ukrainian_ie, SPR_FONTS_CYRILLIC_UKRAINIAN_IE_LOWER - SPR_FONTS_BEGIN }, - { UnicodeChar::cyrillic_dze, 's' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::cyrillic_dotted_i, 'i' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::cyrillic_yi, 239 - CS_SPRITE_FONT_OFFSET }, // Looks just like ï - { UnicodeChar::cyrillic_je, 'J' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cyrillic_dze, 's' - kCSSpriteFontOffset }, + { UnicodeChar::cyrillic_dotted_i, 'i' - kCSSpriteFontOffset }, + { UnicodeChar::cyrillic_yi, 239 - kCSSpriteFontOffset }, // Looks just like ï + { UnicodeChar::cyrillic_je, 'J' - kCSSpriteFontOffset }, { UnicodeChar::cyrillic_ghe_upturn_uc, SPR_FONTS_CYRILLIC_GHE_UPTURN_UPPER - SPR_FONTS_BEGIN }, { UnicodeChar::cyrillic_ghe_upturn, SPR_FONTS_CYRILLIC_GHE_UPTURN_LOWER - SPR_FONTS_BEGIN }, @@ -204,47 +204,47 @@ static const std::unordered_map codepointOffsetMap = { { UnicodeChar::vertical_bar, SPR_FONTS_VERTICAL_BAR - SPR_FONTS_BEGIN }, { UnicodeChar::right_brace, SPR_FONTS_RIGHT_BRACE - SPR_FONTS_BEGIN }, { UnicodeChar::tilde, SPR_FONTS_TILDE - SPR_FONTS_BEGIN }, - { UnicodeChar::non_breaking_space, ' ' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::non_breaking_space, ' ' - kCSSpriteFontOffset }, { UnicodeChar::interpunct, SPR_FONTS_INTERPUNCT - SPR_FONTS_BEGIN }, - { UnicodeChar::multiplication_sign, CSChar::cross - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::en_dash, '-' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::em_dash, '-' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::single_quote_open, '`' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::single_quote_end, '\'' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::single_german_quote_open, ',' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::multiplication_sign, CSChar::cross - kCSSpriteFontOffset }, + { UnicodeChar::en_dash, '-' - kCSSpriteFontOffset }, + { UnicodeChar::em_dash, '-' - kCSSpriteFontOffset }, + { UnicodeChar::single_quote_open, '`' - kCSSpriteFontOffset }, + { UnicodeChar::single_quote_end, '\'' - kCSSpriteFontOffset }, + { UnicodeChar::single_german_quote_open, ',' - kCSSpriteFontOffset }, { UnicodeChar::german_quote_open, SPR_FONTS_GERMAN_OPENQUOTES - SPR_FONTS_BEGIN }, - { UnicodeChar::bullet, CSChar::bullet - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::bullet, CSChar::bullet - kCSSpriteFontOffset }, { UnicodeChar::ellipsis, SPR_FONTS_ELLIPSIS - SPR_FONTS_BEGIN }, - { UnicodeChar::narrow_non_breaking_space, ' ' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::quote_open, CSChar::quote_open - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::quote_close, CSChar::quote_close - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::narrow_non_breaking_space, ' ' - kCSSpriteFontOffset }, + { UnicodeChar::quote_open, CSChar::quote_open - kCSSpriteFontOffset }, + { UnicodeChar::quote_close, CSChar::quote_close - kCSSpriteFontOffset }, // Currency { UnicodeChar::guilder, SPR_FONTS_GUILDER_SIGN - SPR_FONTS_BEGIN }, - { UnicodeChar::euro, CSChar::euro - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::euro, CSChar::euro - kCSSpriteFontOffset }, { UnicodeChar::rouble, SPR_FONTS_ROUBLE_SIGN - SPR_FONTS_BEGIN }, // Dingbats - { UnicodeChar::up, CSChar::up - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::small_up, CSChar::small_up - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::right, CSChar::right - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::down, CSChar::down - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::small_down, CSChar::small_down - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::left, CSChar::left - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::air, CSChar::air - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::tick, CSChar::tick - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::plus, '+' - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::minus, '-' - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::up, CSChar::up - kCSSpriteFontOffset }, + { UnicodeChar::small_up, CSChar::small_up - kCSSpriteFontOffset }, + { UnicodeChar::right, CSChar::right - kCSSpriteFontOffset }, + { UnicodeChar::down, CSChar::down - kCSSpriteFontOffset }, + { UnicodeChar::small_down, CSChar::small_down - kCSSpriteFontOffset }, + { UnicodeChar::left, CSChar::left - kCSSpriteFontOffset }, + { UnicodeChar::air, CSChar::air - kCSSpriteFontOffset }, + { UnicodeChar::tick, CSChar::tick - kCSSpriteFontOffset }, + { UnicodeChar::plus, '+' - kCSSpriteFontOffset }, + { UnicodeChar::minus, '-' - kCSSpriteFontOffset }, // Emoji - { UnicodeChar::cross, CSChar::cross - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::water, CSChar::water - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::cross, CSChar::cross - kCSSpriteFontOffset }, + { UnicodeChar::water, CSChar::water - kCSSpriteFontOffset }, { UnicodeChar::eye, SPR_FONTS_EYE - SPR_FONTS_BEGIN }, - { UnicodeChar::road, CSChar::road - CS_SPRITE_FONT_OFFSET }, - { UnicodeChar::railway, CSChar::railway - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::road, CSChar::road - kCSSpriteFontOffset }, + { UnicodeChar::railway, CSChar::railway - kCSSpriteFontOffset }, // Misc - { UnicodeChar::superscript_minus_one, CSChar::superscript_minus_one - CS_SPRITE_FONT_OFFSET }, + { UnicodeChar::superscript_minus_one, CSChar::superscript_minus_one - kCSSpriteFontOffset }, }; static char32_t _smallestCodepointValue = 0; From af3f61e49bbd6bc5d7dd9a8f964eb670156eeb37 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 19:42:52 +0200 Subject: [PATCH 11/95] Rename MAX_LANGUAGE_SIZE to kMaxLanguageSize --- src/openrct2/localisation/LanguagePack.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2/localisation/LanguagePack.cpp b/src/openrct2/localisation/LanguagePack.cpp index c6eb9fc5bd..86c91479af 100644 --- a/src/openrct2/localisation/LanguagePack.cpp +++ b/src/openrct2/localisation/LanguagePack.cpp @@ -27,7 +27,7 @@ using namespace OpenRCT2; // Don't try to load more than language files that exceed 64 MiB -constexpr uint64_t MAX_LANGUAGE_SIZE = 64 * 1024 * 1024; +static constexpr uint64_t kMaxLanguageSize = 64 * 1024 * 1024; class LanguagePack final : public ILanguagePack { @@ -48,7 +48,7 @@ public: OpenRCT2::FileStream fs = OpenRCT2::FileStream(path, OpenRCT2::FileMode::open); size_t fileLength = static_cast(fs.GetLength()); - if (fileLength > MAX_LANGUAGE_SIZE) + if (fileLength > kMaxLanguageSize) { throw IOException("Language file too large."); } From 600a65b5bfd1e2bd70ce525aafe6c5a6da4ffb54 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 19:46:18 +0200 Subject: [PATCH 12/95] Refactor award effect consts into an enum class --- src/openrct2/management/Award.cpp | 46 ++++++++++++++++--------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/openrct2/management/Award.cpp b/src/openrct2/management/Award.cpp index 0f185d228d..8fcc967abd 100644 --- a/src/openrct2/management/Award.cpp +++ b/src/openrct2/management/Award.cpp @@ -24,27 +24,29 @@ using namespace OpenRCT2; -constexpr uint8_t NEGATIVE = 0; -constexpr uint8_t POSITIVE = 1; - -static constexpr uint8_t AwardPositiveMap[] = { - NEGATIVE, // AwardType::MostUntidy - POSITIVE, // AwardType::MostTidy - POSITIVE, // AwardType::BestRollerCoasters - POSITIVE, // AwardType::BestValue - POSITIVE, // AwardType::MostBeautiful - NEGATIVE, // AwardType::WorstValue - POSITIVE, // AwardType::Safest - POSITIVE, // AwardType::BestStaff - POSITIVE, // AwardType::BestFood - NEGATIVE, // AwardType::WorstFood - POSITIVE, // AwardType::BestToilets - NEGATIVE, // AwardType::MostDisappointing - POSITIVE, // AwardType::BestWaterRides - POSITIVE, // AwardType::BestCustomDesignedRides - POSITIVE, // AwardType::MostDazzlingRideColours - NEGATIVE, // AwardType::MostConfusingLayout - POSITIVE, // AwardType::BestGentleRides +enum class AwardEffect : uint8_t +{ + negative, + positive +}; +static constexpr AwardEffect kAwardPositiveMap[] = { + AwardEffect::negative, // AwardType::MostUntidy + AwardEffect::positive, // AwardType::MostTidy + AwardEffect::positive, // AwardType::BestRollerCoasters + AwardEffect::positive, // AwardType::BestValue + AwardEffect::positive, // AwardType::MostBeautiful + AwardEffect::negative, // AwardType::WorstValue + AwardEffect::positive, // AwardType::Safest + AwardEffect::positive, // AwardType::BestStaff + AwardEffect::positive, // AwardType::BestFood + AwardEffect::negative, // AwardType::WorstFood + AwardEffect::positive, // AwardType::BestToilets + AwardEffect::negative, // AwardType::MostDisappointing + AwardEffect::positive, // AwardType::BestWaterRides + AwardEffect::positive, // AwardType::BestCustomDesignedRides + AwardEffect::positive, // AwardType::MostDazzlingRideColours + AwardEffect::negative, // AwardType::MostConfusingLayout + AwardEffect::positive, // AwardType::BestGentleRides }; static constexpr StringId AwardNewsStrings[] = { @@ -69,7 +71,7 @@ static constexpr StringId AwardNewsStrings[] = { bool AwardIsPositive(AwardType type) { - return AwardPositiveMap[EnumValue(type)]; + return kAwardPositiveMap[EnumValue(type)] == AwardEffect::positive; } #pragma region Award checks From 8468f87a87d1d5a611b1a7dbd7e72f7bc8e7ba66 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 19:58:07 +0200 Subject: [PATCH 13/95] Refactor MarketingCampaignFlags into a FlagHolder --- src/openrct2/actions/ParkMarketingAction.cpp | 2 +- src/openrct2/management/Marketing.cpp | 4 ++-- src/openrct2/management/Marketing.h | 17 +++++++++++------ src/openrct2/park/ParkFile.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/openrct2/actions/ParkMarketingAction.cpp b/src/openrct2/actions/ParkMarketingAction.cpp index 42b031a160..7f65053aeb 100644 --- a/src/openrct2/actions/ParkMarketingAction.cpp +++ b/src/openrct2/actions/ParkMarketingAction.cpp @@ -70,7 +70,7 @@ GameActions::Result ParkMarketingAction::Execute() const MarketingCampaign campaign{}; campaign.Type = _type; campaign.WeeksLeft = _numWeeks; - campaign.Flags = MarketingCampaignFlags::FIRST_WEEK; + campaign.flags = { MarketingCampaignFlag::firstWeek }; if (campaign.Type == ADVERTISING_CAMPAIGN_RIDE_FREE || campaign.Type == ADVERTISING_CAMPAIGN_RIDE) { campaign.RideId = RideId::FromUnderlying(_item); diff --git a/src/openrct2/management/Marketing.cpp b/src/openrct2/management/Marketing.cpp index a424935ebe..12163d7b6e 100644 --- a/src/openrct2/management/Marketing.cpp +++ b/src/openrct2/management/Marketing.cpp @@ -120,11 +120,11 @@ void MarketingUpdate() for (auto it = gameState.marketingCampaigns.begin(); it != gameState.marketingCampaigns.end();) { auto& campaign = *it; - if (campaign.Flags & MarketingCampaignFlags::FIRST_WEEK) + if (campaign.flags.has(MarketingCampaignFlag::firstWeek)) { // This ensures the campaign is active for x full weeks if started within the // middle of a week. - campaign.Flags &= ~MarketingCampaignFlags::FIRST_WEEK; + campaign.flags.unset(MarketingCampaignFlag::firstWeek); } else if (campaign.WeeksLeft > 0) { diff --git a/src/openrct2/management/Marketing.h b/src/openrct2/management/Marketing.h index c56cc83729..3f1e4595ec 100644 --- a/src/openrct2/management/Marketing.h +++ b/src/openrct2/management/Marketing.h @@ -10,6 +10,7 @@ #pragma once #include "../Cheats.h" +#include "../core/FlagHolder.hpp" #include "../localisation/StringIdType.h" #include "../ride/RideTypes.h" #include "../ride/ShopItem.h" @@ -41,11 +42,20 @@ enum CAMPAIGN_ACTIVE_FLAG = (1 << 7) }; +namespace OpenRCT2 +{ + enum class MarketingCampaignFlag : uint8_t + { + firstWeek, + }; + using MarketingCampaignFlags = FlagHolder; +} // namespace OpenRCT2 + struct MarketingCampaign { uint8_t Type{}; uint8_t WeeksLeft{}; - uint8_t Flags{}; + OpenRCT2::MarketingCampaignFlags flags{}; union { ::RideId RideId{}; @@ -53,11 +63,6 @@ struct MarketingCampaign }; }; -namespace OpenRCT2::MarketingCampaignFlags -{ - constexpr uint8_t FIRST_WEEK = 1 << 0; -} - extern const money64 AdvertisingCampaignPricePerWeek[ADVERTISING_CAMPAIGN_COUNT]; extern const StringId kMarketingCampaignNames[ADVERTISING_CAMPAIGN_COUNT][3]; diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 33178d2f6d..9f06105455 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -947,7 +947,7 @@ namespace OpenRCT2 cs.ReadWriteVector(gameState.marketingCampaigns, [&cs](MarketingCampaign& campaign) { cs.ReadWrite(campaign.Type); cs.ReadWrite(campaign.WeeksLeft); - cs.ReadWrite(campaign.Flags); + cs.ReadWrite(campaign.flags.holder); cs.ReadWrite(campaign.RideId); }); diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index bcc19d661c..3ddde3620f 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1615,7 +1615,7 @@ namespace OpenRCT2::RCT2 campaign.WeeksLeft = _s6.CampaignWeeksLeft[i] & ~(CAMPAIGN_ACTIVE_FLAG | CAMPAIGN_FIRST_WEEK_FLAG); if ((_s6.CampaignWeeksLeft[i] & CAMPAIGN_FIRST_WEEK_FLAG) != 0) { - campaign.Flags |= MarketingCampaignFlags::FIRST_WEEK; + campaign.flags.set(MarketingCampaignFlag::firstWeek); } if (campaign.Type == ADVERTISING_CAMPAIGN_RIDE_FREE || campaign.Type == ADVERTISING_CAMPAIGN_RIDE) { From 490012c6a4876189749a059c41d7a78a5e554690 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 19:59:30 +0200 Subject: [PATCH 14/95] Rename constants in DiscordService.cpp to use kCamelCase --- src/openrct2/network/DiscordService.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/openrct2/network/DiscordService.cpp b/src/openrct2/network/DiscordService.cpp index fb1d2e92b2..22471ae1fa 100644 --- a/src/openrct2/network/DiscordService.cpp +++ b/src/openrct2/network/DiscordService.cpp @@ -30,9 +30,9 @@ namespace { using namespace std::chrono_literals; - constexpr const char* APPLICATION_ID = "378612438200877056"; - constexpr const char* STEAM_APP_ID = nullptr; - constexpr auto REFRESH_INTERVAL = 5.0s; + constexpr const char* kApplicationID = "378612438200877056"; + constexpr const char* kSteamAppID = nullptr; + constexpr auto kRefreshInterval = 5.0s; } // namespace static void OnReady([[maybe_unused]] const DiscordUser* request) @@ -56,7 +56,7 @@ DiscordService::DiscordService() handlers.ready = OnReady; handlers.disconnected = OnDisconnected; handlers.errored = OnErrored; - Discord_Initialize(APPLICATION_ID, &handlers, 1, STEAM_APP_ID); + Discord_Initialize(kApplicationID, &handlers, 1, kSteamAppID); } DiscordService::~DiscordService() @@ -74,7 +74,7 @@ void DiscordService::Tick() { Discord_RunCallbacks(); - if (_updateTimer.GetElapsedTime() < REFRESH_INTERVAL) + if (_updateTimer.GetElapsedTime() < kRefreshInterval) return; RefreshPresence(); From 8f42e8b257c861ab118fc7161d9238d314d48791 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 19:59:56 +0200 Subject: [PATCH 15/95] Rename OBJECT_START_INDEX to kObjectStartIndex --- src/openrct2/network/NetworkBase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index c3870a61e0..fe7979caa4 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -2400,8 +2400,8 @@ void NetworkBase::Client_Handle_OBJECTS_LIST(NetworkConnection& connection, Netw uint32_t totalObjects = 0; packet >> index >> totalObjects; - static constexpr uint32_t OBJECT_START_INDEX = 0; - if (index == OBJECT_START_INDEX) + static constexpr uint32_t kObjectStartIndex = 0; + if (index == kObjectStartIndex) { _missingObjects.clear(); } From b138f8ccd85c34c5337c3c1b00b796626ef27a82 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 20:00:45 +0200 Subject: [PATCH 16/95] Rename constants in ServerList.cpp to use kCamelCase --- src/openrct2/network/ServerList.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openrct2/network/ServerList.cpp b/src/openrct2/network/ServerList.cpp index 1d56884d8d..a96e3a926a 100644 --- a/src/openrct2/network/ServerList.cpp +++ b/src/openrct2/network/ServerList.cpp @@ -268,8 +268,8 @@ std::future> ServerList::FetchLocalServerListAsync( { auto broadcastAddress = broadcastEndpoint.GetHostname(); return std::async(std::launch::async, [broadcastAddress] { - constexpr auto RECV_DELAY_MS = 10; - constexpr auto RECV_WAIT_MS = 2000; + constexpr auto kReceiveDelayInMs = 10; + constexpr auto kReceiveWaitInMs = 2000; std::string_view msg = kNetworkLanBroadcastMsg; auto udpSocket = CreateUdpSocket(); @@ -282,7 +282,7 @@ std::future> ServerList::FetchLocalServerListAsync( } std::vector entries; - for (int i = 0; i < (RECV_WAIT_MS / RECV_DELAY_MS); i++) + for (int i = 0; i < (kReceiveWaitInMs / kReceiveDelayInMs); i++) { try { @@ -314,7 +314,7 @@ std::future> ServerList::FetchLocalServerListAsync( { LOG_WARNING("Error receiving data: %s", e.what()); } - Platform::Sleep(RECV_DELAY_MS); + Platform::Sleep(kReceiveDelayInMs); } return entries; }); From 1d75a2d7468dd75534b8643d585564848d39ba93 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 20:02:55 +0200 Subject: [PATCH 17/95] Rename SINGLE_INSTANCE_MUTEX_NAME to kSingleInstanceMutexName --- src/openrct2/platform/Platform.Posix.cpp | 4 ++-- src/openrct2/platform/Platform.Win32.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openrct2/platform/Platform.Posix.cpp b/src/openrct2/platform/Platform.Posix.cpp index 2d525c6183..dfeda0de99 100644 --- a/src/openrct2/platform/Platform.Posix.cpp +++ b/src/openrct2/platform/Platform.Posix.cpp @@ -32,7 +32,7 @@ #include // The name of the mutex used to prevent multiple instances of the game from running -static constexpr const utf8* SINGLE_INSTANCE_MUTEX_NAME = u8"openrct2.lock"; +static constexpr const utf8* kSingleInstanceMutexName = u8"openrct2.lock"; namespace OpenRCT2::Platform { @@ -308,7 +308,7 @@ namespace OpenRCT2::Platform // take care of that, because flock keeps the lock as long as the // file is open and closes it automatically on file close. // This is intentional. - int32_t pidFile = open(SINGLE_INSTANCE_MUTEX_NAME, O_CREAT | O_RDWR, 0666); + int32_t pidFile = open(kSingleInstanceMutexName, O_CREAT | O_RDWR, 0666); if (pidFile == -1) { diff --git a/src/openrct2/platform/Platform.Win32.cpp b/src/openrct2/platform/Platform.Win32.cpp index 9395dc81c5..8da9216b3b 100644 --- a/src/openrct2/platform/Platform.Win32.cpp +++ b/src/openrct2/platform/Platform.Win32.cpp @@ -47,7 +47,7 @@ linker, \ "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") // The name of the mutex used to prevent multiple instances of the game from running -static constexpr wchar_t SINGLE_INSTANCE_MUTEX_NAME[] = L"RollerCoaster Tycoon 2_GSKMUTEX"; +static constexpr wchar_t kSingleInstanceMutexName[] = L"RollerCoaster Tycoon 2_GSKMUTEX"; #define SOFTWARE_CLASSES L"Software\\Classes" #define MUI_CACHE L"Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache" @@ -776,7 +776,7 @@ namespace OpenRCT2::Platform bool LockSingleInstance() { // Check if operating system mutex exists - HANDLE mutex = CreateMutexW(nullptr, FALSE, SINGLE_INSTANCE_MUTEX_NAME); + HANDLE mutex = CreateMutexW(nullptr, FALSE, kSingleInstanceMutexName); if (mutex == nullptr) { LOG_ERROR("unable to create mutex"); From eb40be611cc914791e480e9e2fe51d9a7e085e15 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 20:03:21 +0200 Subject: [PATCH 18/95] Rename MULTIBYTE to kMultibyte --- src/openrct2/rct12/RCT12.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2/rct12/RCT12.cpp b/src/openrct2/rct12/RCT12.cpp index ccdfd7ab65..1cc8be764c 100644 --- a/src/openrct2/rct12/RCT12.cpp +++ b/src/openrct2/rct12/RCT12.cpp @@ -874,12 +874,12 @@ namespace OpenRCT2::RCT12 { size_t GetRCTStringBufferLen(const char* buffer, size_t maxBufferLen) { - constexpr char MULTIBYTE = static_cast(255); + constexpr char kMultibyte = static_cast(255); size_t len = 0; for (size_t i = 0; i < maxBufferLen; i++) { auto ch = buffer[i]; - if (ch == MULTIBYTE) + if (ch == kMultibyte) { i += 2; From 6d71835ee493a4cbaeeb9eeb2e837129cdc3948e Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 20:05:06 +0200 Subject: [PATCH 19/95] Rename constants in SawyerChunkReader.cpp to use kCamelCase --- src/openrct2/rct12/SawyerChunkReader.cpp | 48 ++++++++++++------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/openrct2/rct12/SawyerChunkReader.cpp b/src/openrct2/rct12/SawyerChunkReader.cpp index ac70de20bf..fd0fb1a49d 100644 --- a/src/openrct2/rct12/SawyerChunkReader.cpp +++ b/src/openrct2/rct12/SawyerChunkReader.cpp @@ -16,13 +16,13 @@ namespace OpenRCT2 { // Allow chunks to be uncompressed to a maximum of 16 MiB - constexpr size_t MAX_UNCOMPRESSED_CHUNK_SIZE = 16 * 1024 * 1024; + constexpr size_t kMaxUncompressedChunkSize = 16 * 1024 * 1024; - constexpr const char* EXCEPTION_MSG_CORRUPT_CHUNK_SIZE = "Corrupt chunk size."; - constexpr const char* EXCEPTION_MSG_CORRUPT_RLE = "Corrupt RLE compression data."; - constexpr const char* EXCEPTION_MSG_DESTINATION_TOO_SMALL = "Chunk data larger than allocated destination capacity."; - constexpr const char* EXCEPTION_MSG_INVALID_CHUNK_ENCODING = "Invalid chunk encoding."; - constexpr const char* EXCEPTION_MSG_ZERO_SIZED_CHUNK = "Encountered zero-sized chunk."; + constexpr const char* kExceptionMessageCorruptChunkSize = "Corrupt chunk size."; + constexpr const char* kExceptionMessageCorruptRLE = "Corrupt RLE compression data."; + constexpr const char* kExceptionMessageDestinationTooSmall = "Chunk data larger than allocated destination capacity."; + constexpr const char* kExceptionMessageInvalidChunkEncoding = "Invalid chunk encoding."; + constexpr const char* kExceptionMessageZeroSizedChunk = "Encountered zero-sized chunk."; static MemoryStream DecodeChunk(const void* src, const SawyerCoding::ChunkHeader& header); @@ -53,8 +53,8 @@ namespace OpenRCT2 try { auto header = _stream->ReadValue(); - if (header.length >= MAX_UNCOMPRESSED_CHUNK_SIZE) - throw SawyerChunkException(EXCEPTION_MSG_CORRUPT_CHUNK_SIZE); + if (header.length >= kMaxUncompressedChunkSize) + throw SawyerChunkException(kExceptionMessageCorruptChunkSize); switch (header.encoding) { @@ -66,19 +66,19 @@ namespace OpenRCT2 auto compressedData = std::make_unique(header.length); if (_stream->TryRead(compressedData.get(), header.length) != header.length) { - throw SawyerChunkException(EXCEPTION_MSG_CORRUPT_CHUNK_SIZE); + throw SawyerChunkException(kExceptionMessageCorruptChunkSize); } auto buffer = DecodeChunk(compressedData.get(), header); if (buffer.GetLength() == 0) { - throw SawyerChunkException(EXCEPTION_MSG_ZERO_SIZED_CHUNK); + throw SawyerChunkException(kExceptionMessageZeroSizedChunk); } return std::make_shared(static_cast(header.encoding), std::move(buffer)); } default: - throw SawyerChunkException(EXCEPTION_MSG_INVALID_CHUNK_ENCODING); + throw SawyerChunkException(kExceptionMessageInvalidChunkEncoding); } } catch (const std::exception&) @@ -98,21 +98,21 @@ namespace OpenRCT2 int64_t compressedDataLength64 = _stream->GetLength() - _stream->GetPosition() - 4; if (compressedDataLength64 < 0 || compressedDataLength64 > std::numeric_limits::max()) { - throw SawyerChunkException(EXCEPTION_MSG_ZERO_SIZED_CHUNK); + throw SawyerChunkException(kExceptionMessageZeroSizedChunk); } uint32_t compressedDataLength = compressedDataLength64; auto compressedData = std::make_unique(compressedDataLength); if (_stream->TryRead(compressedData.get(), compressedDataLength) != compressedDataLength) { - throw SawyerChunkException(EXCEPTION_MSG_CORRUPT_CHUNK_SIZE); + throw SawyerChunkException(kExceptionMessageCorruptChunkSize); } SawyerCoding::ChunkHeader header{ CHUNK_ENCODING_RLE, compressedDataLength }; auto buffer = DecodeChunk(compressedData.get(), header); if (buffer.GetLength() == 0) { - throw SawyerChunkException(EXCEPTION_MSG_ZERO_SIZED_CHUNK); + throw SawyerChunkException(kExceptionMessageZeroSizedChunk); } return std::make_shared(SawyerEncoding::rle, std::move(buffer)); } @@ -160,11 +160,11 @@ namespace OpenRCT2 if (i >= srcLength) { - throw SawyerChunkException(EXCEPTION_MSG_CORRUPT_RLE); + throw SawyerChunkException(kExceptionMessageCorruptRLE); } - if (buf.GetLength() + count > MAX_UNCOMPRESSED_CHUNK_SIZE) + if (buf.GetLength() + count > kMaxUncompressedChunkSize) { - throw SawyerChunkException(EXCEPTION_MSG_DESTINATION_TOO_SMALL); + throw SawyerChunkException(kExceptionMessageDestinationTooSmall); } for (size_t n = 0; n < count; n++) @@ -178,15 +178,15 @@ namespace OpenRCT2 if (i + 1 >= srcLength) { - throw SawyerChunkException(EXCEPTION_MSG_CORRUPT_RLE); + throw SawyerChunkException(kExceptionMessageCorruptRLE); } - if (buf.GetLength() + len > MAX_UNCOMPRESSED_CHUNK_SIZE) + if (buf.GetLength() + len > kMaxUncompressedChunkSize) { - throw SawyerChunkException(EXCEPTION_MSG_DESTINATION_TOO_SMALL); + throw SawyerChunkException(kExceptionMessageDestinationTooSmall); } if (i + 1 + len > srcLength) { - throw SawyerChunkException(EXCEPTION_MSG_CORRUPT_RLE); + throw SawyerChunkException(kExceptionMessageCorruptRLE); } const auto* pos = src8 + i + 1; @@ -210,7 +210,7 @@ namespace OpenRCT2 { if (i + 1 >= srcLength) { - throw SawyerChunkException(EXCEPTION_MSG_CORRUPT_RLE); + throw SawyerChunkException(kExceptionMessageCorruptRLE); } i++; buf.WriteValue(src8[i]); @@ -224,7 +224,7 @@ namespace OpenRCT2 if (copySrc < static_cast(buf.GetData()) || copySrc + count > static_cast(buf.GetData()) + buf.GetLength()) { - throw SawyerChunkException(EXCEPTION_MSG_CORRUPT_RLE); + throw SawyerChunkException(kExceptionMessageCorruptRLE); } // We need a temporary buffer as the vector might invalidate the pointer. @@ -279,7 +279,7 @@ namespace OpenRCT2 buf = DecodeChunkRotate(src, header.length); break; default: - throw SawyerChunkException(EXCEPTION_MSG_INVALID_CHUNK_ENCODING); + throw SawyerChunkException(kExceptionMessageInvalidChunkEncoding); } // Return the stream with the position at the beginning. From 6bdca7bcc9acf5f53a2044ffaab5d2ec6ea6f5a2 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 20:14:53 +0200 Subject: [PATCH 20/95] Replace duplicate CHUNK_ENCODING_* with SawyerEncoding::* --- src/openrct2/core/SawyerCoding.cpp | 8 ++++---- src/openrct2/core/SawyerCoding.h | 13 +++---------- src/openrct2/object/ObjectRepository.cpp | 8 ++++---- src/openrct2/rct12/SawyerChunkReader.cpp | 18 +++++++++--------- src/openrct2/rct12/SawyerChunkWriter.cpp | 2 +- 5 files changed, 21 insertions(+), 28 deletions(-) diff --git a/src/openrct2/core/SawyerCoding.cpp b/src/openrct2/core/SawyerCoding.cpp index 503ed0b69a..464b739f70 100644 --- a/src/openrct2/core/SawyerCoding.cpp +++ b/src/openrct2/core/SawyerCoding.cpp @@ -45,14 +45,14 @@ namespace OpenRCT2::SawyerCoding { switch (chunkHeader.encoding) { - case CHUNK_ENCODING_NONE: + case SawyerEncoding::none: std::memcpy(dst_file, &chunkHeader, sizeof(ChunkHeader)); dst_file += sizeof(ChunkHeader); std::memcpy(dst_file, buffer, chunkHeader.length); // fwrite(&chunkHeader, sizeof(ChunkHeader), 1, file); // fwrite(buffer, 1, chunkHeader.length, file); break; - case CHUNK_ENCODING_RLE: + case SawyerEncoding::rle: { auto encode_buffer = std::make_unique(0x600000); chunkHeader.length = static_cast(EncodeChunkRLE(buffer, encode_buffer.get(), chunkHeader.length)); @@ -61,7 +61,7 @@ namespace OpenRCT2::SawyerCoding std::memcpy(dst_file, encode_buffer.get(), chunkHeader.length); } break; - case CHUNK_ENCODING_RLECOMPRESSED: + case SawyerEncoding::rleCompressed: { auto encode_buffer = std::make_unique(chunkHeader.length * 2); auto encode_buffer2 = std::make_unique(0x600000); @@ -73,7 +73,7 @@ namespace OpenRCT2::SawyerCoding std::memcpy(dst_file, encode_buffer2.get(), chunkHeader.length); } break; - case CHUNK_ENCODING_ROTATE: + case SawyerEncoding::rotate: { auto encode_buffer = std::make_unique(chunkHeader.length); std::memcpy(encode_buffer.get(), buffer, chunkHeader.length); diff --git a/src/openrct2/core/SawyerCoding.h b/src/openrct2/core/SawyerCoding.h index 467041ba6d..73d6fa43fe 100644 --- a/src/openrct2/core/SawyerCoding.h +++ b/src/openrct2/core/SawyerCoding.h @@ -9,20 +9,13 @@ #pragma once +#include "../rct12/SawyerChunk.h" + #include #include namespace OpenRCT2 { - // TODO: make enum class in SawyerCoding namespace - enum - { - CHUNK_ENCODING_NONE, - CHUNK_ENCODING_RLE, - CHUNK_ENCODING_RLECOMPRESSED, - CHUNK_ENCODING_ROTATE - }; - // TODO: make enum class in SawyerCoding namespace enum { @@ -43,7 +36,7 @@ namespace OpenRCT2::SawyerCoding #pragma pack(push, 1) struct ChunkHeader { - uint8_t encoding; + SawyerEncoding encoding; uint32_t length; }; static_assert(sizeof(ChunkHeader) == 5); diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index 187f6b01f3..c0fe0545d2 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -475,10 +475,10 @@ private: } // 0x0098DA2C - static constexpr std::array kLegacyObjectEntryGroupEncoding = { - CHUNK_ENCODING_RLE, CHUNK_ENCODING_RLE, CHUNK_ENCODING_RLE, CHUNK_ENCODING_RLE, - CHUNK_ENCODING_RLE, CHUNK_ENCODING_RLE, CHUNK_ENCODING_RLE, CHUNK_ENCODING_RLE, - CHUNK_ENCODING_RLE, CHUNK_ENCODING_RLE, CHUNK_ENCODING_ROTATE, + static constexpr std::array kLegacyObjectEntryGroupEncoding = { + SawyerEncoding::rle, SawyerEncoding::rle, SawyerEncoding::rle, SawyerEncoding::rle, + SawyerEncoding::rle, SawyerEncoding::rle, SawyerEncoding::rle, SawyerEncoding::rle, + SawyerEncoding::rle, SawyerEncoding::rle, SawyerEncoding::rotate, }; static void SaveObject( diff --git a/src/openrct2/rct12/SawyerChunkReader.cpp b/src/openrct2/rct12/SawyerChunkReader.cpp index fd0fb1a49d..2d0c5bbdcb 100644 --- a/src/openrct2/rct12/SawyerChunkReader.cpp +++ b/src/openrct2/rct12/SawyerChunkReader.cpp @@ -58,10 +58,10 @@ namespace OpenRCT2 switch (header.encoding) { - case CHUNK_ENCODING_NONE: - case CHUNK_ENCODING_RLE: - case CHUNK_ENCODING_RLECOMPRESSED: - case CHUNK_ENCODING_ROTATE: + case SawyerEncoding::none: + case SawyerEncoding::rle: + case SawyerEncoding::rleCompressed: + case SawyerEncoding::rotate: { auto compressedData = std::make_unique(header.length); if (_stream->TryRead(compressedData.get(), header.length) != header.length) @@ -108,7 +108,7 @@ namespace OpenRCT2 throw SawyerChunkException(kExceptionMessageCorruptChunkSize); } - SawyerCoding::ChunkHeader header{ CHUNK_ENCODING_RLE, compressedDataLength }; + SawyerCoding::ChunkHeader header{ SawyerEncoding::rle, compressedDataLength }; auto buffer = DecodeChunk(compressedData.get(), header); if (buffer.GetLength() == 0) { @@ -266,16 +266,16 @@ namespace OpenRCT2 switch (header.encoding) { - case CHUNK_ENCODING_NONE: + case SawyerEncoding::none: buf.Write(src, header.length); break; - case CHUNK_ENCODING_RLE: + case SawyerEncoding::rle: buf = DecodeChunkRLE(src, header.length); break; - case CHUNK_ENCODING_RLECOMPRESSED: + case SawyerEncoding::rleCompressed: buf = DecodeChunkRLERepeat(src, header.length); break; - case CHUNK_ENCODING_ROTATE: + case SawyerEncoding::rotate: buf = DecodeChunkRotate(src, header.length); break; default: diff --git a/src/openrct2/rct12/SawyerChunkWriter.cpp b/src/openrct2/rct12/SawyerChunkWriter.cpp index df12cf9e0a..f4a682d455 100644 --- a/src/openrct2/rct12/SawyerChunkWriter.cpp +++ b/src/openrct2/rct12/SawyerChunkWriter.cpp @@ -31,7 +31,7 @@ namespace OpenRCT2 void SawyerChunkWriter::WriteChunk(const void* src, size_t length, SawyerEncoding encoding) { SawyerCoding::ChunkHeader header; - header.encoding = static_cast(encoding); + header.encoding = encoding; header.length = static_cast(length); auto data = std::make_unique(MAX_COMPRESSED_CHUNK_SIZE); From f2a483e0df06952f639cb2c18cefca8b093a5d59 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 20:18:18 +0200 Subject: [PATCH 21/95] Move ChunkHeader to SawyerChunk.h --- src/openrct2/core/SawyerCoding.h | 9 --------- src/openrct2/rct12/SawyerChunk.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/openrct2/core/SawyerCoding.h b/src/openrct2/core/SawyerCoding.h index 73d6fa43fe..8a17423c2d 100644 --- a/src/openrct2/core/SawyerCoding.h +++ b/src/openrct2/core/SawyerCoding.h @@ -33,15 +33,6 @@ namespace OpenRCT2 namespace OpenRCT2::SawyerCoding { -#pragma pack(push, 1) - struct ChunkHeader - { - SawyerEncoding encoding; - uint32_t length; - }; - static_assert(sizeof(ChunkHeader) == 5); -#pragma pack(pop) - uint32_t CalculateChecksum(const uint8_t* buffer, size_t length); size_t WriteChunkBuffer(uint8_t* dst_file, const uint8_t* src_buffer, ChunkHeader chunkHeader); size_t DecodeSV4(const uint8_t* src, uint8_t* dst, size_t length, size_t bufferLength); diff --git a/src/openrct2/rct12/SawyerChunk.h b/src/openrct2/rct12/SawyerChunk.h index 38c7cfb509..1bc947c31a 100644 --- a/src/openrct2/rct12/SawyerChunk.h +++ b/src/openrct2/rct12/SawyerChunk.h @@ -26,6 +26,18 @@ namespace OpenRCT2 rotate, }; + namespace SawyerCoding + { +#pragma pack(push, 1) + struct ChunkHeader + { + SawyerEncoding encoding; + uint32_t length; + }; + static_assert(sizeof(ChunkHeader) == 5); +#pragma pack(pop) + } // namespace SawyerCoding + /** * Represents a sawyer encoded chunk. */ From 9f2db42a198396fa1dedcecfb3f1fae2832539f4 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 20:26:20 +0200 Subject: [PATCH 22/95] Move SawyerEncoding into OpenRCT2::SawyerCoding namespace, rename to ChunkEncoding --- src/openrct2/core/SawyerCoding.cpp | 8 +++---- src/openrct2/object/ObjectRepository.cpp | 9 ++++---- src/openrct2/rct12/SawyerChunk.cpp | 2 +- src/openrct2/rct12/SawyerChunk.h | 29 ++++++++++++------------ src/openrct2/rct12/SawyerChunkReader.cpp | 24 +++++++++++--------- src/openrct2/rct12/SawyerChunkWriter.cpp | 4 +++- src/openrct2/rct12/SawyerChunkWriter.h | 4 ++-- 7 files changed, 42 insertions(+), 38 deletions(-) diff --git a/src/openrct2/core/SawyerCoding.cpp b/src/openrct2/core/SawyerCoding.cpp index 464b739f70..5c00249e57 100644 --- a/src/openrct2/core/SawyerCoding.cpp +++ b/src/openrct2/core/SawyerCoding.cpp @@ -45,14 +45,14 @@ namespace OpenRCT2::SawyerCoding { switch (chunkHeader.encoding) { - case SawyerEncoding::none: + case ChunkEncoding::none: std::memcpy(dst_file, &chunkHeader, sizeof(ChunkHeader)); dst_file += sizeof(ChunkHeader); std::memcpy(dst_file, buffer, chunkHeader.length); // fwrite(&chunkHeader, sizeof(ChunkHeader), 1, file); // fwrite(buffer, 1, chunkHeader.length, file); break; - case SawyerEncoding::rle: + case ChunkEncoding::rle: { auto encode_buffer = std::make_unique(0x600000); chunkHeader.length = static_cast(EncodeChunkRLE(buffer, encode_buffer.get(), chunkHeader.length)); @@ -61,7 +61,7 @@ namespace OpenRCT2::SawyerCoding std::memcpy(dst_file, encode_buffer.get(), chunkHeader.length); } break; - case SawyerEncoding::rleCompressed: + case ChunkEncoding::rleCompressed: { auto encode_buffer = std::make_unique(chunkHeader.length * 2); auto encode_buffer2 = std::make_unique(0x600000); @@ -73,7 +73,7 @@ namespace OpenRCT2::SawyerCoding std::memcpy(dst_file, encode_buffer2.get(), chunkHeader.length); } break; - case SawyerEncoding::rotate: + case ChunkEncoding::rotate: { auto encode_buffer = std::make_unique(chunkHeader.length); std::memcpy(encode_buffer.get(), buffer, chunkHeader.length); diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index c0fe0545d2..3b130e65fc 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -47,6 +47,7 @@ #undef CP_UTF8 using namespace OpenRCT2; +using namespace OpenRCT2::SawyerCoding; struct ObjectEntryHash { @@ -475,10 +476,10 @@ private: } // 0x0098DA2C - static constexpr std::array kLegacyObjectEntryGroupEncoding = { - SawyerEncoding::rle, SawyerEncoding::rle, SawyerEncoding::rle, SawyerEncoding::rle, - SawyerEncoding::rle, SawyerEncoding::rle, SawyerEncoding::rle, SawyerEncoding::rle, - SawyerEncoding::rle, SawyerEncoding::rle, SawyerEncoding::rotate, + static constexpr std::array kLegacyObjectEntryGroupEncoding = { + ChunkEncoding::rle, ChunkEncoding::rle, ChunkEncoding::rle, ChunkEncoding::rle, + ChunkEncoding::rle, ChunkEncoding::rle, ChunkEncoding::rle, ChunkEncoding::rle, + ChunkEncoding::rle, ChunkEncoding::rle, ChunkEncoding::rotate, }; static void SaveObject( diff --git a/src/openrct2/rct12/SawyerChunk.cpp b/src/openrct2/rct12/SawyerChunk.cpp index bb5ec1dfcc..cb3a047ab1 100644 --- a/src/openrct2/rct12/SawyerChunk.cpp +++ b/src/openrct2/rct12/SawyerChunk.cpp @@ -13,7 +13,7 @@ namespace OpenRCT2 { - SawyerChunk::SawyerChunk(SawyerEncoding encoding, MemoryStream&& data) + SawyerChunk::SawyerChunk(SawyerCoding::ChunkEncoding encoding, MemoryStream&& data) : _data(std::move(data)) , _encoding(encoding) { diff --git a/src/openrct2/rct12/SawyerChunk.h b/src/openrct2/rct12/SawyerChunk.h index 1bc947c31a..dfd5be8dc8 100644 --- a/src/openrct2/rct12/SawyerChunk.h +++ b/src/openrct2/rct12/SawyerChunk.h @@ -15,23 +15,22 @@ namespace OpenRCT2 { - /** - * The type of encoding / compression for a sawyer encoded chunk. - */ - enum class SawyerEncoding : uint8_t - { - none, - rle, - rleCompressed, - rotate, - }; - namespace SawyerCoding { + /** + * The type of encoding / compression for a sawyer encoded chunk. + */ + enum class ChunkEncoding : uint8_t + { + none, + rle, + rleCompressed, + rotate, + }; #pragma pack(push, 1) struct ChunkHeader { - SawyerEncoding encoding; + ChunkEncoding encoding; uint32_t length; }; static_assert(sizeof(ChunkHeader) == 5); @@ -45,7 +44,7 @@ namespace OpenRCT2 { private: OpenRCT2::MemoryStream _data; - SawyerEncoding _encoding = SawyerEncoding::none; + SawyerCoding::ChunkEncoding _encoding = SawyerCoding::ChunkEncoding::none; public: const void* GetData() const @@ -56,11 +55,11 @@ namespace OpenRCT2 { return _data.GetLength(); } - SawyerEncoding GetEncoding() const + SawyerCoding::ChunkEncoding GetEncoding() const { return _encoding; } - SawyerChunk(SawyerEncoding encoding, OpenRCT2::MemoryStream&& data); + SawyerChunk(SawyerCoding::ChunkEncoding encoding, OpenRCT2::MemoryStream&& data); }; } // namespace OpenRCT2 diff --git a/src/openrct2/rct12/SawyerChunkReader.cpp b/src/openrct2/rct12/SawyerChunkReader.cpp index 2d0c5bbdcb..78ac13296c 100644 --- a/src/openrct2/rct12/SawyerChunkReader.cpp +++ b/src/openrct2/rct12/SawyerChunkReader.cpp @@ -13,6 +13,8 @@ #include "../core/MemoryStream.h" #include "../core/Numerics.hpp" +using namespace OpenRCT2::SawyerCoding; + namespace OpenRCT2 { // Allow chunks to be uncompressed to a maximum of 16 MiB @@ -58,10 +60,10 @@ namespace OpenRCT2 switch (header.encoding) { - case SawyerEncoding::none: - case SawyerEncoding::rle: - case SawyerEncoding::rleCompressed: - case SawyerEncoding::rotate: + case ChunkEncoding::none: + case ChunkEncoding::rle: + case ChunkEncoding::rleCompressed: + case ChunkEncoding::rotate: { auto compressedData = std::make_unique(header.length); if (_stream->TryRead(compressedData.get(), header.length) != header.length) @@ -75,7 +77,7 @@ namespace OpenRCT2 throw SawyerChunkException(kExceptionMessageZeroSizedChunk); } - return std::make_shared(static_cast(header.encoding), std::move(buffer)); + return std::make_shared(static_cast(header.encoding), std::move(buffer)); } default: throw SawyerChunkException(kExceptionMessageInvalidChunkEncoding); @@ -108,13 +110,13 @@ namespace OpenRCT2 throw SawyerChunkException(kExceptionMessageCorruptChunkSize); } - SawyerCoding::ChunkHeader header{ SawyerEncoding::rle, compressedDataLength }; + SawyerCoding::ChunkHeader header{ ChunkEncoding::rle, compressedDataLength }; auto buffer = DecodeChunk(compressedData.get(), header); if (buffer.GetLength() == 0) { throw SawyerChunkException(kExceptionMessageZeroSizedChunk); } - return std::make_shared(SawyerEncoding::rle, std::move(buffer)); + return std::make_shared(ChunkEncoding::rle, std::move(buffer)); } catch (const std::exception&) { @@ -266,16 +268,16 @@ namespace OpenRCT2 switch (header.encoding) { - case SawyerEncoding::none: + case ChunkEncoding::none: buf.Write(src, header.length); break; - case SawyerEncoding::rle: + case ChunkEncoding::rle: buf = DecodeChunkRLE(src, header.length); break; - case SawyerEncoding::rleCompressed: + case ChunkEncoding::rleCompressed: buf = DecodeChunkRLERepeat(src, header.length); break; - case SawyerEncoding::rotate: + case ChunkEncoding::rotate: buf = DecodeChunkRotate(src, header.length); break; default: diff --git a/src/openrct2/rct12/SawyerChunkWriter.cpp b/src/openrct2/rct12/SawyerChunkWriter.cpp index f4a682d455..035954bd5e 100644 --- a/src/openrct2/rct12/SawyerChunkWriter.cpp +++ b/src/openrct2/rct12/SawyerChunkWriter.cpp @@ -13,6 +13,8 @@ #include "../core/Numerics.hpp" #include "../core/SawyerCoding.h" +using namespace OpenRCT2::SawyerCoding; + namespace OpenRCT2 { // Maximum buffer size to store compressed data, maximum of 16 MiB @@ -28,7 +30,7 @@ namespace OpenRCT2 WriteChunk(chunk->GetData(), chunk->GetLength(), chunk->GetEncoding()); } - void SawyerChunkWriter::WriteChunk(const void* src, size_t length, SawyerEncoding encoding) + void SawyerChunkWriter::WriteChunk(const void* src, size_t length, ChunkEncoding encoding) { SawyerCoding::ChunkHeader header; header.encoding = encoding; diff --git a/src/openrct2/rct12/SawyerChunkWriter.h b/src/openrct2/rct12/SawyerChunkWriter.h index 6c194a4a94..94d159de52 100644 --- a/src/openrct2/rct12/SawyerChunkWriter.h +++ b/src/openrct2/rct12/SawyerChunkWriter.h @@ -39,7 +39,7 @@ namespace OpenRCT2 * @param src The source buffer. * @param length The size of the source buffer. */ - void WriteChunk(const void* src, size_t length, SawyerEncoding encoding); + void WriteChunk(const void* src, size_t length, SawyerCoding::ChunkEncoding encoding); /** * Writes a track chunk to the stream containing the given buffer. @@ -52,7 +52,7 @@ namespace OpenRCT2 * Writes a chunk to the stream containing the given type. */ template - void WriteChunk(const T* src, SawyerEncoding encoding) + void WriteChunk(const T* src, SawyerCoding::ChunkEncoding encoding) { WriteChunk(src, sizeof(T), encoding); } From 8c001ba4b5b406d8e682842114f230dc1161b87c Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 2 Jul 2025 20:32:43 +0200 Subject: [PATCH 23/95] Move SawyerEncoding files to their own folder --- src/openrct2/FileClassifier.cpp | 4 ++-- src/openrct2/Game.cpp | 2 +- src/openrct2/libopenrct2.vcxproj | 16 ++++++++-------- src/openrct2/network/NetworkBase.cpp | 2 +- src/openrct2/object/ObjectFactory.cpp | 2 +- src/openrct2/object/ObjectList.cpp | 2 +- src/openrct2/object/ObjectRepository.cpp | 6 +++--- src/openrct2/platform/Crash.cpp | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct1/T4Importer.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 4 ++-- src/openrct2/rct2/T6Exporter.cpp | 2 +- src/openrct2/rct2/T6Importer.cpp | 2 +- src/openrct2/ride/Track.cpp | 2 +- src/openrct2/ride/TrackDesign.cpp | 2 +- src/openrct2/ride/TrackDesignSave.cpp | 2 +- .../{rct12 => sawyer_coding}/SawyerChunk.cpp | 0 .../{rct12 => sawyer_coding}/SawyerChunk.h | 0 .../SawyerChunkReader.cpp | 0 .../{rct12 => sawyer_coding}/SawyerChunkReader.h | 2 +- .../SawyerChunkWriter.cpp | 2 +- .../{rct12 => sawyer_coding}/SawyerChunkWriter.h | 0 .../{core => sawyer_coding}/SawyerCoding.cpp | 2 +- .../{core => sawyer_coding}/SawyerCoding.h | 2 +- src/openrct2/scenario/Scenario.cpp | 2 +- src/openrct2/scenario/ScenarioRepository.cpp | 2 +- 26 files changed, 33 insertions(+), 33 deletions(-) rename src/openrct2/{rct12 => sawyer_coding}/SawyerChunk.cpp (100%) rename src/openrct2/{rct12 => sawyer_coding}/SawyerChunk.h (100%) rename src/openrct2/{rct12 => sawyer_coding}/SawyerChunkReader.cpp (100%) rename src/openrct2/{rct12 => sawyer_coding}/SawyerChunkReader.h (98%) rename src/openrct2/{rct12 => sawyer_coding}/SawyerChunkWriter.cpp (98%) rename src/openrct2/{rct12 => sawyer_coding}/SawyerChunkWriter.h (100%) rename src/openrct2/{core => sawyer_coding}/SawyerCoding.cpp (99%) rename src/openrct2/{core => sawyer_coding}/SawyerCoding.h (98%) diff --git a/src/openrct2/FileClassifier.cpp b/src/openrct2/FileClassifier.cpp index 2195bc0d2e..a2e8b28540 100644 --- a/src/openrct2/FileClassifier.cpp +++ b/src/openrct2/FileClassifier.cpp @@ -14,11 +14,11 @@ #include "core/FileStream.h" #include "core/Memory.hpp" #include "core/Path.hpp" -#include "core/SawyerCoding.h" #include "core/String.hpp" #include "park/ParkFile.h" -#include "rct12/SawyerChunkReader.h" #include "rct2/RCT2.h" +#include "sawyer_coding/SawyerChunkReader.h" +#include "sawyer_coding/SawyerCoding.h" #include "scenario/Scenario.h" using namespace OpenRCT2; diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 1922c45f16..0fd858f5f4 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -30,7 +30,6 @@ #include "core/FileScanner.h" #include "core/Money.hpp" #include "core/Path.hpp" -#include "core/SawyerCoding.h" #include "core/String.hpp" #include "entity/EntityList.h" #include "entity/EntityRegistry.h" @@ -57,6 +56,7 @@ #include "ride/Track.h" #include "ride/TrackDesign.h" #include "ride/Vehicle.h" +#include "sawyer_coding/SawyerCoding.h" #include "scenes/title/TitleScene.h" #include "scripting/ScriptEngine.h" #include "ui/UiContext.h" diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index 5fe918158a..51117b3e26 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -227,7 +227,6 @@ - @@ -416,9 +415,6 @@ - - - @@ -547,6 +543,10 @@ + + + + @@ -790,7 +790,6 @@ - @@ -1044,9 +1043,6 @@ - - - @@ -1081,6 +1077,10 @@ + + + + diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index fe7979caa4..bf50997b2a 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -23,7 +23,6 @@ #include "../core/File.h" #include "../core/Guard.hpp" #include "../core/Json.hpp" -#include "../core/SawyerCoding.h" #include "../entity/EntityList.h" #include "../entity/EntityRegistry.h" #include "../entity/EntityTweener.h" @@ -32,6 +31,7 @@ #include "../localisation/LocalisationService.h" #include "../park/ParkFile.h" #include "../platform/Platform.h" +#include "../sawyer_coding/SawyerCoding.h" #include "../scripting/ScriptEngine.h" #include "../ui/WindowManager.h" #include "../util/Util.h" diff --git a/src/openrct2/object/ObjectFactory.cpp b/src/openrct2/object/ObjectFactory.cpp index 821fee5a0e..e5eabdcdfa 100644 --- a/src/openrct2/object/ObjectFactory.cpp +++ b/src/openrct2/object/ObjectFactory.cpp @@ -24,7 +24,7 @@ #include "../core/Path.hpp" #include "../core/String.hpp" #include "../core/Zip.h" -#include "../rct12/SawyerChunkReader.h" +#include "../sawyer_coding/SawyerChunkReader.h" #include "AudioObject.h" #include "BannerObject.h" #include "ClimateObject.h" diff --git a/src/openrct2/object/ObjectList.cpp b/src/openrct2/object/ObjectList.cpp index bd5e35a15c..f30525ad5d 100644 --- a/src/openrct2/object/ObjectList.cpp +++ b/src/openrct2/object/ObjectList.cpp @@ -12,8 +12,8 @@ #include "../Context.h" #include "../Game.h" #include "../core/EnumUtils.hpp" -#include "../core/SawyerCoding.h" #include "../object/Object.h" +#include "../sawyer_coding/SawyerCoding.h" #include "ObjectLimits.h" #include "ObjectManager.h" #include "ObjectRepository.h" diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index 3b130e65fc..2b89c28401 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -24,14 +24,14 @@ #include "../core/MemoryStream.h" #include "../core/Numerics.hpp" #include "../core/Path.hpp" -#include "../core/SawyerCoding.h" #include "../core/String.hpp" #include "../localisation/LocalisationService.h" #include "../object/Object.h" #include "../park/Legacy.h" #include "../platform/Platform.h" -#include "../rct12/SawyerChunkReader.h" -#include "../rct12/SawyerChunkWriter.h" +#include "../sawyer_coding/SawyerChunkReader.h" +#include "../sawyer_coding/SawyerChunkWriter.h" +#include "../sawyer_coding/SawyerCoding.h" #include "../scenario/ScenarioRepository.h" #include "Object.h" #include "ObjectFactory.h" diff --git a/src/openrct2/platform/Crash.cpp b/src/openrct2/platform/Crash.cpp index 8a2bf0b89f..9ba9ff5ae8 100644 --- a/src/openrct2/platform/Crash.cpp +++ b/src/openrct2/platform/Crash.cpp @@ -36,12 +36,12 @@ #include "../core/FileStream.h" #include "../core/Guard.hpp" #include "../core/Path.hpp" - #include "../core/SawyerCoding.h" #include "../core/String.hpp" #include "../drawing/IDrawingEngine.h" #include "../interface/Screenshot.h" #include "../object/ObjectManager.h" #include "../park/ParkFile.h" + #include "../sawyer_coding/SawyerCoding.h" #include "Platform.h" #define WSZ(x) L"" x diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index fba26743b9..3c999ae21e 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -25,7 +25,6 @@ #include "../core/IStream.hpp" #include "../core/Memory.hpp" #include "../core/Path.hpp" -#include "../core/SawyerCoding.h" #include "../core/String.hpp" #include "../entity/Balloon.h" #include "../entity/Duck.h" @@ -63,6 +62,7 @@ #include "../ride/Track.h" #include "../ride/TrainManager.h" #include "../ride/Vehicle.h" +#include "../sawyer_coding/SawyerCoding.h" #include "../scenario/ScenarioRepository.h" #include "../scenario/ScenarioSources.h" #include "../world/Climate.h" diff --git a/src/openrct2/rct1/T4Importer.cpp b/src/openrct2/rct1/T4Importer.cpp index d316e72e8a..a4a2d3790f 100644 --- a/src/openrct2/rct1/T4Importer.cpp +++ b/src/openrct2/rct1/T4Importer.cpp @@ -15,12 +15,12 @@ #include "../core/String.hpp" #include "../rct1/RCT1.h" #include "../rct1/Tables.h" -#include "../rct12/SawyerChunkReader.h" #include "../rct12/TD46.h" #include "../ride/Ride.h" #include "../ride/RideData.h" #include "../ride/TrackDesign.h" #include "../ride/TrackDesignRepository.h" +#include "../sawyer_coding/SawyerChunkReader.h" #include diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 3ddde3620f..a7ae4e5819 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -22,7 +22,6 @@ #include "../core/Numerics.hpp" #include "../core/Path.hpp" #include "../core/Random.hpp" -#include "../core/SawyerCoding.h" #include "../core/String.hpp" #include "../entity/Balloon.h" #include "../entity/Duck.h" @@ -57,7 +56,6 @@ #include "../rct12/CSStringConverter.h" #include "../rct12/EntryList.h" #include "../rct12/RCT12.h" -#include "../rct12/SawyerChunkReader.h" #include "../rct12/ScenarioPatcher.h" #include "../rct2/RCT2.h" #include "../ride/Ride.h" @@ -68,6 +66,8 @@ #include "../ride/Track.h" #include "../ride/TrainManager.h" #include "../ride/Vehicle.h" +#include "../sawyer_coding/SawyerChunkReader.h" +#include "../sawyer_coding/SawyerCoding.h" #include "../scenario/ScenarioRepository.h" #include "../scenario/ScenarioSources.h" #include "../world/Climate.h" diff --git a/src/openrct2/rct2/T6Exporter.cpp b/src/openrct2/rct2/T6Exporter.cpp index d41a049c7d..b67b07517d 100644 --- a/src/openrct2/rct2/T6Exporter.cpp +++ b/src/openrct2/rct2/T6Exporter.cpp @@ -15,7 +15,6 @@ #include "../core/MemoryStream.h" #include "../localisation/StringIds.h" #include "../object/ObjectList.h" -#include "../rct12/SawyerChunkWriter.h" #include "../rct12/TD46.h" #include "../rct2/RCT2.h" #include "../ride/Ride.h" @@ -25,6 +24,7 @@ #include "../ride/TrackData.h" #include "../ride/TrackDesign.h" #include "../ride/TrackDesignRepository.h" +#include "../sawyer_coding/SawyerChunkWriter.h" #include "../windows/Intent.h" #include diff --git a/src/openrct2/rct2/T6Importer.cpp b/src/openrct2/rct2/T6Importer.cpp index 3563ea2d69..404f638dc5 100644 --- a/src/openrct2/rct2/T6Importer.cpp +++ b/src/openrct2/rct2/T6Importer.cpp @@ -15,13 +15,13 @@ #include "../core/String.hpp" #include "../object/ObjectRepository.h" #include "../object/RideObject.h" -#include "../rct12/SawyerChunkReader.h" #include "../rct12/TD46.h" #include "../rct2/RCT2.h" #include "../ride/Ride.h" #include "../ride/RideData.h" #include "../ride/TrackDesign.h" #include "../ride/TrackDesignRepository.h" +#include "../sawyer_coding/SawyerChunkReader.h" #include diff --git a/src/openrct2/ride/Track.cpp b/src/openrct2/ride/Track.cpp index 25c9056a9b..e3e8aa1b56 100644 --- a/src/openrct2/ride/Track.cpp +++ b/src/openrct2/ride/Track.cpp @@ -15,13 +15,13 @@ #include "../GameState.h" #include "../audio/Audio.h" #include "../config/Config.h" -#include "../core/SawyerCoding.h" #include "../interface/Viewport.h" #include "../management/Finance.h" #include "../network/Network.h" #include "../platform/Platform.h" #include "../rct1/RCT1.h" #include "../ride/RideColour.h" +#include "../sawyer_coding/SawyerCoding.h" #include "../world/Footpath.h" #include "../world/Map.h" #include "../world/MapAnimation.h" diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index fabed27629..c081a58642 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -34,7 +34,6 @@ #include "../core/DataSerialiser.h" #include "../core/File.h" #include "../core/Numerics.hpp" -#include "../core/SawyerCoding.h" #include "../core/String.hpp" #include "../core/UnitConversion.h" #include "../drawing/X8DrawingEngine.h" @@ -54,6 +53,7 @@ #include "../object/StationObject.h" #include "../rct2/RCT2.h" #include "../ride/RideConstruction.h" +#include "../sawyer_coding/SawyerCoding.h" #include "../world/Footpath.h" #include "../world/Park.h" #include "../world/Scenery.h" diff --git a/src/openrct2/ride/TrackDesignSave.cpp b/src/openrct2/ride/TrackDesignSave.cpp index d19c61e983..7927d3f875 100644 --- a/src/openrct2/ride/TrackDesignSave.cpp +++ b/src/openrct2/ride/TrackDesignSave.cpp @@ -11,7 +11,6 @@ #include "../Diagnostic.h" #include "../Game.h" #include "../audio/Audio.h" -#include "../core/SawyerCoding.h" #include "../interface/Viewport.h" #include "../localisation/StringIds.h" #include "../object/FootpathObject.h" @@ -21,6 +20,7 @@ #include "../object/ObjectList.h" #include "../object/ObjectManager.h" #include "../rct2/RCT2.h" +#include "../sawyer_coding/SawyerCoding.h" #include "../windows/Intent.h" #include "../world/Footpath.h" #include "../world/Scenery.h" diff --git a/src/openrct2/rct12/SawyerChunk.cpp b/src/openrct2/sawyer_coding/SawyerChunk.cpp similarity index 100% rename from src/openrct2/rct12/SawyerChunk.cpp rename to src/openrct2/sawyer_coding/SawyerChunk.cpp diff --git a/src/openrct2/rct12/SawyerChunk.h b/src/openrct2/sawyer_coding/SawyerChunk.h similarity index 100% rename from src/openrct2/rct12/SawyerChunk.h rename to src/openrct2/sawyer_coding/SawyerChunk.h diff --git a/src/openrct2/rct12/SawyerChunkReader.cpp b/src/openrct2/sawyer_coding/SawyerChunkReader.cpp similarity index 100% rename from src/openrct2/rct12/SawyerChunkReader.cpp rename to src/openrct2/sawyer_coding/SawyerChunkReader.cpp diff --git a/src/openrct2/rct12/SawyerChunkReader.h b/src/openrct2/sawyer_coding/SawyerChunkReader.h similarity index 98% rename from src/openrct2/rct12/SawyerChunkReader.h rename to src/openrct2/sawyer_coding/SawyerChunkReader.h index 83c055c78f..08cc7bffde 100644 --- a/src/openrct2/rct12/SawyerChunkReader.h +++ b/src/openrct2/sawyer_coding/SawyerChunkReader.h @@ -10,7 +10,7 @@ #pragma once #include "../core/IStream.hpp" -#include "../core/SawyerCoding.h" +#include "../sawyer_coding/SawyerCoding.h" #include "SawyerChunk.h" #include diff --git a/src/openrct2/rct12/SawyerChunkWriter.cpp b/src/openrct2/sawyer_coding/SawyerChunkWriter.cpp similarity index 98% rename from src/openrct2/rct12/SawyerChunkWriter.cpp rename to src/openrct2/sawyer_coding/SawyerChunkWriter.cpp index 035954bd5e..0cb5b01bda 100644 --- a/src/openrct2/rct12/SawyerChunkWriter.cpp +++ b/src/openrct2/sawyer_coding/SawyerChunkWriter.cpp @@ -11,7 +11,7 @@ #include "../core/IStream.hpp" #include "../core/Numerics.hpp" -#include "../core/SawyerCoding.h" +#include "../sawyer_coding/SawyerCoding.h" using namespace OpenRCT2::SawyerCoding; diff --git a/src/openrct2/rct12/SawyerChunkWriter.h b/src/openrct2/sawyer_coding/SawyerChunkWriter.h similarity index 100% rename from src/openrct2/rct12/SawyerChunkWriter.h rename to src/openrct2/sawyer_coding/SawyerChunkWriter.h diff --git a/src/openrct2/core/SawyerCoding.cpp b/src/openrct2/sawyer_coding/SawyerCoding.cpp similarity index 99% rename from src/openrct2/core/SawyerCoding.cpp rename to src/openrct2/sawyer_coding/SawyerCoding.cpp index 5c00249e57..0da40d045d 100644 --- a/src/openrct2/core/SawyerCoding.cpp +++ b/src/openrct2/sawyer_coding/SawyerCoding.cpp @@ -9,8 +9,8 @@ #include "SawyerCoding.h" +#include "../core/Numerics.hpp" #include "../platform/Platform.h" -#include "Numerics.hpp" #include #include diff --git a/src/openrct2/core/SawyerCoding.h b/src/openrct2/sawyer_coding/SawyerCoding.h similarity index 98% rename from src/openrct2/core/SawyerCoding.h rename to src/openrct2/sawyer_coding/SawyerCoding.h index 8a17423c2d..416a1f3aa7 100644 --- a/src/openrct2/core/SawyerCoding.h +++ b/src/openrct2/sawyer_coding/SawyerCoding.h @@ -9,7 +9,7 @@ #pragma once -#include "../rct12/SawyerChunk.h" +#include "SawyerChunk.h" #include #include diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 9f19c72d2f..330fbbcb48 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -23,7 +23,6 @@ #include "../core/Guard.hpp" #include "../core/Path.hpp" #include "../core/Random.hpp" -#include "../core/SawyerCoding.h" #include "../core/UnitConversion.h" #include "../entity/Duck.h" #include "../entity/Guest.h" @@ -49,6 +48,7 @@ #include "../ride/Ride.h" #include "../ride/RideManager.hpp" #include "../ride/Track.h" +#include "../sawyer_coding/SawyerCoding.h" #include "../ui/WindowManager.h" #include "../util/Util.h" #include "../windows/Intent.h" diff --git a/src/openrct2/scenario/ScenarioRepository.cpp b/src/openrct2/scenario/ScenarioRepository.cpp index b480eb9529..9eb8bdb085 100644 --- a/src/openrct2/scenario/ScenarioRepository.cpp +++ b/src/openrct2/scenario/ScenarioRepository.cpp @@ -27,8 +27,8 @@ #include "../platform/Platform.h" #include "../rct12/CSStringConverter.h" #include "../rct12/RCT12.h" -#include "../rct12/SawyerChunkReader.h" #include "../rct2/RCT2.h" +#include "../sawyer_coding/SawyerChunkReader.h" #include "Scenario.h" #include "ScenarioSources.h" From e29ba3bca48572fcaab90632076bffa1c5d9713c Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Thu, 3 Jul 2025 20:36:56 +0200 Subject: [PATCH 24/95] Move Sawyer coding into its own namespace --- src/openrct2/FileClassifier.cpp | 1 + src/openrct2/object/ObjectFactory.cpp | 1 + src/openrct2/rct1/S4Importer.cpp | 1 + src/openrct2/rct1/T4Importer.cpp | 1 + src/openrct2/rct2/S6Importer.cpp | 1 + src/openrct2/rct2/T6Exporter.cpp | 1 + src/openrct2/rct2/T6Importer.cpp | 1 + src/openrct2/sawyer_coding/SawyerChunk.cpp | 8 ++-- src/openrct2/sawyer_coding/SawyerChunk.h | 43 +++++++++---------- .../sawyer_coding/SawyerChunkReader.cpp | 6 +-- .../sawyer_coding/SawyerChunkReader.h | 5 ++- .../sawyer_coding/SawyerChunkWriter.cpp | 10 ++--- .../sawyer_coding/SawyerChunkWriter.h | 9 ++-- src/openrct2/sawyer_coding/SawyerCoding.h | 5 +-- 14 files changed, 49 insertions(+), 44 deletions(-) diff --git a/src/openrct2/FileClassifier.cpp b/src/openrct2/FileClassifier.cpp index a2e8b28540..1b0bc7f4ff 100644 --- a/src/openrct2/FileClassifier.cpp +++ b/src/openrct2/FileClassifier.cpp @@ -22,6 +22,7 @@ #include "scenario/Scenario.h" using namespace OpenRCT2; +using namespace OpenRCT2::SawyerCoding; static bool TryClassifyAsPark(OpenRCT2::IStream* stream, ClassifiedFileInfo* result); static bool TryClassifyAsS6(OpenRCT2::IStream* stream, ClassifiedFileInfo* result); diff --git a/src/openrct2/object/ObjectFactory.cpp b/src/openrct2/object/ObjectFactory.cpp index e5eabdcdfa..be91661350 100644 --- a/src/openrct2/object/ObjectFactory.cpp +++ b/src/openrct2/object/ObjectFactory.cpp @@ -54,6 +54,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::SawyerCoding; struct IFileDataRetriever { diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 3c999ae21e..94832290fa 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -91,6 +91,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::SawyerCoding; static constexpr ObjectEntryIndex ObjectEntryIndexIgnore = 254; diff --git a/src/openrct2/rct1/T4Importer.cpp b/src/openrct2/rct1/T4Importer.cpp index a4a2d3790f..522163bbf4 100644 --- a/src/openrct2/rct1/T4Importer.cpp +++ b/src/openrct2/rct1/T4Importer.cpp @@ -25,6 +25,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::SawyerCoding; using OpenRCT2::RCT12::TD46MazeElement; using OpenRCT2::RCT12::TD46Version; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index a7ae4e5819..7e3977ff2f 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -90,6 +90,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::SawyerCoding; namespace OpenRCT2::RCT2 { diff --git a/src/openrct2/rct2/T6Exporter.cpp b/src/openrct2/rct2/T6Exporter.cpp index b67b07517d..ce3300a710 100644 --- a/src/openrct2/rct2/T6Exporter.cpp +++ b/src/openrct2/rct2/T6Exporter.cpp @@ -30,6 +30,7 @@ #include using OpenRCT2::RCT12::TD46MazeElementType; +using OpenRCT2::SawyerCoding::SawyerChunkWriter; namespace OpenRCT2::RCT2 { diff --git a/src/openrct2/rct2/T6Importer.cpp b/src/openrct2/rct2/T6Importer.cpp index 404f638dc5..07119ae81b 100644 --- a/src/openrct2/rct2/T6Importer.cpp +++ b/src/openrct2/rct2/T6Importer.cpp @@ -29,6 +29,7 @@ using namespace OpenRCT2; using OpenRCT2::RCT12::TD46MazeElement; using OpenRCT2::RCT12::TD46Version; +using namespace OpenRCT2::SawyerCoding; namespace OpenRCT2::RCT2 { diff --git a/src/openrct2/sawyer_coding/SawyerChunk.cpp b/src/openrct2/sawyer_coding/SawyerChunk.cpp index cb3a047ab1..c0a04dd764 100644 --- a/src/openrct2/sawyer_coding/SawyerChunk.cpp +++ b/src/openrct2/sawyer_coding/SawyerChunk.cpp @@ -11,11 +11,13 @@ #include "SawyerChunkReader.h" -namespace OpenRCT2 +#include + +namespace OpenRCT2::SawyerCoding { - SawyerChunk::SawyerChunk(SawyerCoding::ChunkEncoding encoding, MemoryStream&& data) + SawyerChunk::SawyerChunk(ChunkEncoding encoding, MemoryStream&& data) : _data(std::move(data)) , _encoding(encoding) { } -} // namespace OpenRCT2 +} // namespace OpenRCT2::SawyerCoding diff --git a/src/openrct2/sawyer_coding/SawyerChunk.h b/src/openrct2/sawyer_coding/SawyerChunk.h index dfd5be8dc8..f5a8e124d2 100644 --- a/src/openrct2/sawyer_coding/SawyerChunk.h +++ b/src/openrct2/sawyer_coding/SawyerChunk.h @@ -13,29 +13,26 @@ #include -namespace OpenRCT2 +namespace OpenRCT2::SawyerCoding { - namespace SawyerCoding + /** + * The type of encoding / compression for a sawyer encoded chunk. + */ + enum class ChunkEncoding : uint8_t { - /** - * The type of encoding / compression for a sawyer encoded chunk. - */ - enum class ChunkEncoding : uint8_t - { - none, - rle, - rleCompressed, - rotate, - }; + none, + rle, + rleCompressed, + rotate, + }; #pragma pack(push, 1) - struct ChunkHeader - { - ChunkEncoding encoding; - uint32_t length; - }; - static_assert(sizeof(ChunkHeader) == 5); + struct ChunkHeader + { + ChunkEncoding encoding; + uint32_t length; + }; + static_assert(sizeof(ChunkHeader) == 5); #pragma pack(pop) - } // namespace SawyerCoding /** * Represents a sawyer encoded chunk. @@ -44,7 +41,7 @@ namespace OpenRCT2 { private: OpenRCT2::MemoryStream _data; - SawyerCoding::ChunkEncoding _encoding = SawyerCoding::ChunkEncoding::none; + ChunkEncoding _encoding = ChunkEncoding::none; public: const void* GetData() const @@ -55,11 +52,11 @@ namespace OpenRCT2 { return _data.GetLength(); } - SawyerCoding::ChunkEncoding GetEncoding() const + ChunkEncoding GetEncoding() const { return _encoding; } - SawyerChunk(SawyerCoding::ChunkEncoding encoding, OpenRCT2::MemoryStream&& data); + SawyerChunk(ChunkEncoding encoding, OpenRCT2::MemoryStream&& data); }; -} // namespace OpenRCT2 +} // namespace OpenRCT2::SawyerCoding diff --git a/src/openrct2/sawyer_coding/SawyerChunkReader.cpp b/src/openrct2/sawyer_coding/SawyerChunkReader.cpp index 78ac13296c..12c53bfa4a 100644 --- a/src/openrct2/sawyer_coding/SawyerChunkReader.cpp +++ b/src/openrct2/sawyer_coding/SawyerChunkReader.cpp @@ -13,9 +13,7 @@ #include "../core/MemoryStream.h" #include "../core/Numerics.hpp" -using namespace OpenRCT2::SawyerCoding; - -namespace OpenRCT2 +namespace OpenRCT2::SawyerCoding { // Allow chunks to be uncompressed to a maximum of 16 MiB constexpr size_t kMaxUncompressedChunkSize = 16 * 1024 * 1024; @@ -289,4 +287,4 @@ namespace OpenRCT2 return buf; } -} // namespace OpenRCT2 +} // namespace OpenRCT2::SawyerCoding diff --git a/src/openrct2/sawyer_coding/SawyerChunkReader.h b/src/openrct2/sawyer_coding/SawyerChunkReader.h index 08cc7bffde..ed20fe151a 100644 --- a/src/openrct2/sawyer_coding/SawyerChunkReader.h +++ b/src/openrct2/sawyer_coding/SawyerChunkReader.h @@ -20,7 +20,10 @@ namespace OpenRCT2 { struct IStream; +} +namespace OpenRCT2::SawyerCoding +{ class SawyerChunkException : public IOException { public: @@ -86,4 +89,4 @@ namespace OpenRCT2 return result; } }; -} // namespace OpenRCT2 +} // namespace OpenRCT2::SawyerCoding diff --git a/src/openrct2/sawyer_coding/SawyerChunkWriter.cpp b/src/openrct2/sawyer_coding/SawyerChunkWriter.cpp index 0cb5b01bda..f777438c96 100644 --- a/src/openrct2/sawyer_coding/SawyerChunkWriter.cpp +++ b/src/openrct2/sawyer_coding/SawyerChunkWriter.cpp @@ -13,9 +13,7 @@ #include "../core/Numerics.hpp" #include "../sawyer_coding/SawyerCoding.h" -using namespace OpenRCT2::SawyerCoding; - -namespace OpenRCT2 +namespace OpenRCT2::SawyerCoding { // Maximum buffer size to store compressed data, maximum of 16 MiB constexpr size_t MAX_COMPRESSED_CHUNK_SIZE = 16 * 1024 * 1024; @@ -32,12 +30,12 @@ namespace OpenRCT2 void SawyerChunkWriter::WriteChunk(const void* src, size_t length, ChunkEncoding encoding) { - SawyerCoding::ChunkHeader header; + ChunkHeader header; header.encoding = encoding; header.length = static_cast(length); auto data = std::make_unique(MAX_COMPRESSED_CHUNK_SIZE); - size_t dataLength = SawyerCoding::WriteChunkBuffer(data.get(), static_cast(src), header); + size_t dataLength = WriteChunkBuffer(data.get(), static_cast(src), header); _stream->Write(data.get(), dataLength); } @@ -111,4 +109,4 @@ namespace OpenRCT2 _stream->Write(data.get(), dataLength); _stream->WriteValue(checksum); } -} // namespace OpenRCT2 +} // namespace OpenRCT2::SawyerCoding diff --git a/src/openrct2/sawyer_coding/SawyerChunkWriter.h b/src/openrct2/sawyer_coding/SawyerChunkWriter.h index 94d159de52..3b87b3d39f 100644 --- a/src/openrct2/sawyer_coding/SawyerChunkWriter.h +++ b/src/openrct2/sawyer_coding/SawyerChunkWriter.h @@ -16,7 +16,10 @@ namespace OpenRCT2 { struct IStream; +} +namespace OpenRCT2::SawyerCoding +{ /** * Writes sawyer encoding chunks to a data stream. This can be used to write * SC6 and SV6 files. @@ -39,7 +42,7 @@ namespace OpenRCT2 * @param src The source buffer. * @param length The size of the source buffer. */ - void WriteChunk(const void* src, size_t length, SawyerCoding::ChunkEncoding encoding); + void WriteChunk(const void* src, size_t length, ChunkEncoding encoding); /** * Writes a track chunk to the stream containing the given buffer. @@ -52,9 +55,9 @@ namespace OpenRCT2 * Writes a chunk to the stream containing the given type. */ template - void WriteChunk(const T* src, SawyerCoding::ChunkEncoding encoding) + void WriteChunk(const T* src, ChunkEncoding encoding) { WriteChunk(src, sizeof(T), encoding); } }; -} // namespace OpenRCT2 +} // namespace OpenRCT2::SawyerCoding diff --git a/src/openrct2/sawyer_coding/SawyerCoding.h b/src/openrct2/sawyer_coding/SawyerCoding.h index 416a1f3aa7..90b4a02e71 100644 --- a/src/openrct2/sawyer_coding/SawyerCoding.h +++ b/src/openrct2/sawyer_coding/SawyerCoding.h @@ -14,7 +14,7 @@ #include #include -namespace OpenRCT2 +namespace OpenRCT2::SawyerCoding { // TODO: make enum class in SawyerCoding namespace enum @@ -29,10 +29,7 @@ namespace OpenRCT2 FILE_TYPE_SV4 = (1 << 2), FILE_TYPE_SC4 = (2 << 2) }; -} // namespace OpenRCT2 -namespace OpenRCT2::SawyerCoding -{ uint32_t CalculateChecksum(const uint8_t* buffer, size_t length); size_t WriteChunkBuffer(uint8_t* dst_file, const uint8_t* src_buffer, ChunkHeader chunkHeader); size_t DecodeSV4(const uint8_t* src, uint8_t* dst, size_t length, size_t bufferLength); From 26a085615475b50888d54515925b8f4cf8033c39 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Fri, 4 Jul 2025 23:20:37 +0200 Subject: [PATCH 25/95] Update test suite for Sawyer coding changes --- test/tests/SawyerCodingTest.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test/tests/SawyerCodingTest.cpp b/test/tests/SawyerCodingTest.cpp index a83b11fe1d..823459ecb9 100644 --- a/test/tests/SawyerCodingTest.cpp +++ b/test/tests/SawyerCodingTest.cpp @@ -9,12 +9,13 @@ #include #include -#include -#include +#include +#include constexpr size_t BUFFER_SIZE = 0x600000; using namespace OpenRCT2; +using namespace OpenRCT2::SawyerCoding; class SawyerCodingTest : public testing::Test { @@ -33,7 +34,7 @@ protected: static const uint8_t invalid7[6]; static const uint8_t empty[1]; - void TestEncodeDecode(uint8_t encoding_type) + void TestEncodeDecode(ChunkEncoding encoding_type) { // Encode SawyerCoding::ChunkHeader chdr_in; @@ -48,7 +49,7 @@ protected: OpenRCT2::MemoryStream ms(encodedDataBuffer, encodedDataSize); SawyerChunkReader reader(&ms); auto chunk = reader.ReadChunk(); - ASSERT_EQ(static_cast(chunk->GetEncoding()), chdr_in.encoding); + ASSERT_EQ(chunk->GetEncoding(), chdr_in.encoding); ASSERT_EQ(chunk->GetLength(), chdr_in.length); auto result = memcmp(chunk->GetData(), randomdata, sizeof(randomdata)); ASSERT_EQ(result, 0); @@ -65,7 +66,7 @@ protected: OpenRCT2::MemoryStream ms(data, size); SawyerChunkReader reader(&ms); auto chunk = reader.ReadChunk(); - ASSERT_EQ(static_cast(chunk->GetEncoding()), chdr_in->encoding); + ASSERT_EQ(chunk->GetEncoding(), chdr_in->encoding); ASSERT_EQ(chunk->GetLength(), sizeof(randomdata)); auto result = memcmp(chunk->GetData(), randomdata, sizeof(randomdata)); ASSERT_EQ(result, 0); @@ -74,22 +75,22 @@ protected: TEST_F(SawyerCodingTest, write_read_chunk_none) { - TestEncodeDecode(CHUNK_ENCODING_NONE); + TestEncodeDecode(ChunkEncoding::none); } TEST_F(SawyerCodingTest, write_read_chunk_rle) { - TestEncodeDecode(CHUNK_ENCODING_RLE); + TestEncodeDecode(ChunkEncoding::rle); } TEST_F(SawyerCodingTest, write_read_chunk_rle_compressed) { - TestEncodeDecode(CHUNK_ENCODING_RLECOMPRESSED); + TestEncodeDecode(ChunkEncoding::rleCompressed); } TEST_F(SawyerCodingTest, write_read_chunk_rotate) { - TestEncodeDecode(CHUNK_ENCODING_ROTATE); + TestEncodeDecode(ChunkEncoding::rotate); } // Note we only check if provided data decompresses to the same data, not if it compresses the same. From 22f5568fa575274a30e0bfabc3f8a31ae3e1e60f Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Sat, 5 Jul 2025 04:04:52 +0000 Subject: [PATCH 26/95] Merge Localisation/master into OpenRCT2/develop --- data/language/cs-CZ.txt | 8 +++++++- data/language/ko-KR.txt | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/data/language/cs-CZ.txt b/data/language/cs-CZ.txt index 2a082a0cf2..dd19b89f81 100644 --- a/data/language/cs-CZ.txt +++ b/data/language/cs-CZ.txt @@ -3823,4 +3823,10 @@ STR_6781 :Snímky obrazovky STR_6782 :Upozornění o parku STR_6783 :Upozornění o atrakcích STR_6784 :Upozornění o návštěvnících - +STR_6785 :Gamepad +STR_6786 :Mrtvá zóna: +STR_6787 :Mrtvá zóna analogové páčky (minimální vyžadovaný pohyb) +STR_6788 :Citlivost: +STR_6789 :Násobitel citlivosti analogové páčky +STR_6790 :Mrtvá zóna: {COMMA32}% +STR_6791 :Citlivost: {COMMA32}% diff --git a/data/language/ko-KR.txt b/data/language/ko-KR.txt index 7a34bf6dac..11bec310a9 100644 --- a/data/language/ko-KR.txt +++ b/data/language/ko-KR.txt @@ -3823,3 +3823,10 @@ STR_6781 :스크린 샷 STR_6782 :공원 알림 STR_6783 :놀이기구 알림 STR_6784 :손님 알림 +STR_6785 :게임패드 +STR_6786 :데드존: +STR_6787 :아날로그 스틱 데드존 (최소 필요 움직임 범위) +STR_6788 :민감도: +STR_6789 :아날로그 스틱 민감도 배수 +STR_6790 :데드존: {COMMA32}% +STR_6791 :민감도: {COMMA32}% From 1ecb2f9efe32eb843352345a29ef925946d9ed9b Mon Sep 17 00:00:00 2001 From: LRFLEW Date: Sat, 5 Jul 2025 05:42:24 -0500 Subject: [PATCH 27/95] Fix Compression Issue when Stopping Recording --- src/openrct2/ReplayManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/openrct2/ReplayManager.cpp b/src/openrct2/ReplayManager.cpp index fab261ad5a..7eef78f284 100644 --- a/src/openrct2/ReplayManager.cpp +++ b/src/openrct2/ReplayManager.cpp @@ -312,6 +312,7 @@ namespace OpenRCT2 auto& stream = recSerialiser.GetStream(); MemoryStream compressed; + stream.SetPosition(0); bool compressStatus = Compression::zlibCompress( stream, static_cast(stream.GetLength()), compressed, Compression::ZlibHeaderType::zlib, kReplayCompressionLevel); From 5d0a967c9f03fdfc3ef7ad85e1161b00eb21603d Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sat, 5 Jul 2025 19:09:06 +0200 Subject: [PATCH 28/95] Start 0.4.25 --- distribution/changelog.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 5fe8703e28..ef26e0d34e 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,3 +1,7 @@ +0.4.25 (in development) +------------------------------------------------------------------------ +- Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. + 0.4.24 (2025-07-05) ------------------------------------------------------------------------ - Feature: [#24411] Vanilla scenarios now also have previews in the scenario selection window. From b1411ce186ab49490016004dfdaf304297d33ce0 Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Sun, 6 Jul 2025 04:11:22 +0000 Subject: [PATCH 29/95] Merge Localisation/master into OpenRCT2/develop --- data/language/hu-HU.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/data/language/hu-HU.txt b/data/language/hu-HU.txt index 9c0d54dbf0..f426cc79c6 100644 --- a/data/language/hu-HU.txt +++ b/data/language/hu-HU.txt @@ -3821,3 +3821,10 @@ STR_6781 :Képernyőképek STR_6782 :Park értesítések STR_6783 :Játék értesítések STR_6784 :Látogatói értesítések +STR_6785 :Kontroller +STR_6786 :Holtzóna: +STR_6787 :Analóg kar holtzónája (a minimális szükséges elmozdulás) +STR_6788 :Érzékenység: +STR_6789 :Analóg kar érzékenységi szorzó +STR_6790 :Holtzóna: {COMMA32}% +STR_6791 :Érzékenység: {COMMA32}% From ea8e2c1c5081bbff265574ae8c428d60365de50c Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Mon, 7 Jul 2025 04:11:17 +0000 Subject: [PATCH 30/95] Merge Localisation/master into OpenRCT2/develop --- data/language/de-DE.txt | 14 ++++++++++++++ data/language/en-US.txt | 3 +++ data/language/eo-ZZ.txt | 7 +++++++ data/language/fr-FR.txt | 16 +++++++++++++++- 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/data/language/de-DE.txt b/data/language/de-DE.txt index e73db818d3..324ebe92ae 100644 --- a/data/language/de-DE.txt +++ b/data/language/de-DE.txt @@ -3810,3 +3810,17 @@ STR_6774 :Zeit seit letzter Inspektion STR_6775 :{COMMA16} Minute STR_6776 :{COMMA16} Minuten STR_6777 :über 4 Stunden +STR_6778 :Szenariovorschau mit: +STR_6779 :Die Art des Vorschaubilds im Szenarioauswahlbildschirm auswählen. +STR_6780 :Übersichtskarten +STR_6781 :Screenshots +STR_6782 :Parkbenachrichtigungen +STR_6783 :Fahrgeschäftsbenachrichtigungen +STR_6784 :Besucherbenachrichtigungen +STR_6785 :Gamepad +STR_6786 :Tote Zone: +STR_6787 :Analogstick-Totzone (minimale Bewegung benötigt) +STR_6788 :Empfindlichkeit: +STR_6789 :Analogstickempfindlichkeitsfaktor +STR_6790 :Tote Zone {COMMA32}% +STR_6791 :Empfindlichkeit: {COMMA32}% diff --git a/data/language/en-US.txt b/data/language/en-US.txt index b3a4dea438..65885a0a38 100644 --- a/data/language/en-US.txt +++ b/data/language/en-US.txt @@ -245,3 +245,6 @@ STR_6662 :Randomize colors for every train or vehicle STR_6670 :Guest behavior STR_6732 :Show a button in the toolbar to rotate the view counterclockwise + +STR_6787 :Analog stick deadzone (minimum movement required) +STR_6789 :Analog stick sensitivity multiplier diff --git a/data/language/eo-ZZ.txt b/data/language/eo-ZZ.txt index e7c142956c..80cb47b6aa 100644 --- a/data/language/eo-ZZ.txt +++ b/data/language/eo-ZZ.txt @@ -3820,3 +3820,10 @@ STR_6781 :Ekrankopioj STR_6782 :Sciigoj de parko STR_6783 :Sciigoj de atrakcioj STR_6784 :Sciigoj de gastoj +STR_6785 :Ludregilo +STR_6786 :Morta zono: +STR_6787 :Morta zono de stirstango (minimuma movado bezonata) +STR_6788 :Sentemo: +STR_6789 :Sentema obligilo de stirstango +STR_6790 :Morta zono: {COMMA32}% +STR_6791 :Sentemo: {COMMA32}% diff --git a/data/language/fr-FR.txt b/data/language/fr-FR.txt index fd08975e8c..82c45fc88e 100644 --- a/data/language/fr-FR.txt +++ b/data/language/fr-FR.txt @@ -3611,7 +3611,7 @@ STR_6563 :Bleu pervenche STR_6564 :Viride STR_6565 :Vert écume STR_6566 :Violette -STR_6567 :Lavende +STR_6567 :Lavande STR_6568 :Orange pastel STR_6569 :Grands fonds STR_6570 :Rose pastel @@ -3823,3 +3823,17 @@ STR_6774 :Temps depuis la dernière inspection STR_6775 :{COMMA16} minute STR_6776 :{COMMA16} minutes STR_6777 :Plus de 4 heures +STR_6778 :Type d’aperçu de scénario : +STR_6779 :Sélectionne le type d’image d’aperçu affiché dans la fenêtre de sélection de scénario +STR_6780 :Mini-carte +STR_6781 :Capture d’écran +STR_6782 :Notifications du parc +STR_6783 :Notifications des attractions +STR_6784 :Notifications des visiteurs +STR_6785 :Manette de jeu +STR_6786 :Zone morte : +STR_6787 :Zone morte du stick analogique (mouvement minimum requis) +STR_6788 :Sensibilité : +STR_6789 :Multiplicateur de sensibilité du stick analogique +STR_6790 :Zone morte : {COMMA32}% +STR_6791 :Sensibilité : {COMMA32}% From 16b76b1b7452f5189483790fc11130d600418085 Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Tue, 8 Jul 2025 04:08:25 +0000 Subject: [PATCH 31/95] Merge Localisation/master into OpenRCT2/develop --- data/language/cs-CZ.txt | 24 ++++++------ data/language/da-DK.txt | 84 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 95 insertions(+), 13 deletions(-) diff --git a/data/language/cs-CZ.txt b/data/language/cs-CZ.txt index dd19b89f81..60dce3cb67 100644 --- a/data/language/cs-CZ.txt +++ b/data/language/cs-CZ.txt @@ -1735,28 +1735,28 @@ STR_2381 :Upravit větší vodní plochu STR_2382 :Země STR_2383 :Voda STR_2384 :{WINDOW_COLOUR_2}Cíl scénáře: -STR_2385 :{BLACK}žádný +STR_2385 :{BLACK}Žádný STR_2386 :{BLACK}Mít v parku alespoň {COMMA32} návštěvníků na konci {MONTHYEAR}, s hodnocením parku alespoň 600 STR_2387 :{BLACK}Dosáhnout hodnoty parku alespoň {POP16}{POP16}{CURRENCY} na konci {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2388 :{BLACK}Příjemnou zábavu! STR_2389 :{BLACK}Postav ten nejlepší {STRINGID}! -STR_2390 :{BLACK}Mít v parku 10 druhů kolotočů v provozu, každý s hodnotou zábavnosti alespoň 6.00 +STR_2390 :{BLACK}Mít v parku 10 různých druhů horských drah v provozu, každý s hodnotou nadšení alespoň 6.00 STR_2391 :{BLACK}Mít v parku alespoň {COMMA32} návštěvníků a zároveň nikdy nenechat hodnocení parku spadnout pod 700! STR_2392 :{BLACK}Dosáhnout měsíčního příjmu z lístků na atrakce alespoň {POP16}{POP16}{CURRENCY} -STR_2393 :{BLACK}{BLACK}Mít v parku 10 druhů kolotočů v provozu, každý s hodnotou zábavnosti alespoň 7.00 a délkou alespoň {LENGHT} -STR_2394 :{BLACK}Dokončit všech 5 rozestavěných horských drah tak, aby každá dosahovala hodnocení vzrušení alespoň {POP16}{POP16}{COMMA2DP32} +STR_2393 :{BLACK}Mít v parku 10 různých druhů horských drah v provozu, každý s délkou alespoň {LENGTH} a hodnotou nadšení alespoň 7.00 +STR_2394 :{BLACK}Dokončit všech 5 rozestavěných horských drah tak, aby každá dosahovala hodnocení nadšení alespoň {POP16}{POP16}{COMMA2DP32} STR_2395 :{BLACK}Vrátit půjčku a dosáhnout hodnoty parku alespoň {POP16}{POP16}{CURRENCY} STR_2396 :{BLACK}Dosáhnout měsíčního zisku z jídla, pití a suvenýrů alespoň {POP16}{POP16}{CURRENCY} STR_2397 :Nic STR_2398 :Počet návštěvníků v daný čas -STR_2399 :Hodnotu praku v dané datum +STR_2399 :Hodnotu parku v dané datum STR_2400 :Volná zábava STR_2401 :Postav nejlepší atrakci co dokážeš -STR_2402 :Postavit 10 kolotočů +STR_2402 :Postavit 10 horských drah STR_2403 :Počet návštěvníků v parku -STR_2404 :Měsíční příjem z +STR_2404 :Měsíční příjem z lístků STR_2405 :Postavit 10 drah zadané délky -STR_2406 :Dokončit stavbu 5 kolotočů +STR_2406 :Dokončit stavbu 5ti horských drah STR_2407 :Vrátit půjčku a dosáhnout dané hodnoty parku STR_2408 :Měsíční zisk z prodeje jídla a suvenýrů STR_2409 :{WINDOW_COLOUR_2}Probíhající reklamní kampaně @@ -2178,7 +2178,7 @@ STR_3160 :Vyberte počet kol za jednu jízdu STR_3162 :Nepodařilo se alokovat dostatek paměti STR_3163 :Instaluji nová data: STR_3164 :{BLACK}{COMMA16} vybráno (maximum {COMMA16}) -STR_3167 :{WINDOW_COLOUR_2}Včetně: {BLACK}{COMMA16} objektů +STR_3167 :{WINDOW_COLOUR_2}Obsahuje: {BLACK}{COMMA16} objektů STR_3169 :Nebyly nalezeny data pro následující objekt: STR_3170 :Nedostatek místa pro grafiku STR_3171 :Vybráno příliš mnoho objektů tohoto typu @@ -3210,7 +3210,7 @@ STR_6124 :Název objektu STR_6125 :Typ objektu STR_6126 :Neznámý typ STR_6127 :Soubor: {STRING} -STR_6128 :Soubor se nepodařilo načíst, protože využívá objekty, z nichž některé jsou porušené nebo zcela chybí. Seznam takových objektů je k dispozici níže. +STR_6128 :Soubor se nepodařilo načíst, protože využívá objekty, z nichž některé jsou porušené nebo zcela chybí. Seznam těchto objektů je k dispozici níže. STR_6129 :Kopírovat STR_6130 :Kopírovat vše STR_6131 :Zdroj objektu @@ -3235,7 +3235,7 @@ STR_6149 :Nepodařilo se připojit k master serveru STR_6150 :Neplatná odpověď master serveru (chybí JSON číslo) STR_6151 :Master server neposlal seznam herních serverů STR_6152 :Neplatná odpověď master serveru (chybí JSON pole) -STR_6153 :Zpoplatněné vstupné / Zpoplatněné atrakce +STR_6153 :Placené vstupné / placené atrakce STR_6154 :Z bezpečnostních důvodů se nedoporučuje spouštět OpenRCT2 v řežimu zvýšených oprávnění. STR_6155 :Není nainstalován KDialog ani Zenity. Jeden z nich prosím nainstalujte, nebo konfigurujte z příkazové řádky. STR_6156 :Tento název je rezervován a nelze jej použít. @@ -3783,7 +3783,7 @@ STR_6741 :{WINDOW_COLOUR_2}Poč. atrakcí: {BLACK}{UINT16} STR_6742 :{WINDOW_COLOUR_2}Poč. návštěvníků: {BLACK}{UINT16} STR_6743 :Podnebí STR_6744 :{WINDOW_COLOUR_2}{UINT16}% -STR_6745 :{WINDOW_COLOUR_2}Návštěvníky upřednostňovaná intenzita: +STR_6745 :{WINDOW_COLOUR_2}Upřednostňovaná intenzita: STR_6746 :Bez upřednostnění STR_6747 :Upřednostnění se liší (výchozí) STR_6748 :Pouze méně intenzivní atrakce diff --git a/data/language/da-DK.txt b/data/language/da-DK.txt index 0a2718c863..b23cc9a0fe 100644 --- a/data/language/da-DK.txt +++ b/data/language/da-DK.txt @@ -2195,7 +2195,7 @@ STR_3188 :Stiskilte STR_3189 :Klassiske Gangstier STR_3190 :Sti udstyr STR_3191 :Sceneri Grupper -STR_3192 :Park indgang +STR_3192 :Park indgange STR_3193 :Vand STR_3195 :Opfindelses liste STR_3196 :{WINDOW_COLOUR_2}forskningsgruppe: {BLACK}{STRINGID} @@ -3746,3 +3746,85 @@ STR_6706 :{WINDOW_COLOUR_2}Nuværende billedfil: {BLACK}{STRING} STR_6707 :(Ingen valgt) STR_6708 :Udglatnings Styrke STR_6709 :Angiv udglatnings styrke imellem {COMMA16} og {COMMA16} +STR_6710 :Stable sort +STR_6711 :Filename: +STR_6712 :Save +STR_6713 :{COMMA32} {STRINGID} +STR_6714 :Filename +STR_6715 :Date modified +STR_6716 :File size +STR_6717 :File size {STRINGID} +STR_6718 :Peep Animations +STR_6719 :At least one guest peep animations object must be selected +STR_6720 :At least one handyman peep animations object must be selected +STR_6721 :At least one mechanic peep animations object must be selected +STR_6722 :At least one security peep animations object must be selected +STR_6723 :At least one entertainer peep animations object must be selected +STR_6724 :Scenarie Tekster +STR_6725 :X: +STR_6726 :Y: +STR_6727 :Dive Loop (left) +STR_6728 :Dive Loop (right) +STR_6729 :Cable lift hill must start immediately after station or block brake +STR_6730 :Export emscripten data +STR_6731 :Import emscripten data +STR_6732 :Show a button in the toolbar to rotate the view anti-clockwise +STR_6733 :See-Through +STR_6734 :Map elements that are at or above the cutting height are rendered translucent. +STR_6735 :Go up to parent folder +STR_6736 :Preview +STR_6737 :No preview available +STR_6738 :{WINDOW_COLOUR_2}Park rating: {BLACK}{UINT16} +STR_6739 :{WINDOW_COLOUR_2}Date: {BLACK}{STRINGID} +STR_6740 :{WINDOW_COLOUR_2}Cash: {BLACK}{CURRENCY2DP} +STR_6741 :{WINDOW_COLOUR_2}Num. rides: {BLACK}{UINT16} +STR_6742 :{WINDOW_COLOUR_2}Num. guests: {BLACK}{UINT16} +STR_6743 :Climate +STR_6744 :{WINDOW_COLOUR_2}{UINT16}% +STR_6745 :{WINDOW_COLOUR_2}Guests’ intensity preferences: +STR_6746 :No preferences +STR_6747 :Preferences vary (default) +STR_6748 :Only less intense rides +STR_6749 :Only more intense rides +STR_6750 :Select what kind of ride intensity newly spawned guests prefer. +STR_6751 :Queue paths cannot be used for level crossings! +STR_6752 :Scenario options - Objective +STR_6753 :Scenario options - Scenario Details +STR_6754 :Scenario options - Land Restrictions +STR_6755 :Show objective options +STR_6756 :Show scenario details options +STR_6757 :Show land restriction options +STR_6758 :Loan options +STR_6759 :Business model +STR_6760 :Earnings: +STR_6761 :Scenario Details +STR_6762 :Interface +STR_6763 :RollerCoaster Tycoon 1 +STR_6764 :Saving and autosaves +STR_6765 :Advanced +STR_6766 :Clear +STR_6767 :Window +STR_6768 :Rendering +STR_6769 :Behaviour +STR_6770 :Frame rate limit: +STR_6771 :Internal speed (default) +STR_6772 :Vertical sync +STR_6773 :Unrestricted +STR_6774 :Time since last inspection +STR_6775 :{COMMA16} minute +STR_6776 :{COMMA16} minutes +STR_6777 :more than 4 hours +STR_6778 :Preview scenarios using: +STR_6779 :Select the kind of preview image to use in the scenario selection screen. +STR_6780 :Mini maps +STR_6781 :Screenshots +STR_6782 :Park notifications +STR_6783 :Ride notifications +STR_6784 :Guest notifications +STR_6785 :Gamepad +STR_6786 :Deadzone: +STR_6787 :Analogue stick deadzone (minimum movement required) +STR_6788 :Sensitivity: +STR_6789 :Analogue stick sensitivity multiplier +STR_6790 :Deadzone: {COMMA32}% +STR_6791 :Sensitivity: {COMMA32}% From 65b5d86e6ccc5ad371a2fb826b277faf10b1303d Mon Sep 17 00:00:00 2001 From: Cory Sanin Date: Tue, 8 Jul 2025 02:18:25 -0500 Subject: [PATCH 32/95] Feature: [Plugin] Add bindings for missing cheats Added the following binds for completeness: - ignoreRidePrice - makeAllDestructible - forcedParkRating* `allowSpecialColourSchemes` was missing from the type definition file so I added that as well. \*forcedParkRating required a little more logic than the boolean cheats and I added some safeguards to prevent setting invalid values --- distribution/changelog.txt | 1 + distribution/openrct2.d.ts | 4 ++ src/openrct2/scripting/ScriptEngine.h | 2 +- .../scripting/bindings/game/ScCheats.hpp | 40 +++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index ef26e0d34e..527a6ca0fb 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.4.25 (in development) ------------------------------------------------------------------------ +- Feature: [#24702] [Plugin] Add bindings for missing cheats (forcedParkRating, ignoreRidePrice, makeAllDestructible). - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. 0.4.24 (2025-07-05) diff --git a/distribution/openrct2.d.ts b/distribution/openrct2.d.ts index 332fba684c..d50582516c 100644 --- a/distribution/openrct2.d.ts +++ b/distribution/openrct2.d.ts @@ -4589,6 +4589,7 @@ declare global { interface Cheats { allowArbitraryRideTypeChanges: boolean; + allowSpecialColourSchemes: boolean; allowTrackPlaceInvalidHeights: boolean; buildInPauseMode: boolean; disableAllBreakdowns: boolean; @@ -4603,10 +4604,13 @@ declare global { enableAllDrawableTrackPieces: boolean; enableChainLiftOnAllTrack: boolean; fastLiftHill: boolean; + forcedParkRating: number; freezeWeather: boolean; ignoreResearchStatus: boolean; ignoreRideIntensity: boolean; + ignoreRidePrice: boolean; neverendingMarketing: boolean; + makeAllDestructible: boolean; sandboxMode: boolean; showAllOperatingModes: boolean; showVehiclesFromOtherTrackTypes: boolean; diff --git a/src/openrct2/scripting/ScriptEngine.h b/src/openrct2/scripting/ScriptEngine.h index fbb269f62d..e54898add0 100644 --- a/src/openrct2/scripting/ScriptEngine.h +++ b/src/openrct2/scripting/ScriptEngine.h @@ -46,7 +46,7 @@ namespace OpenRCT2 namespace OpenRCT2::Scripting { - static constexpr int32_t kPluginApiVersion = 108; + static constexpr int32_t kPluginApiVersion = 109; // Versions marking breaking changes. static constexpr int32_t kApiVersionPeepDeprecation = 33; diff --git a/src/openrct2/scripting/bindings/game/ScCheats.hpp b/src/openrct2/scripting/bindings/game/ScCheats.hpp index 27c3ea6b3d..2335157398 100644 --- a/src/openrct2/scripting/bindings/game/ScCheats.hpp +++ b/src/openrct2/scripting/bindings/game/ScCheats.hpp @@ -66,14 +66,19 @@ namespace OpenRCT2::Scripting ctx, &ScCheats::ignoreResearchStatus_get, &ScCheats::ignoreResearchStatus_set, "ignoreResearchStatus"); dukglue_register_property( ctx, &ScCheats::ignoreRideIntensity_get, &ScCheats::ignoreRideIntensity_set, "ignoreRideIntensity"); + dukglue_register_property(ctx, &ScCheats::ignoreRidePrice_get, &ScCheats::ignoreRidePrice_set, "ignoreRidePrice"); dukglue_register_property( ctx, &ScCheats::neverendingMarketing_get, &ScCheats::neverendingMarketing_set, "neverendingMarketing"); + dukglue_register_property( + ctx, &ScCheats::forcedParkRating_get, &ScCheats::forcedParkRating_set, "forcedParkRating"); dukglue_register_property(ctx, &ScCheats::sandboxMode_get, &ScCheats::sandboxMode_set, "sandboxMode"); dukglue_register_property( ctx, &ScCheats::showAllOperatingModes_get, &ScCheats::showAllOperatingModes_set, "showAllOperatingModes"); dukglue_register_property( ctx, &ScCheats::showVehiclesFromOtherTrackTypes_get, &ScCheats::showVehiclesFromOtherTrackTypes_set, "showVehiclesFromOtherTrackTypes"); + dukglue_register_property( + ctx, &ScCheats::makeAllDestructible_get, &ScCheats::makeAllDestructible_set, "makeAllDestructible"); } private: @@ -297,6 +302,17 @@ namespace OpenRCT2::Scripting getGameState().cheats.ignoreRideIntensity = value; } + bool ignoreRidePrice_get() + { + return getGameState().cheats.ignorePrice; + } + + void ignoreRidePrice_set(bool value) + { + ThrowIfGameStateNotMutable(); + getGameState().cheats.ignorePrice = value; + } + bool neverendingMarketing_get() { return getGameState().cheats.neverendingMarketing; @@ -308,6 +324,19 @@ namespace OpenRCT2::Scripting getGameState().cheats.neverendingMarketing = value; } + int32_t forcedParkRating_get() + { + return getGameState().cheats.forcedParkRating; + } + + void forcedParkRating_set(int32_t value) + { + ThrowIfGameStateNotMutable(); + int32_t adjusted = std::max(-1, std::min(value, 999)); + getGameState().cheats.forcedParkRating = adjusted; + Park::SetForcedRating(adjusted); + } + bool sandboxMode_get() { return getGameState().cheats.sandboxMode; @@ -340,6 +369,17 @@ namespace OpenRCT2::Scripting ThrowIfGameStateNotMutable(); getGameState().cheats.showVehiclesFromOtherTrackTypes = value; } + + bool makeAllDestructible_get() + { + return getGameState().cheats.makeAllDestructible; + } + + void makeAllDestructible_set(bool value) + { + ThrowIfGameStateNotMutable(); + getGameState().cheats.makeAllDestructible = value; + } }; } // namespace OpenRCT2::Scripting From 0cbdee9fe872601b0d0e0ddf454c2aa8b7ca8aba Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Wed, 9 Jul 2025 04:10:42 +0000 Subject: [PATCH 33/95] Merge Localisation/master into OpenRCT2/develop --- data/language/cs-CZ.txt | 73 +++++++++++++++++++++-------------------- data/language/es-ES.txt | 20 +++++++++-- 2 files changed, 54 insertions(+), 39 deletions(-) diff --git a/data/language/cs-CZ.txt b/data/language/cs-CZ.txt index 60dce3cb67..3560b58494 100644 --- a/data/language/cs-CZ.txt +++ b/data/language/cs-CZ.txt @@ -124,7 +124,7 @@ STR_0531 :Malá ocelová horská dráha, na které vlak projíždí smyčky a STR_0532 :Bludiště z šest stop vysokých zdí nebo živého plotu. Návštěvníci bloudí dokud nenajdou východ STR_0533 :Dřevěná budova s krytým schodištěm a venkovní skluzavkou s koberečky STR_0534 :Návštěvníci závodí v motokárách po asfaltovém okruhu -STR_0535 :Lodě plují ve vodním kanále a sjíždejí strmé klesání, až z toho jsou návštěvníci mokří. +STR_0535 :Lodě plují ve vodním kanále a sjíždí strmé klesání, až z toho jsou návštěvníci mokří. STR_0536 :Loď pluje po širokých meandrech, přes stříkající vodopády a po vzrušujících pěnících peřejích STR_0537 :Návštěvníci do sebe bourají v autíčcích na autodromu STR_0538 :Velká houpající se pirátská kocábka @@ -138,7 +138,7 @@ STR_0548 :Toalety STR_0549 :Ruské kolo s otevřenými kabinami STR_0550 :Kino v simulátoru pohybu, se kterým během filmu třese hydraulické rameno STR_0551 :3D kino ve velké kopuli -STR_0552 :Návštěvníci sedí v zavěšených gondolách, které se otáčí dopředu, dozadu a vzhůru nohoama +STR_0552 :Návštěvníci sedí v zavěšených gondolách, které se otáčí dopředu, dozadu a vzhůru nohama STR_0553 :Návštěvníci rotují v gyroskopických kruzích zcela volně ve všech směrech STR_0554 :Po mocném startu pomocí elektromotorů se vozy rozjedou po svislé dráze, přes vrchol a svisle dolů zpět do stanice STR_0555 :Návštěvníci jezdí ve výtahu nahoru a dolů @@ -155,17 +155,17 @@ STR_0565 :Jednoduchá dřevěná horská dráha schopná jen mírných kopců STR_0566 :Malá horská dráha, na které vozy po jednom projíždí cik-cak trať s kroucenými pády a ostrými zatáčkami STR_0567 :Vozy se sedadly schopny otáčet návštěvníky vzhůru nohama STR_0569 :Jízda ve speciálních postrojích zavěšených pod tratí, poskytuje pocit letu jako pták -STR_0571 :Kulaté vozy se otáčejí dokola tím, jak projíždějí dřevěnou klikatou tratí -STR_0572 :Lodě s velkou kapacitou jedou po širokém vodním kanále, vzhůru poháněné bežícím pásem, zrychlují z prudkých svahů, aby obrovským šplouchnutím namočily všechny návštěvníky -STR_0573 :Vozy ve tvaru helikoptér jedou na postavení dráze -STR_0574 :Návštěvníci ve speciálních postrojích zavěšení v leže pod tratí, jedou přes zatáčky a obraty pozadu, nebo čelem k zemi +STR_0571 :Kulaté vozy se otáčejí dokola při jízdě klikatou dřevěnou tratí +STR_0572 :Lodě s velkou kapacitou jedou po širokém vodním kanále, vzhůru poháněné běžícím pásem, zrychlují z prudkých svahů, aby obrovským šplouchnutím namočily všechny návštěvníky +STR_0573 :Vozy ve tvaru helikoptér, poháněné šlapáním, jezdí po ocelové dráze +STR_0574 :Návštěvníci ve speciálních postrojích zavěšení v leže pod tratí, jedou přes zatáčky a obraty pozadu nebo čelem k zemi STR_0575 :Poháněné vlaky visící pod visutou kolejí převážejí návštěvníky po parku STR_0577 :Vozy s dvěma podvozky jedou po dřevěné trati, otáčející se dokola na speciálních místech STR_0578 :Horská dráha, která se točí dokola tak, že návštěvníci jsou pořád na stejném místě. STR_0579 :Pohodový minigolf STR_0580 :Gigantická ocelová horská dráha schopna volných pádů a kopců přes 90 metrů dlouhých STR_0581 :Kruh sedadel je za pomalé rotace vytažen na vrchol vysoké věže, spuštěn volným pádem k zemi a opatrně zastaven pomocí magnetických brzd -STR_0582 :Návštevníci volně jezdí na vznášedlech. +STR_0582 :Návštěvníci volně jezdí na vznášedlech. STR_0583 :Budova s pokřivenými chodbami a zvláštními místnostmi, která dezorientuje návštěvníky STR_0584 :Speciální kola jezdí po ocelové koleji, poháněná šlapáním jezdců STR_0585 :Návštěvníci sedí po dvou zavěšení pod tratí a jedou skrze loopingy a ostré zatáčky @@ -182,8 +182,8 @@ STR_0600 :Horská dráha s vozy ve stylu důlních vagónů, které jedou po STR_0602 :Horská dráha s vozy poháněnými elektromotorem, které sviští skrze propletenou dráhu STR_0603 :Dřevěná horská dráha s ocelovými kolejemi, umožňující strmé přepady a obraty. STR_0604 :Jezdci jedou v jednom radě na úzké, jednokolejové dráze, při závodě úzkými obrátkami a změnami směru. -STR_0605 :Jezdci se kloužou zauzlenou ocelovou dráhou, brzdíc pro ovládání rychlosti -STR_0606 :Dřevěná horská dráha staršího stylu s drsnou a rychlou jízdou, koupou času ve vzduchu, bočným přetížením, navrhnutá pro pocit ‘ztracené kontroly’ +STR_0605 :Jezdci se kloužou zauzlenou ocelovou drahou, ovládají brzdy a tím svou rychlost +STR_0606 :Dřevěná horská dráha staršího stylu s drsnou a rychlou jízdou, koupou času ve vzduchu, bočným přetížením, navržená pro pocit ‘ztracené kontroly’ STR_0607 :Intenzivní horská dráha staršího stylu, na které návštěvníci jedou vestoje STR_0608 :Vozy poháněné lineárními synchronními elektromotory sviští skrze těsné vývrtky a zatáčky STR_0609 :Dřevěná horská dráha staršího stylu s drsnou a rychlou jízdou, kloubovými vozy, spoustou času ve vzduchu a zakroucenou dráhou @@ -410,7 +410,7 @@ STR_1012 :Otevřít vše STR_1013 :Zavřít park STR_1014 :Otevřít park STR_1015 :Tento mód nefunguje s více než jednou stanicí -STR_1016 :Tento mód nefunguje s méně než dvěmi stanicemi +STR_1016 :Tento mód nefunguje s méně než dvěma stanicemi STR_1017 :Nelze změnit mód běhu… STR_1018 :Nelze vytvářet změny… STR_1019 :Nelze vytvářet změny… @@ -546,7 +546,7 @@ STR_1148 :25% naložení STR_1149 :50% naložení STR_1150 :75% naložení STR_1151 :plné naložení -STR_1152 :jakkékoliv naložení +STR_1152 :jakékoliv naložení STR_1153 :Výškové popisky atrakcí STR_1154 :Výškové popisky krajiny STR_1155 :Výškové popisky cest @@ -919,7 +919,7 @@ STR_1520 :„Tahle mapa parku z {STRINGID} se opravdu vyplatí“ STR_1521 :„Tahle fotka z atrakce {STRINGID} se opravdu vyplatí“ STR_1522 :„Tenhle deštník z {STRINGID} se opravdu vyplatí“ STR_1523 :„Tohle pití od {STRINGID} se opravdu vyplatí“ -STR_1524 :„Tenhle burgr od {STRINGID} se opravdu vyplatí“ +STR_1524 :„Tenhle burger od {STRINGID} se opravdu vyplatí“ STR_1525 :„Tyhle hranolky od {STRINGID} se opravdu vyplatí“ STR_1526 :„Ta zmrzlina od {STRINGID} se opravdu vyplatí“ STR_1527 :„Tahle cukrová vata od {STRINGID} se opravdu vyplatí“ @@ -953,7 +953,7 @@ STR_1554 :„Nezaplatím tak moc za mapu parku z {STRINGID}“ STR_1555 :„Nezaplatím tak moc za fotku z atrakce {STRINGID}“ STR_1556 :„Nezaplatím tak moc za deštník z {STRINGID}“ STR_1557 :„Nezaplatím tak moc za pití od {STRINGID}“ -STR_1558 :„Nezaplatím tak moc za burgr od {STRINGID}“ +STR_1558 :„Nezaplatím tak moc za burger od {STRINGID}“ STR_1559 :„Nezaplatím tak moc za hranolky od {STRINGID}“ STR_1560 :„Nezaplatím tak moc za zmrzlinu od {STRINGID}“ STR_1561 :„Nezaplatím tak moc za cukrovou vatu od {STRINGID}“ @@ -1428,7 +1428,7 @@ STR_2052 :zmrzlina STR_2053 :cukrová vata STR_2054 :prázdná plechovka STR_2055 :odpadky -STR_2056 :prázdná krabice od burgru +STR_2056 :prázdná krabice od burgeru STR_2057 :kus pizzy STR_2058 :kupon STR_2059 :popcorn @@ -1456,7 +1456,7 @@ STR_2080 :Zmrzlina STR_2081 :Cukrová vata STR_2082 :Prázdná plechovka STR_2083 :Odpadky -STR_2084 :Prázdná krabice od burgru +STR_2084 :Prázdná krabice od burgeru STR_2085 :Pizza STR_2086 :Kupon na {STRINGID} STR_2087 :Popcorn @@ -1665,7 +1665,7 @@ STR_2305 :Soubory tratě STR_2306 :Uložit návrh trati STR_2307 :Vyberte návrh {STRINGID} STR_2308 :Návrhy trati {STRINGID} -STR_2309 :Nainstalvoat nové návrh tratí +STR_2309 :Nainstalovat nové návrh tratí STR_2310 :Vytvořit vlastní návrh STR_2311 :{WINDOW_COLOUR_2}Nadšení: asi {BLACK}{COMMA2DP32} STR_2312 :{WINDOW_COLOUR_2}Intenzita: asi {BLACK}{COMMA2DP32} @@ -2131,7 +2131,7 @@ STR_3096 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP STR_3097 :Vyberte rychlost řetězového vleku STR_3099 :Vyberte barvu STR_3100 :Vyberte sekundární barvu -STR_3101 :Vyberte terciální barvu +STR_3101 :Vyberte terciární barvu STR_3102 :Přebarvit kulisy v krajině STR_3103 :Nelze přemalovat… STR_3104 :Seznam atrakcí @@ -2240,7 +2240,7 @@ STR_3228 :Nastavit počáteční pozice návštěvníků STR_3229 :Blokové brzdy nelze použít hned za stanicí STR_3230 :Blokové brzdy nelze použít v řadě za sebou STR_3231 :Blokové brzdy nelze použít hned za řetězovým výtahem -STR_3232 :Nastavení scénaře - Finance +STR_3232 :Nastavení scénáře - Finance STR_3233 :Nastavení scénáře - Návštěvníci STR_3235 :Zobrazit nastavení financí STR_3236 :Zobrazit nastavení návštěvníků @@ -2528,7 +2528,7 @@ STR_5280 :Povolit pomocí okna s mapou úpravy nastavení práv pozemků dal STR_5281 :Funkce STR_5282 :RCT1 světla atrakcí otevřeno/zavřeno STR_5283 :RCT1 světla parku otevřeno/zavřeno -STR_5284 :RCT1 výber fontu scénáře +STR_5284 :RCT1 výběr fontu scénáře STR_5287 :Atrakce už má poruchu STR_5288 :Atrakce je zavřená STR_5289 :Tato atrakce nemůže mít poruchy @@ -2897,7 +2897,7 @@ STR_5794 :V některých scénářích není možné{NEWLINE}provádět úprav STR_5795 :Návštěvníci navštěvují všechny atrakce,{NEWLINE}i když mají velmi vysokou intenzitu STR_5796 :Vynutí otevření nebo zavření parku STR_5797 :Zakáže změny počasí{NEWLINE}(v parku bude odteď pořád stejně) -STR_5798 :Povolí stavění, když je hra zapauzována +STR_5798 :Povolí stavění, když je hra zapauzovaná STR_5799 :Zakáže havárie atrakcí způsobené poruchou brzd STR_5800 :Atrakce nebudou mít poruchy STR_5801 :Zakázat odhazování odpadků @@ -3012,7 +3012,7 @@ STR_5917 :{COMMA16} hráči STR_5918 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{COMMA16} STR_5919 :{COMMA16} STR_5920 :Vykreslovat efekty počasí -STR_5921 :Pokud zaškrtnete, budou během bouřek barvy ponurejší. +STR_5921 :Pokud zaškrtnete, budou během bouřek barvy ponuřejší. STR_5922 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}Max {STRINGID} STR_5923 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}Max {COMMA16} {STRINGID} / vlak STR_5924 :Detail povrchu @@ -3041,8 +3041,8 @@ STR_5946 :Typ atrakce: {BLACK}{STRINGID} STR_5947 :ID atrakce: {BLACK}{COMMA16} STR_5948 :Název atrakce: {BLACK}{STRINGID} STR_5949 :Řetězový výtah -STR_5950 :Aplikovat změny pro celou část traťi -STR_5951 :ID části traťi: {BLACK}{COMMA16} +STR_5950 :Aplikovat změny pro celou část trati +STR_5951 :ID části trati: {BLACK}{COMMA16} STR_5952 :Číslo sekvence: {BLACK}{COMMA16} STR_5953 :Seřadit elementy mapy vybrané dlaždice podle jejich základní výšky STR_5954 :Stáří kulis: {BLACK}{COMMA16} @@ -3077,7 +3077,7 @@ STR_5982 :Typ velké kulisy: {BLACK}{COMMA16} STR_5983 :ID velké kulisy: {BLACK}{COMMA16} STR_5984 :Zablokované cesty: STR_5985 :Nová složka -STR_5986 :Napiště název nové složky +STR_5986 :Napište název nové složky STR_5987 :Nepodařilo se vytvořit složku STR_5988 :Žádná další pozemková práva ke koupi STR_5989 :Žádná další stavební práva ke koupi @@ -3092,7 +3092,7 @@ STR_5997 :Přidat/nastavit peníze STR_5998 :Přidat peníze STR_5999 :Nastavit peníze STR_6000 :Zadejte novou hodnotu -STR_6001 :Zapnout efekty osvětlení (experimentalní) +STR_6001 :Zapnout efekty osvětlení (experimentální) STR_6002 :Lampy a atrakce budou v noci svítit.{NEWLINE}Vyžaduje nastavení hardwarového vykreslování (GPU). STR_6003 :Seříznuté zobrazení STR_6004 :Seříznuté zobrazení @@ -3104,7 +3104,7 @@ STR_6009 :Zvolit výšku řezu STR_6010 :{COMMA2DP32}m STR_6011 :{COMMA1DP16}ft STR_6012 :{COMMA1DP16} -STR_6013 :Návštěvníci platí pouze za vstup do parku a služby. Atrakce jsou zdrarma. +STR_6013 :Návštěvníci platí pouze za vstup do parku a služby. Atrakce jsou zdarma. STR_6014 :Návštěvníci platí pouze za služby a atrakce. Vstup do parku je zdarma. STR_6015 :Nakloněný STR_6016 :Upravit dlaždici @@ -3132,7 +3132,7 @@ STR_6037 :Vybraná složka neobsahuje instalaci RollerCoaster Tycoon 1. STR_6038 :Pokud máte nainstalovaný RCT1, použijte tuto volbu k nastavení cesty k RCT1 pro možnost nahrání scénářů, hudby a dalších. STR_6039 :Rychle odebrat atrakci STR_6040 :Upravit nastavení scénáře -STR_6041 :{BLACK}Nemáte najmuté žádné mechaniky! +STR_6041 :{BLACK}Nemáte najaté žádné mechaniky! STR_6042 :Načíst výškovou mapu STR_6043 :Vybrat výškovou mapu STR_6044 :Vyhladit výškovou mapu @@ -3236,7 +3236,7 @@ STR_6150 :Neplatná odpověď master serveru (chybí JSON číslo) STR_6151 :Master server neposlal seznam herních serverů STR_6152 :Neplatná odpověď master serveru (chybí JSON pole) STR_6153 :Placené vstupné / placené atrakce -STR_6154 :Z bezpečnostních důvodů se nedoporučuje spouštět OpenRCT2 v řežimu zvýšených oprávnění. +STR_6154 :Z bezpečnostních důvodů se nedoporučuje spouštět OpenRCT2 v režimu zvýšených oprávnění. STR_6155 :Není nainstalován KDialog ani Zenity. Jeden z nich prosím nainstalujte, nebo konfigurujte z příkazové řádky. STR_6156 :Tento název je rezervován a nelze jej použít. STR_6157 :Konzole @@ -3246,7 +3246,7 @@ STR_6162 :Točící se divoká myš STR_6163 :Vozy ve tvaru myší jedou po dřevěné trati a pro dezorientaci návštěvníků se točí, zatímco se naklání v ostrých zatáčkách a drsných pádech STR_6164 :{WHITE}❌ STR_6165 :Vertikální synchronizace obrazu -STR_6166 :Synchonizuje každý zobrazený snímek dle obnovovací frekvence monitoru. Zamezuje trhání obrazu. +STR_6166 :Synchronizuje každý zobrazený snímek dle obnovovací frekvence monitoru. Zamezuje trhání obrazu. STR_6167 :Pokročilé STR_6168 :Úvodní herní sekvence STR_6170 :Vychytávky @@ -3407,7 +3407,7 @@ STR_6364 :{RED}{COMMA16} zemřel(a) při nehodě na {STRINGID} STR_6365 :Oběti atrakce STR_6366 :Zaseklá vozidla STR_6367 :Snímek animace: -STR_6368 :Z důvodů kompatibility není doporučeno spuštět OpenRCT2 pod Wine. OpenRCT2 má nativví podporu pro macOS, Linux, FreeBSD a OpenBSD. +STR_6368 :Z důvodů kompatibility není doporučeno spouštět OpenRCT2 pod Wine. OpenRCT2 má nativní podporu pro macOS, Linux, FreeBSD a OpenBSD. STR_6369 :Povolit stavbu trati v jakémkoliv výšce STR_6370 :Umožní stavět dráhu v neplatné výšce STR_6371 :Vybraná složka obsahuje RollerCoaster Tycoon 1, ale chybí soubor „csg1i.dat“. Tento soubor je nutné překopírovat z Loopy Landscapes nebo RCT Deluxe instalačního CD do složky „Data“ ve vaší složce s RollerCoaster Tycoon 1. @@ -3561,7 +3561,7 @@ STR_6519 :Extra STR_6520 :Balíky součástí STR_6521 :Nízká priorita STR_6522 :Vysoká priorita -STR_6523 :Znížit prioritu zvoleného balíku součástí. +STR_6523 :Snížit prioritu zvoleného balíku součástí. STR_6524 :Zvýšit prioritu zvoleného balíčku součástí. STR_6525 :Znovu načíst všechny součásti hry ze zvolených balíků. STR_6526 :(základní grafika, hudba a zvukové efekty) @@ -3584,7 +3584,7 @@ STR_6542 :Přispěvatelé STR_6543 :Přispěvatelé… STR_6544 :Půjčka nemůže být záporná! STR_6545 :Použít výpočet úroku RCT1 -STR_6546 :Použije algoritmus výpočtu úroku z RollerCoaster Tycoon 1, který použivá pevný úrok přibližně 1.33%. +STR_6546 :Použije algoritmus výpočtu úroku z RollerCoaster Tycoon 1, který používá pevný úrok přibližně 1.33%. STR_6547 :Všechny kulisy STR_6548 :Zobrazit zábradlí na křižovatkách STR_6549 :Nelze vybrat objekty pro kompatibilitu! @@ -3698,7 +3698,7 @@ STR_6656 :Odstraní všechny ploty okolo parku STR_6657 :Nevlastněné pozemky STR_6658 :Nastavit pozemky na nevlastněné parkem, bez možnosti zakoupení STR_6659 :Návštěvníci ignorují ceny -STR_6660 :Návštěvnící nebudou hledět na ceny na atrakcích a stáncích +STR_6660 :Návštěvníci nebudou hledět na ceny na atrakcích a stáncích STR_6661 :Všechny náhodně STR_6662 :Nastaví náhodné barvy pro každý vlak nebo vozidlo STR_6663 :Cheaty - datum @@ -3734,7 +3734,7 @@ STR_6692 :Maximální výška země STR_6693 :Zadejte max. výšku země mezi {COMMA16} a {COMMA16} STR_6694 :Minimální výška stromů STR_6695 :Zadejte min. výšku stromů mezi {COMMA16} a {COMMA16} -STR_6696 :Maximmální výška stromů +STR_6696 :Maximální výška stromů STR_6697 :Zadejte max. výšku stromů mezi {COMMA16} a {COMMA16} STR_6698 :Poměr stromů k zemi STR_6699 :Zadejte poměr stromů k zemi mezi {COMMA16} a {COMMA16} @@ -3816,8 +3816,8 @@ STR_6774 :Doba od poslední inspekce STR_6775 :{COMMA16} minuta STR_6776 :{COMMA16} minut STR_6777 :více než 4 hodiny -STR_6778 :Náhled scénařů pomocí: -STR_6779 :Vyberte typ náhledu k použití na obrazovce pro výběr scénaře. +STR_6778 :Náhled scénářů pomocí: +STR_6779 :Vyberte typ náhledu k použití na obrazovce pro výběr scénáře. STR_6780 :Mini mapy STR_6781 :Snímky obrazovky STR_6782 :Upozornění o parku @@ -3825,6 +3825,7 @@ STR_6783 :Upozornění o atrakcích STR_6784 :Upozornění o návštěvnících STR_6785 :Gamepad STR_6786 :Mrtvá zóna: + STR_6787 :Mrtvá zóna analogové páčky (minimální vyžadovaný pohyb) STR_6788 :Citlivost: STR_6789 :Násobitel citlivosti analogové páčky diff --git a/data/language/es-ES.txt b/data/language/es-ES.txt index fa39848ce2..701dab0552 100644 --- a/data/language/es-ES.txt +++ b/data/language/es-ES.txt @@ -2166,7 +2166,6 @@ STR_3136 :Advertencia: Este diseño se construirá con un tipo de vehículo a STR_3137 :Selecc. Escenario Cercano STR_3138 :Reiniciar Selecc. STR_3139 :Cable de elevación no puede funcionar en este modo -STR_3140 :Cable de elevación debe comenzar después de la estación STR_3141 :Multi-circuito por attracc. no es posible con un cable de elevación STR_3142 :{WINDOW_COLOUR_2}Capacidad: {BLACK}{STRINGID} STR_3143 :Mostrar visitantes en el mapa @@ -2198,7 +2197,7 @@ STR_3188 :Señales de Sendero STR_3189 :Senderos Legacy STR_3190 :Decoración Senderos STR_3191 :Escenarios -STR_3192 :Entrada del parque +STR_3192 :Entradas del parque STR_3193 :Agua STR_3195 :Lista de inventos STR_3196 :{WINDOW_COLOUR_2}Grupo Investigación: {BLACK}{STRINGID} @@ -3198,7 +3197,7 @@ STR_6102 :El valor de una atracción no disminuye con el tiempo, así los vis STR_6103 :Esta opción está des-habilitada durante una partida multijugador. STR_6105 :Hiper-montaña Rusa STR_6107 :Camiones Monstruo -STR_6109 :Hiper-Twister +STR_6109 :Montaña Rusa Hiper-Twister STR_6111 :Mini Montaña Rusa Clásica STR_6113 :Una montaña rusa alta y que no se invierte con grandes caídas, alta velocidad y vagones confortables con sólo unas barras para sujetarse STR_6115 :Camiones gigantes autopropulsados 4x4 que pueden subir cuestas impresionantes @@ -3758,3 +3757,18 @@ STR_6714 :Nombre de archivo STR_6715 :Fecha de modificación STR_6716 :Tamaño de archivo STR_6717 :Tamaño de archivo {STRINGID} +STR_6718 :Animaciones de Personitas +STR_6719 :Se debe seleccionar al menos un objeto de animaciones de personita invitado +STR_6720 :Se debe seleccionar al menos un objeto de animaciones de personita jardinero +STR_6721 :Se debe seleccionar al menos un objeto de animaciones de personita mecánico +STR_6722 :Se debe seleccionar al menos un objeto de animaciones de personita de seguridad +STR_6723 :Se debe seleccionar al menos un objeto de animaciones de personita animador +STR_6724 :Textos de escenario +STR_6725 :X: +STR_6726 :Y: +STR_6727 :Rizo de inmersión (izq) +STR_6728 :Rizo de inmersión (der) +STR_6729 :El cable de elevación debe comenzar inmediatamente después de la estación o del bloque de frenado +STR_6730 :Exportar datos de emscripten +STR_6731 :Importar datos de emscripten +STR_6732 :Mostrar un botón en la barra de herramientas para girar la vista en sentido antihorario \ No newline at end of file From 7217558ad183b8b4f7bdd1af4fbcc3b6f97710d3 Mon Sep 17 00:00:00 2001 From: Cory Sanin Date: Wed, 9 Jul 2025 01:59:38 -0500 Subject: [PATCH 34/95] openrct2.d.ts style fixes --- distribution/openrct2.d.ts | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/distribution/openrct2.d.ts b/distribution/openrct2.d.ts index d50582516c..9c828690ac 100644 --- a/distribution/openrct2.d.ts +++ b/distribution/openrct2.d.ts @@ -1750,7 +1750,7 @@ declare global { * @param elementIndex The index of the track element on the tile. */ getTrackIterator(location: CoordsXY, elementIndex: number): TrackIterator | null; - + } type TileElementType = @@ -2501,30 +2501,30 @@ declare global { * Highest drop height in height units. Use `context.formatString()` to convert into metres/feet. Ex: `formatString('{HEIGHT}', ride.highestDropHeight)`. */ readonly highestDropHeight: number; - - /** - * The current breakdown of the ride. - */ + + /** + * The current breakdown of the ride. + */ readonly breakdown: BreakdownType; - - /** + + /** * Set a breakdown on a ride. * @param breakdown The type of breakdown to set. */ setBreakdown(breakdown: BreakdownType): void; - - /** + + /** * Fix a ride / clear the breakdown. */ fixBreakdown(): void; - + } type RideClassification = "ride" | "stall" | "facility"; type RideStatus = "closed" | "open" | "testing" | "simulating"; - - type BreakdownType = "brakes_failure" | "control_failure" | "doors_stuck_closed" | "doors_stuck_open" | "restraints_stuck_closed" | "restraints_stuck_open" | "safety_cut_out" | "vehicle_malfunction"; + + type BreakdownType = "brakes_failure" | "control_failure" | "doors_stuck_closed" | "doors_stuck_open" | "restraints_stuck_closed" | "restraints_stuck_open" | "safety_cut_out" | "vehicle_malfunction"; interface TrackColour { main: number; @@ -3874,26 +3874,26 @@ declare global { "empty_juice_cup" | "empty_bowl_blue"; - /** + /** * Represents balloon entity. */ interface Balloon extends Entity { /** * The colour of the balloon. */ - colour: number; - } - - /** + colour: number; + } + + /** * Represents money_effect entity. */ interface MoneyEffect extends Entity { /** * The value of the money effect. */ - value: number; - } - + value: number; + } + /** * Network APIs * Use `network.mode` to determine whether the current game is a client, server or in single player mode. From c72c32cd1d0176530838b0d66bf201039b524578 Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Fri, 11 Jul 2025 04:13:36 +0000 Subject: [PATCH 35/95] Merge Localisation/master into OpenRCT2/develop --- data/language/hu-HU.txt | 56 ++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/data/language/hu-HU.txt b/data/language/hu-HU.txt index f426cc79c6..dc9d74cf1c 100644 --- a/data/language/hu-HU.txt +++ b/data/language/hu-HU.txt @@ -390,7 +390,7 @@ STR_0993 :Játék/épület lerombolása STR_0994 :Lerombolás STR_0995 :{WINDOW_COLOUR_1}Biztosan le akarod bontani ezt: {STRINGID}? STR_0996 :Teljes nézet -STR_0997 :A látkép kiválasztása +STR_0997 :A nézetablak kiválasztása STR_0998 :A játék nem tartalmazhat több állomást STR_0999 :Állomásra van szüksége STR_1000 :A pálya nem teljes körpálya @@ -785,7 +785,7 @@ STR_1388 :{OUTLINE}{GREEN}+ {CURRENCY} STR_1389 :{OUTLINE}{RED}- {CURRENCY} STR_1390 :{CURRENCY2DP} STR_1391 :{RED}{CURRENCY2DP} -STR_1392 :A játék/épület látképe +STR_1392 :A játék/épület nézetablaka STR_1393 :A jármű részletei és beállításai STR_1394 :Üzemmód-beállítások STR_1395 :Karbantartási beállítások @@ -1046,8 +1046,8 @@ STR_1649 :„Mindjárt elfogy a pénzem!” STR_1650 :„Hű! Egy új játék épül!” STR_1653 :„…és itt vagyunk ezen: {STRINGID}!” STR_1654 :{WINDOW_COLOUR_2}Legutóbbi gondolatok: -STR_1655 :Út építése a földön -STR_1656 :Út építése hídon vagy alagútban +STR_1655 :Út építése a talajon +STR_1656 :Út építése hídként vagy alagútként STR_1657 :{WINDOW_COLOUR_2}Előnyben részesített játék- STR_1658 :{WINDOW_COLOUR_2}intenzitás: {BLACK}kevesebb mint {COMMA16} STR_1659 :{WINDOW_COLOUR_2}intenzitás: {BLACK}{COMMA16} és {COMMA16} között @@ -1305,8 +1305,8 @@ STR_1934 :{STRINGID} elhagyta ezt: {STRINGID} STR_1935 :{STRINGID} elhagyta a parkot STR_1936 :{STRINGID} ezt vásárolta: {STRINGID} STR_1937 :Információk az üzenet tárgyáról -STR_1938 :A vendég látképe -STR_1939 :Az alkalmazott látképe +STR_1938 :A vendég nézetablaka +STR_1939 :Az alkalmazott nézetablaka STR_1940 :A vendég boldogsága, energiája, éhsége stb. STR_1941 :A vendég által használt játékok STR_1942 :A vendég pénzügyi információi @@ -1796,7 +1796,7 @@ STR_2458 :Grafikon a pénz (kölcsön nélküli) alakulásáról STR_2459 :Grafikon a park értékének alakulásáról STR_2460 :Grafikon a heti nyereség alakulásáról STR_2461 :Marketingkampányok -STR_2462 :A park bejáratának látképe +STR_2462 :A park bejáratának nézetablaka STR_2463 :Grafikon a park értékelésének alakulásáról STR_2464 :Grafikon a vendégek számának alakulásáról STR_2465 :A park belépési díja és bevétele @@ -1846,7 +1846,7 @@ STR_2510 :Magasságjelek az utakon be/ki STR_2511 :Talaj módosítása STR_2512 :Víz módosítása STR_2513 :Díszlet építése -STR_2514 :Utak építése +STR_2514 :Útépítés STR_2515 :Új játék építése STR_2516 :Pénzügyi információk STR_2517 :Kutatási információk @@ -1966,8 +1966,8 @@ STR_2775 :Telj. kép. (keret nélküli abl.) STR_2776 :Nyelv: STR_2777 :{MOVE_X}{10}{STRING} STR_2778 :»{MOVE_X}{10}{STRING} -STR_2779 :Látkép {COMMA16} -STR_2780 :Extra látkép +STR_2779 :Nézetablak {COMMA16} +STR_2780 :Extra nézetablak # End of new strings STR_2781 :{STRINGID}: STR_2782 :SHIFT + @@ -2240,7 +2240,7 @@ STR_3232 :Pálya beállítások - Pénzügyi STR_3233 :Pálya beállítások - Vendégek STR_3235 :Pénzügyi beállítások STR_3236 :A vendégek beállításai -STR_3238 :Nem kell pénz +STR_3238 :Pénz nélküli mód STR_3239 :Legyen ez a park egy „pénz nélküli” park, pénzügyi korlátozások nélkül STR_3240 :Kezdőtőke: STR_3241 :Kezdeti kölcsön: @@ -2422,9 +2422,9 @@ STR_5162 :Nap/hónap/év STR_5163 :Hónap/nap/év STR_5177 :Képernyőmód: STR_5178 :Pénzügyi csalások -STR_5179 :Vendég-csalások -STR_5180 :Park-csalások -STR_5181 :Játék-csalások +STR_5179 :Vendégcsalások +STR_5180 :Parkcsalások +STR_5181 :Játékcsalások STR_5182 :{INT32} STR_5183 :Alapmagasság STR_5184 :Add meg az alapmagasságot {COMMA16} és {COMMA16} között @@ -2434,7 +2434,7 @@ STR_5187 :Pénzügyek STR_5188 :Új kampány STR_5189 :Kutatás STR_5190 :Térkép -STR_5191 :Látkép +STR_5191 :Nézetablak STR_5192 :Friss hírek STR_5193 :Talaj STR_5194 :Víz @@ -2562,9 +2562,9 @@ STR_5340 :Teljes magasság STR_5343 :Alkalmazottak automatikus lerakása STR_5344 :Változási napló STR_5345 :Pénzügyi csalások -STR_5346 :Vendég-csalások -STR_5347 :Park-csalások -STR_5348 :Játék-csalások +STR_5346 :Vendégcsalások +STR_5347 :Parkcsalások +STR_5348 :Játékcsalások STR_5349 :Minden játék STR_5350 :Max. STR_5351 :Min. @@ -2651,7 +2651,7 @@ STR_5502 :Többjátékos mód STR_5503 :Add meg a gépnevet vagy IP-címet: STR_5504 :A többjátékos mód állapota STR_5505 :Nem lehet csatlakozni a szerverhez. -STR_5506 :Vendégeket nem érdeklik az intenzitások +STR_5506 :Vendégeket nem érdekli az intenzitás STR_5510 :Alapértelmezett hangeszköz STR_5511 :(ISMERETLEN) STR_5512 :Játék mentése másként @@ -2706,7 +2706,7 @@ STR_5561 :A nyelv betöltése sikertelen STR_5562 :FIGYELMEZTETÉS! STR_5563 :Ez a funkció jelenleg instabil, legyél rendkívül elővigyázatos. STR_5566 :Jelszó: -STR_5567 :Hirdetés +STR_5567 :Kihirdetés STR_5568 :Jelszó szükséges STR_5569 :Ehhez a szerverhez jelszó szükséges STR_5570 :Szerver keresése @@ -2920,7 +2920,7 @@ STR_5822 :A nap és az éjszaka váltakozásának bekapcsolása.{NEWLINE}A te STR_5823 :Nagybetűs megjelenítés a hirdetőtáblákon (RCT1-beli viselkedés) STR_5824 :A viharok alatti villámhatás{NEWLINE}kikapcsolása STR_5825 :Az egérmutató maradjon az ablakon belül -STR_5826 :A látkép jobb egeres húzásának invertálása +STR_5826 :A nézetbalak jobb egeres húzásának invertálása STR_5827 :A felhasználói felület színsémájának beállítása STR_5828 :A távolságok, sebesség stb. mértékegységeinek megváltoztatása STR_5829 :A használatban lévő pénznem formátum megváltoztatása. Tisztán vizuális, a pontos árfolyam nincs implementálva. @@ -3699,13 +3699,13 @@ STR_6659 :Vendégeket nem érdeklik az árak STR_6660 :A vendégek hagyják figyelmen kívül a játékok és bódék árait STR_6661 :Véletlenszerűek STR_6662 :Véletlenszerű színek minden vonat vagy jármű számára -STR_6663 :Dátum csalások -STR_6664 :Dátum csalások megjelenítése -STR_6665 :Természet/időjárás csalások -STR_6666 :Természet/időjárás csalások megjelenítése +STR_6663 :Dátumcsalások +STR_6664 :Dátumcsalások +STR_6665 :Természet-/időjárás-csalások +STR_6666 :Természet-/időjárás-csalások STR_6667 :Fauna STR_6668 :Személyzeti csalások -STR_6669 :Személyzeti csalások megjelenítése +STR_6669 :Személyzeti csalások STR_6670 :Vendégek viselkedése STR_6671 :Alkalmazottak „igazi” nevének mutatása STR_6672 :Váltás az alkalmazottak „igazi” nevének és az alkalmazottak számának mutatása között @@ -3713,7 +3713,7 @@ STR_6673 :Átlátszó STR_6674 :{COMMA16}. év {MONTH} STR_6675 :Vendég nevek STR_6676 :Legalább egy vendégneves objektumot ki kell választani -STR_6677 :Partok létrehozása vízfelületek körül +STR_6677 :Part létrehozása a vízfelületek körül STR_6678 :Magasságtérkép forrása: STR_6679 :Síkság STR_6680 :Szimplex zaj @@ -3821,7 +3821,7 @@ STR_6781 :Képernyőképek STR_6782 :Park értesítések STR_6783 :Játék értesítések STR_6784 :Látogatói értesítések -STR_6785 :Kontroller +STR_6785 :Játékvezérlő STR_6786 :Holtzóna: STR_6787 :Analóg kar holtzónája (a minimális szükséges elmozdulás) STR_6788 :Érzékenység: From fdc4d4d8922c1e48576f1552421b65acd4f5fe21 Mon Sep 17 00:00:00 2001 From: Jan Strauss Date: Fri, 11 Jul 2025 19:06:41 +0200 Subject: [PATCH 36/95] Set -Wmissing-prototypes for clang builds (#24757) * Set -Wmissing-prototypes for clang builds. GCC defines -Wmissing-declarations as specialization of -Wmissing-prototypes for C++ (See https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmissing-declarations and https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmissing-prototypes) while Clang uses -Wmissing-prototypes for both languages and -Wmissing-declarations is a different diagnostic (See https://clang.llvm.org/docs/DiagnosticsReference.html#wmissing-prototypes and https://clang.llvm.org/docs/DiagnosticsReference.html#wmissing-declarations). Use MATCHES against CMAKE_CXX_COMPILER_ID (See https://stackoverflow.com/a/10055571, https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html) as conditional to handle both AppleClang and Clang. Clang enables -Wmissing-declarations by default so no point in setting it only if !Clang. See also: https://github.com/llvm/llvm-project/issues/16660 https://reviews.llvm.org/D119361 * Make HasMatchingLanguage in Platform.macOS.mm static. Uncovered by setting -Wmissing-prototypes flag for Clang builds in 306c277c. * Ignore -Wmissing-prototypes for extern GetVersion. Result of setting -Wmissing-prototypes flag for Clang builds in 306c277c. See also: https://github.com/llvm/llvm-project/issues/94138 --- CMakeLists.txt | 5 +++++ src/openrct2/Version.cpp | 8 +++++++- src/openrct2/platform/Platform.macOS.mm | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5e032400e..ac9bb20326 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -358,6 +358,11 @@ else () set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=objc-method-access") endif() + # Clang -Wmissing-declarations differs from GCC, set -Wmissing-prototypes for parity + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-prototypes") + endif() + # On mingw all code is already PIC, this will avoid compiler error on redefining this option if (NOT MINGW) set(CMAKE_POSITION_INDEPENDENT_CODE ON) diff --git a/src/openrct2/Version.cpp b/src/openrct2/Version.cpp index d88beed61b..37dffddad7 100644 --- a/src/openrct2/Version.cpp +++ b/src/openrct2/Version.cpp @@ -56,13 +56,19 @@ const char gVersionInfoFull[] = OPENRCT2_NAME ", " ; #ifdef __EMSCRIPTEN__ -// This must be wrapped in extern "C", according to the emscripten docs, "to prevent C++ name mangling" + // This must be wrapped in extern "C", according to the emscripten docs, "to prevent C++ name mangling" + // Ignore -Wmissing-prototypes here, see https://github.com/llvm/llvm-project/issues/94138 + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wmissing-prototypes" + extern "C" { const char* GetVersion() { return gVersionInfoFull; } } + + #pragma clang diagnostic pop #endif NewVersionInfo GetLatestVersion() diff --git a/src/openrct2/platform/Platform.macOS.mm b/src/openrct2/platform/Platform.macOS.mm index 2d412b56de..5235e0884f 100644 --- a/src/openrct2/platform/Platform.macOS.mm +++ b/src/openrct2/platform/Platform.macOS.mm @@ -155,7 +155,7 @@ namespace OpenRCT2::Platform return false; } - bool HasMatchingLanguage(NSString* preferredLocale, uint16_t* languageIdentifier) + static bool HasMatchingLanguage(NSString* preferredLocale, uint16_t* languageIdentifier) { @autoreleasepool { From 6ac5bd3cccddeb985fed97f0135230525aa82b1b Mon Sep 17 00:00:00 2001 From: Michael Steenbeek <1478678+Gymnasiast@users.noreply.github.com> Date: Sat, 12 Jul 2025 19:47:22 +0200 Subject: [PATCH 37/95] Add Arabic translations to NSIS installer --- distribution/windows/install.nsi | 3 ++- distribution/windows/language/install_ar.nsi | 23 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 distribution/windows/language/install_ar.nsi diff --git a/distribution/windows/install.nsi b/distribution/windows/install.nsi index a5f24935f1..483d4ca22a 100644 --- a/distribution/windows/install.nsi +++ b/distribution/windows/install.nsi @@ -105,7 +105,7 @@ ManifestDPIAware true ; Set languages (first is default language). Other languages are sorted by ISO code. ; Only specify languages for which we actually have translations, because otherwise strings will show up blank. !insertmacro MUI_LANGUAGE "English" -;!insertmacro MUI_LANGUAGE "Arabic" +!insertmacro MUI_LANGUAGE "Arabic" ;!insertmacro MUI_LANGUAGE "Catalan" !insertmacro MUI_LANGUAGE "Czech" ;!insertmacro MUI_LANGUAGE "Danish" @@ -133,6 +133,7 @@ ManifestDPIAware true !insertmacro MUI_RESERVEFILE_LANGDLL !include "language\install_en.nsi" +!include "language\install_ar.nsi" !include "language\install_cs.nsi" !include "language\install_de.nsi" !include "language\install_fi.nsi" diff --git a/distribution/windows/language/install_ar.nsi b/distribution/windows/language/install_ar.nsi new file mode 100644 index 0000000000..9db9ac94ae --- /dev/null +++ b/distribution/windows/language/install_ar.nsi @@ -0,0 +1,23 @@ +LangString ls32bitVersionOn64bitOS ${LANG_ARABIC} "أنت تحاول تثبيت OpenRCT2 بنسخة 32 بت على نظام تشغيل 64 بت. هذا غير مستحسن، ولكنه سيعمل بقدرات محدودة. نقترح عليك تنزيل الإصدار الصحيح. هل تريد المتابعة حقًا؟" +LangString ls64bitVersionOn32bitOS ${LANG_ARABIC} "أنت تحاول تثبيت OpenRCT2 بنسخة 64 بت على نظام تشغيل 32 بت. لن يعمل هذا. يرجى تنزيل الإصدار الصحيح. هل تريد المتابعة حقًا؟" +LangString lsBrandingText ${LANG_ARABIC} "مثبت OpenRCT2" +LangString lsCannotInstallToRCT2Dir ${LANG_ARABIC} "لا يمكنك تثبيت OpenRCT2 في نفس مجلد RollerCoaster Tycoon 2." +LangString lsCannotInstallToRCTClassicDir ${LANG_ARABIC} "لا يمكنك تثبيت OpenRCT2 في نفس مجلد RollerCoaster Tycoon Classic." +LangString lsComponentDescription ${LANG_ARABIC} "تثبيت OpenRCT2 بحد أدنى. يجب أن يكون لديك RollerCoaster Tycoon 2 أو Classic مثبتًا." +LangString lsFinishPageLink ${LANG_ARABIC} "قم بزيارة موقع OpenRCT2 لمزيد من المعلومات" +LangString lsInstallerName ${LANG_ARABIC} "${APPNAMEANDVERSION} ${PLATFORM} لنظام $(lsSupportedOS)" +LangString lsNewWindowsVersionOnOldWindows ${LANG_ARABIC} "أنت تحاول تثبيت إصدار Windows XP SP3 و Vista والإصدارات الأحدث على ويندوز 95 أو 98 أو ME أو 2000 أو XP بدون SP3. لن يعمل هذا. يرجى تنزيل الإصدار الصحيح. هل تريد المتابعة حقًا؟" +LangString lsOldWindowsVersionOnNewWindows ${LANG_ARABIC} "أنت تحاول تثبيت إصدار ويندوز 95 أو 98 أو 2000 و XP بدون SP3 على ويندوزXP SP3 أو Vista أو أحدث. هذا غير مستحسن، ولكنه سيعمل بقدرات محدودة. نقترح عليك تنزيل الإصدار الصحيح. هل تريد المتابعة حقًا؟" +LangString lsOpenRCT2IsRunning ${LANG_ARABIC} "برنامج OpenRCT2 قيد التشغيل. يرجى إغلاقه وإعادة المحاولة." +LangString lsRunNow ${LANG_ARABIC} "تشغيل ${APPNAMEANDVERSION} الآن!" +LangString lsSupportedOS ${LANG_ARABIC} "ويندوز 7 والإصدارات الأحدث" +LangString lsUACErrorDefault ${LANG_ARABIC} "غير قادر على الرفع، خطأ $0" +LangString lsUACError1062 ${LANG_ARABIC} "خدمة تسجيل الدخول غير قيد التشغيل، يتم الإلغاء!" +LangString lsUACError1223 ${LANG_ARABIC} "يتطلب هذا ${thing} امتيازات المسؤول، يتم الإلغاء!" +LangString lsUACRequiresElevation ${LANG_ARABIC} "يتطلب هذا ${thing} امتيازات المسؤول، حاول مرة أخرى" +LangString lsUninstall ${LANG_ARABIC} "إلغاء تثبيت ${APPNAMEANDVERSION}" +LangString lsUpgradeNotice ${LANG_ARABIC} "مرحبًا بك في إعداد ${APPNAMEANDVERSION}.$\nسيسمح لك هذا بالترقية من الإصدار $OLDVERSION." +VIAddVersionKey /LANG=${LANG_ARABIC} "Comments" "تثبيت ${APPNAMEANDVERSION}" +VIAddVersionKey /LANG=${LANG_ARABIC} "CompanyName" "مطورون OpenRCT2" +VIAddVersionKey /LANG=${LANG_ARABIC} "FileDescription" "تثبيت ${APPNAMEANDVERSION}" +VIAddVersionKey /LANG=${LANG_ARABIC} "ProductName" "مثبت OpenRCT2 ${PLATFORM} لنظام ويندوز 7 والإصدارات الأحدث" From f5fc12b7a8dd567517b7658dadb76f28fca47c45 Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Sun, 13 Jul 2025 04:14:28 +0000 Subject: [PATCH 38/95] Merge Localisation/master into OpenRCT2/develop --- data/language/da-DK.txt | 4 +- data/language/gl-ES.txt | 7 ++ data/language/sv-SE.txt | 138 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 146 insertions(+), 3 deletions(-) diff --git a/data/language/da-DK.txt b/data/language/da-DK.txt index b23cc9a0fe..9c9a7deaa2 100644 --- a/data/language/da-DK.txt +++ b/data/language/da-DK.txt @@ -2508,7 +2508,7 @@ STR_5265 :Vælg hvilke indholdskilder der er synlige STR_5266 :Skærm STR_5267 :Kultur og enheder STR_5268 :Lyd -STR_5269 :Kontrol og udseende +STR_5269 :Kontrol STR_5270 :Diverse STR_5272 :Lille Sceneri STR_5273 :Stort Sceneri @@ -3798,7 +3798,7 @@ STR_6758 :Loan options STR_6759 :Business model STR_6760 :Earnings: STR_6761 :Scenario Details -STR_6762 :Interface +STR_6762 :Udseende STR_6763 :RollerCoaster Tycoon 1 STR_6764 :Saving and autosaves STR_6765 :Advanced diff --git a/data/language/gl-ES.txt b/data/language/gl-ES.txt index d199585b5f..d6c924daf4 100644 --- a/data/language/gl-ES.txt +++ b/data/language/gl-ES.txt @@ -3821,3 +3821,10 @@ STR_6781 :Capturas de pantalla STR_6782 :Notificacións do parque STR_6783 :Notificacións das atraccións STR_6784 :Notificacións dos visitantes +STR_6785 :Mando +STR_6786 :Zona morta: +STR_6787 :Zona morta do mando analóxico (movemento mínimo requirido) +STR_6788 :Sensibilidade: +STR_6789 :Multiplicador de sensibilidade do mando analóxico +STR_6790 :Zona morta: {COMMA32}% +STR_6791 :Sensibilidade: {COMMA32}% diff --git a/data/language/sv-SE.txt b/data/language/sv-SE.txt index 22d00f9cf8..cfd50857db 100644 --- a/data/language/sv-SE.txt +++ b/data/language/sv-SE.txt @@ -2511,7 +2511,7 @@ STR_5265 :Välj vilket innehåll som ska vara synligt STR_5266 :Skärm STR_5267 :Kultur och enheter STR_5268 :Ljud -STR_5269 :Kontroller och gränssnitt +STR_5269 :Kontroller STR_5270 :Diverse STR_5272 :Små dekorationer STR_5273 :Stora dekorationer @@ -3694,3 +3694,139 @@ STR_6652 :Felmeddelande STR_6653 :Alla källor visas STR_6654 :Visar {POP16}{UINT16} källor STR_6655 :Endast ‘{POP16}{STRINGID}’ +STR_6656 :Ta bort alla stängsel från parken +STR_6657 :Marken ägs inte +STR_6658 :Ställ in marken som inte ägd av parken och inte tillgänglig för köp +STR_6659 :Gäster ignorerar priser +STR_6660 :Gäster kommer att ignorera priser på åkattraktioner och stånd +STR_6661 :Slumpa alla +STR_6662 :Slumpa färger för varje tåg eller fordon +STR_6663 :Datumfusk +STR_6664 :Visa datumfusk +STR_6665 :Natur/väderfusk +STR_6666 :Visa natur/väderfusk +STR_6667 :Fauna +STR_6668 :Personal fusk +STR_6669 :Visa personal fusk +STR_6670 :Gästbeteende +STR_6671 :Visa “riktiga” namn på personal +STR_6672 :Växla mellan att visa “riktiga” namn och personalnummer +STR_6673 :Transparent +STR_6674 :{MONTH}, År {COMMA16} +STR_6675 :Peep-namn +STR_6676 :Minst ett peep-namns objekt måste vara valt +STR_6677 :Lägg till stränder runt vattendrag +STR_6678 :Höjdkällkälla: +STR_6679 :Slättland +STR_6680 :Simplex-brus +STR_6681 :Höjdkarta-fil +STR_6682 :Kartgenerator - Generator +STR_6683 :Kartgenerator - Terräng +STR_6684 :Kartgenerator - Vatten +STR_6685 :Kartgenerator - Skogar +STR_6686 :Träd till mark förhållande: +STR_6687 :Min. trädaltitud: +STR_6688 :Max. trädaltitud: +STR_6689 :{UINT16}% +STR_6690 :Minsta markhöjd +STR_6691 :Ange min. markhöjd mellan {COMMA16} och {COMMA16} +STR_6692 :Högsta markhöjd +STR_6693 :Ange max. markhöjd mellan {COMMA16} och {COMMA16} +STR_6694 :Minsta trädaltitud +STR_6695 :Ange min. trädaltitud mellan {COMMA16} och {COMMA16} +STR_6696 :Högsta trädaltitud +STR_6697 :Ange max. trädaltitud mellan {COMMA16} och {COMMA16} +STR_6698 :Träd-till-mark-förhållande +STR_6699 :Ange träd-till-mark-förhållande mellan {COMMA16} och {COMMA16} +STR_6700 :Simplex Grundfrekvens +STR_6701 :Ange grundfrekvens mellan {COMMA2DP32} och {COMMA2DP32} +STR_6702 :Simplex Oktaver +STR_6703 :Ange antal oktaver mellan {COMMA16} och {COMMA16} +STR_6704 :{COMMA2DP32} +STR_6705 :Bläddra... +STR_6706 :{WINDOW_COLOUR_2}Aktuell bildfil: {BLACK}{STRING} +STR_6707 :(ingen vald) +STR_6708 :Utjämningsstyrka +STR_6709 :Ange utjämningsstyrka mellan {COMMA16} och {COMMA16} +STR_6710 :Stabil sortering +STR_6711 :Filnamn: +STR_6712 :Spara +STR_6713 :{COMMA32} {STRINGID} +STR_6714 :Filnamn +STR_6715 :Ändringsdatum +STR_6716 :Filstorlek +STR_6717 :Filstorlek {STRINGID} +STR_6718 :Gästanimationer +STR_6719 :Minst ett gästanimationsobjekt måste vara valt +STR_6720 :Minst ett vaktmästaranimationsobjekt måste vara valt +STR_6721 :Minst ett mekanikeranimationsobjekt måste vara valt +STR_6722 :Minst ett säkerhetsanimationsobjekt måste vara valt +STR_6723 :Minst ett underhållaranimationsobjekt måste vara valt +STR_6724 :Scenariotexter +STR_6725 :X: +STR_6726 :Y: +STR_6727 :Dykloop (vänster) +STR_6728 :Dykloop (höger) +STR_6729 :Kabelhissbacke måste börja direkt efter station eller blockbroms +STR_6730 :Exportera emscripten-data +STR_6731 :Importera emscripten-data +STR_6732 :Visa en knapp i verktygsfältet för att rotera vyn moturs +STR_6733 :Genomskinlig +STR_6734 :Kartobjekt vid eller ovanför snitthöjd renderas halvgenomskinliga +STR_6735 :Gå upp till föräldermapp +STR_6736 :Förhandsvisning +STR_6737 :Ingen förhandsvisning tillgänglig +STR_6738 :{WINDOW_COLOUR_2}Parkbetyg: {BLACK}{UINT16} +STR_6739 :{WINDOW_COLOUR_2}Datum: {BLACK}{STRINGID} +STR_6740 :{WINDOW_COLOUR_2}Kassa: {BLACK}{CURRENCY2DP} +STR_6741 :{WINDOW_COLOUR_2}Antal åkattraktioner: {BLACK}{UINT16} +STR_6742 :{WINDOW_COLOUR_2}Antal gäster: {BLACK}{UINT16} +STR_6743 :Klimat +STR_6744 :{WINDOW_COLOUR_2}{UINT16}% +STR_6745 :{WINDOW_COLOUR_2}Gästernas intensitetspreferenser: +STR_6746 :Inga preferenser +STR_6747 :Preferenser varierar (standard) +STR_6748 :Endast mindre intensiva åk +STR_6749 :Endast mer intensiva åk +STR_6750 :Välj vilken intensitet nya gäster föredrar +STR_6751 :Kövägar kan inte användas för plankorsningar! +STR_6752 :Scenarioalternativ - Mål +STR_6753 :Scenarioalternativ - Detaljer +STR_6754 :Scenarioalternativ - Markbegränsningar +STR_6755 :Visa målalternativ +STR_6756 :Visa scenarioinformation +STR_6757 :Visa markbegränsningsalternativ +STR_6758 :Lånealternativ +STR_6759 :Affärsmodell +STR_6760 :Intäkter: +STR_6761 :Scenariodetaljer +STR_6762 :Gränssnitt +STR_6763 :RollerCoaster Tycoon 1 +STR_6764 :Sparande och autospar +STR_6765 :Avancerat +STR_6766 :Rensa +STR_6767 :Fönster +STR_6768 :Rendering +STR_6769 :Beteende +STR_6770 :Bildfrekvensgräns: +STR_6771 :Intern hastighet (standard) +STR_6772 :Vertikal synkronisering +STR_6773 :Obegränsad +STR_6774 :Tid sedan senaste inspektion +STR_6775 :{COMMA16} minut +STR_6776 :{COMMA16} minuter +STR_6777 :mer än 4 timmar +STR_6778 :Förhandsgranska scenarier med: +STR_6779 :Välj vilken typ av förhandsbild som ska användas i scenarioskärmen +STR_6780 :Minikartor +STR_6781 :Skärmdumpar +STR_6782 :Parknotiser +STR_6783 :Åknotiser +STR_6784 :Gästnotiser +STR_6785 :Handkontroll +STR_6786 :Dödzon: +STR_6787 :Dödzon för analog spak (minsta rörelse som krävs) +STR_6788 :Känslighet: +STR_6789 :Känslighet multiplikator för analog spak +STR_6790 :Dödzon: {COMMA32}% +STR_6791 :Känslighet: {COMMA32}% From 0522ae848b7a94114b4c0fa3e7975e006073a7a5 Mon Sep 17 00:00:00 2001 From: Jan Strauss Date: Sun, 13 Jul 2025 12:04:26 +0200 Subject: [PATCH 39/95] Add award plugin APIs (#24468) * Add award plugin apis * Address review feedback (use erase_if, extract AwardAdd method) * Address review feedback (remove redundant comments, make AwardAdd static) * Address review feedback (bump plugin api version, add changelog entry) --- distribution/changelog.txt | 1 + distribution/openrct2.d.ts | 66 ++++++++++ src/openrct2-ui/UiStringIds.h | 17 --- src/openrct2-ui/windows/Park.cpp | 29 +---- src/openrct2/libopenrct2.vcxproj | 2 + src/openrct2/localisation/StringIds.h | 17 +++ src/openrct2/management/Award.cpp | 115 +++++++++++------- src/openrct2/management/Award.h | 7 ++ src/openrct2/scripting/ScriptEngine.cpp | 2 + src/openrct2/scripting/ScriptEngine.h | 2 +- .../scripting/bindings/world/ScAward.cpp | 90 ++++++++++++++ .../scripting/bindings/world/ScAward.hpp | 85 +++++++++++++ .../scripting/bindings/world/ScPark.cpp | 32 +++++ .../scripting/bindings/world/ScPark.hpp | 7 ++ 14 files changed, 382 insertions(+), 90 deletions(-) create mode 100644 src/openrct2/scripting/bindings/world/ScAward.cpp create mode 100644 src/openrct2/scripting/bindings/world/ScAward.hpp diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 527a6ca0fb..4b3f544237 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.4.25 (in development) ------------------------------------------------------------------------ +- Feature: [#24468] [Plugin] Add awards to plugin API. - Feature: [#24702] [Plugin] Add bindings for missing cheats (forcedParkRating, ignoreRidePrice, makeAllDestructible). - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. diff --git a/distribution/openrct2.d.ts b/distribution/openrct2.d.ts index 9c828690ac..892b4cce63 100644 --- a/distribution/openrct2.d.ts +++ b/distribution/openrct2.d.ts @@ -4179,6 +4179,53 @@ declare global { "scenarioCompleteNameInput" | "unlockAllPrices"; + type AwardType = + "mostUntidy" | + "mostTidy" | + "bestRollerCoasters" | + "bestValue" | + "mostBeautiful" | + "worstValue" | + "safest" | + "bestStaff" | + "bestFood" | + "worstFood" | + "bestToilets" | + "mostDisappointing" | + "bestWaterRides" | + "bestCustomDesignedRides" | + "mostDazzlingRideColours" | + "mostConfusingLayout" | + "bestGentleRides"; + + interface Award { + /** + * The type of the award. + */ + readonly type: AwardType; + + /** + * The award description. + */ + readonly text: string; + + /** + * Number of months this award will remain active. + * Starts at 5, expires at 0. + */ + readonly monthsRemaining: number; + + /** + * The sprite of the award. + */ + readonly imageId: number; + + /** + * Whether this is a positive or negative award. + */ + readonly positive: boolean; + } + interface Park { cash: number; rating: number; @@ -4326,6 +4373,25 @@ declare global { * @param type The type of expenditure to get. */ getMonthlyExpenditure(type: ExpenditureType): number[] + + /** + * The current awards of the park. + */ + readonly awards: Award[] + + /** + * Clear all awards. + */ + clearAwards(): void + + /** + * Grant the given award type to the park. + * Does not check eligibility. + * If the park already has an active award of the given type, the old award will be removed. + * If the park already has 4 active awards, the oldest award will be removed. + * @param type the award type to grant + */ + grantAward(type: AwardType): void } interface Research { diff --git a/src/openrct2-ui/UiStringIds.h b/src/openrct2-ui/UiStringIds.h index b890df371f..290734a5ae 100644 --- a/src/openrct2-ui/UiStringIds.h +++ b/src/openrct2-ui/UiStringIds.h @@ -1290,23 +1290,6 @@ namespace OpenRCT2 // Window: Park STR_ADMISSION_PRICE = 1756, STR_ADMISSION_PRICE_PAY_PER_RIDE_TIP = 6014, - STR_AWARD_MOST_UNTIDY = 2814, - STR_AWARD_BEST_CUSTOM_DESIGNED_RIDES = STR_AWARD_MOST_UNTIDY + 13, - STR_AWARD_BEST_FOOD = STR_AWARD_MOST_UNTIDY + 8, - STR_AWARD_BEST_GENTLE_RIDES = STR_AWARD_MOST_UNTIDY + 16, - STR_AWARD_BEST_ROLLERCOASTERS = STR_AWARD_MOST_UNTIDY + 2, - STR_AWARD_BEST_STAFF = STR_AWARD_MOST_UNTIDY + 7, - STR_AWARD_BEST_TOILETS = STR_AWARD_MOST_UNTIDY + 10, - STR_AWARD_BEST_VALUE = STR_AWARD_MOST_UNTIDY + 3, - STR_AWARD_BEST_WATER_RIDES = STR_AWARD_MOST_UNTIDY + 12, - STR_AWARD_MOST_BEAUTIFUL = STR_AWARD_MOST_UNTIDY + 4, - STR_AWARD_MOST_CONFUSING_LAYOUT = STR_AWARD_MOST_UNTIDY + 15, - STR_AWARD_MOST_DAZZLING_RIDE_COLOURS = STR_AWARD_MOST_UNTIDY + 14, - STR_AWARD_MOST_DISAPPOINTING = STR_AWARD_MOST_UNTIDY + 11, - STR_AWARD_MOST_TIDY = STR_AWARD_MOST_UNTIDY + 1, - STR_AWARD_SAFEST = STR_AWARD_MOST_UNTIDY + 6, - STR_AWARD_WORST_FOOD = STR_AWARD_MOST_UNTIDY + 9, - STR_AWARD_WORST_VALUE = STR_AWARD_MOST_UNTIDY + 5, STR_BUY_LAND_AND_CONSTRUCTION_RIGHTS_TIP = 5135, STR_CLOSE_PARK = 1013, STR_CLOSE_PARK_TIP = 5296, diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 9b8e81d7ec..233d86cbdf 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -164,31 +164,6 @@ namespace OpenRCT2::Ui::Windows 0, 0, }; - - struct WindowParkAward { - StringId text; - uint32_t sprite; - }; - - static constexpr WindowParkAward _parkAwards[] = { - { STR_AWARD_MOST_UNTIDY, SPR_AWARD_MOST_UNTIDY }, - { STR_AWARD_MOST_TIDY, SPR_AWARD_MOST_TIDY }, - { STR_AWARD_BEST_ROLLERCOASTERS, SPR_AWARD_BEST_ROLLERCOASTERS }, - { STR_AWARD_BEST_VALUE, SPR_AWARD_BEST_VALUE }, - { STR_AWARD_MOST_BEAUTIFUL, SPR_AWARD_MOST_BEAUTIFUL }, - { STR_AWARD_WORST_VALUE, SPR_AWARD_WORST_VALUE }, - { STR_AWARD_SAFEST, SPR_AWARD_SAFEST }, - { STR_AWARD_BEST_STAFF, SPR_AWARD_BEST_STAFF }, - { STR_AWARD_BEST_FOOD, SPR_AWARD_BEST_FOOD }, - { STR_AWARD_WORST_FOOD, SPR_AWARD_WORST_FOOD }, - { STR_AWARD_BEST_TOILETS, SPR_AWARD_BEST_TOILETS }, - { STR_AWARD_MOST_DISAPPOINTING, SPR_AWARD_MOST_DISAPPOINTING }, - { STR_AWARD_BEST_WATER_RIDES, SPR_AWARD_BEST_WATER_RIDES }, - { STR_AWARD_BEST_CUSTOM_DESIGNED_RIDES, SPR_AWARD_BEST_CUSTOM_DESIGNED_RIDES }, - { STR_AWARD_MOST_DAZZLING_RIDE_COLOURS, SPR_AWARD_MOST_DAZZLING_RIDE_COLOURS }, - { STR_AWARD_MOST_CONFUSING_LAYOUT, SPR_AWARD_MOST_CONFUSING_LAYOUT }, - { STR_AWARD_BEST_GENTLE_RIDES, SPR_AWARD_BEST_GENTLE_RIDES }, - }; // clang-format on class ParkWindow final : public Window @@ -1164,8 +1139,8 @@ namespace OpenRCT2::Ui::Windows for (const auto& award : currentAwards) { - GfxDrawSprite(rt, ImageId(_parkAwards[EnumValue(award.Type)].sprite), screenCoords); - DrawTextWrapped(rt, screenCoords + ScreenCoordsXY{ 34, 6 }, 180, _parkAwards[EnumValue(award.Type)].text); + GfxDrawSprite(rt, ImageId(AwardGetSprite(award.Type)), screenCoords); + DrawTextWrapped(rt, screenCoords + ScreenCoordsXY{ 34, 6 }, 180, AwardGetText(award.Type)); screenCoords.y += 32; } diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index 51117b3e26..5467efa682 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -595,6 +595,7 @@ + @@ -1117,6 +1118,7 @@ + diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index ae9a3dd9d2..f8868b66ee 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -1096,6 +1096,23 @@ enum : StringId STR_PEEPS_CANT_FIND_TOILET = 2811, STR_PEEPS_GETTING_LOST_OR_STUCK = 2812, STR_ENTRANCE_FEE_TOO_HI = 2813, + STR_AWARD_MOST_UNTIDY = 2814, + STR_AWARD_BEST_CUSTOM_DESIGNED_RIDES = STR_AWARD_MOST_UNTIDY + 13, + STR_AWARD_BEST_FOOD = STR_AWARD_MOST_UNTIDY + 8, + STR_AWARD_BEST_GENTLE_RIDES = STR_AWARD_MOST_UNTIDY + 16, + STR_AWARD_BEST_ROLLERCOASTERS = STR_AWARD_MOST_UNTIDY + 2, + STR_AWARD_BEST_STAFF = STR_AWARD_MOST_UNTIDY + 7, + STR_AWARD_BEST_TOILETS = STR_AWARD_MOST_UNTIDY + 10, + STR_AWARD_BEST_VALUE = STR_AWARD_MOST_UNTIDY + 3, + STR_AWARD_BEST_WATER_RIDES = STR_AWARD_MOST_UNTIDY + 12, + STR_AWARD_MOST_BEAUTIFUL = STR_AWARD_MOST_UNTIDY + 4, + STR_AWARD_MOST_CONFUSING_LAYOUT = STR_AWARD_MOST_UNTIDY + 15, + STR_AWARD_MOST_DAZZLING_RIDE_COLOURS = STR_AWARD_MOST_UNTIDY + 14, + STR_AWARD_MOST_DISAPPOINTING = STR_AWARD_MOST_UNTIDY + 11, + STR_AWARD_MOST_TIDY = STR_AWARD_MOST_UNTIDY + 1, + STR_AWARD_SAFEST = STR_AWARD_MOST_UNTIDY + 6, + STR_AWARD_WORST_FOOD = STR_AWARD_MOST_UNTIDY + 9, + STR_AWARD_WORST_VALUE = STR_AWARD_MOST_UNTIDY + 5, STR_NEWS_ITEM_AWARD_MOST_UNTIDY = 2831, STR_NEWS_ITEM_MOST_TIDY = STR_NEWS_ITEM_AWARD_MOST_UNTIDY + 1, STR_NEWS_ITEM_BEST_ROLLERCOASTERS = STR_NEWS_ITEM_AWARD_MOST_UNTIDY + 2, diff --git a/src/openrct2/management/Award.cpp b/src/openrct2/management/Award.cpp index 8fcc967abd..f08ada6a8d 100644 --- a/src/openrct2/management/Award.cpp +++ b/src/openrct2/management/Award.cpp @@ -13,7 +13,6 @@ #include "../config/Config.h" #include "../entity/EntityList.h" #include "../entity/Guest.h" -#include "../localisation/StringIds.h" #include "../profiling/Profiling.h" #include "../ride/Ride.h" #include "../ride/RideData.h" @@ -29,49 +28,55 @@ enum class AwardEffect : uint8_t negative, positive }; -static constexpr AwardEffect kAwardPositiveMap[] = { - AwardEffect::negative, // AwardType::MostUntidy - AwardEffect::positive, // AwardType::MostTidy - AwardEffect::positive, // AwardType::BestRollerCoasters - AwardEffect::positive, // AwardType::BestValue - AwardEffect::positive, // AwardType::MostBeautiful - AwardEffect::negative, // AwardType::WorstValue - AwardEffect::positive, // AwardType::Safest - AwardEffect::positive, // AwardType::BestStaff - AwardEffect::positive, // AwardType::BestFood - AwardEffect::negative, // AwardType::WorstFood - AwardEffect::positive, // AwardType::BestToilets - AwardEffect::negative, // AwardType::MostDisappointing - AwardEffect::positive, // AwardType::BestWaterRides - AwardEffect::positive, // AwardType::BestCustomDesignedRides - AwardEffect::positive, // AwardType::MostDazzlingRideColours - AwardEffect::negative, // AwardType::MostConfusingLayout - AwardEffect::positive, // AwardType::BestGentleRides + +struct AwardData_t +{ + StringId text; + StringId news; + ImageIndex sprite; + AwardEffect effect; }; -static constexpr StringId AwardNewsStrings[] = { - STR_NEWS_ITEM_AWARD_MOST_UNTIDY, - STR_NEWS_ITEM_MOST_TIDY, - STR_NEWS_ITEM_BEST_ROLLERCOASTERS, - STR_NEWS_ITEM_BEST_VALUE, - STR_NEWS_ITEM_MOST_BEAUTIFUL, - STR_NEWS_ITEM_WORST_VALUE, - STR_NEWS_ITEM_SAFEST, - STR_NEWS_ITEM_BEST_STAFF, - STR_NEWS_ITEM_BEST_FOOD, - STR_NEWS_ITEM_WORST_FOOD, - STR_NEWS_ITEM_BEST_TOILETS, - STR_NEWS_ITEM_MOST_DISAPPOINTING, - STR_NEWS_ITEM_BEST_WATER_RIDES, - STR_NEWS_ITEM_BEST_CUSTOM_DESIGNED_RIDES, - STR_NEWS_ITEM_MOST_DAZZLING_RIDE_COLOURS, - STR_NEWS_ITEM_MOST_CONFUSING_LAYOUT, - STR_NEWS_ITEM_BEST_GENTLE_RIDES, +// clang-format off +static constexpr AwardData_t AwardData[] = { + { STR_AWARD_MOST_UNTIDY, STR_NEWS_ITEM_AWARD_MOST_UNTIDY, SPR_AWARD_MOST_UNTIDY, AwardEffect::negative }, + { STR_AWARD_MOST_TIDY, STR_NEWS_ITEM_MOST_TIDY, SPR_AWARD_MOST_TIDY, AwardEffect::positive }, + { STR_AWARD_BEST_ROLLERCOASTERS, STR_NEWS_ITEM_BEST_ROLLERCOASTERS, SPR_AWARD_BEST_ROLLERCOASTERS, AwardEffect::positive }, + { STR_AWARD_BEST_VALUE, STR_NEWS_ITEM_BEST_VALUE, SPR_AWARD_BEST_VALUE, AwardEffect::positive }, + { STR_AWARD_MOST_BEAUTIFUL, STR_NEWS_ITEM_MOST_BEAUTIFUL, SPR_AWARD_MOST_BEAUTIFUL, AwardEffect::positive }, + { STR_AWARD_WORST_VALUE, STR_NEWS_ITEM_WORST_VALUE, SPR_AWARD_WORST_VALUE, AwardEffect::negative }, + { STR_AWARD_SAFEST, STR_NEWS_ITEM_SAFEST, SPR_AWARD_SAFEST, AwardEffect::positive }, + { STR_AWARD_BEST_STAFF, STR_NEWS_ITEM_BEST_STAFF, SPR_AWARD_BEST_STAFF, AwardEffect::positive }, + { STR_AWARD_BEST_FOOD, STR_NEWS_ITEM_BEST_FOOD, SPR_AWARD_BEST_FOOD, AwardEffect::positive }, + { STR_AWARD_WORST_FOOD, STR_NEWS_ITEM_WORST_FOOD, SPR_AWARD_WORST_FOOD, AwardEffect::negative }, + { STR_AWARD_BEST_TOILETS, STR_NEWS_ITEM_BEST_TOILETS, SPR_AWARD_BEST_TOILETS, AwardEffect::positive }, + { STR_AWARD_MOST_DISAPPOINTING, STR_NEWS_ITEM_MOST_DISAPPOINTING, SPR_AWARD_MOST_DISAPPOINTING, AwardEffect::negative }, + { STR_AWARD_BEST_WATER_RIDES, STR_NEWS_ITEM_BEST_WATER_RIDES, SPR_AWARD_BEST_WATER_RIDES, AwardEffect::positive }, + { STR_AWARD_BEST_CUSTOM_DESIGNED_RIDES, STR_NEWS_ITEM_BEST_CUSTOM_DESIGNED_RIDES, SPR_AWARD_BEST_CUSTOM_DESIGNED_RIDES, AwardEffect::positive }, + { STR_AWARD_MOST_DAZZLING_RIDE_COLOURS, STR_NEWS_ITEM_MOST_DAZZLING_RIDE_COLOURS, SPR_AWARD_MOST_DAZZLING_RIDE_COLOURS, AwardEffect::positive }, + { STR_AWARD_MOST_CONFUSING_LAYOUT, STR_NEWS_ITEM_MOST_CONFUSING_LAYOUT, SPR_AWARD_MOST_CONFUSING_LAYOUT, AwardEffect::negative }, + { STR_AWARD_BEST_GENTLE_RIDES, STR_NEWS_ITEM_BEST_GENTLE_RIDES, SPR_AWARD_BEST_GENTLE_RIDES, AwardEffect::positive }, }; +// clang-format on bool AwardIsPositive(AwardType type) { - return kAwardPositiveMap[EnumValue(type)] == AwardEffect::positive; + return AwardData[EnumValue(type)].effect == AwardEffect::positive; +} + +ImageIndex AwardGetSprite(AwardType type) +{ + return AwardData[EnumValue(type)].sprite; +} + +StringId AwardGetText(AwardType type) +{ + return AwardData[EnumValue(type)].text; +} + +StringId AwardGetNews(AwardType type) +{ + return AwardData[EnumValue(type)].news; } #pragma region Award checks @@ -598,6 +603,16 @@ void AwardReset() getGameState().currentAwards.clear(); } +static void AwardAdd(AwardType type) +{ + getGameState().currentAwards.push_back(Award{ 5u, type }); + if (Config::Get().notifications.ParkAward) + { + News::AddItemToQueue(News::ItemType::award, AwardGetNews(type), 0, {}); + } + Ui::GetWindowManager()->InvalidateByClass(WindowClass::ParkInformation); +} + /** * * rct2: 0x0066A86C @@ -648,14 +663,24 @@ void AwardUpdateAll() // Check if award is deserved if (AwardIsDeserved(awardType, activeAwardTypes)) { - // Add award - currentAwards.push_back(Award{ 5u, awardType }); - if (Config::Get().notifications.ParkAward) - { - News::AddItemToQueue(News::ItemType::award, AwardNewsStrings[EnumValue(awardType)], 0, {}); - } - windowMgr->InvalidateByClass(WindowClass::ParkInformation); + AwardAdd(awardType); } } } } + +void AwardGrant(AwardType type) +{ + auto& currentAwards = getGameState().currentAwards; + + // Remove award type if already granted + std::erase_if(currentAwards, [type](const Award& award) { return award.Type == type; }); + + // Ensure there is space for the award + if (currentAwards.size() >= OpenRCT2::Limits::kMaxAwards) + { + currentAwards.erase(currentAwards.begin()); + } + + AwardAdd(type); +} diff --git a/src/openrct2/management/Award.h b/src/openrct2/management/Award.h index 24467da0e3..60790f0954 100644 --- a/src/openrct2/management/Award.h +++ b/src/openrct2/management/Award.h @@ -9,6 +9,9 @@ #pragma once +#include "../SpriteIds.h" +#include "../localisation/StringIds.h" + #include #include @@ -42,5 +45,9 @@ struct Award }; bool AwardIsPositive(AwardType type); +ImageIndex AwardGetSprite(AwardType type); +StringId AwardGetText(AwardType type); +StringId AwardGetNews(AwardType type); +void AwardGrant(AwardType type); void AwardReset(); void AwardUpdateAll(); diff --git a/src/openrct2/scripting/ScriptEngine.cpp b/src/openrct2/scripting/ScriptEngine.cpp index 8ddfd71c80..537842edf3 100644 --- a/src/openrct2/scripting/ScriptEngine.cpp +++ b/src/openrct2/scripting/ScriptEngine.cpp @@ -51,6 +51,7 @@ #include "bindings/object/ScObjectManager.h" #include "bindings/ride/ScRide.hpp" #include "bindings/ride/ScRideStation.hpp" + #include "bindings/world/ScAward.hpp" #include "bindings/world/ScClimate.hpp" #include "bindings/world/ScDate.hpp" #include "bindings/world/ScMap.hpp" @@ -403,6 +404,7 @@ void ScriptEngine::Initialise() throw std::runtime_error("Script engine already initialised."); auto ctx = static_cast(_context); + ScAward::Register(ctx); ScCheats::Register(ctx); ScClimate::Register(ctx); ScWeatherState::Register(ctx); diff --git a/src/openrct2/scripting/ScriptEngine.h b/src/openrct2/scripting/ScriptEngine.h index e54898add0..38919c5cbf 100644 --- a/src/openrct2/scripting/ScriptEngine.h +++ b/src/openrct2/scripting/ScriptEngine.h @@ -46,7 +46,7 @@ namespace OpenRCT2 namespace OpenRCT2::Scripting { - static constexpr int32_t kPluginApiVersion = 109; + static constexpr int32_t kPluginApiVersion = 110; // Versions marking breaking changes. static constexpr int32_t kApiVersionPeepDeprecation = 33; diff --git a/src/openrct2/scripting/bindings/world/ScAward.cpp b/src/openrct2/scripting/bindings/world/ScAward.cpp new file mode 100644 index 0000000000..f1f29d7d40 --- /dev/null +++ b/src/openrct2/scripting/bindings/world/ScAward.cpp @@ -0,0 +1,90 @@ +/***************************************************************************** + * Copyright (c) 2014-2025 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#ifdef ENABLE_SCRIPTING + + #include "ScAward.hpp" + + #include "../../../GameState.h" + #include "../../../localisation/Formatting.h" + #include "../../../management/Award.h" + #include "../../../windows/Intent.h" + #include "../../Duktape.hpp" + +namespace OpenRCT2::Scripting +{ + ScAward::ScAward(size_t index) + : _index(index) + { + } + + void ScAward::Register(duk_context* ctx) + { + dukglue_register_property(ctx, &ScAward::type_get, nullptr, "type"); + dukglue_register_property(ctx, &ScAward::text_get, nullptr, "text"); + dukglue_register_property(ctx, &ScAward::positive_get, nullptr, "positive"); + dukglue_register_property(ctx, &ScAward::imageId_get, nullptr, "imageId"); + dukglue_register_property(ctx, &ScAward::monthsRemaining_get, nullptr, "monthsRemaining"); + } + + Award* ScAward::GetAward() const + { + return &getGameState().currentAwards[_index]; + } + + std::string ScAward::type_get() const + { + auto award = GetAward(); + if (award == nullptr) + return {}; + + return AwardTypeToString(award->Type).value_or(std::string()); + } + + std::string ScAward::text_get() const + { + auto award = GetAward(); + if (award == nullptr) + return {}; + + Formatter ft{}; + ft.Add(AwardGetText(award->Type)); + return FormatStringIDLegacy(STR_STRINGID, ft.Data()); + } + + uint16_t ScAward::monthsRemaining_get() const + { + auto award = GetAward(); + if (award == nullptr) + return {}; + + return award->Time; + } + + bool ScAward::positive_get() const + { + auto award = GetAward(); + if (award == nullptr) + return {}; + + return AwardIsPositive(award->Type); + } + + uint32_t ScAward::imageId_get() const + { + auto award = GetAward(); + if (award == nullptr) + return {}; + + return AwardGetSprite(award->Type); + } + +} // namespace OpenRCT2::Scripting + +#endif diff --git a/src/openrct2/scripting/bindings/world/ScAward.hpp b/src/openrct2/scripting/bindings/world/ScAward.hpp new file mode 100644 index 0000000000..f38b1a556f --- /dev/null +++ b/src/openrct2/scripting/bindings/world/ScAward.hpp @@ -0,0 +1,85 @@ +/***************************************************************************** + * Copyright (c) 2014-2025 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#ifdef ENABLE_SCRIPTING + + #include "../../../Context.h" + #include "../../../management/Award.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" + + #include + +namespace OpenRCT2::Scripting +{ + static constexpr const char* AwardTypes[] = { + "mostUntidy", + "mostTidy", + "bestRollerCoasters", + "bestValue", + "mostBeautiful", + "worstValue", + "safest", + "bestStaff", + "bestFood", + "worstFood", + "bestToilets", + "mostDisappointing", + "bestWaterRides", + "bestCustomDesignedRides", + "mostDazzlingRideColours", + "mostConfusingLayout", + "bestGentleRides", + }; + + inline std::optional AwardTypeToString(AwardType awardType) + { + auto index = static_cast(awardType); + if (index < std::size(AwardTypes)) + { + return AwardTypes[index]; + } + return std::nullopt; + } + + inline std::optional StringToAwardType(std::string_view awardType) + { + auto it = std::find(std::begin(AwardTypes), std::end(AwardTypes), awardType); + if (it != std::end(AwardTypes)) + { + return std::optional(static_cast(std::distance(std::begin(AwardTypes), it))); + } + return std::nullopt; + } + + class ScAward + { + private: + size_t _index{}; + + public: + ScAward(size_t index); + + static void Register(duk_context* ctx); + + private: + Award* GetAward() const; + + std::string type_get() const; + std::string text_get() const; + uint16_t monthsRemaining_get() const; + bool positive_get() const; + uint32_t imageId_get() const; + }; + +} // namespace OpenRCT2::Scripting + +#endif diff --git a/src/openrct2/scripting/bindings/world/ScPark.cpp b/src/openrct2/scripting/bindings/world/ScPark.cpp index 555bcff057..5dabf66f1c 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.cpp +++ b/src/openrct2/scripting/bindings/world/ScPark.cpp @@ -430,6 +430,35 @@ namespace OpenRCT2::Scripting return result; } + std::vector> ScPark::awards_get() const + { + std::vector> result; + + auto& gameState = getGameState(); + for (size_t i = 0; i < gameState.currentAwards.size(); i++) + { + result.push_back(std::make_shared(i)); + } + + return result; + } + + void ScPark::clearAwards() const + { + ThrowIfGameStateNotMutable(); + AwardReset(); + } + + void ScPark::grantAward(const std::string& awardType) const + { + ThrowIfGameStateNotMutable(); + auto optType = StringToAwardType(awardType); + if (optType.has_value()) + { + AwardGrant(optType.value()); + } + } + void ScPark::Register(duk_context* ctx) { dukglue_register_property(ctx, &ScPark::cash_get, &ScPark::cash_set, "cash"); @@ -463,6 +492,9 @@ namespace OpenRCT2::Scripting dukglue_register_method(ctx, &ScPark::setFlag, "setFlag"); dukglue_register_method(ctx, &ScPark::postMessage, "postMessage"); dukglue_register_method(ctx, &ScPark::getMonthlyExpenditure, "getMonthlyExpenditure"); + dukglue_register_property(ctx, &ScPark::awards_get, nullptr, "awards"); + dukglue_register_method(ctx, &ScPark::clearAwards, "clearAwards"); + dukglue_register_method(ctx, &ScPark::grantAward, "grantAward"); } } // namespace OpenRCT2::Scripting diff --git a/src/openrct2/scripting/bindings/world/ScPark.hpp b/src/openrct2/scripting/bindings/world/ScPark.hpp index 42668dbe9c..dcef4d4377 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.hpp +++ b/src/openrct2/scripting/bindings/world/ScPark.hpp @@ -13,6 +13,7 @@ #include "../../../Context.h" #include "../../Duktape.hpp" + #include "ScAward.hpp" #include "ScParkMessage.hpp" #include "ScResearch.hpp" @@ -101,6 +102,12 @@ namespace OpenRCT2::Scripting std::vector getMonthlyExpenditure(const std::string& expenditureType) const; + std::vector> awards_get() const; + + void clearAwards() const; + + void grantAward(const std::string& awardType) const; + static void Register(duk_context* ctx); }; } // namespace OpenRCT2::Scripting From 936f5f231a2871ab2935b89ec08e08559cdbc28f Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Mon, 14 Jul 2025 04:16:29 +0000 Subject: [PATCH 40/95] Merge Localisation/master into OpenRCT2/develop --- data/language/pt-BR.txt | 7 +++++++ data/language/sv-SE.txt | 12 ++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/data/language/pt-BR.txt b/data/language/pt-BR.txt index 3e67ac361c..99ce7fb2a6 100644 --- a/data/language/pt-BR.txt +++ b/data/language/pt-BR.txt @@ -3820,3 +3820,10 @@ STR_6781 :Capturas de tela STR_6782 :Notificações de Parque STR_6783 :Notificações de Atração STR_6784 :Notificações de Visitantes +STR_6785 :Controle de videogame +STR_6786 :Zona morta: +STR_6787 :Zona morta do direcional analógico (movimento mínimo requerido) +STR_6788 :Sensibilidade: +STR_6789 :Multiplicador de sensibilidade do direcional analógico +STR_6790 :Zona morta: {COMMA32}% +STR_6791 :Sensibilidade: {COMMA32}% diff --git a/data/language/sv-SE.txt b/data/language/sv-SE.txt index cfd50857db..c6d64648db 100644 --- a/data/language/sv-SE.txt +++ b/data/language/sv-SE.txt @@ -26,7 +26,7 @@ STR_0020 :Linbana STR_0021 :Korkskruvsberg- och dalbana STR_0022 :Labyrint STR_0023 :Spiralrutschkana -STR_0024 :Gokart +STR_0024 :Gokarter STR_0025 :Stockfors STR_0026 :Forsränning STR_0027 :Radiobilar @@ -100,6 +100,8 @@ STR_0094 :Enkelspårig berg- och dalbana STR_0095 :Alpin berg- och dalbana STR_0096 :Klassisk berg- och dalbana i trä STR_0097 :Klassisk stående berg- och dalbana +STR_0098 :LSM-accelererad berg-och-dalbana +STR_0099 :Klassisk träberg-och-dalbana i twister-stil STR_0512 :En kompakt berg- och dalbana med en spiralvriden kedjelift och mjuka, vridna stup. STR_0513 :En ringlande berg- och dalbana där passagerarna åker stående STR_0514 :Tåg hängande under banan som svingar ut åt sidan i kurvorna @@ -184,6 +186,8 @@ STR_0604 :Passagerare åker i singelled längs en stålbalk, som tar dem geno STR_0605 :Passagerare åker släde nerför ett slingrande stålspår och bromsar för att reglera hastigheten STR_0606 :Den här berg- och dalbanan i trä är i äldre stil. Den är snabb, tuff, högljudd och ger en känsla av att förlora kontrollen. Dessutom spenderar man mycket tid flygandes över topparna STR_0607 :En intensiv berg- och dalbana i äldre stil där passagerarna åker stående +STR_0608 :Berg-och-dalbanetågen accelereras med linjära synkronmotorer och far genom snäva svängar och kurvor +STR_0609 :En träberg-och-dalbana i äldre stil med en snabb och skakig åktur, ledade tåg, mycket airtime och slingrande spår STR_0767 :Besökare {INT32} STR_0768 :Vaktmästare {INT32} STR_0769 :Mekaniker {INT32} @@ -2196,7 +2200,7 @@ STR_3188 :Gångvägsskyltar STR_3189 :Utfasade gångvägar STR_3190 :Gångvägsdetaljer STR_3191 :Dekorationsgrupper -STR_3192 :Parkentré +STR_3192 :Parkingångar STR_3193 :Vatten STR_3195 :Uppfinningslista STR_3196 :{WINDOW_COLOUR_2}Forskningsgrupp: {BLACK}{STRINGID} @@ -3410,7 +3414,7 @@ STR_6367 :Animationsruta: STR_6368 :Av kompatibilitetsskäl är det inte rekommenderat att köra OpenRCT2 med Wine. OpenRCT2 har direkt stöd för macOS, Linux, FreeBSD och OpenBSD. STR_6369 :Tillåt spårbygge på ogiltiga höjder STR_6370 :Tillåter bygge av spårdelar på alla höjdintervall -STR_6371 :Den angivna sökvägen innehåller en installation av RollerCoaster Tycoon 1, men filen ”csg1i.dat” saknas. Filen måste kopieras från RollerCoaster Tycoon 1-skivan till ”Data”-mappen under RollerCoaster Tycoon 1-installationen på din hårddisk. +STR_6371 :Den angivna sökvägen innehåller en installation av RollerCoaster Tycoon 1, men filen “csg1i.dat” saknas. Filen måste kopieras från Loopy Landscapes- eller RCT Deluxe-skivan till “Data”-mappen under RollerCoaster Tycoon 1-installationen på din hårddisk. STR_6372 :Den angivna sökvägen innehåller en installation av RollerCoaster Tycoon 1, men av en version som inte är lämplig. OpenRCT2 behöver en installation av Loopy Landscapes eller RCT Deluxe för att använda resurser från RollerCoaster Tycoon 1. STR_6373 :Aktivera eller avaktivera kontroller för fri höjd STR_6374 :F @@ -3579,7 +3583,7 @@ STR_6537 :Tillåt normala gångvägar som köer STR_6538 :Visar normala gångvägar i kölistan i gångvägsfönstret STR_6539 :Bromsen stängd STR_6540 :{WINDOW_COLOUR_2}Särskilt tack till följande företag för att de tillåter oss att använda deras likhet: -STR_6541 :{WINDOW_COLOUR_2}Rocky Mountain Construction Group, Josef Wiegand GmbH & Co. KG +STR_6541 :{WINDOW_COLOUR_2}Rocky Mountain Construction Group, Josef Wiegand GmbH & Co. KG, Intamin Amusement Rides Int. Corp. Est. STR_6542 :Medverkande STR_6543 :Medverkande … STR_6544 :Lånet kan inte vara negativt! From 312225ecc203e03a0589749162fbb38293903448 Mon Sep 17 00:00:00 2001 From: mix Date: Mon, 14 Jul 2025 16:30:54 +0100 Subject: [PATCH 41/95] Fix scenery and new ride windows non legacy object file name filter --- src/openrct2-ui/windows/NewRide.cpp | 3 +-- src/openrct2-ui/windows/Scenery.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 7e48b97303..00f8fc918a 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -793,8 +793,7 @@ namespace OpenRCT2::Ui::Windows bool IsFilterInFilename(const RideObject& rideObject) { - auto repoItem = ObjectRepositoryFindObjectByEntry(&(rideObject.GetObjectEntry())); - + const auto* const repoItem = OpenRCT2::GetContext()->GetObjectRepository().FindObject(rideObject.GetIdentifier()); return String::contains(repoItem->Path, _filter, true); } diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 34908386fb..3096d8b8e2 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -1366,7 +1366,7 @@ namespace OpenRCT2::Ui::Windows bool IsFilterInFilename(const Object& object) { - auto repoItem = ObjectRepositoryFindObjectByEntry(&(object.GetObjectEntry())); + const auto* const repoItem = OpenRCT2::GetContext()->GetObjectRepository().FindObject(object.GetIdentifier()); return String::contains(repoItem->Path, _filteredSceneryTab.Filter, true); } From 42217e01dcd75fcce5cff6bfed5073b458f20901 Mon Sep 17 00:00:00 2001 From: mix Date: Mon, 14 Jul 2025 16:44:48 +0100 Subject: [PATCH 42/95] Fix new ride window filter by id not working for non legacy objects --- src/openrct2-ui/windows/NewRide.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 00f8fc918a..8c83da25aa 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -786,9 +786,7 @@ namespace OpenRCT2::Ui::Windows bool IsFilterInIdentifier(const RideObject& rideObject) { - auto objectName = rideObject.GetObjectEntry().GetName(); - - return String::contains(objectName, _filter, true); + return String::contains(rideObject.GetIdentifier(), _filter, true); } bool IsFilterInFilename(const RideObject& rideObject) From 3ce25e97416628782ec684dead2e63cff4a83aee Mon Sep 17 00:00:00 2001 From: mix Date: Mon, 14 Jul 2025 16:51:36 +0100 Subject: [PATCH 43/95] Add changelog entry for scenery and new ride window filter fixes --- distribution/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 75a671cc83..e51cec70ff 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -5,6 +5,7 @@ - Change: [#24730] Security guards now only walk slowly in crowded areas. - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. - Fix: [#24773] The new ride window debug authors does not show the correct authors for non legacy ride objects. +- Fix: [#24775] The scenery and new ride windows do not filter by file name or identifier correctly for non legacy objects. 0.4.24 (2025-07-05) ------------------------------------------------------------------------ From ea1f17ab836a6088dd0eaecb829c3eb39242d7d4 Mon Sep 17 00:00:00 2001 From: Llewelyn Gareth Griffiths Date: Mon, 14 Jul 2025 17:16:26 +0200 Subject: [PATCH 44/95] reliability progress bar no longer has min value of 10 --- src/openrct2-ui/windows/Ride.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 0c06b42b37..a4f1dd89e0 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -4032,7 +4032,7 @@ namespace OpenRCT2::Ui::Windows return; uint16_t reliability = ride->reliabilityPercentage; - widgetProgressBarSetNewPercentage(widgets[WIDX_RELIABILITY_BAR], std::max(10, reliability)); + widgetProgressBarSetNewPercentage(widgets[WIDX_RELIABILITY_BAR], reliability); uint16_t downTime = ride->downtime; widgetProgressBarSetNewPercentage(widgets[WIDX_DOWN_TIME_BAR], downTime); From 56a42882c240810a4a76dcb0da55c0f316634e39 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 13 Jul 2025 06:58:03 -0300 Subject: [PATCH 45/95] Add Swedish translations to NSIS installer --- distribution/windows/install.nsi | 3 ++- distribution/windows/language/install_sv.nsi | 23 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 distribution/windows/language/install_sv.nsi diff --git a/distribution/windows/install.nsi b/distribution/windows/install.nsi index 483d4ca22a..feca4155b9 100644 --- a/distribution/windows/install.nsi +++ b/distribution/windows/install.nsi @@ -124,7 +124,7 @@ ManifestDPIAware true ;!insertmacro MUI_LANGUAGE "Polish" !insertmacro MUI_LANGUAGE "PortugueseBR" !insertmacro MUI_LANGUAGE "Russian" -;!insertmacro MUI_LANGUAGE "Swedish" +!insertmacro MUI_LANGUAGE "Swedish" ;!insertmacro MUI_LANGUAGE "Turkish" ;!insertmacro MUI_LANGUAGE "Ukrainian" ;!insertmacro MUI_LANGUAGE "Vietnamese" @@ -145,6 +145,7 @@ ManifestDPIAware true !include "language\install_nl.nsi" !include "language\install_pt.nsi" !include "language\install_ru.nsi" +!include "language\install_sv.nsi" !macro Init thing uac_tryagain: diff --git a/distribution/windows/language/install_sv.nsi b/distribution/windows/language/install_sv.nsi new file mode 100644 index 0000000000..5042493796 --- /dev/null +++ b/distribution/windows/language/install_sv.nsi @@ -0,0 +1,23 @@ +LangString ls32bitVersionOn64bitOS ${LANG_SWEDISH} "Du försöker installera 32-bitarsversionen av OpenRCT2 på ett 64-bitars operativsystem. Detta rekommenderas inte, men det kommer att fungera med begränsad funktionalitet. Vi föreslår att du laddar ner rätt version. Vill du verkligen fortsätta?" +LangString ls64bitVersionOn32bitOS ${LANG_SWEDISH} "Du försöker installera 64-bitarsversionen av OpenRCT2 på ett 32-bitars operativsystem. Detta kommer inte att fungera. Vänligen ladda ner rätt version. Vill du verkligen fortsätta?" +LangString lsBrandingText ${LANG_SWEDISH} "OpenRCT2 Installationsprogram" +LangString lsCannotInstallToRCT2Dir ${LANG_SWEDISH} "Du kan inte installera OpenRCT2 i samma katalog som RollerCoaster Tycoon 2." +LangString lsCannotInstallToRCTClassicDir ${LANG_SWEDISH} "Du kan inte installera OpenRCT2 i samma katalog som RollerCoaster Tycoon Classic." +LangString lsComponentDescription ${LANG_SWEDISH} "Minimal installation av OpenRCT2. Du måste ha RollerCoaster Tycoon 2 eller Classic installerat." +LangString lsFinishPageLink ${LANG_SWEDISH} "Besök OpenRCT2:s webbplats för mer information" +LangString lsInstallerName ${LANG_SWEDISH} "${APPNAMEANDVERSION} ${PLATFORM} för $(lsSupportedOS)" +LangString lsNewWindowsVersionOnOldWindows ${LANG_SWEDISH} "Du försöker installera versionen för Windows XP SP3, Vista eller nyare på Windows 95, 98, ME, 2000 eller XP utan SP3. Detta kommer inte att fungera. Vänligen ladda ner rätt version. Vill du verkligen fortsätta?" +LangString lsOldWindowsVersionOnNewWindows ${LANG_SWEDISH} "Du försöker installera versionen för Windows 95, 98, 2000 och XP utan SP3 på Windows XP SP3, Vista eller nyare. Detta rekommenderas inte, men det kommer att fungera med begränsad funktionalitet. Vi föreslår att du laddar ner rätt version. Vill du verkligen fortsätta?" +LangString lsOpenRCT2IsRunning ${LANG_SWEDISH} "OpenRCT2 är redan igång. Vänligen stäng programmet och försök igen." +LangString lsRunNow ${LANG_SWEDISH} "Starta ${APPNAMEANDVERSION} nu!" +LangString lsSupportedOS ${LANG_SWEDISH} "Windows 7 eller senare" +LangString lsUACErrorDefault ${LANG_SWEDISH} "Kunde inte expandera, fel $0" +LangString lsUACError1062 ${LANG_SWEDISH} "Inloggningstjänsten är inte igång, avbryter!" +LangString lsUACError1223 ${LANG_SWEDISH} "Denna ${thing} kräver administratörsbehörighet, avbryter!" +LangString lsUACRequiresElevation ${LANG_SWEDISH} "Denna ${thing} kräver administratörsbehörighet, försök igen" +LangString lsUninstall ${LANG_SWEDISH} "Avinstallera ${APPNAMEANDVERSION}" +LangString lsUpgradeNotice ${LANG_SWEDISH} "Välkommen till installationsprogrammet för ${APPNAMEANDVERSION}.$\nDetta gör att du kan uppgradera från version $OLDVERSION." +VIAddVersionKey /LANG=${LANG_SWEDISH} "Comments" "Installerar ${APPNAMEANDVERSION}" +VIAddVersionKey /LANG=${LANG_SWEDISH} "CompanyName" "OpenRCT2 utvecklarna" +VIAddVersionKey /LANG=${LANG_SWEDISH} "FileDescription" "Installerar ${APPNAMEANDVERSION}" +VIAddVersionKey /LANG=${LANG_SWEDISH} "ProductName" "OpenRCT2 ${PLATFORM} Installationsprogram för Windows 7 eller senare" From 12cf96b9d0493d815a06ee9bdb1f46940274860d Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Tue, 15 Jul 2025 06:32:30 -0300 Subject: [PATCH 46/95] Add Spanish translations to NSIS installer --- distribution/windows/install.nsi | 3 ++- distribution/windows/language/install_es.nsi | 23 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 distribution/windows/language/install_es.nsi diff --git a/distribution/windows/install.nsi b/distribution/windows/install.nsi index feca4155b9..b7a4b7fbdd 100644 --- a/distribution/windows/install.nsi +++ b/distribution/windows/install.nsi @@ -111,7 +111,7 @@ ManifestDPIAware true ;!insertmacro MUI_LANGUAGE "Danish" !insertmacro MUI_LANGUAGE "German" ;!insertmacro MUI_LANGUAGE "Esperanto" -;!insertmacro MUI_LANGUAGE "Spanish" +!insertmacro MUI_LANGUAGE "Spanish" !insertmacro MUI_LANGUAGE "Finnish" !insertmacro MUI_LANGUAGE "French" !insertmacro MUI_LANGUAGE "Galician" @@ -136,6 +136,7 @@ ManifestDPIAware true !include "language\install_ar.nsi" !include "language\install_cs.nsi" !include "language\install_de.nsi" +!include "language\install_es.nsi" !include "language\install_fi.nsi" !include "language\install_fr.nsi" !include "language\install_gl.nsi" diff --git a/distribution/windows/language/install_es.nsi b/distribution/windows/language/install_es.nsi new file mode 100644 index 0000000000..ad49b21bec --- /dev/null +++ b/distribution/windows/language/install_es.nsi @@ -0,0 +1,23 @@ +LangString ls32bitVersionOn64bitOS ${LANG_SPANISH} "Está intentando instalar la versión de 32 bits de OpenRCT2 en un sistema operativo de 64 bits. Esto no es recomendable, pero funcionará con capacidades reducidas. Le sugerimos que descargue la versión correcta. ¿Realmente desea continuar?" +LangString ls64bitVersionOn32bitOS ${LANG_SPANISH} "Está intentando instalar la versión de 64 bits de OpenRCT2 en un sistema operativo de 32 bits. Esto no funcionará. Por favor descargue la versión correcta. ¿Realmente desea continuar?" +LangString lsBrandingText ${LANG_SPANISH} "Instalador de OpenRCT2" +LangString lsCannotInstallToRCT2Dir ${LANG_SPANISH} "No puede instalar OpenRCT2 en el mismo directorio que RollerCoaster Tycoon 2." +LangString lsCannotInstallToRCTClassicDir ${LANG_SPANISH} "No puede instalar OpenRCT2 en el mismo directorio que RollerCoaster Tycoon Classic." +LangString lsComponentDescription ${LANG_SPANISH} "Instalación mínima de OpenRCT2. Debe tener instalado RollerCoaster Tycoon 2 o Classic." +LangString lsFinishPageLink ${LANG_SPANISH} "Visite la web de OpenRCT2 para más información" +LangString lsInstallerName ${LANG_SPANISH} "${APPNAMEANDVERSION} ${PLATFORM} para $(lsSupportedOS)" +LangString lsNewWindowsVersionOnOldWindows ${LANG_SPANISH} "Está intentando instalar la versión para Windows XP SP3, Vista y posteriores en Windows 95, 98, ME, 2000 o XP sin SP3. Esto no funcionará. Por favor descargue la versión correcta. ¿Realmente desea continuar?" +LangString lsOldWindowsVersionOnNewWindows ${LANG_SPANISH} "Está intentando instalar la versión para Windows 95, 98, 2000 y XP sin SP3 en Windows XP SP3, Vista o posteriores. Esto no es recomendable, pero funcionará con capacidades reducidas. Le sugerimos que descargue la versión correcta. ¿Realmente desea continuar?" +LangString lsOpenRCT2IsRunning ${LANG_SPANISH} "OpenRCT2 se está ejecutando. Por favor ciérrelo e inténtelo de nuevo." +LangString lsRunNow ${LANG_SPANISH} "¡Ejecutar ${APPNAMEANDVERSION} ahora!" +LangString lsSupportedOS ${LANG_SPANISH} "Windows 7 y posteriores" +LangString lsUACErrorDefault ${LANG_SPANISH} "No se pudo elevar privilegios, error $0" +LangString lsUACError1062 ${LANG_SPANISH} "Servicio de inicio de sesión no activo, ¡abortando!" +LangString lsUACError1223 ${LANG_SPANISH} "Este ${thing} requiere privilegios de administrador, ¡abortando!" +LangString lsUACRequiresElevation ${LANG_SPANISH} "Este ${thing} requiere privilegios de administrador, inténtelo de nuevo" +LangString lsUninstall ${LANG_SPANISH} "Desinstalar ${APPNAMEANDVERSION}" +LangString lsUpgradeNotice ${LANG_SPANISH} "Bienvenido a la instalación de ${APPNAMEANDVERSION}.$\nEsto le permitirá actualizar desde la versión $OLDVERSION." +VIAddVersionKey /LANG=${LANG_SPANISH} "Comments" "Instala ${APPNAMEANDVERSION}" +VIAddVersionKey /LANG=${LANG_SPANISH} "CompanyName" "Desarrolladores de OpenRCT2" +VIAddVersionKey /LANG=${LANG_SPANISH} "FileDescription" "Instala ${APPNAMEANDVERSION}" +VIAddVersionKey /LANG=${LANG_SPANISH} "ProductName" "Instalador de OpenRCT2 ${PLATFORM} para Windows 7 y posteriores" From ec0f4126b068e71322433beba5713d5edbefbb91 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Tue, 15 Jul 2025 12:02:37 +0200 Subject: [PATCH 47/95] Let security guards alternate between slow and fast walking (#24730) * Let security guards alternate between slow and fast walking * Alternate based on amount of nearby guests instead * Optimise loop to exit early once threshold has been reached * Only count walking guests for security crowdedness * Update replay bundle to v0.0.89 * Update NetworkBase.cpp --- CMakeLists.txt | 4 +-- distribution/changelog.txt | 1 + openrct2.deps.targets | 4 +-- src/openrct2/entity/Staff.cpp | 53 +++++++++++++++++++++++++--- src/openrct2/entity/Staff.h | 1 + src/openrct2/network/NetworkBase.cpp | 2 +- 6 files changed, 56 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac9bb20326..157b42d358 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,9 +82,9 @@ set(OPENMSX_VERSION "1.6") set(OPENMSX_URL "https://github.com/OpenRCT2/OpenMusic/releases/download/v${OPENMSX_VERSION}/openmusic.zip") set(OPENMSX_SHA1 "ba170fa6d777b309c15420f4b6eb3fa25082a9d1") -set(REPLAYS_VERSION "0.0.87") +set(REPLAYS_VERSION "0.0.89") set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v${REPLAYS_VERSION}/replays.zip") -set(REPLAYS_SHA1 "6061B53DE346BD853BB997E635AC7374B1A7D2F0") +set(REPLAYS_SHA1 "089CB8EEA76A98028367FDDE72675E9309AB9036") option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.") option(WITH_TESTS "Build tests") diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 4b3f544237..c41e9826ad 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -2,6 +2,7 @@ ------------------------------------------------------------------------ - Feature: [#24468] [Plugin] Add awards to plugin API. - Feature: [#24702] [Plugin] Add bindings for missing cheats (forcedParkRating, ignoreRidePrice, makeAllDestructible). +- Change: [#25967] Security guards now only walk slowly in crowded areas. - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. 0.4.24 (2025-07-05) diff --git a/openrct2.deps.targets b/openrct2.deps.targets index 9c2bb75b5f..8f428cde8d 100644 --- a/openrct2.deps.targets +++ b/openrct2.deps.targets @@ -224,8 +224,8 @@ b1b1f1b241d2cbff63a1889c4dc5a09bdf769bfb https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6/openmusic.zip ba170fa6d777b309c15420f4b6eb3fa25082a9d1 - https://github.com/OpenRCT2/replays/releases/download/v0.0.87/replays.zip - 6061B53DE346BD853BB997E635AC7374B1A7D2F0 + https://github.com/OpenRCT2/replays/releases/download/v0.0.89/replays.zip + 089CB8EEA76A98028367FDDE72675E9309AB9036 diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index 2e81d1353e..faf690a9c1 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -889,7 +889,7 @@ void Staff::EntertainerUpdateNearbyPeeps() const continue; int16_t z_dist = std::abs(z - guest->z); - if (z_dist > 48) + if (z_dist > kTileRadius / 2) continue; int16_t x_dist = std::abs(x - guest->x); @@ -1644,14 +1644,58 @@ bool Staff::UpdatePatrollingFindSweeping() return false; } +bool Staff::SecurityGuardPathIsCrowded() const +{ + // Iterate over tiles within a 3-tile radius (96 units) + constexpr auto kTileRadius = 3; + constexpr auto kLookupRadius = kCoordsXYStep * kTileRadius; + constexpr auto kSecurityPathCrowdedThreshold = 20; + + int16_t guestCount = 0; + + for (int32_t tileX = x - kLookupRadius; tileX <= x + kLookupRadius; tileX += kCoordsXYStep) + { + for (int32_t tileY = y - kLookupRadius; tileY <= y + kLookupRadius; tileY += kCoordsXYStep) + { + for (auto* guest : EntityTileList({ tileX, tileY })) + { + if (guest->x == kLocationNull) + continue; + + int16_t zDist = std::abs(z - guest->z); + if (zDist > kTileRadius / 2) + continue; + + int16_t xDist = std::abs(x - guest->x); + if (xDist > kLookupRadius) + continue; + + int16_t yDist = std::abs(y - guest->y); + if (yDist > kLookupRadius) + continue; + + if (!guest->IsActionWalking()) + continue; + + guestCount++; + if (guestCount >= kSecurityPathCrowdedThreshold) + return true; + } + } + } + + return false; +} + void Staff::Tick128UpdateStaff() { if (AssignedStaffType != StaffType::Security) return; - PeepAnimationGroup newAnimationGroup = PeepAnimationGroup::Alternate; - if (State != PeepState::Patrolling) - newAnimationGroup = PeepAnimationGroup::Normal; + // Alternate between walking animations based on crowd size + auto newAnimationGroup = PeepAnimationGroup::Normal; + if (State == PeepState::Patrolling && SecurityGuardPathIsCrowded()) + newAnimationGroup = PeepAnimationGroup::Alternate; if (AnimationGroup == newAnimationGroup) return; @@ -1665,6 +1709,7 @@ void Staff::Tick128UpdateStaff() auto& objManager = GetContext()->GetObjectManager(); auto* animObj = objManager.GetLoadedObject(AnimationObjectIndex); + // NB: security staff have two animations groups: one regular, and one slow-walking PeepFlags &= ~PEEP_FLAGS_SLOW_WALK; if (animObj->IsSlowWalking(newAnimationGroup)) { diff --git a/src/openrct2/entity/Staff.h b/src/openrct2/entity/Staff.h index 301b9c51db..b9e7bd0c43 100644 --- a/src/openrct2/entity/Staff.h +++ b/src/openrct2/entity/Staff.h @@ -112,6 +112,7 @@ private: Direction HandymanDirectionRandSurface(uint8_t validDirections) const; void EntertainerUpdateNearbyPeeps() const; + bool SecurityGuardPathIsCrowded() const; uint8_t GetValidPatrolDirections(const CoordsXY& loc) const; Direction HandymanDirectionToNearestLitter() const; diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index bf50997b2a..3c971727ab 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -49,7 +49,7 @@ using namespace OpenRCT2; // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -constexpr uint8_t kNetworkStreamVersion = 0; +constexpr uint8_t kNetworkStreamVersion = 1; const std::string kNetworkStreamID = std::string(kOpenRCT2Version) + "-" + std::to_string(kNetworkStreamVersion); From ba1328578443102a8d1de69f46034bff3827e2ca Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Tue, 15 Jul 2025 17:07:31 +0200 Subject: [PATCH 48/95] Fix changelog entry for #24730 --- distribution/changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index c41e9826ad..2bd26509c5 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -2,7 +2,7 @@ ------------------------------------------------------------------------ - Feature: [#24468] [Plugin] Add awards to plugin API. - Feature: [#24702] [Plugin] Add bindings for missing cheats (forcedParkRating, ignoreRidePrice, makeAllDestructible). -- Change: [#25967] Security guards now only walk slowly in crowded areas. +- Change: [#24730] Security guards now only walk slowly in crowded areas. - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. 0.4.24 (2025-07-05) From fe5a47c6b15c9d20596d987ca65a4fd5cead97bc Mon Sep 17 00:00:00 2001 From: mix <167040362+mixiate@users.noreply.github.com> Date: Wed, 16 Jul 2025 12:07:39 +0100 Subject: [PATCH 49/95] Fix new ride window authors (#24773) --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/NewRide.cpp | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 2bd26509c5..75a671cc83 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -4,6 +4,7 @@ - Feature: [#24702] [Plugin] Add bindings for missing cheats (forcedParkRating, ignoreRidePrice, makeAllDestructible). - Change: [#24730] Security guards now only walk slowly in crowded areas. - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. +- Fix: [#24773] The new ride window debug authors does not show the correct authors for non legacy ride objects. 0.4.24 (2025-07-05) ------------------------------------------------------------------------ diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index b12f1222d1..7e48b97303 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -980,14 +980,12 @@ namespace OpenRCT2::Ui::Windows } // Draw object author(s) if debugging tools are active - if (Config::Get().general.DebuggingTools) + if (Config::Get().general.DebuggingTools && !rideObj->GetAuthors().empty()) { - auto repoItem = ObjectRepositoryFindObjectByEntry(&(rideObj->GetObjectEntry())); - - StringId authorStringId = repoItem->Authors.size() > 1 ? STR_AUTHORS_STRING : STR_AUTHOR_STRING; + const auto& authors = rideObj->GetAuthors(); std::string authorsString; - for (auto& author : repoItem->Authors) + for (auto& author : authors) { if (!authorsString.empty()) authorsString.append(", "); @@ -996,7 +994,7 @@ namespace OpenRCT2::Ui::Windows } ft = Formatter(); - ft.Add(authorStringId); + ft.Add(authors.size() > 1 ? STR_AUTHORS_STRING : STR_AUTHOR_STRING); ft.Add(authorsString.c_str()); DrawTextEllipsised( From ecc02bd4e6da14c1215216b8fd6cebe2fd7e043a Mon Sep 17 00:00:00 2001 From: Britt Luttik <45373631+spaghetticat08@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:54:25 +0200 Subject: [PATCH 50/95] Generalise tooltips for object group tabs in Object Selection window (#24776) --- data/language/en-GB.txt | 3 +++ src/openrct2-ui/UiStringIds.h | 3 +++ src/openrct2-ui/windows/EditorObjectSelection.cpp | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 4e142d282b..339d94b91b 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3830,3 +3830,6 @@ STR_6788 :Sensitivity: STR_6789 :Analogue stick sensitivity multiplier STR_6790 :Deadzone: {COMMA32}% STR_6791 :Sensitivity: {COMMA32}% +STR_6792 :Entrance Buildings +STR_6793 :Guests and Staff +STR_6794 :Scenery and Themes diff --git a/src/openrct2-ui/UiStringIds.h b/src/openrct2-ui/UiStringIds.h index 290734a5ae..6a00ba404a 100644 --- a/src/openrct2-ui/UiStringIds.h +++ b/src/openrct2-ui/UiStringIds.h @@ -524,8 +524,11 @@ namespace OpenRCT2 STR_OBJECT_SELECTION_ADVANCED_TIP = 3365, STR_OBJECT_SELECTION_ALL_SOURCES_SHOWN = 6653, STR_OBJECT_SELECTION_COMPAT_OBJECT_DESCRIPTION = 6550, + STR_OBJECT_SELECTION_ENTRANCE_BUILDINGS = 6792, STR_OBJECT_SELECTION_FALLBACK_IMAGES_WARNING = 6516, + STR_OBJECT_SELECTION_GUESTS_AND_STAFF = 6793, STR_OBJECT_SELECTION_ONLY_STRINGID = 6655, + STR_OBJECT_SELECTION_SCENERY_AND_THEMES = 6794, STR_OBJECT_SELECTION_SELECTION_SIZE = 3164, STR_OBJECT_SELECTION_SHOWING_N_SOURCES = 6654, STR_OBJECT_USES_FALLBACK_IMAGES = 6515, diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 983c3d5b27..e2294a911c 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -177,12 +177,12 @@ namespace OpenRCT2::Ui::Windows static constexpr ObjectPageDesc ObjectSelectionPages[] = { { STR_OBJECT_SELECTION_RIDE_VEHICLES_ATTRACTIONS, ObjectType::ride, SPR_TAB_RIDE_16, kRideObjectSubTabs }, - { STR_OBJECT_SELECTION_SCENERY_GROUPS, ObjectType::sceneryGroup, SPR_TAB_SCENERY_STATUES, kSceneryObjectSubTabs }, + { STR_OBJECT_SELECTION_SCENERY_AND_THEMES, ObjectType::sceneryGroup, SPR_TAB_SCENERY_STATUES, kSceneryObjectSubTabs }, { STR_OBJECT_SELECTION_FOOTPATH_SURFACES, ObjectType::footpathSurface, SPR_G2_LEGACY_PATH_TAB, kPathObjectSubTabs }, - { STR_OBJECT_SELECTION_PARK_ENTRANCE, ObjectType::parkEntrance, SPR_TAB_PARK, kEntrancesObjectSubTabs }, + { STR_OBJECT_SELECTION_ENTRANCE_BUILDINGS, ObjectType::parkEntrance, SPR_TAB_PARK, kEntrancesObjectSubTabs }, { STR_OBJECT_SELECTION_TERRAIN_SURFACES, ObjectType::terrainSurface, SPR_G2_MAP_GEN_TERRAIN_TAB, kTerrainObjectSubTabs }, { STR_OBJECT_SELECTION_MUSIC, ObjectType::music, SPR_TAB_MUSIC_0, {} }, - { STR_OBJECT_SELECTION_PEEP_NAMES, ObjectType::peepNames, SPR_TAB_GUESTS_0, kPeepObjectSubTabs }, + { STR_OBJECT_SELECTION_GUESTS_AND_STAFF, ObjectType::peepNames, SPR_TAB_GUESTS_0, kPeepObjectSubTabs }, }; // clang-format on From 11ae2371ea8bf54bc6458600c1518af0ce3d026d Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Wed, 16 Jul 2025 20:42:54 +0200 Subject: [PATCH 51/95] Smooth map based on inferred PNG image size, not leftover setting (#24782) --- distribution/changelog.txt | 1 + src/openrct2/world/map_generator/PngTerrainGenerator.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index e51cec70ff..d055491884 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -4,6 +4,7 @@ - Feature: [#24702] [Plugin] Add bindings for missing cheats (forcedParkRating, ignoreRidePrice, makeAllDestructible). - Change: [#24730] Security guards now only walk slowly in crowded areas. - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. +- Fix: [#24711] The map soothing function only partially works for custom height map image files. - Fix: [#24773] The new ride window debug authors does not show the correct authors for non legacy ride objects. - Fix: [#24775] The scenery and new ride windows do not filter by file name or identifier correctly for non legacy objects. diff --git a/src/openrct2/world/map_generator/PngTerrainGenerator.cpp b/src/openrct2/world/map_generator/PngTerrainGenerator.cpp index e76d4169b7..02cf9ba182 100644 --- a/src/openrct2/world/map_generator/PngTerrainGenerator.cpp +++ b/src/openrct2/world/map_generator/PngTerrainGenerator.cpp @@ -156,9 +156,9 @@ namespace OpenRCT2::World::MapGenerator HeightMap dest = _heightMapData; // Get technical map size, +2 for the black tiles around the map - auto maxWidth = static_cast(dest.width + 2); - auto maxHeight = static_cast(dest.height + 2); - MapInit({ maxHeight, maxWidth }); + auto mapWidth = static_cast(dest.width + 2); + auto mapHeight = static_cast(dest.height + 2); + MapInit({ mapHeight, mapWidth }); if (settings->smooth_height_map) { @@ -236,7 +236,7 @@ namespace OpenRCT2::World::MapGenerator if (settings->smoothTileEdges) { // Set the tile slopes so that there are no cliffs - smoothMap(settings->mapSize, smoothTileWeak); + smoothMap({ mapWidth, mapHeight }, smoothTileWeak); } } } // namespace OpenRCT2::World::MapGenerator From 09fb8ea2aa0e1e7f8e6c212ce2f73a0ea4dbf264 Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Thu, 17 Jul 2025 04:13:49 +0000 Subject: [PATCH 52/95] Merge Localisation/master into OpenRCT2/develop --- data/language/ko-KR.txt | 3 +++ data/language/pt-BR.txt | 3 +++ data/language/ru-RU.txt | 3 +++ 3 files changed, 9 insertions(+) diff --git a/data/language/ko-KR.txt b/data/language/ko-KR.txt index 11bec310a9..05259967b4 100644 --- a/data/language/ko-KR.txt +++ b/data/language/ko-KR.txt @@ -3830,3 +3830,6 @@ STR_6788 :민감도: STR_6789 :아날로그 스틱 민감도 배수 STR_6790 :데드존: {COMMA32}% STR_6791 :민감도: {COMMA32}% +STR_6792 :놀이공원 출입구 +STR_6793 :손님과 직원 +STR_6794 :풍경과 테마 diff --git a/data/language/pt-BR.txt b/data/language/pt-BR.txt index 99ce7fb2a6..6717953e8e 100644 --- a/data/language/pt-BR.txt +++ b/data/language/pt-BR.txt @@ -3827,3 +3827,6 @@ STR_6788 :Sensibilidade: STR_6789 :Multiplicador de sensibilidade do direcional analógico STR_6790 :Zona morta: {COMMA32}% STR_6791 :Sensibilidade: {COMMA32}% +STR_6792 :Edifícios de entrada +STR_6793 :Visitantes e funcionários +STR_6794 :Cenários e Temas diff --git a/data/language/ru-RU.txt b/data/language/ru-RU.txt index f46b785bc0..c7fafb4162 100644 --- a/data/language/ru-RU.txt +++ b/data/language/ru-RU.txt @@ -3816,3 +3816,6 @@ STR_6788 :Чувствительность: STR_6789 :Мультипликатор чувтствительности аналогового стика STR_6790 :Мёртвая зона: {COMMA32}% STR_6791 :Чувствительность: {COMMA32}% +STR_6792 :Здания входа +STR_6793 :Гости и сотрудники +STR_6794 :Пейзаж и темы From 82ab76824f93231d730943b11f8e3f0c3c72e2f2 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Fri, 18 Jul 2025 14:41:52 +0200 Subject: [PATCH 53/95] Config.cpp: fix serialisation for sorting by file size --- src/openrct2/config/Config.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index 3597aa7f55..32c2d675ed 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -113,6 +113,8 @@ namespace OpenRCT2::Config static const auto Enum_FileBrowserSort = ConfigEnum({ ConfigEnumEntry("NAME_ASCENDING", FileBrowserSort::NameAscending), ConfigEnumEntry("NAME_DESCENDING", FileBrowserSort::NameDescending), + ConfigEnumEntry("SIZE_ASCENDING", FileBrowserSort::SizeAscending), + ConfigEnumEntry("SIZE_DESCENDING", FileBrowserSort::SizeDescending), ConfigEnumEntry("DATE_ASCENDING", FileBrowserSort::DateAscending), ConfigEnumEntry("DATE_DESCENDING", FileBrowserSort::DateDescending), }); From 091da9bdef548470d6539a209087f0c5ef74c9ba Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Fri, 18 Jul 2025 15:02:05 +0200 Subject: [PATCH 54/95] Fix LoadSave window frame not resizing when toggling previews --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/LoadSave.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 5bd84ba4c1..79ddccc4d4 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -9,6 +9,7 @@ - Fix: [#24711] The map smoothing function only partially works for custom height map image files. - Fix: [#24773] The new ride window debug authors does not show the correct authors for non legacy ride objects. - Fix: [#24775] The scenery and new ride windows do not filter by file name or identifier correctly for non legacy objects. +- Fix: [#24794] The load/save browser does not resize cleanly when toggling the preview sidebar. - Fix: [#24824] The Air Powered Vertical Coaster top section track piece has vertical tunnels (original bug). - Fix: [#24825] The River Rapids flat-to-gentle track piece tunnels are incorrect on the gentle side. - Fix: [#24826] The Junior Roller Coaster flat-to-steep track piece tunnels are incorrect. diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index ffd4376388..41d4ea666f 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -918,6 +918,8 @@ namespace OpenRCT2::Ui::Windows { Config::Save(); Invalidate(); + ResizeFrame(); + OnResize(); } } From 2e219ec1e7a1d3f33561814c7bbcc276e1b4b256 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Fri, 18 Jul 2025 15:53:29 +0200 Subject: [PATCH 55/95] Introduce option to show minimap previews in LoadSave browser --- data/language/en-GB.txt | 5 + distribution/changelog.txt | 1 + src/openrct2-ui/UiStringIds.h | 5 + src/openrct2-ui/windows/LoadSave.cpp | 151 ++++++++++++++++++--------- src/openrct2/config/Config.cpp | 11 +- src/openrct2/config/Config.h | 2 +- src/openrct2/config/ConfigTypes.h | 7 ++ 7 files changed, 129 insertions(+), 53 deletions(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 339d94b91b..6b8c3e6c30 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3833,3 +3833,8 @@ STR_6791 :Sensitivity: {COMMA32}% STR_6792 :Entrance Buildings STR_6793 :Guests and Staff STR_6794 :Scenery and Themes +STR_6795 :{MOVE_X}{10}{STRINGID} +STR_6796 :•{MOVE_X}{10}{STRINGID} +STR_6797 :No preview +STR_6798 :Screenshot +STR_6799 :Mini map diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 79ddccc4d4..5f45d982e3 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -2,6 +2,7 @@ ------------------------------------------------------------------------ - Feature: [#24468] [Plugin] Add awards to plugin API. - Feature: [#24702] [Plugin] Add bindings for missing cheats (forcedParkRating, ignoreRidePrice, makeAllDestructible). +- Feature: [#24794] The load/save browser can now optionally show mini map previews instead of screenshots. - Improved: [#24812] Taiwan Park has been added to the Extras tab if it is present. - Change: [#24730] Security guards now only walk slowly in crowded areas. - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. diff --git a/src/openrct2-ui/UiStringIds.h b/src/openrct2-ui/UiStringIds.h index 6a00ba404a..d8c2c4532a 100644 --- a/src/openrct2-ui/UiStringIds.h +++ b/src/openrct2-ui/UiStringIds.h @@ -278,6 +278,8 @@ namespace OpenRCT2 // Widgets STR_CLOSE_X = 824, STR_CLOSE_X_WHITE = 6164, + STR_DROPDOWN_BULLET_OPTION = 6795, + STR_DROPDOWN_BULLET_OPTION_CHECKED = 6796, // Used as STR_DROPDOWN_BULLET_OPTION + 1 STR_DROPDOWN_GLYPH = 876, STR_NUMERIC_DOWN = 1219, STR_NUMERIC_UP = 1218, @@ -854,6 +856,9 @@ namespace OpenRCT2 STR_FILEBROWSER_CUSTOMISE_FILENAME = 6714, STR_FILEBROWSER_CUSTOMISE_SIZE = 6716, STR_FILEBROWSER_CUSTOMISE_PREVIEW = 6736, + STR_FILEBROWSER_PREVIEW_DISABLED = 6797, + STR_FILEBROWSER_PREVIEW_MINIMAP = 6799, + STR_FILEBROWSER_PREVIEW_SCREENSHOT = 6798, STR_FILEBROWSER_FILE_SIZE_VALUE = 6713, STR_FILEBROWSER_FOLDER_NAME_PROMPT = 5986, STR_FILEBROWSER_OVERWRITE_PROMPT = 2708, diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 41d4ea666f..cfb548815b 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -61,8 +61,8 @@ namespace OpenRCT2::Ui::Windows static constexpr auto kPadding = 5; - static constexpr auto kPreviewWidth = 250; - static constexpr auto kWindowSizeMinPreview = ScreenSize{ kWindowSize.width + kPreviewWidth, kWindowSize.height }; + static constexpr auto kPreviewWidthScreenshot = 250; + static constexpr auto kPreviewWidthMiniMap = 180; static constexpr int kKibiByte = 1024; static constexpr int kMebiByte = kKibiByte * 1024; @@ -136,7 +136,27 @@ namespace OpenRCT2::Ui::Windows bool ShowPreviews() { auto& config = Config::Get().general; - return config.FileBrowserShowPreviews; + return config.FileBrowserPreviewType != ParkPreviewPref::disabled; + } + + ScreenSize GetPreviewSize() const + { + auto& config = Config::Get().general; + switch (config.FileBrowserPreviewType) + { + case ParkPreviewPref::screenshot: + return { kPreviewWidthScreenshot, kPreviewWidthScreenshot / 5 * 4 }; + case ParkPreviewPref::miniMap: + return { kPreviewWidthMiniMap, kPreviewWidthMiniMap }; + case ParkPreviewPref::disabled: + default: + return { 0, 0 }; + } + } + + ScreenSize GetMinimumWindowSize() const + { + return kWindowSizeMin + GetPreviewSize(); } void PopulateList(const u8string& directory, std::string_view extensionPattern) @@ -383,44 +403,66 @@ namespace OpenRCT2::Ui::Windows void DrawPreview(RenderTarget& rt) { - constexpr auto kPreviewHeight = kPreviewWidth / 5 * 4; - - // Draw frame - auto& widget = widgets[WIDX_SCROLL]; - auto frameStartPos = windowPos + ScreenCoordsXY(width - kPreviewWidth - kPadding - 1, widget.top); - auto frameEndPos = frameStartPos + ScreenCoordsXY(kPreviewWidth + 1, kPreviewHeight + 1); - GfxFillRectInset(rt, { frameStartPos, frameEndPos }, colours[1], INSET_RECT_F_60 | INSET_RECT_FLAG_FILL_MID_LIGHT); - - // Draw park name + // Find preview image to draw + PreviewImage* image = nullptr; + auto targetPref = Config::Get().general.FileBrowserPreviewType; + auto targetType = targetPref == ParkPreviewPref::screenshot ? PreviewImageType::screenshot + : PreviewImageType::miniMap; + for (auto& candidate : _preview.images) { - auto namePos = frameStartPos + ScreenCoordsXY{ kPreviewWidth / 2, -kButtonFaceHeight }; - auto ft = Formatter(); - ft.Add(STR_STRING); - ft.Add(_preview.parkName.c_str()); - DrawTextEllipsised(rt, namePos, kPreviewWidth, STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE }); - } - - // Draw image, if available - bool foundImage = false; - for (auto& image : _preview.images) - { - if (image.type == PreviewImageType::screenshot) + if (candidate.type == targetType) { - auto imagePos = frameStartPos + ScreenCoordsXY(1, 1); - drawPreviewImage(image, rt, imagePos); - foundImage = true; + image = &candidate; break; } } - // Draw OpenRCT2 logo if no preview was found - if (!foundImage) + const auto previewPaneSize = GetPreviewSize(); + auto& widget = widgets[WIDX_SCROLL]; + + // Draw park name + { + auto namePos = windowPos + + ScreenCoordsXY(width - previewPaneSize.width / 2 - kPadding, widget.top - kButtonFaceHeight); + auto ft = Formatter(); + ft.Add(STR_STRING); + ft.Add(_preview.parkName.c_str()); + DrawTextEllipsised( + rt, namePos, previewPaneSize.width - kPadding * 2, STR_WINDOW_COLOUR_2_STRINGID, ft, + { TextAlignment::CENTRE }); + } + + const bool drawFrame = image != nullptr || targetType == PreviewImageType::screenshot; + const auto previewWidth = image != nullptr ? image->width : previewPaneSize.width; + const auto previewHeight = image != nullptr ? image->height : previewPaneSize.height; + + auto hCentre = (previewPaneSize.width - previewWidth) / 2 - kPadding; + auto frameStartPos = windowPos + ScreenCoordsXY(width - previewPaneSize.width + hCentre - 1, widget.top); + auto frameEndPos = frameStartPos + ScreenCoordsXY(previewWidth + 1, previewHeight + 1); + + if (drawFrame) + { + GfxFillRectInset( + rt, { frameStartPos, frameEndPos }, colours[1], INSET_RECT_F_60 | INSET_RECT_FLAG_FILL_MID_LIGHT); + } + + // Draw image, or placeholder if no preview was found + if (image != nullptr) + { + auto imagePos = frameStartPos + ScreenCoordsXY(1, 1); + drawPreviewImage(*image, rt, imagePos); + } + else { auto imagePos = frameStartPos + ScreenCoordsXY(1, 1); - auto colour = ColourMapA[colours[1].colour].dark; - GfxDrawSpriteSolid(rt, ImageId(SPR_G2_LOGO_MONO_DITHERED), imagePos, colour); - auto textPos = imagePos + ScreenCoordsXY(kPreviewWidth / 2, kPreviewHeight / 2 - 6); + if (targetType == PreviewImageType::screenshot) + { + auto colour = ColourMapA[colours[1].colour].dark; + GfxDrawSpriteSolid(rt, ImageId(SPR_G2_LOGO_MONO_DITHERED), imagePos, colour); + } + + auto textPos = imagePos + ScreenCoordsXY(previewWidth / 2, previewHeight / 2 - 6); // NOTE: Can't simplify this as the compiler complains about different enumeration types. StringId previewText = STR_NO_PREVIEW_AVAILABLE; @@ -435,7 +477,8 @@ namespace OpenRCT2::Ui::Windows return; } - auto summaryCoords = frameStartPos + ScreenCoordsXY(0, kPreviewHeight + kListRowHeight); + auto summaryCoords = windowPos + + ScreenCoordsXY(width - previewPaneSize.width - kPadding, widget.top + previewHeight + kListRowHeight); // Date { @@ -538,8 +581,7 @@ namespace OpenRCT2::Ui::Windows InitScrollWidgets(); ComputeMaxDateWidth(); - auto minSize = ShowPreviews() ? kWindowSizeMinPreview : kWindowSizeMin; - WindowSetResize(*this, minSize, kWindowSizeMax); + WindowSetResize(*this, GetMinimumWindowSize(), kWindowSizeMax); } void OnClose() override @@ -561,8 +603,7 @@ namespace OpenRCT2::Ui::Windows void OnResize() override { - auto minSize = ShowPreviews() ? kWindowSizeMinPreview : kWindowSizeMin; - WindowSetResize(*this, minSize, kWindowSizeMax); + WindowSetResize(*this, GetMinimumWindowSize(), kWindowSizeMax); auto& config = Config::Get().general; config.FileBrowserWidth = width; @@ -594,7 +635,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_SCROLL].right = width - kPadding; widgets[WIDX_SCROLL].bottom = height - paddingBottom; if (ShowPreviews()) - widgets[WIDX_SCROLL].right -= kPreviewWidth + kPadding; + widgets[WIDX_SCROLL].right -= GetPreviewSize().width + kPadding; Widget& customiseWidget = widgets[WIDX_SORT_CUSTOMISE]; customiseWidget.right = widgets[WIDX_SCROLL].right; @@ -864,24 +905,32 @@ namespace OpenRCT2::Ui::Windows gDropdownItems[0].Format = STR_TOGGLE_OPTION; gDropdownItems[1].Format = STR_TOGGLE_OPTION; gDropdownItems[2].Format = STR_TOGGLE_OPTION; - gDropdownItems[3].Format = STR_TOGGLE_OPTION; + gDropdownItems[3].Format = kStringIdEmpty; + gDropdownItems[4].Format = STR_DROPDOWN_BULLET_OPTION; + gDropdownItems[5].Format = STR_DROPDOWN_BULLET_OPTION; + gDropdownItems[6].Format = STR_DROPDOWN_BULLET_OPTION; + gDropdownItems[0].Args = STR_FILEBROWSER_CUSTOMISE_FILENAME; gDropdownItems[1].Args = STR_FILEBROWSER_CUSTOMISE_SIZE; gDropdownItems[2].Args = STR_FILEBROWSER_CUSTOMISE_DATE; - gDropdownItems[3].Args = STR_FILEBROWSER_CUSTOMISE_PREVIEW; + gDropdownItems[4].Args = STR_FILEBROWSER_PREVIEW_DISABLED; + gDropdownItems[5].Args = STR_FILEBROWSER_PREVIEW_MINIMAP; + gDropdownItems[6].Args = STR_FILEBROWSER_PREVIEW_SCREENSHOT; Widget* widget = &widgets[WIDX_SORT_CUSTOMISE]; WindowDropdownShowTextCustomWidth( { windowPos.x + widget->left - 70, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, 4, 90); + Dropdown::Flag::StayOpen, 7, 90); auto& config = Config::Get().general; Dropdown::SetChecked(0, true); Dropdown::SetChecked(1, config.FileBrowserShowSizeColumn); Dropdown::SetChecked(2, config.FileBrowserShowDateColumn); - Dropdown::SetChecked(3, config.FileBrowserShowPreviews); + Dropdown::SetChecked(4, config.FileBrowserPreviewType == ParkPreviewPref::disabled); + Dropdown::SetChecked(5, config.FileBrowserPreviewType == ParkPreviewPref::miniMap); + Dropdown::SetChecked(6, config.FileBrowserPreviewType == ParkPreviewPref::screenshot); } void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override @@ -901,17 +950,19 @@ namespace OpenRCT2::Ui::Windows config.FileBrowserShowDateColumn ^= true; changed = true; } - else if (selectedIndex == 3) + else if (selectedIndex >= 4 && selectedIndex <= 6) { - config.FileBrowserShowPreviews ^= true; + auto newPref = ParkPreviewPref(selectedIndex - 4); + if (config.FileBrowserPreviewType != newPref) + { + Invalidate(); + width -= GetPreviewSize().width; - Invalidate(); - if (config.FileBrowserShowPreviews) - width += kPreviewWidth; - else - width -= kPreviewWidth; + config.FileBrowserPreviewType = newPref; + width += GetPreviewSize().width; - changed = true; + changed = true; + } } if (changed) diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index 32c2d675ed..b03e350c0c 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -119,6 +119,12 @@ namespace OpenRCT2::Config ConfigEnumEntry("DATE_DESCENDING", FileBrowserSort::DateDescending), }); + static const auto Enum_ParkPreviewPref = ConfigEnum({ + ConfigEnumEntry("DISABLED", ParkPreviewPref::disabled), + ConfigEnumEntry("SCREENSHOT", ParkPreviewPref::screenshot), + ConfigEnumEntry("MINIMAP", ParkPreviewPref::miniMap), + }); + static const auto Enum_VirtualFloorStyle = ConfigEnum({ ConfigEnumEntry("OFF", VirtualFloorStyles::Off), ConfigEnumEntry("CLEAR", VirtualFloorStyles::Clear), @@ -261,7 +267,8 @@ namespace OpenRCT2::Config model->FileBrowserHeight = reader->GetInt32("file_browser_height", 0); model->FileBrowserShowSizeColumn = reader->GetBoolean("file_browser_show_size_column", true); model->FileBrowserShowDateColumn = reader->GetBoolean("file_browser_show_date_column", true); - model->FileBrowserShowPreviews = reader->GetBoolean("file_browser_show_previews", true); + model->FileBrowserPreviewType = reader->GetEnum( + "file_browser_preview_type", ParkPreviewPref::screenshot, Enum_ParkPreviewPref); } } @@ -354,7 +361,7 @@ namespace OpenRCT2::Config writer->WriteInt32("file_browser_height", model->FileBrowserHeight); writer->WriteBoolean("file_browser_show_size_column", model->FileBrowserShowSizeColumn); writer->WriteBoolean("file_browser_show_date_column", model->FileBrowserShowDateColumn); - writer->WriteBoolean("file_browser_show_previews", model->FileBrowserShowPreviews); + writer->WriteEnum("file_browser_preview_type", model->FileBrowserPreviewType, Enum_ParkPreviewPref); } static void ReadInterface(IIniReader* reader) diff --git a/src/openrct2/config/Config.h b/src/openrct2/config/Config.h index 8e1707b3c7..5daa723e7f 100644 --- a/src/openrct2/config/Config.h +++ b/src/openrct2/config/Config.h @@ -123,7 +123,7 @@ namespace OpenRCT2::Config int16_t FileBrowserHeight; bool FileBrowserShowSizeColumn; bool FileBrowserShowDateColumn; - bool FileBrowserShowPreviews; + ParkPreviewPref FileBrowserPreviewType; }; struct Interface diff --git a/src/openrct2/config/ConfigTypes.h b/src/openrct2/config/ConfigTypes.h index 0419ec4fee..4850d8ea84 100644 --- a/src/openrct2/config/ConfigTypes.h +++ b/src/openrct2/config/ConfigTypes.h @@ -29,6 +29,13 @@ enum class FileBrowserSort : int32_t DateDescending, }; +enum class ParkPreviewPref : int32_t +{ + disabled, + miniMap, + screenshot, +}; + enum class TemperatureUnit : int32_t { Celsius, From 8b3f286eeb707549fb59b08a425e8c22ab168d93 Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Sun, 20 Jul 2025 04:16:52 +0000 Subject: [PATCH 56/95] Merge Localisation/master into OpenRCT2/develop --- data/language/es-ES.txt | 14 +- data/language/gl-ES.txt | 3 + data/language/hu-HU.txt | 3 + data/language/zh-CN.txt | 282 +++++++++++++++++++++++++++++++--------- 4 files changed, 236 insertions(+), 66 deletions(-) diff --git a/data/language/es-ES.txt b/data/language/es-ES.txt index 701dab0552..49dfcd3999 100644 --- a/data/language/es-ES.txt +++ b/data/language/es-ES.txt @@ -3771,4 +3771,16 @@ STR_6728 :Rizo de inmersión (der) STR_6729 :El cable de elevación debe comenzar inmediatamente después de la estación o del bloque de frenado STR_6730 :Exportar datos de emscripten STR_6731 :Importar datos de emscripten -STR_6732 :Mostrar un botón en la barra de herramientas para girar la vista en sentido antihorario \ No newline at end of file +STR_6732 :Mostrar un botón en la barra de herramientas para girar la vista en sentido antihorario +STR_6733 :Ver através +STR_6734 :Los elementos del mapa que están a la altura de corte o por encima se renderizan de forma translúcida. +STR_6735 :Ir a la carpeta superior +STR_6736 :Vista previa +STR_6737 :No hay vista previa disponible +STR_6738 :{WINDOW_COLOUR_2}Valoración del parque: {BLACK}{UINT16} +STR_6739 :{WINDOW_COLOUR_2}Fecha: {BLACK}{STRINGID} +STR_6740 :{WINDOW_COLOUR_2}Dinero: {BLACK}{CURRENCY2DP} +STR_6741 :{WINDOW_COLOUR_2}Num. atracciones: {BLACK}{UINT16} +STR_6742 :{WINDOW_COLOUR_2}Num. visitantes: {BLACK}{UINT16} +STR_6743 :Clima +STR_6744 :{WINDOW_COLOUR_2}{UINT16}% diff --git a/data/language/gl-ES.txt b/data/language/gl-ES.txt index d6c924daf4..4938ba49c9 100644 --- a/data/language/gl-ES.txt +++ b/data/language/gl-ES.txt @@ -3828,3 +3828,6 @@ STR_6788 :Sensibilidade: STR_6789 :Multiplicador de sensibilidade do mando analóxico STR_6790 :Zona morta: {COMMA32}% STR_6791 :Sensibilidade: {COMMA32}% +STR_6792 :Edificios de entrada +STR_6793 :Visitantes e persoal +STR_6794 :Decoración e temáticas diff --git a/data/language/hu-HU.txt b/data/language/hu-HU.txt index dc9d74cf1c..62153a16c3 100644 --- a/data/language/hu-HU.txt +++ b/data/language/hu-HU.txt @@ -3828,3 +3828,6 @@ STR_6788 :Érzékenység: STR_6789 :Analóg kar érzékenységi szorzó STR_6790 :Holtzóna: {COMMA32}% STR_6791 :Érzékenység: {COMMA32}% +STR_6792 :Bejárati épületek +STR_6793 :Vendégek és személyzet +STR_6794 :Díszletek és témák diff --git a/data/language/zh-CN.txt b/data/language/zh-CN.txt index 8bd89c4320..e341be5eeb 100644 --- a/data/language/zh-CN.txt +++ b/data/language/zh-CN.txt @@ -32,12 +32,12 @@ STR_0027 :碰碰车 STR_0028 :海盗船 STR_0029 :摇摆海盗船 STR_0030 :食品小站 -STR_0031 :未知店铺 (1D) +STR_0031 :未知店铺(1D) STR_0032 :饮料铺 -STR_0033 :未知店铺 (1F) +STR_0033 :未知店铺(1F) STR_0034 :商店 STR_0035 :旋转木马 -STR_0036 :未知店铺 (22) +STR_0036 :未知店铺(22) STR_0037 :信息亭 STR_0038 :厕所 STR_0039 :摩天轮 @@ -59,15 +59,15 @@ STR_0054 :木制过山车 STR_0055 :侧向阻力式过山车 STR_0056 :疯狂老鼠过山车 STR_0057 :多维过山车 -STR_0058 :未知游乐设施 (38) +STR_0058 :未知游乐设施(38) STR_0059 :飞翔过山车 -STR_0060 :未知游乐设施 (3A) +STR_0060 :未知游乐设施(3A) STR_0061 :弗吉尼亚卷轴过山车 STR_0062 :激流勇进 STR_0063 :迷你直升机 STR_0064 :躺卧式过山车 STR_0065 :悬挂式单轨电车 -STR_0066 :未知游乐设施 (40) +STR_0066 :未知游乐设施(40) STR_0067 :反转过山车 STR_0068 :心跳回旋过山车 STR_0069 :迷你高尔夫 @@ -83,22 +83,24 @@ STR_0078 :回转发卡过山车 STR_0079 :魔毯 STR_0080 :迷你潜艇 STR_0081 :水上木筏 -STR_0082 :未知游乐设施 (50) +STR_0082 :未知游乐设施(50) STR_0083 :企业号 -STR_0084 :未知游乐设施 (52) -STR_0085 :未知游乐设施 (53) -STR_0086 :未知游乐设施 (54) -STR_0087 :未知游乐设施 (55) +STR_0084 :未知游乐设施(52) +STR_0085 :未知游乐设施(53) +STR_0086 :未知游乐设施(54) +STR_0087 :未知游乐设施(55) STR_0088 :回转冲力过山车 STR_0089 :迷你过山车 STR_0090 :矿车式过山车 -STR_0091 :未知游乐设施 (59) +STR_0091 :未知游乐设施(59) STR_0092 :LIM喷射过山车 STR_0093 :混合过山车 STR_0094 :单轨过山车 STR_0095 :高山过山车 -STR_0097 :经典站立式过山车 STR_0096 :经典木质过山车 +STR_0097 :经典站立式过山车 +STR_0098 :线性同步电机喷射式过山车 +STR_0099 :经典木质扭扭乐过山车 STR_0512 :一种紧凑的过山车,有着螺旋状的爬升和平滑盘旋的下坠 STR_0513 :乘客采用站立方式乘坐的过山车,全身都能感受到翻滚时血液在体内的涌动 STR_0514 :一种转弯的时候会自行产生离心运动,车厢可自由摆动的过山车 @@ -108,7 +110,7 @@ STR_0517 :乘客乘坐小型列车沿着一条窄轨道行驶 STR_0518 :乘客乘坐电车沿着单轨铁道行驶 STR_0519 :乘客乘坐悬挂在单轨轨道下的小车厢,在拐角处左右自由摆动 STR_0520 :供游客在水体上驾驶/划行个人水上摩托艇的码头平台 -STR_0521 :快速曲折的过山车,其紧凑的转弯和陡峭的落差造就了极高的强度。 +STR_0521 :快速曲折的过山车,其紧凑的转弯和陡峭的落差造就了极高的刺激度。 STR_0522 :一款较小型的过山车,乘客坐在轨道上而并没有其他车包围他们 STR_0523 :乘客会坐在有动力的车辆内,慢慢地依照轨道进行观光游览 STR_0524 :自由落体的车辆会被气体喷射到高塔顶,并随后自由落下 @@ -183,6 +185,8 @@ STR_0604 :乘客在狭窄的单轨列车轨道上单列行驶,在紧张的 STR_0605 :乘客乘坐雪橇在蜿蜒的钢轨上滑行,通过刹车控制速度 STR_0606 :一个拥有老式风格的木质过山车,它拥有快速且粗糙质感的车厢、大量的失重感以及侧向加速度,这些设计使得乘客感到“失去控制”般的刺激。 STR_0607 :一款紧张刺激的老式钢制环形过山车,乘客以站立姿势乘坐 +STR_0608 :过山车列车由线性同步电机加速,在急转弯中飞驰 +STR_0609 :一款老式木质过山车,具有铰接式列车、充足的零重力时间和曲折的轨道等特点,运行速度快而平稳。 STR_0767 :游客{INT32} STR_0768 :清洁工人{INT32} STR_0769 :维修人员{INT32} @@ -278,7 +282,7 @@ STR_0882 :加载游戏 STR_0883 :保存游戏 STR_0884 :加载地形 STR_0885 :保存地形 -STR_0887 :退出场景编辑器 +STR_0887 :退出剧情编辑器 STR_0888 :退出轨道设计工具 STR_0889 :退出轨道设计管理工具 STR_0891 :截图 @@ -1816,7 +1820,7 @@ STR_2482 :营利:每周{CURRENCY},游乐园价值:{POP16}{POP16}{CURREN STR_2483 :{WINDOW_COLOUR_2}每周营利:{BLACK}+{CURRENCY2DP} STR_2484 :{WINDOW_COLOUR_2}每周营利:{RED}{CURRENCY2DP} STR_2487 :显示游客的“真实”姓名 -STR_2488 :在游客“真实”姓名和游客编号之间切换 +STR_2488 :在显示游客“真实”姓名和游客编号之间切换 STR_2489 :快捷键…… STR_2490 :键盘快捷键 STR_2491 :重置快捷键 @@ -1853,31 +1857,31 @@ STR_2521 :显示工作人员列表 STR_2522 :显示最近信息 STR_2523 :显示地图 STR_2524 :截图 -STR_2533 :Backspace (退格) -STR_2534 :Tab (制表) -STR_2537 :Clear (清除) -STR_2538 :Return (回车) -STR_2543 :Alt/Menu (Alt/菜单) -STR_2544 :Pause (暂停) -STR_2545 :Caps (大写锁定) -STR_2552 :Escape (退出) -STR_2557 :Spacebar (空格) -STR_2558 :PgUp (上一页) -STR_2559 :PgDn (下一页) -STR_2560 :End (结束) -STR_2561 :Home (主页) -STR_2562 :Left (左) -STR_2563 :Up (上) -STR_2564 :Right (右) -STR_2565 :Down (下) -STR_2566 :Select (选择) -STR_2567 :Print (打印) -STR_2568 :Execute (执行) -STR_2569 :Snapshot (快照) -STR_2570 :Insert (插入) -STR_2571 :Delete (删除) -STR_2572 :Help (帮助) -STR_2618 :Menu (菜单) +STR_2533 :Backspace(退格) +STR_2534 :Tab(制表) +STR_2537 :Clear(清除) +STR_2538 :Return(回车) +STR_2543 :Alt/Menu(Alt/菜单) +STR_2544 :Pause(暂停) +STR_2545 :Caps(大写锁定) +STR_2552 :Escape(退出) +STR_2557 :Spacebar(空格) +STR_2558 :PgUp(上一页) +STR_2559 :PgDn(下一页) +STR_2560 :End(结束) +STR_2561 :Home(主页) +STR_2562 :Left(左) +STR_2563 :Up(上) +STR_2564 :Right(右) +STR_2565 :Down(下) +STR_2566 :Select(选择) +STR_2567 :Print(打印) +STR_2568 :Execute(执行) +STR_2569 :Snapshot(快照) +STR_2570 :Insert(插入) +STR_2571 :Delete(删除) +STR_2572 :Help(帮助) +STR_2618 :Menu(菜单) STR_2621 :数字小键盘 0 STR_2622 :数字小键盘 1 STR_2623 :数字小键盘 2 @@ -1893,13 +1897,13 @@ STR_2632 :数字小键盘 + STR_2634 :数字小键盘 - STR_2635 :数字小键盘 . STR_2636 :数字小键盘 / -STR_2669 :NumLock (数字锁定) -STR_2670 :Scroll (鼠标滚动) +STR_2669 :NumLock(数字锁定) +STR_2670 :Scroll(鼠标滚动) STR_2680 :所有项目已研发完毕 STR_2684 :一大批游客到访 STR_2685 :单形噪声参数 -STR_2686 :低值: -STR_2687 :高值: +STR_2686 :最小陆地高度: +STR_2687 :最大陆地高度: STR_2688 :基础频率: STR_2689 :八音度: STR_2690 :生成地图 @@ -2161,7 +2165,6 @@ STR_3136 :警告:此设计会使用另一款车辆,它的运作可能会 STR_3137 :选择邻近景物 STR_3138 :重新选择 STR_3139 :缆道坡道不能在这个运作模式运作 -STR_3140 :缆道坡道需要连接至车站 STR_3141 :缆道坡道并不适用于单次多圈数的游乐设施 STR_3142 :{WINDOW_COLOUR_2}载客量:{BLACK}{STRINGID} STR_3143 :在地图上显示所有人物 @@ -2232,8 +2235,8 @@ STR_3228 :设置游客的初始位置 STR_3229 :区块制动器不能紧接在车站之后 STR_3230 :区块制动器不能紧接在另一个区块制动器之后 STR_3231 :区块制动器不能紧接在这个提升坡的顶部之后 -STR_3232 :选项——财政 -STR_3233 :选项——游客 +STR_3232 :剧情选项——财政 +STR_3233 :剧情选项——游客 STR_3235 :显示财政选项 STR_3236 :显示游客选项 STR_3238 :无金钱限制 @@ -2277,7 +2280,7 @@ STR_3279 :免费进入 / 游乐设施单独付费 STR_3280 :付费进入 / 免费乘搭游乐设施 STR_3281 :游乐园门票价格: STR_3283 :选择要保留的游乐设施/店铺 -STR_3285 :保留游乐设施/店铺 +STR_3285 :剧情选项——保留游乐设施/店铺 STR_3286 :选择此剧情的目标 STR_3287 :{WINDOW_COLOUR_2}目标: STR_3294 :更改…… @@ -2487,7 +2490,7 @@ STR_5244 :主题 STR_5245 :顶部工具栏 STR_5246 :底部工具栏 STR_5247 :轨道编辑器底部工具栏 -STR_5248 :场景编辑器底部工具栏 +STR_5248 :剧情编辑器底部工具栏 STR_5249 :主界面菜单按钮 STR_5250 :主界面退出按钮 STR_5251 :主界面选项按钮 @@ -2506,7 +2509,7 @@ STR_5265 :选择可见内容 STR_5266 :显示 STR_5267 :语言及单位 STR_5268 :音效 -STR_5269 :控制及界面 +STR_5269 :控制 STR_5270 :杂项 STR_5272 :小型景观 STR_5273 :大型景观 @@ -2543,7 +2546,7 @@ STR_5305 :过山车大亨1(RCT1) STR_5306 :过山车大亨1(+资料片1——AA) STR_5307 :过山车大亨1(+资料片1&2——AA+LL) STR_5308 :过山车大亨2(RCT2) -STR_5309 :开源过山车大亨2 (OpenRCT2) +STR_5309 :开源过山车大亨2(OpenRCT2) STR_5310 :随机 STR_5311 :调试工具 STR_5312 :显示控制台 @@ -2573,8 +2576,8 @@ STR_5357 :{BLACK}恶心耐受度: STR_5358 :{BLACK}如厕度: STR_5359 :移除游客 STR_5360 :移除地图上的所有游客 -STR_5361 :给所有游客: -STR_5362 :{BLACK}设置所有客人的首选乘坐强度: +STR_5361 :加入游客背包 +STR_5362 :{BLACK}刺激度偏好: STR_5363 :大于 1 STR_5364 :小于 15 STR_5365 :{BLACK}员工速度: @@ -2584,7 +2587,7 @@ STR_5368 :复位故障状态 STR_5371 :选取对象 STR_5372 :拖拽时反转鼠标右键 STR_5373 :名称{STRINGID} -STR_5374 :日期{STRINGID} +STR_5374 :上次修改日期{STRINGID} STR_5375 :▲ STR_5376 :▼ STR_5404 :名称已被使用 @@ -2604,7 +2607,7 @@ STR_5457 :去除支撑限制 STR_5458 :顺时计旋转 STR_5459 :逆时计旋转 STR_5460 :逆时针旋转检视范围 -STR_5461 :设置游客的属性 +STR_5461 :设置所有游客属性 STR_5462 :{CURRENCY} STR_5463 :目标:尽情玩吧! STR_5464 :一般 @@ -2712,10 +2715,10 @@ STR_5573 :取消收藏 STR_5574 :服务器名称: STR_5575 :最大人数: STR_5576 :端口: -STR_5577 :韩元 (W) -STR_5578 :卢布 (₽) +STR_5577 :韩元(W) +STR_5578 :卢布(₽) STR_5579 :窗口缩放比例: -STR_5580 :捷克克朗 (Kč) +STR_5580 :捷克克朗(Kč) STR_5581 :显示帧数 STR_5582 :限制鼠标指针仅在窗口内移动 STR_5583 :{COMMA1DP16}米每秒 @@ -3130,9 +3133,9 @@ STR_6041 :{BLACK}没有雇佣维修人员! STR_6042 :加载高度图 STR_6043 :选择高度图 STR_6044 :平滑高度图 -STR_6045 :强度 +STR_6045 :强度: STR_6046 :归一化高度图 -STR_6047 :平滑地块 +STR_6047 :平滑地块边缘 STR_6048 :高度图错误 STR_6049 :PNG读取错误 STR_6050 :位图读取错误 @@ -3190,7 +3193,7 @@ STR_6102 :游乐设施的价值不会随时间流逝而贬值,因此游客 STR_6103 :此选项在联网模式下被禁用。 STR_6105 :超级过山车 STR_6107 :怪兽卡车 -STR_6109 :超旋转式 +STR_6109 :超旋转式过山车 STR_6111 :经典迷你过山车 STR_6113 :一种高大的非翻转的过山车,拥有巨大下坡,高速和只有围栏限制的舒适的车厢 STR_6115 :动力十足的4x4四驱卡车,可以攀爬陡峭的斜坡 @@ -3573,7 +3576,7 @@ STR_6537 :允许使用普通道路作为队列道路使用 STR_6538 :在道路窗口中的队列道路选择框中显示普通道路。 STR_6539 :关闭制动器 STR_6540 :{WINDOW_COLOUR_2}特别感谢以下公司允许他们的肖像: -STR_6541 :{WINDOW_COLOUR_2}Rocky Mountain Construction Group,Josef Wiegand GmbH & Co. KG +STR_6541 :{WINDOW_COLOUR_2}Rocky Mountain Construction Group,Josef Wiegand GmbH & Co. KG, Intamin Amusement Rides Int. Corp. Est. STR_6542 :贡献者 STR_6543 :贡献者…… STR_6544 :贷款不得为负! @@ -3618,7 +3621,7 @@ STR_6582 :打开快捷键窗口 STR_6583 :{WINDOW_COLOUR_2}反向列车 STR_6584 :选择反向运行列车 STR_6585 :无法做出更改…… -STR_6586 :开源过山车大亨2 (OpenRCT2) +STR_6586 :开源过山车大亨2(OpenRCT2) STR_6587 :OpenRCT2的标题样式由Allister Brimble设计,{NEWLINE}许可证类型 CC BY-SA 4.0. STR_6588 :感谢Herman Riddering允许我们录制“35er Voigt”。 STR_6589 :在左侧显示窗口按钮 @@ -3654,7 +3657,7 @@ STR_6618 :无法限制或取消限制对象…… STR_6619 :无法限制对象类型! STR_6620 :未找到对象! STR_6621 :限制 -STR_6622 :将对象限制在“场景编辑器”和“沙盒”模式中。 +STR_6622 :将对象限制在“剧情编辑器”和“沙盒”模式中。 STR_6623 :输入“help”查看可用命令列表。输入“hide”隐藏控制台。 STR_6624 :地块检查器:对元素进行排序 STR_6625 :颜色无效 @@ -3678,3 +3681,152 @@ STR_6642 :{STRING}({COMMA32} / {COMMA32}) STR_6643 :{STRING}({COMMA32} / {COMMA32} 千字节) STR_6644 :增强触控模式 STR_6645 :将一些用户界面元素放大,使其更容易点击或触碰。 +STR_6646 :作者:{STRING} +STR_6647 :作者:{STRING} +STR_6648 :正在加载插件引擎…… +STR_6649 :正在加载剧情…… +STR_6650 :正在加载存档…… +STR_6651 :{STRING}({COMMA32}%) +STR_6652 :错误提示窗口 +STR_6653 :显示所有物品来源 +STR_6654 :显示{POP16}{UINT16}个物品来源 +STR_6655 :只显示出自“{POP16}{STRINGID}”的物品 +STR_6656 :移除游乐园中所有栅栏 +STR_6657 :土地无法获取 +STR_6658 :设置土地不属于游乐园,也不可购买。 +STR_6659 :游客忽视价格 +STR_6660 :游客会忽视游乐设施和店铺的价格。 +STR_6661 :全部随机 +STR_6662 :为每辆列车或车厢随机设置颜色。 +STR_6663 :日期作弊 +STR_6664 :显示日期作弊工具 +STR_6665 :天气作弊 +STR_6666 :显示天气作弊工具 +STR_6667 :动物 +STR_6668 :员工作弊 +STR_6669 :显示员工作弊 +STR_6670 :游客行为 +STR_6671 :显示员工的“真实”姓名 +STR_6672 :在显示工作人员“真实”姓名和工作人员编号之间切换 +STR_6673 :透明 +STR_6674 :第{COMMA16}年,{MONTH}月 +STR_6675 :人物名称 +STR_6676 :必须至少选择一个人物名对象 +STR_6677 :在水体周围增加海滩 +STR_6678 :高度图源: +STR_6679 :平地 +STR_6680 :单形噪声 +STR_6681 :高度图文件 +STR_6682 :地图生成器 - 生成器 +STR_6683 :地图生成器 - 地形 +STR_6684 :地图生成器 - 水体 +STR_6685 :地图生成器 - 林地 +STR_6686 :树木与土地占比: +STR_6687 :最低树木海拔: +STR_6688 :最高树木海拔: +STR_6689 :{UINT16}% +STR_6690 :最小陆地高度 +STR_6691 :输入{COMMA16}和{COMMA16}之间的最小陆地高度 +STR_6692 :最大陆地高度 +STR_6693 :输入{COMMA16}和{COMMA16}之间的最大陆地高度 +STR_6694 :最低树木海拔 +STR_6695 :输入{COMMA16}和{COMMA16}之间的最低树木海拔 +STR_6696 :最高树木海拔 +STR_6697 :输入{COMMA16}和{COMMA16}之间的最高树木海拔 +STR_6698 :树木与土地占比 +STR_6699 :输入{COMMA16}和{COMMA16}之间的树木与土地比例 +STR_6700 :单形噪声基频 +STR_6701 :输入{COMMA2DP32}和{COMMA2DP32}之间的噪声基频 +STR_6702 :单形噪声八度 +STR_6703 :输入{COMMA16}和{COMMA16}之间的噪声八度 +STR_6704 :{COMMA2DP32} +STR_6705 :浏览…… +STR_6706 :{WINDOW_COLOUR_2}当前图片文件:{BLACK}{STRING} +STR_6707 :(未选取) +STR_6708 :平滑强度 +STR_6709 :输入{COMMA16}和{COMMA16}之间的平滑强度 +STR_6710 :稳定渲染排序算法 +STR_6711 :文件名: +STR_6712 :保存 +STR_6713 :{COMMA32} {STRINGID} +STR_6714 :文件名 +STR_6715 :上次修改日期 +STR_6716 :文件大小 +STR_6717 :文件大小{STRINGID} +STR_6718 :人物动画 +STR_6719 :必须选择至少一个游客人物动画对象 +STR_6720 :必须选择至少一个清洁工人人物动画对象 +STR_6721 :必须选择至少一个维修人员人物动画对象 +STR_6722 :必须选择至少一个安全警卫人物动画对象 +STR_6723 :必须选择至少一个表演人员人物动画对象 +STR_6724 :剧情标识 +STR_6725 :X: +STR_6726 :Y: +STR_6727 :旋转回环(左) +STR_6728 :旋转回环(右) +STR_6729 :缆索坡道必须连接至站台或区块制动器 +STR_6730 :导出emscripten数据 +STR_6731 :导入emscripten数据 +STR_6732 :在工具栏中显示用于逆时针旋转视图的按钮 +STR_6733 :透明化 +STR_6734 :将位于或高于切割高度的地图元素透明化。 +STR_6735 :返回上一层目录 +STR_6736 :预览 +STR_6737 :无预览 +STR_6738 :{WINDOW_COLOUR_2}游乐园评分:{BLACK}{UINT16} +STR_6739 :{WINDOW_COLOUR_2}日期:{BLACK}{STRINGID} +STR_6740 :{WINDOW_COLOUR_2}现金:{BLACK}{CURRENCY2DP} +STR_6741 :{WINDOW_COLOUR_2}游乐设施数量:{BLACK}{UINT16} +STR_6742 :{WINDOW_COLOUR_2}游客数量:{BLACK}{UINT16} +STR_6743 :气候 +STR_6744 :{WINDOW_COLOUR_2}{UINT16}% +STR_6745 :{WINDOW_COLOUR_2}游客刺激度偏好: +STR_6746 :无偏好 +STR_6747 :随即偏好(默认) +STR_6748 :只偏好不刺激的游乐设施 +STR_6749 :只偏好更刺激的游乐设施 +STR_6750 :选择新游客偏好的游乐设施刺激度。 +STR_6751 :队列道路不可用于平道交口! +STR_6752 :剧情设置 - 目标 +STR_6753 :剧情设置 - 剧情详情 +STR_6754 :剧情设置 - 土地限制 +STR_6755 :显示目标选项 +STR_6756 :显示剧情详情选项 +STR_6757 :显示土地限制选项 +STR_6758 :贷款选项 +STR_6759 :商业模式 +STR_6760 :收入: +STR_6761 :剧情详情 +STR_6762 :界面 +STR_6763 :过山车大亨1 +STR_6764 :存储及自动存档 +STR_6765 :高级设置 +STR_6766 :清除 +STR_6767 :窗口 +STR_6768 :渲染 +STR_6769 :行为 +STR_6770 :帧率限制: +STR_6771 :内部速度(默认) +STR_6772 :垂直同步 +STR_6773 :无限制 +STR_6774 :距离上次检查的时间 +STR_6775 :{COMMA16}分钟 +STR_6776 :{COMMA16}分钟 +STR_6777 :超过4小时前 +STR_6778 :用以下方式预览剧情: +STR_6779 :选择要在剧情选择界面中使用的预览图像类型。 +STR_6780 :迷你地图 +STR_6781 :截屏 +STR_6782 :游乐园通知 +STR_6783 :游乐设施通知 +STR_6784 :游客通知 +STR_6785 :游戏手柄 +STR_6786 :盲区: +STR_6787 :摇杆盲区(所需最小移动幅度) +STR_6788 :灵敏度: +STR_6789 :遥感灵敏度倍数 +STR_6790 :盲区:{COMMA32}% +STR_6791 :灵敏度:{COMMA32}% +STR_6792 :入口建筑 +STR_6793 :游客和员工 +STR_6794 :剧情和主题 From fd6707e9fb255f23c9a6be211706197fefff3d87 Mon Sep 17 00:00:00 2001 From: Llewelyn Gareth Griffiths Date: Sun, 20 Jul 2025 16:54:51 +0200 Subject: [PATCH 57/95] updating change log to add fix --- distribution/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 4b3f544237..ce9911e7e9 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -3,6 +3,7 @@ - Feature: [#24468] [Plugin] Add awards to plugin API. - Feature: [#24702] [Plugin] Add bindings for missing cheats (forcedParkRating, ignoreRidePrice, makeAllDestructible). - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. +- Fix: [#24761] Reliability bar in the ride inspector now acts consistently with the Down-Time bar, it no longer has a minimum value of 10. 0.4.24 (2025-07-05) ------------------------------------------------------------------------ From 9d5b21cebf0a6bb1858decec91df103206378fd8 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek <1478678+Gymnasiast@users.noreply.github.com> Date: Sun, 20 Jul 2025 18:37:32 +0300 Subject: [PATCH 58/95] Fix typo in changelog --- distribution/changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index d055491884..d1a6352b77 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -4,7 +4,7 @@ - Feature: [#24702] [Plugin] Add bindings for missing cheats (forcedParkRating, ignoreRidePrice, makeAllDestructible). - Change: [#24730] Security guards now only walk slowly in crowded areas. - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. -- Fix: [#24711] The map soothing function only partially works for custom height map image files. +- Fix: [#24711] The map smoothing function only partially works for custom height map image files. - Fix: [#24773] The new ride window debug authors does not show the correct authors for non legacy ride objects. - Fix: [#24775] The scenery and new ride windows do not filter by file name or identifier correctly for non legacy objects. From 2ac0373de3784bc7f0747363fd0ad2cc69176a99 Mon Sep 17 00:00:00 2001 From: ZeeMaji <42477864+ZeeMaji@users.noreply.github.com> Date: Sun, 20 Jul 2025 18:39:08 +0000 Subject: [PATCH 59/95] Add Taiwan Park to extras --- distribution/changelog.txt | 1 + src/openrct2/scenario/ScenarioSources.cpp | 1 + src/openrct2/scenario/ScenarioSources.h | 1 + 3 files changed, 3 insertions(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 2d678e5973..588c3a568a 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -2,6 +2,7 @@ ------------------------------------------------------------------------ - Feature: [#24468] [Plugin] Add awards to plugin API. - Feature: [#24702] [Plugin] Add bindings for missing cheats (forcedParkRating, ignoreRidePrice, makeAllDestructible). +- Improved: [#24812] Taiwan Park has been added to the Extras tab if it is present. - Change: [#24730] Security guards now only walk slowly in crowded areas. - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. - Fix: [#24611] The confirmation prompt for track file deletion is not vertically aligned. diff --git a/src/openrct2/scenario/ScenarioSources.cpp b/src/openrct2/scenario/ScenarioSources.cpp index ec5e8d6e2c..03d99e6e78 100644 --- a/src/openrct2/scenario/ScenarioSources.cpp +++ b/src/openrct2/scenario/ScenarioSources.cpp @@ -316,6 +316,7 @@ namespace OpenRCT2::ScenarioSources static constexpr ScenarioTitleDescriptor kScenarioTitlesExtrasParks[] = { { SC_FORT_ANACHRONISM, "Fort Anachronism", ScenarioCategory::dlc, "rct1dlc.scenario_meta.fort_anachronism" }, + { SC_TAIWAN_PARK, "Taiwan Park", ScenarioCategory::dlc, "rct1tw.scenario_meta.taiwan_park" }, { SC_PCPLAYER, "PC Player", ScenarioCategory::dlc, "rct1dlc.scenario_meta.pc_player" }, { SC_PCGW, "PC Gaming World", ScenarioCategory::dlc, "rct1dlc.scenario_meta.pc_gaming_world" }, { SC_GAMEPLAY, "gameplay", ScenarioCategory::dlc, "rct1dlc.scenario_meta.gameplay" }, diff --git a/src/openrct2/scenario/ScenarioSources.h b/src/openrct2/scenario/ScenarioSources.h index f7105fd426..03ce947c3f 100644 --- a/src/openrct2/scenario/ScenarioSources.h +++ b/src/openrct2/scenario/ScenarioSources.h @@ -74,6 +74,7 @@ enum // Special SC_ALTON_TOWERS, SC_FORT_ANACHRONISM, + SC_TAIWAN_PARK, // Added Attractions SC_WHISPERING_CLIFFS = 40, From c79eb0609b4db4e60d0587493215eab52a5e34a2 Mon Sep 17 00:00:00 2001 From: LRFLEW Date: Sun, 20 Jul 2025 19:03:52 -0500 Subject: [PATCH 60/95] Don't Double-Compress Park Chunks in Replay File (#24728) --- src/openrct2/ReplayManager.cpp | 9 ++++---- src/openrct2/core/OrcaStream.hpp | 28 ++++++++++++++++++------- src/openrct2/park/ParkFile.cpp | 36 ++++++++++++++++---------------- src/openrct2/park/ParkFile.h | 24 +++++++++++++-------- 4 files changed, 58 insertions(+), 39 deletions(-) diff --git a/src/openrct2/ReplayManager.cpp b/src/openrct2/ReplayManager.cpp index 7eef78f284..03cbc01a99 100644 --- a/src/openrct2/ReplayManager.cpp +++ b/src/openrct2/ReplayManager.cpp @@ -261,7 +261,7 @@ namespace OpenRCT2 auto exporter = std::make_unique(); exporter->ExportObjectsList = objects; - exporter->Export(gameState, replayData->parkData); + exporter->Export(gameState, replayData->parkData, Compression::kNoCompressionLevel); replayData->timeRecorded = std::chrono::seconds(std::time(nullptr)).count(); @@ -314,8 +314,7 @@ namespace OpenRCT2 MemoryStream compressed; stream.SetPosition(0); bool compressStatus = Compression::zlibCompress( - stream, static_cast(stream.GetLength()), compressed, Compression::ZlibHeaderType::zlib, - kReplayCompressionLevel); + stream, stream.GetLength(), compressed, Compression::ZlibHeaderType::zlib, kReplayCompressionLevel); if (!compressStatus) throw IOException("Compression Error"); @@ -567,8 +566,8 @@ namespace OpenRCT2 recFile.data.SetPosition(0); decompressStatus = Compression::zlibDecompress( - recFile.data, static_cast(recFile.data.GetLength()), decompressed, - static_cast(recFile.uncompressedSize), Compression::ZlibHeaderType::zlib); + recFile.data, recFile.data.GetLength(), decompressed, recFile.uncompressedSize, + Compression::ZlibHeaderType::zlib); if (!decompressStatus) throw IOException("Decompression Error"); diff --git a/src/openrct2/core/OrcaStream.hpp b/src/openrct2/core/OrcaStream.hpp index bbeb8b0ef8..86b98d722a 100644 --- a/src/openrct2/core/OrcaStream.hpp +++ b/src/openrct2/core/OrcaStream.hpp @@ -73,12 +73,14 @@ namespace OpenRCT2 sfl::small_vector _chunks; MemoryStream _buffer; ChunkEntry _currentChunk; + int16_t _compressionLevel; public: - OrcaStream(IStream& stream, const Mode mode) + OrcaStream(IStream& stream, const Mode mode, int16_t compressionLevel = Compression::kZlibDefaultCompressionLevel) { _stream = &stream; _mode = mode; + _compressionLevel = compressionLevel; if (mode == Mode::READING) { _header = _stream->ReadValue
(); @@ -93,15 +95,14 @@ namespace OpenRCT2 // Uncompress if (_header.Compression != CompressionType::none) { - size_t compressedSize = static_cast(_header.CompressedSize); - size_t uncompressedSize = static_cast(_header.UncompressedSize); bool decompressStatus = false; switch (_header.Compression) { case CompressionType::gzip: decompressStatus = Compression::zlibDecompress( - *_stream, compressedSize, _buffer, uncompressedSize, Compression::ZlibHeaderType::gzip); + *_stream, _header.CompressedSize, _buffer, _header.UncompressedSize, + Compression::ZlibHeaderType::gzip); break; default: throw IOException("Unknown Park Compression Type"); @@ -129,7 +130,8 @@ namespace OpenRCT2 else { _header = {}; - _header.Compression = CompressionType::gzip; + _header.Compression = _compressionLevel == Compression::kNoCompressionLevel ? CompressionType::none + : CompressionType::gzip; _buffer = MemoryStream{}; } } @@ -145,11 +147,13 @@ namespace OpenRCT2 _header.CompressedSize = _buffer.GetLength(); _header.FNV1a = Crypt::FNV1a(_buffer.GetData(), _buffer.GetLength()); + if (_compressionLevel == Compression::kNoCompressionLevel) + _header.Compression = CompressionType::none; + // Compress data if (_header.Compression != CompressionType::none) { MemoryStream compressed; - size_t bufferLength = static_cast(_buffer.GetLength()); bool compressStatus = false; _buffer.SetPosition(0); @@ -157,7 +161,7 @@ namespace OpenRCT2 { case CompressionType::gzip: compressStatus = Compression::zlibCompress( - _buffer, bufferLength, compressed, Compression::ZlibHeaderType::gzip); + _buffer, _buffer.GetLength(), compressed, Compression::ZlibHeaderType::gzip, _compressionLevel); break; default: break; @@ -199,6 +203,16 @@ namespace OpenRCT2 return _header; } + int16_t GetCompressionLevel() const + { + return _compressionLevel; + } + + void SetCompressionLevel(int16_t compressionLevel) + { + _compressionLevel = compressionLevel; + } + template bool ReadWriteChunk(const uint32_t chunkId, TFunc f) { diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 9f06105455..306f797cba 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -177,9 +177,9 @@ namespace OpenRCT2 gameState.initialCash = gameState.cash; } - void Save(GameState_t& gameState, IStream& stream) + void Save(GameState_t& gameState, IStream& stream, int16_t compressionLevel) { - OrcaStream os(stream, OrcaStream::Mode::WRITING); + OrcaStream os(stream, OrcaStream::Mode::WRITING, compressionLevel); auto& header = os.GetHeader(); header.Magic = kParkFileMagic; @@ -206,10 +206,10 @@ namespace OpenRCT2 ReadWritePackedObjectsChunk(os); } - void Save(GameState_t& gameState, const std::string_view path) + void Save(GameState_t& gameState, const std::string_view path, int16_t compressionLevel) { FileStream fs(path, FileMode::write); - Save(gameState, fs); + Save(gameState, fs, compressionLevel); } ScenarioIndexEntry ReadScenarioChunk() @@ -2706,21 +2706,21 @@ namespace OpenRCT2 } }); } + + void ParkFileExporter::Export(GameState_t& gameState, std::string_view path, int16_t compressionLevel) + { + auto parkFile = std::make_unique(); + parkFile->Save(gameState, path, compressionLevel); + } + + void ParkFileExporter::Export(GameState_t& gameState, IStream& stream, int16_t compressionLevel) + { + auto parkFile = std::make_unique(); + parkFile->ExportObjectsList = ExportObjectsList; + parkFile->Save(gameState, stream, compressionLevel); + } } // namespace OpenRCT2 -void ParkFileExporter::Export(GameState_t& gameState, std::string_view path) -{ - auto parkFile = std::make_unique(); - parkFile->Save(gameState, path); -} - -void ParkFileExporter::Export(GameState_t& gameState, IStream& stream) -{ - auto parkFile = std::make_unique(); - parkFile->ExportObjectsList = ExportObjectsList; - parkFile->Save(gameState, stream); -} - enum : uint32_t { S6_SAVE_FLAG_EXPORT = 1 << 0, @@ -2766,7 +2766,7 @@ int32_t ScenarioSave(GameState_t& gameState, u8string_view path, int32_t flags) { // s6exporter->SaveGame(path); } - parkFile->Save(gameState, path); + parkFile->Save(gameState, path, Compression::kZlibDefaultCompressionLevel); result = true; } catch (const std::exception& e) diff --git a/src/openrct2/park/ParkFile.h b/src/openrct2/park/ParkFile.h index d432103f30..e6475ce67f 100644 --- a/src/openrct2/park/ParkFile.h +++ b/src/openrct2/park/ParkFile.h @@ -9,6 +9,8 @@ #pragma once +#include "../core/Compression.h" + #include #include #include @@ -54,13 +56,17 @@ namespace OpenRCT2 constexpr uint16_t kExtendedGoKartsVersion = 54; constexpr uint16_t kHigherInversionsHolesHelicesStatsVersion = 55; constexpr uint16_t kFixedObsoleteFootpathsVersion = 56; + + class ParkFileExporter + { + public: + std::vector ExportObjectsList; + + void Export( + OpenRCT2::GameState_t& gameState, std::string_view path, + int16_t compressionLevel = Compression::kZlibDefaultCompressionLevel); + void Export( + OpenRCT2::GameState_t& gameState, OpenRCT2::IStream& stream, + int16_t compressionLevel = Compression::kZlibDefaultCompressionLevel); + }; } // namespace OpenRCT2 - -class ParkFileExporter -{ -public: - std::vector ExportObjectsList; - - void Export(OpenRCT2::GameState_t& gameState, std::string_view path); - void Export(OpenRCT2::GameState_t& gameState, OpenRCT2::IStream& stream); -}; From 2e36ec54be2d4e2ebc8940a2b79d8494f5fce083 Mon Sep 17 00:00:00 2001 From: Arnold Zhou Date: Mon, 21 Jul 2025 22:04:36 +1000 Subject: [PATCH 61/95] zh-CN: Add translation to Flathub package --- distribution/linux/openrct2.appdata.xml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/distribution/linux/openrct2.appdata.xml b/distribution/linux/openrct2.appdata.xml index 21fef703af..1e5a560f1f 100644 --- a/distribution/linux/openrct2.appdata.xml +++ b/distribution/linux/openrct2.appdata.xml @@ -30,6 +30,7 @@ Het OpenRCT2-team Zespół OpenRCT2 Equipe do OpenRCT2 + OpenRCT2团队 OpenRCT2團隊 openrct2.desktop @@ -152,6 +153,13 @@ “caixa de areia” deixa o jogador construir um parque mais flexível, opcionalmente sem restrições ou finanças.

+

+ OpenRCT2是《过山车大亨2》(RCT2)的开源重制版本。 + 游戏玩法围绕建造和维护一个游乐园展开,其中包括游乐项目、店铺和其他设施。 + 玩家需要尝试盈利并保持良好的游乐园声誉,同时让游客们满意。OpenRCT2同时支持 + 剧情模式和沙盒模式。剧情模式中,玩家需要在设定的时间限制内完成特定目标; + 而沙盒模式允许玩家选择不受限制或财务限制,更灵活地建造游乐园。 +

OpenRCT2為一個免費及開放原始碼的模擬樂園2(RCT2)重製版本. 遊戲方式圍繞著建造及經營內含遊樂設施, 店鋪及其他設施的主題樂園 @@ -199,6 +207,9 @@

O OpenRCT2 conta com muitas mudanças quando comparado ao jogo RollerCoaster Tycoon 2 original. Aqui são listadas algumas delas.

+

+ OpenRCT2对比原本的《过山车大亨2》(RCT2)有着很多改变。一些改变的例子如下。 +

OpenRCT2 對比原本的模擬樂園2(RCT2)有著很多改變. 一些改變的例子如下.

@@ -217,6 +228,7 @@
  • Thema’s voor de grafische interface.
  • Edycja motywów interfejsu użytkownika
  • Customização por temas da interface de usuário.
  • +
  • 自定义操作界面主题配色。
  • 自訂操作介面主題.
  • Fast-forwarding gameplay.
  • @@ -232,6 +244,7 @@
  • Tijd sneller laten verlopen.
  • Przyspieszanie rozgrywki
  • Dinâmica de jogo acelerável.
  • +
  • 快进游戏时间。
  • 快轉遊戲運作.
  • Multiplayer support.
  • @@ -247,6 +260,7 @@
  • Ondersteuning voor multiplayer.
  • Tryb wieloosobowy
  • Suporte multijogador.
  • +
  • 多人游戏支持。
  • 多人遊戲功能.
  • Multilingual. Improved translations.
  • @@ -262,6 +276,7 @@
  • In meerdere talen vertaald. Verbeterde vertalingen.
  • Wielojęzyczność i ulepszone tłumaczenia
  • Multilíngue. Traduções aperfeiçoadas.
  • +
  • 多语言,提升翻译质量。
  • 多語言. 翻譯改進.
  • OpenGL hardware rendering.
  • @@ -277,6 +292,7 @@
  • Hardwarerendering via OpenGL.
  • Obsługa renderowania OpenGL
  • Renderização por hardware OpenGL.
  • +
  • OpenGL硬件渲染。
  • OpenGL硬體渲染.
  • Various fixes and improvements for bugs in the original game.
  • @@ -292,6 +308,7 @@
  • Veel fixes en verbeteringen voor bugs die in het originele spel zaten.
  • Poprawki błędów i usprawnienia względem oryginalnej gry
  • Várias correções e melhorias para problemas no jogo original.
  • +
  • 众多针对原游戏的问题修复及改进。
  • 眾多對原遊戲的修復及改進.
  • Native support for Linux and macOS.
  • @@ -307,6 +324,7 @@
  • Ondersteunt Linux en macOS direct.
  • Natywna obsługa systemów Linux i macOS
  • Suporte nativo para Linux e macOS.
  • +
  • 对Linux和macOS的原生支持。
  • 對Linux and macOS的原生支援.
  • Added hacks and cheats.
  • @@ -322,6 +340,7 @@
  • Ingebouwde ondersteuning voor hacks en cheats.
  • Kody i hacki
  • Trapaças e hacks adicionados.
  • +
  • 新增作弊选项。
  • 新增及密技.
  • Auto-saving and giant screenshots.
  • @@ -337,6 +356,7 @@
  • Automatische backups. Screenshots van het hele park.
  • Autozapis i możliwość robienia ogromnych zrzutów ekranu
  • Salvamento automático e capturas de tela gigantes.
  • +
  • 自动存档和巨型截屏。
  • 自動儲存及巨型截圖.
  • @@ -379,6 +399,9 @@

    Arquivos dos jogos originais RollerCoaster Tycoon 2 ou RollerCoaster Tycoon Classic são necessários para jogar OpenRCT2.

    +

    + OpenRCT2需要《过山车大亨2》或《过山车大亨经典版》的原始游戏文件才能运行。 +

    OpenRCT2需要原本的模擬樂園2(RCT2)或RollerCoaster Tycoon Classic的遊戲檔案才能運行.

    @@ -399,6 +422,7 @@ Pretpark met een omgekeerde achtbaan, een wildwaterbaan en zelfgemaakt decor. Park rozrywki z odwróconą kolejką górską, spływem rwącą rzeką i niestandardową scenerią Parque de diversões que conta com uma montanha-russa invertida, corredeira de rio e cenários customizados + 一个设有悬吊式云霄飞车、激流勇进和自定义景物的主题乐园 一個附有懸吊式雲霄飛車. 一個激流船及自定義景物的主題樂園 From ec463164a2283ea285dbedce61a3e27aa0cab7a3 Mon Sep 17 00:00:00 2001 From: Britt Luttik <45373631+spaghetticat08@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:55:11 +0200 Subject: [PATCH 62/95] Fix track deletion confirmation prompt not being aligned vertically (#24783) Co-authored-by: Aaron van Geffen --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/TrackDesignManage.cpp | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index d1a6352b77..a511b4f821 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -4,6 +4,7 @@ - Feature: [#24702] [Plugin] Add bindings for missing cheats (forcedParkRating, ignoreRidePrice, makeAllDestructible). - Change: [#24730] Security guards now only walk slowly in crowded areas. - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. +- Fix: [#24611] The confirmation prompt for track file deletion is not vertically aligned. - Fix: [#24711] The map smoothing function only partially works for custom height map image files. - Fix: [#24773] The new ride window debug authors does not show the correct authors for non legacy ride objects. - Fix: [#24775] The scenery and new ride windows do not filter by file name or identifier correctly for non legacy objects. diff --git a/src/openrct2-ui/windows/TrackDesignManage.cpp b/src/openrct2-ui/windows/TrackDesignManage.cpp index 317cc4248a..58da1e9daf 100644 --- a/src/openrct2-ui/windows/TrackDesignManage.cpp +++ b/src/openrct2-ui/windows/TrackDesignManage.cpp @@ -230,11 +230,17 @@ namespace OpenRCT2::Ui::Windows { DrawWidgets(rt); + const auto titleBarBottom = widgets[WIDX_TITLE].bottom; + const auto buttonTop = widgets[WIDX_PROMPT_DELETE].top; + const auto fontHeight = FontGetLineHeight(FontStyle::Medium); + + const auto maxMessageHeight = buttonTop - titleBarBottom; + const auto messageTop = titleBarBottom + (maxMessageHeight - fontHeight) / 2; + auto ft = Formatter(); ft.Add(_trackDesignFileReference->name.c_str()); DrawTextWrapped( - rt, windowPos + ScreenCoordsXY{ (kWindowSizeDeletePrompt.width / 2), ((kWindowSizeDeletePrompt.height / 2) - 9) }, - (kWindowSizeDeletePrompt.width - 4), STR_ARE_YOU_SURE_YOU_WANT_TO_PERMANENTLY_DELETE_TRACK, ft, - { TextAlignment::CENTRE }); + rt, windowPos + ScreenCoordsXY{ width / 2, messageTop }, (width - 4), + STR_ARE_YOU_SURE_YOU_WANT_TO_PERMANENTLY_DELETE_TRACK, ft, { TextAlignment::CENTRE }); } } // namespace OpenRCT2::Ui::Windows From bbf4f0fd746f560c70ca9ceea9143073aa88f989 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Wed, 23 Jul 2025 06:47:12 -0300 Subject: [PATCH 63/95] Add Simplified Chinese translations to NSIS installer --- distribution/windows/install.nsi | 3 ++- .../windows/language/install_zh_cn.nsi | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 distribution/windows/language/install_zh_cn.nsi diff --git a/distribution/windows/install.nsi b/distribution/windows/install.nsi index b7a4b7fbdd..000227b551 100644 --- a/distribution/windows/install.nsi +++ b/distribution/windows/install.nsi @@ -128,7 +128,7 @@ ManifestDPIAware true ;!insertmacro MUI_LANGUAGE "Turkish" ;!insertmacro MUI_LANGUAGE "Ukrainian" ;!insertmacro MUI_LANGUAGE "Vietnamese" -;!insertmacro MUI_LANGUAGE "SimpChinese" +!insertmacro MUI_LANGUAGE "SimpChinese" ;!insertmacro MUI_LANGUAGE "TradChinese" !insertmacro MUI_RESERVEFILE_LANGDLL @@ -147,6 +147,7 @@ ManifestDPIAware true !include "language\install_pt.nsi" !include "language\install_ru.nsi" !include "language\install_sv.nsi" +!include "language\install_zh_cn.nsi" !macro Init thing uac_tryagain: diff --git a/distribution/windows/language/install_zh_cn.nsi b/distribution/windows/language/install_zh_cn.nsi new file mode 100644 index 0000000000..6155db4a3a --- /dev/null +++ b/distribution/windows/language/install_zh_cn.nsi @@ -0,0 +1,23 @@ +LangString ls32bitVersionOn64bitOS ${LANG_SIMPCHINESE} "您试图在64位操作系统上安装32位版OpenRCT2。我们不建议您这样做,但程序仍会以低性能运行。我们建议您下载正确的版本。您真的要继续吗?" +LangString ls64bitVersionOn32bitOS ${LANG_SIMPCHINESE} "您试图在32位操作系统上安装64位版OpenRCT2。程序将会无法运行。请下载正确的版本。您真的要继续吗?" +LangString lsBrandingText ${LANG_SIMPCHINESE} "OpenRCT2安装程序" +LangString lsCannotInstallToRCT2Dir ${LANG_SIMPCHINESE} "您不能将OpenRCT2与《过山车大亨 2》安装在同一目录下。" +LangString lsCannotInstallToRCTClassicDir ${LANG_SIMPCHINESE} "您不能将OpenRCT2与《过山车大亨经典版》安装在同一目录下。" +LangString lsComponentDescription ${LANG_SIMPCHINESE} "安装最精简版OpenRCT2。您必须安装过《过山车大亨 2》或《过山车大亨经典版》。" +LangString lsFinishPageLink ${LANG_SIMPCHINESE} "访问OpenRCT2网站了解更多信息" +LangString lsInstallerName ${LANG_SIMPCHINESE} "${APPNAMEANDVERSION} ${PLATFORM} 适用于 $(lsSupportedOS)" +LangString lsNewWindowsVersionOnOldWindows ${LANG_SIMPCHINESE} "您正试图在不带SP3的Windows 95、98、ME、2000或XP上安装 Windows XP SP3、Vista 及更新版本。程序将无法运行。请下载正确的版本。您真的要继续吗?" +LangString lsOldWindowsVersionOnNewWindows ${LANG_SIMPCHINESE} "您正尝试在Windows XP SP3、Vista或更新版本上安装不带SP3版本的Windows 95、98、2000 和 XP。我们不建议您这样做,但程序仍会以低性能运行。我们建议您下载正确的版本。您真的要继续吗?" +LangString lsOpenRCT2IsRunning ${LANG_SIMPCHINESE} "OpenRCT2正在运行。请关闭后重试。" +LangString lsRunNow ${LANG_SIMPCHINESE} "立即运行${APPNAMEANDVERSION}!" +LangString lsSupportedOS ${LANG_SIMPCHINESE} "Windows 7及更高版本" +LangString lsUACErrorDefault ${LANG_SIMPCHINESE} "无法获取权限,错误代码$0" +LangString lsUACError1062 ${LANG_SIMPCHINESE} "登录服务未运行,正在中止!" +LangString lsUACError1223 ${LANG_SIMPCHINESE} "${thing}需要管理员权限,正在中止!" +LangString lsUACRequiresElevation ${LANG_SIMPCHINESE} "${thing}需要管理员权限,请重试" +LangString lsUninstall ${LANG_SIMPCHINESE} "卸载${APPNAMEANDVERSION}" +LangString lsUpgradeNotice ${LANG_SIMPCHINESE} "欢迎使用${APPNAMEANDVERSION}安装程序。$\n这将允许您从$OLDVERSION版本升级。" +VIAddVersionKey /LANG=${LANG_SIMPCHINESE} "Comments" "安装${APPNAMEANDVERSION}" +VIAddVersionKey /LANG=${LANG_SIMPCHINESE} "CompanyName" "OpenRCT2开发者" +VIAddVersionKey /LANG=${LANG_SIMPCHINESE} "FileDescription" "安装${APPNAMEANDVERSION}" +VIAddVersionKey /LANG=${LANG_SIMPCHINESE} "ProductName" "OpenRCT2 ${PLATFORM}安装程序,适用于Windows 7及更高版本" \ No newline at end of file From 785c3df8f55158895dd147763b500c82521daa39 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Wed, 23 Jul 2025 06:47:29 -0300 Subject: [PATCH 64/95] Add Catalan translations to NSIS installer --- distribution/windows/install.nsi | 3 ++- distribution/windows/language/install_ca.nsi | 23 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 distribution/windows/language/install_ca.nsi diff --git a/distribution/windows/install.nsi b/distribution/windows/install.nsi index 000227b551..b89e4fcbb9 100644 --- a/distribution/windows/install.nsi +++ b/distribution/windows/install.nsi @@ -106,7 +106,7 @@ ManifestDPIAware true ; Only specify languages for which we actually have translations, because otherwise strings will show up blank. !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "Arabic" -;!insertmacro MUI_LANGUAGE "Catalan" +!insertmacro MUI_LANGUAGE "Catalan" !insertmacro MUI_LANGUAGE "Czech" ;!insertmacro MUI_LANGUAGE "Danish" !insertmacro MUI_LANGUAGE "German" @@ -134,6 +134,7 @@ ManifestDPIAware true !include "language\install_en.nsi" !include "language\install_ar.nsi" +!include "language\install_ca.nsi" !include "language\install_cs.nsi" !include "language\install_de.nsi" !include "language\install_es.nsi" diff --git a/distribution/windows/language/install_ca.nsi b/distribution/windows/language/install_ca.nsi new file mode 100644 index 0000000000..9a09972493 --- /dev/null +++ b/distribution/windows/language/install_ca.nsi @@ -0,0 +1,23 @@ +LangString ls32bitVersionOn64bitOS ${LANG_CATALAN} "Esteu intentant instal·lar la versió de 32 bits de l’OpenRCT2 en un sistema de 64 bits. No és recomanable, però funcionarà igualment encara que de manera menys eficient. Es recomana que descarregueu la versió de 64 bits. Esteu segur que voleu continuar?" +LangString ls64bitVersionOn32bitOS ${LANG_CATALAN} "Esteu intentant instal·lar la versió de 64 bits de l’OpenRCT2 en un sistema de 32 bits. El programa no funcionarà. Descarregueu i instal·leu la versió de 32 bits. Esteu segur que voleu continuar?" +LangString lsBrandingText ${LANG_CATALAN} "Instal·lador de l’OpenRCT2" +LangString lsCannotInstallToRCT2Dir ${LANG_CATALAN} "No podeu instal·lar l’OpenRCT2 a la mateixa carpeta del RollerCoaster Tycoon 2." +LangString lsCannotInstallToRCTClassicDir ${LANG_CATALAN} "No podeu instal·lar l’OpenRCT2 a la mateixa carpeta del RollerCoaster Tycoon Clàssic." +LangString lsComponentDescription ${LANG_CATALAN} "Instal·lació mínima de l’OpenRCT2. Heu de tenir instal·lat el RollerCoaster Tycoon 2 o el RollerCoaster Tycoon Clàssic." +LangString lsFinishPageLink ${LANG_CATALAN} "Visiteu el lloc de l’OpenRCT2 per a obtenir més informació" +LangString lsInstallerName ${LANG_CATALAN} "${APPNAMEANDVERSION} ${PLATFORM} per a $(lsSupportedOS)" +LangString lsNewWindowsVersionOnOldWindows ${LANG_CATALAN} "Esteu intentant instal·lar la versió per a Windows XP SP3, Vista o posterior en Windows 95, 98, ME, 2000 o XP (no SP3). No funcionarà. Descarregueu la versió correcta. Esteu segur que voleu continuar?" +LangString lsOldWindowsVersionOnNewWindows ${LANG_CATALAN} "Esteu intentant instal·lar la versió per a Windows 95, 98, 2000 i XP (no SP3) ehnWindows XP SP3, Vista o superior. No es recomana, però el programa funcionarà encara que amb unes capacitats reduïdes. Es recomana que descarregueu la versió correcta. Esteu segur que voleu continuar?" +LangString lsOpenRCT2IsRunning ${LANG_CATALAN} "L’OpenRCT2 s’està executant. Tanqueu-lo i torneu-ho a provar." +LangString lsRunNow ${LANG_CATALAN} "Executa ${APPNAMEANDVERSION} ara." +LangString lsSupportedOS ${LANG_CATALAN} "Windows 7 i posteriors" +LangString lsUACErrorDefault ${LANG_CATALAN} "No es pot elevar. Error $0" +LangString lsUACError1062 ${LANG_CATALAN} "El servei de Logon no s’executa. Es detén l’execució." +LangString lsUACError1223 ${LANG_CATALAN} "Aquest ${thing} requereix privilegis d’administrador. Es detén l’execució." +LangString lsUACRequiresElevation ${LANG_CATALAN} "Aquest ${thing} requereix privilegis d’administrador. Proveu-ho de nou." +LangString lsUninstall ${LANG_CATALAN} "Desinstal·la ${APPNAMEANDVERSION}" +LangString lsUpgradeNotice ${LANG_CATALAN} "Us donem la benvinguda a la configuració de l’${APPNAMEANDVERSION}.$\nUs permetrà actualitzar des de la versió $OLDVERSION." +VIAddVersionKey /LANG=${LANG_CATALAN} "Comments" "Instal·la l’${APPNAMEANDVERSION}" +VIAddVersionKey /LANG=${LANG_CATALAN} "CompanyName" "Desenvolupadors de l’OpenRCT2" +VIAddVersionKey /LANG=${LANG_CATALAN} "FileDescription" "Instal·la l’${APPNAMEANDVERSION}" +VIAddVersionKey /LANG=${LANG_CATALAN} "ProductName" "Instal·lador ${PLATFORM} per a Windows 7 o posterior" \ No newline at end of file From 92cf940b868e6a1f98b35c24b13129afd3126d46 Mon Sep 17 00:00:00 2001 From: mix <167040362+mixiate@users.noreply.github.com> Date: Wed, 23 Jul 2025 11:03:09 +0100 Subject: [PATCH 65/95] Fix #24785: Change scenery window filter to use filename instead of full path (#24786) --- src/openrct2-ui/windows/NewRide.cpp | 3 +-- src/openrct2-ui/windows/Scenery.cpp | 3 +-- src/openrct2/object/Object.h | 10 ++++++++++ src/openrct2/object/ObjectFactory.cpp | 12 ++++++++---- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 8c83da25aa..657ec4689d 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -791,8 +791,7 @@ namespace OpenRCT2::Ui::Windows bool IsFilterInFilename(const RideObject& rideObject) { - const auto* const repoItem = OpenRCT2::GetContext()->GetObjectRepository().FindObject(rideObject.GetIdentifier()); - return String::contains(repoItem->Path, _filter, true); + return String::contains(rideObject.GetFileName(), _filter, true); } void SetPressedTab() diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 3096d8b8e2..bc92b369b1 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -1366,8 +1366,7 @@ namespace OpenRCT2::Ui::Windows bool IsFilterInFilename(const Object& object) { - const auto* const repoItem = OpenRCT2::GetContext()->GetObjectRepository().FindObject(object.GetIdentifier()); - return String::contains(repoItem->Path, _filteredSceneryTab.Filter, true); + return String::contains(object.GetFileName(), _filteredSceneryTab.Filter, true); } void SortTabs() diff --git a/src/openrct2/object/Object.h b/src/openrct2/object/Object.h index 42788a3af2..9f2bed6d4f 100644 --- a/src/openrct2/object/Object.h +++ b/src/openrct2/object/Object.h @@ -197,6 +197,7 @@ private: bool _usesFallbackImages{}; bool _isCompatibilityObject{}; ImageIndex _baseImageId{ kImageIndexUndefined }; + std::string _fileName; protected: StringTable& GetStringTable() @@ -259,6 +260,15 @@ public: _descriptor = value; } + std::string_view GetFileName() const + { + return _fileName; + } + void SetFileName(const std::string_view fileName) + { + _fileName = fileName; + } + constexpr bool UsesFallbackImages() const { return _usesFallbackImages; diff --git a/src/openrct2/object/ObjectFactory.cpp b/src/openrct2/object/ObjectFactory.cpp index be91661350..84357b5b92 100644 --- a/src/openrct2/object/ObjectFactory.cpp +++ b/src/openrct2/object/ObjectFactory.cpp @@ -226,7 +226,8 @@ namespace OpenRCT2::ObjectFactory * @note jRoot is deliberately left non-const: json_t behaviour changes when const */ static std::unique_ptr CreateObjectFromJson( - IObjectRepository& objectRepository, json_t& jRoot, const IFileDataRetriever* fileRetriever, bool loadImageTable); + IObjectRepository& objectRepository, json_t& jRoot, const IFileDataRetriever* fileRetriever, bool loadImageTable, + const std::string_view path); static ObjectSourceGame ParseSourceGame(const std::string_view s) { @@ -277,6 +278,7 @@ namespace OpenRCT2::ObjectFactory { result = CreateObject(entry.GetType()); result->SetDescriptor(ObjectEntryDescriptor(entry)); + result->SetFileName(OpenRCT2::Path::GetFileNameWithoutExtension(path)); utf8 objectName[kDatNameLength + 1] = { 0 }; ObjectEntryGetNameFixed(objectName, sizeof(objectName), &entry); @@ -446,7 +448,7 @@ namespace OpenRCT2::ObjectFactory if (jRoot.is_object()) { auto fileDataRetriever = ZipDataRetriever(path, *archive); - return CreateObjectFromJson(objectRepository, jRoot, &fileDataRetriever, loadImages); + return CreateObjectFromJson(objectRepository, jRoot, &fileDataRetriever, loadImages, path); } } catch (const std::exception& e) @@ -465,7 +467,7 @@ namespace OpenRCT2::ObjectFactory { json_t jRoot = Json::ReadFromFile(path.c_str()); auto fileDataRetriever = FileSystemDataRetriever(Path::GetDirectory(path)); - return CreateObjectFromJson(objectRepository, jRoot, &fileDataRetriever, loadImages); + return CreateObjectFromJson(objectRepository, jRoot, &fileDataRetriever, loadImages, path); } catch (const std::runtime_error& err) { @@ -514,7 +516,8 @@ namespace OpenRCT2::ObjectFactory } std::unique_ptr CreateObjectFromJson( - IObjectRepository& objectRepository, json_t& jRoot, const IFileDataRetriever* fileRetriever, bool loadImageTable) + IObjectRepository& objectRepository, json_t& jRoot, const IFileDataRetriever* fileRetriever, bool loadImageTable, + const std::string_view path) { if (!jRoot.is_object()) { @@ -573,6 +576,7 @@ namespace OpenRCT2::ObjectFactory result->SetVersion(version); result->SetIdentifier(id); result->SetDescriptor(descriptor); + result->SetFileName(OpenRCT2::Path::GetFileNameWithoutExtension(path)); result->MarkAsJsonObject(); auto readContext = ReadObjectContext(objectRepository, id, loadImageTable, fileRetriever); result->ReadJson(&readContext, jRoot); From 64309259f00c10b4abb6a45126a93bc095fff61f Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Thu, 24 Jul 2025 04:14:50 +0000 Subject: [PATCH 66/95] Merge Localisation/master into OpenRCT2/develop --- data/language/ca-ES.txt | 6 +++--- data/language/cs-CZ.txt | 3 +++ data/language/es-ES.txt | 45 +++++++++++++++++++++++++++++++++++------ data/language/sv-SE.txt | 3 +++ 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/data/language/ca-ES.txt b/data/language/ca-ES.txt index 8d8d8d4619..5047c637f6 100644 --- a/data/language/ca-ES.txt +++ b/data/language/ca-ES.txt @@ -2238,8 +2238,8 @@ STR_3228 :Estableix la posició inicial dels visitants. STR_3229 :Els frens de bloc no es poden usar just després de l’estació. STR_3230 :No es poden usar dos frens de bloc consecutius. STR_3231 :Els frens de bloc no es poden usar directament després de la cadena d’elevació. -STR_3232 :Opcions - Finances -STR_3233 :Opcions - Visitants +STR_3232 :Opcions d’escenari - Finances +STR_3233 :Opcions d’escenari - Visitants STR_3235 :Mostra les opcions financeres. STR_3236 :Mostra les opcions dels visitants. STR_3238 :Sense diners @@ -2283,7 +2283,7 @@ STR_3279 :Entrada gratis / Atraccions de pagament STR_3280 :Entrada de pagament / Atraccions gratis STR_3281 :Preu de l’entrada: STR_3283 :Seleccioneu les atraccions protegides. Aquestes s’hauran de preservar i no es podran modificar. -STR_3285 :Atraccions protegides +STR_3285 :Opcions d’escenari - Atraccions protegides STR_3286 :Seleccioneu l’objectiu d’aquest escenari. STR_3287 :{WINDOW_COLOUR_2}Objectiu: STR_3294 :Canvia… diff --git a/data/language/cs-CZ.txt b/data/language/cs-CZ.txt index 3560b58494..9a25f63ba4 100644 --- a/data/language/cs-CZ.txt +++ b/data/language/cs-CZ.txt @@ -3831,3 +3831,6 @@ STR_6788 :Citlivost: STR_6789 :Násobitel citlivosti analogové páčky STR_6790 :Mrtvá zóna: {COMMA32}% STR_6791 :Citlivost: {COMMA32}% +STR_6792 :Budovy vstupů +STR_6793 :Návštěvníci a personál +STR_6794 :Kulisy a motivy diff --git a/data/language/es-ES.txt b/data/language/es-ES.txt index 49dfcd3999..710db66eb8 100644 --- a/data/language/es-ES.txt +++ b/data/language/es-ES.txt @@ -2236,8 +2236,8 @@ STR_3228 :Establecer posición inicial de las personas STR_3229 :El bloque de frenado no debe ser usado después de la estación. STR_3230 :El bloque de frenado no debe ser usado después de otro. STR_3231 :El bloque de frenado no debe ser usado después del final de la cadena de elevación. -STR_3232 :Opciones - Finanzas -STR_3233 :Opciones - Visitantes +STR_3232 :Opciones de Escenario - Finanzas +STR_3233 :Opciones de Escenario - Visitantes STR_3235 :Opciones de finanzas STR_3236 :Opciones de visitantes STR_3238 :Sin dinero @@ -2281,7 +2281,7 @@ STR_3279 :Entrada libre / Atracciones de pago STR_3280 :Pagar por entrar / Atracciones gratis STR_3281 :Precio de entrada: STR_3283 :Seleccionar atracciones a preservar -STR_3285 :Atracciones preservadas +STR_3285 :Opciones de Escenario - Atracciones preservadas STR_3286 :Seleccionar objetivos para este escenario STR_3287 :{WINDOW_COLOUR_2}Objetivo: STR_3294 :Cambiar… @@ -2512,7 +2512,7 @@ STR_5265 :Selecciona que contenidos son visibles STR_5266 :Gráficos STR_5267 :Idioma y unidades STR_5268 :Audio -STR_5269 :Interfaz y controles +STR_5269 :Controles STR_5270 :Otras opciones STR_5272 :Decorado pequeño STR_5273 :Decorado grande @@ -2654,7 +2654,7 @@ STR_5503 :Escribe el nombre del host o la IP: STR_5504 :Mostrar estado multijugador STR_5505 :No se pudo conectar al servidor. STR_5506 :Visitantes ignoran intensidad de atracc. -STR_5510 :Dispositivo de sonido predeterminado +STR_5510 :Dispositivo de sonido por defecto STR_5511 :(DESCONOCIDO) STR_5512 :Guardar Partida como… STR_5513 :Guardar juego de forma rápida @@ -3618,7 +3618,7 @@ STR_6575 :Permitir esquemas de colores especiales STR_6576 :Agrega colores especiales al menú desplegable de colores STR_6577 :Velocidad del freno bloqueante STR_6578 :Establece el límite de velocidad para los frenos bloqueantes. En el modo de sección de bloque, los frenos adyacentes con una velocidad más lenta se vinculan al freno bloqueante. -STR_6579 :Los frenos bloqueantes se establecerán a la velocidad predeterminada al guardarlos como diseño de vía. +STR_6579 :Los frenos bloqueantes se establecerán a la velocidad por defecto al guardarlos como diseño de vía. STR_6580 :Restablecer STR_6581 :¿Estás seguro de que quieres restablecer todos los atajos de teclado en esta pestaña? STR_6582 :Abrir ventana de atajos de teclado @@ -3784,3 +3784,36 @@ STR_6741 :{WINDOW_COLOUR_2}Num. atracciones: {BLACK}{UINT16} STR_6742 :{WINDOW_COLOUR_2}Num. visitantes: {BLACK}{UINT16} STR_6743 :Clima STR_6744 :{WINDOW_COLOUR_2}{UINT16}% +STR_6745 :{WINDOW_COLOUR_2}Preferencias de intensidad de los visitantes: +STR_6746 :Sin preferencias +STR_6747 :Las preferencias varían (por defecto) +STR_6748 :Solo atracciones menos intensas +STR_6749 :Solo atracciones más intensas +STR_6750 :Selecciona qué tipo de intensidad de atracción prefieren los nuevos visitantes. +STR_6751 :¡Las colas no pueden usarse como cruces a nivel! +STR_6752 :Opciones de Escenario - Objetivo +STR_6753 :Opciones de Escenario - Detalles del escenario +STR_6754 :Opciones de Escenario - Restricciones de terreno +STR_6755 :Mostrar opciones de objetivo +STR_6756 :Mostrar opciones de detalles del escenario +STR_6757 :Mostrar opciones de restricciones de terreno +STR_6758 :Opciones de préstamo +STR_6759 :Modelo de negocio +STR_6760 :Ganancias: +STR_6761 :Detalles del escenario +STR_6762 :Interfaz +STR_6763 :RollerCoaster Tycoon 1 +STR_6764 :Guardado y autoguardados +STR_6765 :Avanzado +STR_6766 :Limpiar +STR_6767 :Ventana +STR_6768 :Renderizado +STR_6769 :Comportamiento +STR_6770 :Límite de FPS: +STR_6771 :Velocidad interna (por defecto) +STR_6772 :Sincronización vertical +STR_6773 :Sin límite +STR_6774 :Tiempo desde la última inspección +STR_6775 :{COMMA16} minuto +STR_6776 :{COMMA16} minutos +STR_6777 :más de 4 horas \ No newline at end of file diff --git a/data/language/sv-SE.txt b/data/language/sv-SE.txt index c6d64648db..c96f8181fc 100644 --- a/data/language/sv-SE.txt +++ b/data/language/sv-SE.txt @@ -3834,3 +3834,6 @@ STR_6788 :Känslighet: STR_6789 :Känslighet multiplikator för analog spak STR_6790 :Dödzon: {COMMA32}% STR_6791 :Känslighet: {COMMA32}% +STR_6792 :Entrébyggnader +STR_6793 :Gäster och Personal +STR_6794 :Landskap och Teman From be8636fe4cfb8d24be93e371e6240a64a534edfc Mon Sep 17 00:00:00 2001 From: mix <167040362+mixiate@users.noreply.github.com> Date: Thu, 24 Jul 2025 09:17:48 +0100 Subject: [PATCH 67/95] Fix Air Powered Vertical Coaster top section tunnels (#24824) --- distribution/changelog.txt | 1 + src/openrct2/paint/track/coaster/AirPoweredVerticalCoaster.cpp | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index a511b4f821..2245255a2c 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -8,6 +8,7 @@ - Fix: [#24711] The map smoothing function only partially works for custom height map image files. - Fix: [#24773] The new ride window debug authors does not show the correct authors for non legacy ride objects. - Fix: [#24775] The scenery and new ride windows do not filter by file name or identifier correctly for non legacy objects. +- Fix: [#24824] The Air Powered Vertical Coaster top section track piece has vertical tunnels (original bug). 0.4.24 (2025-07-05) ------------------------------------------------------------------------ diff --git a/src/openrct2/paint/track/coaster/AirPoweredVerticalCoaster.cpp b/src/openrct2/paint/track/coaster/AirPoweredVerticalCoaster.cpp index eb74e1e168..da25723d9c 100644 --- a/src/openrct2/paint/track/coaster/AirPoweredVerticalCoaster.cpp +++ b/src/openrct2/paint/track/coaster/AirPoweredVerticalCoaster.cpp @@ -903,7 +903,6 @@ static void AirPoweredVerticalRCTrackVerticalTop( PaintAddImageAsParentRotated( session, direction, imageIdT, { 0, 0, height }, { { 33, 6, height }, { 2, 20, 1 } }); } - PaintUtilSetVerticalTunnel(session, height + 80); break; case 2: imageIdT = session.TrackColours.WithIndex(imageIds[direction][3]); @@ -917,7 +916,6 @@ static void AirPoweredVerticalRCTrackVerticalTop( PaintAddImageAsParentRotated( session, direction, imageIdT, { 0, 0, height }, { { 0, 6, height }, { 2, 20, 15 } }); } - PaintUtilSetVerticalTunnel(session, height + 80); break; case 3: imageIdS = session.SupportColours.WithIndex(imageIds[direction][4]); From 386bebe7003795757c83dca7682a749855ec94d7 Mon Sep 17 00:00:00 2001 From: mix <167040362+mixiate@users.noreply.github.com> Date: Thu, 24 Jul 2025 10:52:03 +0100 Subject: [PATCH 68/95] Fix River Rapids flat to gentle track piece tunnels (#24825) --- distribution/changelog.txt | 1 + src/openrct2/paint/track/water/RiverRapids.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 2245255a2c..2d678e5973 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -9,6 +9,7 @@ - Fix: [#24773] The new ride window debug authors does not show the correct authors for non legacy ride objects. - Fix: [#24775] The scenery and new ride windows do not filter by file name or identifier correctly for non legacy objects. - Fix: [#24824] The Air Powered Vertical Coaster top section track piece has vertical tunnels (original bug). +- Fix: [#24825] The River Rapids flat-to-gentle track piece tunnels are incorrect on the gentle side. 0.4.24 (2025-07-05) ------------------------------------------------------------------------ diff --git a/src/openrct2/paint/track/water/RiverRapids.cpp b/src/openrct2/paint/track/water/RiverRapids.cpp index 45784aa4bb..03d048f9ff 100644 --- a/src/openrct2/paint/track/water/RiverRapids.cpp +++ b/src/openrct2/paint/track/water/RiverRapids.cpp @@ -348,7 +348,8 @@ static void PaintRiverRapidsTrack25DegToFlatB( DrawSupportForSequenceA( session, supportType.wooden, 0, direction, height, session.SupportColours); - PaintUtilPushTunnelRotated(session, direction, height, kTunnelGroup, TunnelSubType::Flat); + const auto tunnelType = direction == 0 || direction == 3 ? TunnelSubType::Flat : TunnelSubType::SlopeEnd; + PaintUtilPushTunnelRotated(session, direction, height, kTunnelGroup, tunnelType); PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); PaintUtilSetGeneralSupportHeight(session, height + 48); From 420cea17aee77dbd71364aff9761c345dbd16b74 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Thu, 24 Jul 2025 12:24:10 +0200 Subject: [PATCH 69/95] Update objects to v1.7.2 --- CMakeLists.txt | 4 ++-- openrct2.deps.targets | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 157b42d358..232896479a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,9 +70,9 @@ set(TITLE_SEQUENCE_VERSION "0.4.14") set(TITLE_SEQUENCE_URL "https://github.com/OpenRCT2/title-sequences/releases/download/v${TITLE_SEQUENCE_VERSION}/title-sequences.zip") set(TITLE_SEQUENCE_SHA1 "6c04781b959b468e1f65ec2d2f21f5aaa5e5724d") -set(OBJECTS_VERSION "1.7.1") +set(OBJECTS_VERSION "1.7.2") set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v${OBJECTS_VERSION}/objects.zip") -set(OBJECTS_SHA1 "6bfcb5f8dbd87b049071088baba029d8215f969c") +set(OBJECTS_SHA1 "ab0f05744105528067c6403a9e837fb6a2c52f74") set(OPENSFX_VERSION "1.0.5") set(OPENSFX_URL "https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v${OPENSFX_VERSION}/opensound.zip") diff --git a/openrct2.deps.targets b/openrct2.deps.targets index 8f428cde8d..c58d5ba66b 100644 --- a/openrct2.deps.targets +++ b/openrct2.deps.targets @@ -218,8 +218,8 @@ 9984c1e317dcfb3aaf8e17f1db2ebb0f771e2373 https://github.com/OpenRCT2/title-sequences/releases/download/v0.4.14/title-sequences.zip 6c04781b959b468e1f65ec2d2f21f5aaa5e5724d - https://github.com/OpenRCT2/objects/releases/download/v1.7.1/objects.zip - 6bfcb5f8dbd87b049071088baba029d8215f969c + https://github.com/OpenRCT2/objects/releases/download/v1.7.2/objects.zip + ab0f05744105528067c6403a9e837fb6a2c52f74 https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.5/opensound.zip b1b1f1b241d2cbff63a1889c4dc5a09bdf769bfb https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6/openmusic.zip From 0c8ea41c6d328bd66541ca2fbc1cf80760e2d72f Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Thu, 24 Jul 2025 12:35:27 +0200 Subject: [PATCH 70/95] Update distribution/changelog.txt --- distribution/changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 91455b5ee0..6b02ddcf8c 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -5,7 +5,7 @@ - Change: [#24730] Security guards now only walk slowly in crowded areas. - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. - Fix: [#24711] The map smoothing function only partially works for custom height map image files. -- Fix: [#24761] Reliability bar in the ride inspector now acts consistently with the Down-Time bar, it no longer has a minimum value of 10. +- Fix: [#24761] The reliability bar in the ride window visually does not go below 10%. - Fix: [#24773] The new ride window debug authors does not show the correct authors for non legacy ride objects. - Fix: [#24775] The scenery and new ride windows do not filter by file name or identifier correctly for non legacy objects. From cacf35205945e800cc405bb77dab7f05ab07aac7 Mon Sep 17 00:00:00 2001 From: mix <167040362+mixiate@users.noreply.github.com> Date: Thu, 24 Jul 2025 13:34:54 +0100 Subject: [PATCH 71/95] Fix Junior Roller Coaster flat to steep tunnels (#24826) --- distribution/changelog.txt | 1 + .../paint/track/coaster/JuniorRollerCoaster.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 2d678e5973..9fc91d67c8 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -10,6 +10,7 @@ - Fix: [#24775] The scenery and new ride windows do not filter by file name or identifier correctly for non legacy objects. - Fix: [#24824] The Air Powered Vertical Coaster top section track piece has vertical tunnels (original bug). - Fix: [#24825] The River Rapids flat-to-gentle track piece tunnels are incorrect on the gentle side. +- Fix: [#24826] The Junior Roller Coaster flat-to-steep track piece tunnels are incorrect. 0.4.24 (2025-07-05) ------------------------------------------------------------------------ diff --git a/src/openrct2/paint/track/coaster/JuniorRollerCoaster.cpp b/src/openrct2/paint/track/coaster/JuniorRollerCoaster.cpp index c30bd67991..442f263a49 100644 --- a/src/openrct2/paint/track/coaster/JuniorRollerCoaster.cpp +++ b/src/openrct2/paint/track/coaster/JuniorRollerCoaster.cpp @@ -5592,7 +5592,7 @@ static void JuniorRCFlatTo60DegUpPaintSetup( switch (direction) { case 0: - PaintUtilPushTunnelLeft(session, height, kTunnelGroup, TunnelSubType::SlopeStart); + PaintUtilPushTunnelLeft(session, height, kTunnelGroup, TunnelSubType::Flat); break; case 1: PaintUtilPushTunnelRight(session, height + 24, kTunnelGroup, TunnelSubType::SlopeEnd); @@ -5601,7 +5601,7 @@ static void JuniorRCFlatTo60DegUpPaintSetup( PaintUtilPushTunnelLeft(session, height + 24, kTunnelGroup, TunnelSubType::SlopeEnd); break; case 3: - PaintUtilPushTunnelRight(session, height, kTunnelGroup, TunnelSubType::SlopeStart); + PaintUtilPushTunnelRight(session, height, kTunnelGroup, TunnelSubType::Flat); break; } @@ -5655,16 +5655,16 @@ static void JuniorRC60DegUpToFlatPaintSetup( switch (direction) { case 0: - PaintUtilPushTunnelLeft(session, height, kTunnelGroup, TunnelSubType::SlopeStart); + PaintUtilPushTunnelLeft(session, height - 8, kTunnelGroup, TunnelSubType::SlopeStart); break; case 1: - PaintUtilPushTunnelRight(session, height + 24, kTunnelGroup, TunnelSubType::SlopeEnd); + PaintUtilPushTunnelRight(session, height + 24, kTunnelGroup, TunnelSubType::Flat); break; case 2: - PaintUtilPushTunnelLeft(session, height + 24, kTunnelGroup, TunnelSubType::SlopeEnd); + PaintUtilPushTunnelLeft(session, height + 24, kTunnelGroup, TunnelSubType::Flat); break; case 3: - PaintUtilPushTunnelRight(session, height, kTunnelGroup, TunnelSubType::SlopeStart); + PaintUtilPushTunnelRight(session, height - 8, kTunnelGroup, TunnelSubType::SlopeStart); break; } From 975b64a7fd3a3bd779eda40a09f4d6336cb1dc9c Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Thu, 24 Jul 2025 20:12:35 +0200 Subject: [PATCH 72/95] Fix custom RCT1 scenarios potentially being confused with official ones (#24832) --- distribution/changelog.txt | 1 + src/openrct2/rct1/S4Importer.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 0e2d3d96af..618fe77217 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -13,6 +13,7 @@ - Fix: [#24824] The Air Powered Vertical Coaster top section track piece has vertical tunnels (original bug). - Fix: [#24825] The River Rapids flat-to-gentle track piece tunnels are incorrect on the gentle side. - Fix: [#24826] The Junior Roller Coaster flat-to-steep track piece tunnels are incorrect. +- Fix: [#24831] Park names are being overwritten for custom RCT1 scenarios that use competition id slots. 0.4.24 (2025-07-05) ------------------------------------------------------------------------ diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 94832290fa..f8dc1b4e48 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2424,7 +2424,14 @@ namespace OpenRCT2::RCT1 if (scNumber != -1) { SourceDescriptor desc; - if (ScenarioSources::TryGetById(scNumber, &desc) && !desc.textObjectId.empty()) + // If no entry is found, this is a custom scenario + bool isOfficial = ScenarioSources::TryGetById(_s4.ScenarioSlotIndex, &desc); + + // Perform an additional name check if this is detected to be a competition scenario + if (isOfficial && desc.category == ScenarioCategory::competitions) + isOfficial = ScenarioSources::TryGetByName(_s4.ScenarioName, &desc); + + if (isOfficial && !desc.textObjectId.empty()) { auto& objManager = GetContext()->GetObjectManager(); From 5eaeaf3c9566d438b468dea1603077b5766bfcfd Mon Sep 17 00:00:00 2001 From: mix <167040362+mixiate@users.noreply.github.com> Date: Thu, 24 Jul 2025 21:19:14 +0100 Subject: [PATCH 73/95] Fix the pattern of long grass being different to RCT1 and 2 (#24829) --- distribution/changelog.txt | 1 + src/openrct2/object/TerrainSurfaceObject.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 618fe77217..1744eb5d7f 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -13,6 +13,7 @@ - Fix: [#24824] The Air Powered Vertical Coaster top section track piece has vertical tunnels (original bug). - Fix: [#24825] The River Rapids flat-to-gentle track piece tunnels are incorrect on the gentle side. - Fix: [#24826] The Junior Roller Coaster flat-to-steep track piece tunnels are incorrect. +- Fix: [#24829] The pattern of long grass across tiles is different to RCT1 and RCT2. - Fix: [#24831] Park names are being overwritten for custom RCT1 scenarios that use competition id slots. 0.4.24 (2025-07-05) diff --git a/src/openrct2/object/TerrainSurfaceObject.cpp b/src/openrct2/object/TerrainSurfaceObject.cpp index 2ba27a7450..e224f1c428 100644 --- a/src/openrct2/object/TerrainSurfaceObject.cpp +++ b/src/openrct2/object/TerrainSurfaceObject.cpp @@ -157,7 +157,7 @@ ImageId TerrainSurfaceObject::GetImageId( } TileCoordsXY tilePos(position); - uint8_t variation = ((tilePos.x << 1) & 0b10) | (tilePos.y & 0b01); + const uint8_t variation = (tilePos.x & 0b01) | ((tilePos.y << 1) & 0b10); // Look for a matching special for (const SpecialEntry& special : entries) From 815f75f02de49165d96161f32240dd012ab019b3 Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Fri, 25 Jul 2025 04:14:45 +0000 Subject: [PATCH 74/95] Merge Localisation/master into OpenRCT2/develop --- data/language/cs-CZ.txt | 40 ++++++++++++++++++++-------------------- data/language/es-ES.txt | 19 ++++++++++++++++++- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/data/language/cs-CZ.txt b/data/language/cs-CZ.txt index 9a25f63ba4..3d9da1a01b 100644 --- a/data/language/cs-CZ.txt +++ b/data/language/cs-CZ.txt @@ -183,7 +183,7 @@ STR_0602 :Horská dráha s vozy poháněnými elektromotorem, které sviští STR_0603 :Dřevěná horská dráha s ocelovými kolejemi, umožňující strmé přepady a obraty. STR_0604 :Jezdci jedou v jednom radě na úzké, jednokolejové dráze, při závodě úzkými obrátkami a změnami směru. STR_0605 :Jezdci se kloužou zauzlenou ocelovou drahou, ovládají brzdy a tím svou rychlost -STR_0606 :Dřevěná horská dráha staršího stylu s drsnou a rychlou jízdou, koupou času ve vzduchu, bočným přetížením, navržená pro pocit ‘ztracené kontroly’ +STR_0606 :Dřevěná horská dráha staršího stylu s drsnou a rychlou jízdou, koupou času ve vzduchu, bočným přetížením, navržená pro pocit „ztracené kontroly„“ STR_0607 :Intenzivní horská dráha staršího stylu, na které návštěvníci jedou vestoje STR_0608 :Vozy poháněné lineárními synchronními elektromotory sviští skrze těsné vývrtky a zatáčky STR_0609 :Dřevěná horská dráha staršího stylu s drsnou a rychlou jízdou, kloubovými vozy, spoustou času ve vzduchu a zakroucenou dráhou @@ -342,9 +342,9 @@ STR_0943 :Průhledná výzdoba STR_0944 :Uložit STR_0945 :Neukládat STR_0946 :Zrušit -STR_0947 :Uložit před zavřením ? -STR_0948 :Uložit před ukončením ? -STR_0949 :Uložit před ukončením ? +STR_0947 :Uložit před zavřením? +STR_0948 :Uložit před ukončením? +STR_0949 :Uložit před ukončením? STR_0950 :Nahrát hru STR_0951 :Ukončit hru STR_0952 :Ukončit hru @@ -1865,20 +1865,20 @@ STR_2524 :Snímek obrazovky STR_2533 :Backspace STR_2534 :Tab STR_2537 :Clear -STR_2538 :Return +STR_2538 :Enter STR_2543 :Alt/Menu STR_2544 :Pause STR_2545 :Caps STR_2552 :Escape -STR_2557 :Spacebar +STR_2557 :Mezerník STR_2558 :PgUp STR_2559 :PgDn STR_2560 :End STR_2561 :Home -STR_2562 :Left -STR_2563 :Up -STR_2564 :Right -STR_2565 :Down +STR_2562 :Vlevo +STR_2563 :Nahoru +STR_2564 :Doprava +STR_2565 :Dolů STR_2566 :Select STR_2567 :Print STR_2568 :Execute @@ -2047,7 +2047,7 @@ STR_2850 :Nový návrh tratě úspěšně nainstalován STR_2851 :Scénář už je nainstalovaný STR_2852 :Návrh trati už je nainstalován STR_2853 :Zakázáno místní správnou! -STR_2854 :{RED}Návštěvníci nemohou najít vstup do {STRINGID} !{NEWLINE}Postavte cestu k vstupu +STR_2854 :{RED}Návštěvníci nemohou najít vstup do {STRINGID}!{NEWLINE}Postavte cestu k vstupu STR_2855 :{RED}{STRINGID} nemá postavenou vestu z východu!{NEWLINE}Postavte cestu z východu atrakce STR_2858 :Nelze zahájit reklamní kampaň… STR_2861 :{WINDOW_COLOUR_2}Licencováno Infogrames Interactive Inc. @@ -2347,7 +2347,7 @@ STR_3353 :Nový název obsahuje neplatné znaky STR_3354 :Existuje soubor se stejným jménem, nebo je soubor jen pro čtení STR_3355 :Soubor je jen pro čtení, nebo zamčený STR_3356 :Smazat soubor -STR_3357 :{WINDOW_COLOUR_2}Opravdu chcete nevratně odstranit {STRING} ? +STR_3357 :{WINDOW_COLOUR_2}Opravdu chcete nevratně odstranit {STRING}? STR_3358 :Nelze odstranit návrh trati… STR_3359 :{BLACK}Žádné návrhy tratí tohoto typu STR_3360 :Pozor! @@ -2814,7 +2814,7 @@ STR_5705 :Nelze nastavit tuto skupinu STR_5706 :Nelze odebrat skupinu, ke které hráč patří STR_5707 :Tato skupina nemůže být upravena STR_5708 :Nelze odebrat skupinu, ke které patří zakladatel hry -STR_5709 :Přejmenovat skupinu +STR_5709 :Přejmen. skup. STR_5710 :Název skupiny STR_5711 :Zadejte nový název skupiny: STR_5712 :Nelze upravit oprávnění, které nemáte @@ -3123,7 +3123,7 @@ STR_6028 :Stavba - postavit aktivní část STR_6029 :Stavba - odebrat aktivní část STR_6030 :Výběr kulis. Klikněte na jakoukoliv kulisu na mapě pro postavení její kopie. STR_6031 :Popis serveru: -STR_6032 :Uvítací zpráva serveru: +STR_6032 :Uvítací zpráva serv.: STR_6033 :Cesta k RCT1 instalaci: STR_6034 :{BLACK}{STRING} STR_6035 :Prosím vyberte složku s RCT1 @@ -3435,8 +3435,8 @@ STR_6392 :Ve zvolené složce se nepodařilo nalézt {STRING}. STR_6393 :Výběr cíle STR_6394 :Cíl STR_6395 :Údržba -STR_6396 :Vypnout šetřič a úsporu energie monitoru -STR_6397 :{SMALLFONT}{BLACK}Při zvolení, šetřič obrazovky a funkce úspory energie monitoru budou pozastaveny pokud je OpenRCT2 spuštěno. +STR_6396 :Vypnout spořič a úsporu energie monitoru +STR_6397 :{SMALLFONT}{BLACK}Při zaškrtnutí budou spořič obrazovky a funkce úspory energie monitoru pozastaveny pokud je OpenRCT2 spuštěno. STR_6398 :Soubor obsahuje nepodporované atrakce. Prosím aktualizujte na novější verzi OpenRCT2. STR_6399 :OpenRCT2 vyžaduje k fungování soubory původního RollerCoaster Tycoon 2. Nastavte “game_path” hodnotu v config.ini na složku instalace RollerCoaster Tycoon 2, poté restartujte OpenRCT2. STR_6400 :Mám stažený GOG offline instalátor pro RollerCoaster Tycoon 2, ale není nainstalován @@ -3447,9 +3447,9 @@ STR_6404 :Prosím vyberte GOG RollerCoaster Tycoon 2 instalátor. STR_6405 :Vyberte GOG Instalátor STR_6406 :GOG RollerCoaster Tycoon 2 Instalátor STR_6407 :Tohle může zabrat několik minut. -STR_6408 :Prosím nainstalujte “innoextract” pro extrakci GOG Instalátoru, pak restartujte OpenRCT2. +STR_6408 :Prosím nainstalujte „innoextract“ pro extrakci GOG Instalátoru, pak restartujte OpenRCT2. STR_6409 :Vybraný soubor není offline GOG Instalátor pro RollerCoaster Tycoon 2. Možná jste stáhnuli GOG Galaxy stahovací základ nebo vybrali špatný soubor. -STR_6410 :Přiblížit /Oddálit +STR_6410 :Přiblížit / Oddálit STR_6411 :Zobrazit tlačítka přiblížení a oddálení na nástrojové liště STR_6412 :Číselník Enter STR_6413 :Shift @@ -3661,7 +3661,7 @@ STR_6619 :Tento typ objektu nelze omezit! STR_6620 :Objekt nenalezen! STR_6621 :Omezit STR_6622 :Omezit objekt na Editor scénáře a Sandbox. -STR_6623 :Napište ‘help’ pro zobrazení seznamu dostupných příkazů. Napište ‘hide’ to hide the console. +STR_6623 :Napište „help“ pro zobrazení seznamu dostupných příkazů. Napište „hide“ to hide the console. STR_6624 :Průzkumník dlaždic: Seřadit elementy STR_6625 :Neplatná barva STR_6626 :Animace je obrácená @@ -3693,7 +3693,7 @@ STR_6651 :{STRING} ({COMMA32}%) STR_6652 :Okno s chybou STR_6653 :Zobrazení všech zdrojů STR_6654 :Zobrazení {POP16}{UINT16} zdrojů -STR_6655 :Pouze ‘{POP16}{STRINGID}’ +STR_6655 :Pouze „{POP16}{STRINGID}“ STR_6656 :Odstraní všechny ploty okolo parku STR_6657 :Nevlastněné pozemky STR_6658 :Nastavit pozemky na nevlastněné parkem, bez možnosti zakoupení diff --git a/data/language/es-ES.txt b/data/language/es-ES.txt index 710db66eb8..237766cfd6 100644 --- a/data/language/es-ES.txt +++ b/data/language/es-ES.txt @@ -3816,4 +3816,21 @@ STR_6773 :Sin límite STR_6774 :Tiempo desde la última inspección STR_6775 :{COMMA16} minuto STR_6776 :{COMMA16} minutos -STR_6777 :más de 4 horas \ No newline at end of file +STR_6777 :más de 4 horas +STR_6778 :Previsualizar escenarios usando: +STR_6779 :Selecciona el tipo de imagen de previsualización para usar en la pantalla de selección de escenarios. +STR_6780 :Mini mapas +STR_6781 :Capturas de pantalla +STR_6782 :Notificaciones de parque +STR_6783 :Notificaciones de atracciones +STR_6784 :Notificaciones de visitantes +STR_6785 :Mando +STR_6786 :Zona muerta: +STR_6787 :Zona muerta del stick analógico (movimiento mínimo requerido) +STR_6788 :Sensibilidad: +STR_6789 :Multiplicador de la sensibilidad del stick analógico +STR_6790 :Zona muerta: {COMMA32}% +STR_6791 :Sensibilidad: {COMMA32}% +STR_6792 :Edificios de entrada +STR_6793 :Visitantes y personal +STR_6794 :Decoración y temas \ No newline at end of file From 3c52205810af3aca81f0a9a06e1b4d635da35655 Mon Sep 17 00:00:00 2001 From: AuraSpecs Date: Fri, 25 Jul 2025 10:43:48 +0200 Subject: [PATCH 75/95] Update OpenMSX and OpenSFX --- CMakeLists.txt | 8 ++++---- distribution/changelog.txt | 1 + openrct2.deps.targets | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 232896479a..a28253b2d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,13 +74,13 @@ set(OBJECTS_VERSION "1.7.2") set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v${OBJECTS_VERSION}/objects.zip") set(OBJECTS_SHA1 "ab0f05744105528067c6403a9e837fb6a2c52f74") -set(OPENSFX_VERSION "1.0.5") +set(OPENSFX_VERSION "1.0.6") set(OPENSFX_URL "https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v${OPENSFX_VERSION}/opensound.zip") -set(OPENSFX_SHA1 "b1b1f1b241d2cbff63a1889c4dc5a09bdf769bfb") +set(OPENSFX_SHA1 "e8b6f24b3fb9d1ed5dc27022a50aaea98923d872") -set(OPENMSX_VERSION "1.6") +set(OPENMSX_VERSION "1.6.1") set(OPENMSX_URL "https://github.com/OpenRCT2/OpenMusic/releases/download/v${OPENMSX_VERSION}/openmusic.zip") -set(OPENMSX_SHA1 "ba170fa6d777b309c15420f4b6eb3fa25082a9d1") +set(OPENMSX_SHA1 "5168c852b1a10b623c10f0ff2a590ba494df4edb") set(REPLAYS_VERSION "0.0.89") set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v${REPLAYS_VERSION}/replays.zip") diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 1744eb5d7f..d6e0baab10 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -3,6 +3,7 @@ - Feature: [#24468] [Plugin] Add awards to plugin API. - Feature: [#24702] [Plugin] Add bindings for missing cheats (forcedParkRating, ignoreRidePrice, makeAllDestructible). - Improved: [#24812] Taiwan Park has been added to the Extras tab if it is present. +- Improved: [OpenSFX#12] Add Brake Fix, Buy and Dinghy Slide running sounds. - Change: [#24730] Security guards now only walk slowly in crowded areas. - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. - Fix: [#24611] The confirmation prompt for track file deletion is not vertically aligned. diff --git a/openrct2.deps.targets b/openrct2.deps.targets index c58d5ba66b..6e3737f91b 100644 --- a/openrct2.deps.targets +++ b/openrct2.deps.targets @@ -220,10 +220,10 @@ 6c04781b959b468e1f65ec2d2f21f5aaa5e5724d https://github.com/OpenRCT2/objects/releases/download/v1.7.2/objects.zip ab0f05744105528067c6403a9e837fb6a2c52f74 - https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.5/opensound.zip - b1b1f1b241d2cbff63a1889c4dc5a09bdf769bfb - https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6/openmusic.zip - ba170fa6d777b309c15420f4b6eb3fa25082a9d1 + https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.6/opensound.zip + e8b6f24b3fb9d1ed5dc27022a50aaea98923d872 + https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6.1/openmusic.zip + 5168c852b1a10b623c10f0ff2a590ba494df4edb https://github.com/OpenRCT2/replays/releases/download/v0.0.89/replays.zip 089CB8EEA76A98028367FDDE72675E9309AB9036 From 87a9e7888ff5530a35321138f7951e22eb3249f6 Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Sat, 26 Jul 2025 04:12:56 +0000 Subject: [PATCH 76/95] Merge Localisation/master into OpenRCT2/develop --- data/language/cs-CZ.txt | 5 +++++ data/language/hu-HU.txt | 5 +++++ data/language/ko-KR.txt | 5 +++++ data/language/pt-BR.txt | 5 +++++ data/language/ru-RU.txt | 5 +++++ 5 files changed, 25 insertions(+) diff --git a/data/language/cs-CZ.txt b/data/language/cs-CZ.txt index 3d9da1a01b..ece343b36b 100644 --- a/data/language/cs-CZ.txt +++ b/data/language/cs-CZ.txt @@ -3834,3 +3834,8 @@ STR_6791 :Citlivost: {COMMA32}% STR_6792 :Budovy vstupů STR_6793 :Návštěvníci a personál STR_6794 :Kulisy a motivy +STR_6795 :{MOVE_X}{10}{STRINGID} +STR_6796 :•{MOVE_X}{10}{STRINGID} +STR_6797 :Bez náhledu +STR_6798 :Snímek obr. +STR_6799 :Mini mapa diff --git a/data/language/hu-HU.txt b/data/language/hu-HU.txt index 62153a16c3..98f99bdb89 100644 --- a/data/language/hu-HU.txt +++ b/data/language/hu-HU.txt @@ -3831,3 +3831,8 @@ STR_6791 :Érzékenység: {COMMA32}% STR_6792 :Bejárati épületek STR_6793 :Vendégek és személyzet STR_6794 :Díszletek és témák +STR_6795 :{MOVE_X}{10}{STRINGID} +STR_6796 :•{MOVE_X}{10}{STRINGID} +STR_6797 :Nincs előnézet +STR_6798 :Képernyőkép +STR_6799 :Mini térkép diff --git a/data/language/ko-KR.txt b/data/language/ko-KR.txt index 05259967b4..58e95bebe4 100644 --- a/data/language/ko-KR.txt +++ b/data/language/ko-KR.txt @@ -3833,3 +3833,8 @@ STR_6791 :민감도: {COMMA32}% STR_6792 :놀이공원 출입구 STR_6793 :손님과 직원 STR_6794 :풍경과 테마 +STR_6795 :{MOVE_X}{10}{STRINGID} +STR_6796 :•{MOVE_X}{10}{STRINGID} +STR_6797 :미리보기 없음 +STR_6798 :스크린 샷 +STR_6799 :미니 맵 diff --git a/data/language/pt-BR.txt b/data/language/pt-BR.txt index 6717953e8e..d93e8c8a2c 100644 --- a/data/language/pt-BR.txt +++ b/data/language/pt-BR.txt @@ -3830,3 +3830,8 @@ STR_6791 :Sensibilidade: {COMMA32}% STR_6792 :Edifícios de entrada STR_6793 :Visitantes e funcionários STR_6794 :Cenários e Temas +STR_6795 :{MOVE_X}{10}{STRINGID} +STR_6796 :•{MOVE_X}{10}{STRINGID} +STR_6797 :Sem pré-visualização +STR_6798 :Captura de tela +STR_6799 :Mini mapa diff --git a/data/language/ru-RU.txt b/data/language/ru-RU.txt index c7fafb4162..2d39f21e01 100644 --- a/data/language/ru-RU.txt +++ b/data/language/ru-RU.txt @@ -3819,3 +3819,8 @@ STR_6791 :Чувствительность: {COMMA32}% STR_6792 :Здания входа STR_6793 :Гости и сотрудники STR_6794 :Пейзаж и темы +STR_6795 :{MOVE_X}{10}{STRINGID} +STR_6796 :•{MOVE_X}{10}{STRINGID} +STR_6797 :Отключить +STR_6798 :Скриншот +STR_6799 :Мини-карта From 8292885ea2c427908305b4c82a6bed549aa7643c Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Sun, 27 Jul 2025 04:17:32 +0000 Subject: [PATCH 77/95] Merge Localisation/master into OpenRCT2/develop --- data/language/eo-ZZ.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/data/language/eo-ZZ.txt b/data/language/eo-ZZ.txt index 80cb47b6aa..92e4af76df 100644 --- a/data/language/eo-ZZ.txt +++ b/data/language/eo-ZZ.txt @@ -3827,3 +3827,11 @@ STR_6788 :Sentemo: STR_6789 :Sentema obligilo de stirstango STR_6790 :Morta zono: {COMMA32}% STR_6791 :Sentemo: {COMMA32}% +STR_6792 :Enirejo-Konstruaĵoj +STR_6793 :Gastoj kaj Dungitaro +STR_6794 :Pejzaĝo kaj Temoj +STR_6795 :{MOVE_X}{10}{STRINGID} +STR_6796 :•{MOVE_X}{10}{STRINGID} +STR_6797 :Neniu antaŭrigardo +STR_6798 :Ekrankopio +STR_6799 :Eta mapo From f8865469cbb09941e95c5bbbea5e01c199e1dd01 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Sun, 27 Jul 2025 11:07:46 -0500 Subject: [PATCH 78/95] emscripten: increase STACK_SIZE to 8mb (#24840) --- scripts/build-emscripten | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-emscripten b/scripts/build-emscripten index badf742fc6..a1c54af707 100755 --- a/scripts/build-emscripten +++ b/scripts/build-emscripten @@ -25,7 +25,7 @@ emcmake cmake ../ \ -DICU_DT_LIBRARY_RELEASE="$ICU_ROOT/stubdata/libicudata.so" \ -DLIBZIP_LIBRARIES="$LIBZIP_ROOT/build/lib/libzip.a" \ -DEMSCRIPTEN_FLAGS="-s USE_SDL=2 -s USE_BZIP2=1 -s USE_LIBPNG=1 -pthread -O3" \ - -DEMSCRIPTEN_LDFLAGS="-Wno-pthreads-mem-growth -s SAFE_HEAP=0 -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s INITIAL_MEMORY=2GB -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -s PTHREAD_POOL_SIZE=120 -pthread -s EXPORTED_RUNTIME_METHODS=ccall,FS,callMain,UTF8ToString,stringToNewUTF8 -lidbfs.js --use-preload-plugins -s MODULARIZE=1 -s 'EXPORT_NAME=\"OPENRCT2_WEB\"'" + -DEMSCRIPTEN_LDFLAGS="-Wno-pthreads-mem-growth -s SAFE_HEAP=0 -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s INITIAL_MEMORY=2GB -s STACK_SIZE=8388608 -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -s PTHREAD_POOL_SIZE=120 -pthread -s EXPORTED_RUNTIME_METHODS=ccall,FS,callMain,UTF8ToString,stringToNewUTF8 -lidbfs.js --use-preload-plugins -s MODULARIZE=1 -s 'EXPORT_NAME=\"OPENRCT2_WEB\"'" emmake ninja From 19035ec2ebef818756472e476566e5587379c53e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=AD=C5=A1a=20Szlachta?= Date: Sun, 27 Jul 2025 18:25:03 +0200 Subject: [PATCH 79/95] Fix unlocalized word for conjunction when having multiple shortcuts for the same action (#24838) * create STR_7000: "or" * declare STR_OR * enable localisation via LanguageGetString() * Update ShortcutManager.cpp * Update changelog.txt --------- Co-authored-by: Tulio Leao --- data/language/en-GB.txt | 1 + distribution/changelog.txt | 1 + src/openrct2-ui/UiStringIds.h | 1 + src/openrct2-ui/input/ShortcutManager.cpp | 6 ++++-- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 6b8c3e6c30..01bcb7a1db 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3838,3 +3838,4 @@ STR_6796 :•{MOVE_X}{10}{STRINGID} STR_6797 :No preview STR_6798 :Screenshot STR_6799 :Mini map +STR_7000 :or diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 38cdb34b1f..00e88b7ca4 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -18,6 +18,7 @@ - Fix: [#24826] The Junior Roller Coaster flat-to-steep track piece tunnels are incorrect. - Fix: [#24829] The pattern of long grass across tiles is different to RCT1 and RCT2. - Fix: [#24831] Park names are being overwritten for custom RCT1 scenarios that use competition id slots. +- Fix: [#24838] Not using localized word for conjunction when having multiple shortcuts for the same action. 0.4.24 (2025-07-05) ------------------------------------------------------------------------ diff --git a/src/openrct2-ui/UiStringIds.h b/src/openrct2-ui/UiStringIds.h index d8c2c4532a..574890bc31 100644 --- a/src/openrct2-ui/UiStringIds.h +++ b/src/openrct2-ui/UiStringIds.h @@ -274,6 +274,7 @@ namespace OpenRCT2 STR_SHORTCUT_WINDOWED_MODE_TOGGLE = 5806, STR_SHORTCUT_ZOOM_VIEW_IN = 2498, STR_SHORTCUT_ZOOM_VIEW_OUT = 2497, + STR_OR = 7000, // Widgets STR_CLOSE_X = 824, diff --git a/src/openrct2-ui/input/ShortcutManager.cpp b/src/openrct2-ui/input/ShortcutManager.cpp index 52f3c09bc3..7777f8f8ef 100644 --- a/src/openrct2-ui/input/ShortcutManager.cpp +++ b/src/openrct2-ui/input/ShortcutManager.cpp @@ -12,6 +12,7 @@ #include "ShortcutIds.h" #include +#include #include #include #include @@ -101,8 +102,9 @@ std::string RegisteredShortcut::GetDisplayString() const result += kc.ToLocalisedString(); if (i < numChords - 1) { - // TODO localise... - result += " or "; + result += " "; + result += LanguageGetString(STR_OR); + result += " "; } } return result; From b92a0054597c0bb67911c82145f15b9e06bc9dfe Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Sun, 27 Jul 2025 16:44:08 -0500 Subject: [PATCH 80/95] Enhance emscripten display settings (#24841) * emscripten: Invoke HTML5 emscripten fullscreen API instead of using SDL * emscripten: Disable OpenGL * emscripten: Add fullscreen change to changelog --- distribution/changelog.txt | 1 + scripts/build-emscripten | 1 + src/openrct2-ui/UiContext.cpp | 11 +++++++++++ 3 files changed, 13 insertions(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 00e88b7ca4..0a507ed367 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -19,6 +19,7 @@ - Fix: [#24829] The pattern of long grass across tiles is different to RCT1 and RCT2. - Fix: [#24831] Park names are being overwritten for custom RCT1 scenarios that use competition id slots. - Fix: [#24838] Not using localized word for conjunction when having multiple shortcuts for the same action. +- Fix: [#24841] Fullscreen options do not work correctly with Emscripten. 0.4.24 (2025-07-05) ------------------------------------------------------------------------ diff --git a/scripts/build-emscripten b/scripts/build-emscripten index a1c54af707..af9065ec36 100755 --- a/scripts/build-emscripten +++ b/scripts/build-emscripten @@ -12,6 +12,7 @@ JSON_DIR=/usr/include/nlohmann/ emcmake cmake ../ \ -G Ninja \ -DDISABLE_NETWORK=ON \ + -DDISABLE_OPENGL=ON \ -DDISABLE_HTTP=ON \ -DDISABLE_TTF=ON \ -DDISABLE_FLAC=ON \ diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index 604363a745..5d72e68465 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -182,6 +182,7 @@ public: void SetFullscreenMode(FullscreenMode mode) override { +#ifndef __EMSCRIPTEN__ static constexpr int32_t kSDLFullscreenFlags[] = { 0, SDL_WINDOW_FULLSCREEN, @@ -212,6 +213,16 @@ public: // TODO try another display mode rather than just exiting the game } +#else + if (mode == FullscreenMode::fullscreen) + { + emscripten_request_fullscreen("!canvas", false); + } + else if (mode == FullscreenMode::windowed) + { + emscripten_exit_fullscreen(); + } +#endif // __EMSCRIPTEN__ } const std::vector& GetFullscreenResolutions() override From 24c719de679a865c96301c3c990d5bd44e1fbb0c Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Mon, 28 Jul 2025 04:18:03 +0000 Subject: [PATCH 81/95] Merge Localisation/master into OpenRCT2/develop --- data/language/cs-CZ.txt | 23 ++++++++++++----------- data/language/eo-ZZ.txt | 1 + data/language/fr-FR.txt | 9 +++++++++ data/language/hu-HU.txt | 1 + data/language/pt-BR.txt | 1 + data/language/ru-RU.txt | 1 + 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/data/language/cs-CZ.txt b/data/language/cs-CZ.txt index ece343b36b..fb8ae3639f 100644 --- a/data/language/cs-CZ.txt +++ b/data/language/cs-CZ.txt @@ -9,7 +9,7 @@ STR_0004 :Závěsná houpající se horská dráha STR_0005 :Obrácená horská dráha STR_0006 :Dorostenecká horská dráha STR_0007 :Miniaturní železnice -STR_0008 :Visutá jednokolejka +STR_0008 :Monorail STR_0009 :Malá zavěšená dráha STR_0010 :Půjčovna lodí STR_0011 :Dřevěná divoká myš @@ -66,7 +66,7 @@ STR_0061 :Virginský moták STR_0062 :Cákající lodě STR_0063 :Mini helikoptéra STR_0064 :Horská dráha v leže -STR_0065 :Visutá jednokolejka +STR_0065 :Visutá dráha STR_0066 :Neznámá atrakce (40) STR_0067 :Obrácená horská dráha STR_0068 :Heartline Twister Coaster @@ -106,20 +106,20 @@ STR_0513 :Návštěvníci jedou po horské dráze s loopingy ve stoje STR_0514 :Vlaky zavěšené pod kolejí se v zatáčkách houpají do stran STR_0515 :Ocelová horská dráha s vlaky držícími zespoda trati s mnoha zatáčkami STR_0516 :Pozvolná horská dráha pro ty kdo se zatím neodvažují na větší dráhy -STR_0517 :Návštěvníci jezdí v miniaturních vlacích po úzkorozchodné koleji. -STR_0518 :Návštěvníci jedou v elektrických vlacích po visuté jednokolejné dráze. +STR_0517 :Cestující jedou v miniaturních vlacích po úzkorozchodné koleji +STR_0518 :Cestující jedou v elektrických vlacích po visuté jednokolejné dráze STR_0519 :Návštěvníci jedou zavěšení pod jednou kolejí v malých kabinách, volně se houpajících ze strany na stranu STR_0520 :Přístavní molo, kde návštěvníci mohou řídit osobní plavidlo na vodní hladině STR_0521 :Rychlá a mrštná horská dráha s ostrými zatáčkami a strmými svahy. Dráha je předurčená k vysoké intenzitě. STR_0522 :Menší horská dráha, na které návštěvníci sedí nad dráhou bez kabiny kolem sebe -STR_0523 :Návštěvníci jedou pomalu ve vozidlech po postavené dráze. +STR_0523 :Návštěvnící jedou po trati v pomalu jedoucích vozidlech STR_0524 :Kabina pro volný pád je pneumaticky vystřelena vzhůru po vysoké ocelové věži a následně volně padá k zemi STR_0525 :Návštěvníci jedou po propletené bobové dráze STR_0526 :Otáčející se vyhlídková kabina, která postupně vyjíždí na vysokou věž STR_0527 :Plynulá ocelová horská dráha s loopingy STR_0528 :Návštěvníci jedou v nafukovacích člunech po tobogánu STR_0529 :Ocelová horská dráha ve stylu důlního vlaku s věrně vypadajícími důlními kolejemi. -STR_0530 :Kabiny visí na ocelovém laně, které nepřetržitě jede z jednoho konce na druhý a zpět +STR_0530 :Kabiny nebo sedačky jsou zavěšeny na laně obíhajícím mezi stanicemi STR_0531 :Malá ocelová horská dráha, na které vlak projíždí smyčky a vývrtky STR_0532 :Bludiště z šest stop vysokých zdí nebo živého plotu. Návštěvníci bloudí dokud nenajdou východ STR_0533 :Dřevěná budova s krytým schodištěm a venkovní skluzavkou s koberečky @@ -141,7 +141,7 @@ STR_0551 :3D kino ve velké kopuli STR_0552 :Návštěvníci sedí v zavěšených gondolách, které se otáčí dopředu, dozadu a vzhůru nohama STR_0553 :Návštěvníci rotují v gyroskopických kruzích zcela volně ve všech směrech STR_0554 :Po mocném startu pomocí elektromotorů se vozy rozjedou po svislé dráze, přes vrchol a svisle dolů zpět do stanice -STR_0555 :Návštěvníci jezdí ve výtahu nahoru a dolů +STR_0555 :Návštěvníci jedou ve výtahu umístěném ve věži nahoru nebo dolů z jednoho patra do druhého STR_0556 :Extra široké vozy se vrhají střemhlav dolů za zážitky úplného volného pádu na horské dráze STR_0557 :Bankomat, který se návštěvníkům hodí zejména, když utratí všechny peníze STR_0558 :Návštěvníci sedí po dvojicích v rotujících kabinách @@ -159,15 +159,15 @@ STR_0571 :Kulaté vozy se otáčejí dokola při jízdě klikatou dřevěnou STR_0572 :Lodě s velkou kapacitou jedou po širokém vodním kanále, vzhůru poháněné běžícím pásem, zrychlují z prudkých svahů, aby obrovským šplouchnutím namočily všechny návštěvníky STR_0573 :Vozy ve tvaru helikoptér, poháněné šlapáním, jezdí po ocelové dráze STR_0574 :Návštěvníci ve speciálních postrojích zavěšení v leže pod tratí, jedou přes zatáčky a obraty pozadu nebo čelem k zemi -STR_0575 :Poháněné vlaky visící pod visutou kolejí převážejí návštěvníky po parku +STR_0575 :Trakční vlaky zavěšné pod kolejí převážejí návštěvníky po parku STR_0577 :Vozy s dvěma podvozky jedou po dřevěné trati, otáčející se dokola na speciálních místech STR_0578 :Horská dráha, která se točí dokola tak, že návštěvníci jsou pořád na stejném místě. STR_0579 :Pohodový minigolf STR_0580 :Gigantická ocelová horská dráha schopna volných pádů a kopců přes 90 metrů dlouhých STR_0581 :Kruh sedadel je za pomalé rotace vytažen na vrchol vysoké věže, spuštěn volným pádem k zemi a opatrně zastaven pomocí magnetických brzd -STR_0582 :Návštěvníci volně jezdí na vznášedlech. +STR_0582 :Návštěvníci volně jezdí na vznášedlech STR_0583 :Budova s pokřivenými chodbami a zvláštními místnostmi, která dezorientuje návštěvníky -STR_0584 :Speciální kola jezdí po ocelové koleji, poháněná šlapáním jezdců +STR_0584 :Speciální kola poháněná šlapáním jezdců jezdí po ocelové koleji STR_0585 :Návštěvníci sedí po dvou zavěšení pod tratí a jedou skrze loopingy a ostré zatáčky STR_0586 :Vozy ve tvaru lodí jedou po trati horské dráhy, což umožňuje ostré zatáčky, strmé klesání a cákající zpomalení pro mírnější říční úseky STR_0587 :Po mocném startu na stlačený vzduch se vozy rozjedou po svislé dráze, přes vrchol a svisle dolů zpět do stanice @@ -3195,7 +3195,7 @@ STR_6101 :Hodnota atrakcí časem nedegraduje STR_6102 :Hodnota atrakce nebude s postupem času klesat, takže návštěvníci nebudou najednou mít pocit, že je vstupné moc drahé. STR_6103 :Tato volba není ve hře více hráčů dostupná. STR_6105 :Hyper horská dráha -STR_6107 :Monster Trucks +STR_6107 :Monster trucky STR_6109 :Hyper-Twister horská dráha STR_6111 :Klasická malá horská dráha STR_6113 :Vysoká horská dráha s dlouhými pády, velkou rychlostí a pohodlnými vlaky, kde se jezdí s opěrkou v klíně @@ -3839,3 +3839,4 @@ STR_6796 :•{MOVE_X}{10}{STRINGID} STR_6797 :Bez náhledu STR_6798 :Snímek obr. STR_6799 :Mini mapa +STR_7000 :nebo diff --git a/data/language/eo-ZZ.txt b/data/language/eo-ZZ.txt index 92e4af76df..96ffe13fde 100644 --- a/data/language/eo-ZZ.txt +++ b/data/language/eo-ZZ.txt @@ -3835,3 +3835,4 @@ STR_6796 :•{MOVE_X}{10}{STRINGID} STR_6797 :Neniu antaŭrigardo STR_6798 :Ekrankopio STR_6799 :Eta mapo +STR_7000 :aŭ diff --git a/data/language/fr-FR.txt b/data/language/fr-FR.txt index 82c45fc88e..ec6750fa98 100644 --- a/data/language/fr-FR.txt +++ b/data/language/fr-FR.txt @@ -3837,3 +3837,12 @@ STR_6788 :Sensibilité : STR_6789 :Multiplicateur de sensibilité du stick analogique STR_6790 :Zone morte : {COMMA32}% STR_6791 :Sensibilité : {COMMA32}% +STR_6792 :Bâtiments d’entrée +STR_6793 :Visiteurs et employés +STR_6794 :Décor et thèmes +STR_6795 :{MOVE_X}{10}{STRINGID} +STR_6796 :•{MOVE_X}{10}{STRINGID} +STR_6797 :Pas d’aperçu +STR_6798 :Capture d’écran +STR_6799 :Mini-carte +STR_7000 :ou diff --git a/data/language/hu-HU.txt b/data/language/hu-HU.txt index 98f99bdb89..ebe1c33cb0 100644 --- a/data/language/hu-HU.txt +++ b/data/language/hu-HU.txt @@ -3836,3 +3836,4 @@ STR_6796 :•{MOVE_X}{10}{STRINGID} STR_6797 :Nincs előnézet STR_6798 :Képernyőkép STR_6799 :Mini térkép +STR_7000 :vagy diff --git a/data/language/pt-BR.txt b/data/language/pt-BR.txt index d93e8c8a2c..86ffb7fa43 100644 --- a/data/language/pt-BR.txt +++ b/data/language/pt-BR.txt @@ -3835,3 +3835,4 @@ STR_6796 :•{MOVE_X}{10}{STRINGID} STR_6797 :Sem pré-visualização STR_6798 :Captura de tela STR_6799 :Mini mapa +STR_7000 :ou diff --git a/data/language/ru-RU.txt b/data/language/ru-RU.txt index 2d39f21e01..b0e6a5ad03 100644 --- a/data/language/ru-RU.txt +++ b/data/language/ru-RU.txt @@ -3824,3 +3824,4 @@ STR_6796 :•{MOVE_X}{10}{STRINGID} STR_6797 :Отключить STR_6798 :Скриншот STR_6799 :Мини-карта +STR_7000 :или From fe0edd71f771bf7150e51d8ffe4e2d5185e9f873 Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Tue, 29 Jul 2025 04:19:13 +0000 Subject: [PATCH 82/95] Merge Localisation/master into OpenRCT2/develop --- data/language/ko-KR.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/data/language/ko-KR.txt b/data/language/ko-KR.txt index 58e95bebe4..926a45b310 100644 --- a/data/language/ko-KR.txt +++ b/data/language/ko-KR.txt @@ -3838,3 +3838,4 @@ STR_6796 :•{MOVE_X}{10}{STRINGID} STR_6797 :미리보기 없음 STR_6798 :스크린 샷 STR_6799 :미니 맵 +STR_7000 :(또는) From 616fdee571f17339b6286c07694af89d40d44c4b Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Wed, 30 Jul 2025 04:16:50 +0000 Subject: [PATCH 83/95] Merge Localisation/master into OpenRCT2/develop --- data/language/gl-ES.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/data/language/gl-ES.txt b/data/language/gl-ES.txt index 4938ba49c9..de4b637ed8 100644 --- a/data/language/gl-ES.txt +++ b/data/language/gl-ES.txt @@ -1855,7 +1855,7 @@ STR_2519 :Amosar información do parque STR_2520 :Amosar lista de visitantes STR_2521 :Amosar lista de persoal STR_2522 :Amosar mensaxes recentes -STR_2523 ​​​​ :Amosar mapa +STR_2523 :Amosar mapa STR_2524 :captura de pantalla STR_2533 :tecla RETROCESO STR_2534 :Tab @@ -3831,3 +3831,9 @@ STR_6791 :Sensibilidade: {COMMA32}% STR_6792 :Edificios de entrada STR_6793 :Visitantes e persoal STR_6794 :Decoración e temáticas +STR_6795 :{MOVE_X}{10}{STRINGID} +STR_6796 :•{MOVE_X}{10}{STRINGID} +STR_6797 :Sen vista previa +STR_6798 :Captura de pantalla +STR_6799 :Minimapa +STR_7000 :ou From f6292b4c1308247fe64adf73b13db33b016f9ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 31 Jul 2025 11:01:48 +0200 Subject: [PATCH 84/95] Use clang-format 20 (#24861) https://clang.llvm.org/docs/ClangFormatStyleOptions.html --- .github/workflows/ci.yml | 2 +- scripts/check-code-formatting | 2 +- src/openrct2-ui/WindowManager.cpp | 5 +- src/openrct2-ui/scripting/CustomMenu.cpp | 29 +- src/openrct2-ui/scripting/ScTitleSequence.hpp | 25 +- src/openrct2-ui/scripting/ScUi.hpp | 44 +-- .../windows/EditorParkEntrance.cpp | 10 +- src/openrct2-ui/windows/Footpath.cpp | 5 +- src/openrct2/core/Json.cpp | 5 +- src/openrct2/entity/EntityTweener.cpp | 7 +- src/openrct2/interface/InteractiveConsole.cpp | 11 +- src/openrct2/network/Socket.cpp | 5 +- src/openrct2/object/ImageTable.cpp | 17 +- src/openrct2/object/PeepAnimationsObject.cpp | 15 +- src/openrct2/paint/track/thrill/GoKarts.cpp | 2 +- src/openrct2/peep/GuestPathfinding.cpp | 5 +- src/openrct2/peep/PeepAnimations.cpp | 161 +++++------ src/openrct2/platform/Crash.cpp | 5 +- src/openrct2/rct1/S4Importer.cpp | 34 +-- src/openrct2/scripting/HookEngine.cpp | 37 +-- .../scripting/bindings/entity/ScGuest.cpp | 255 +++++++++--------- .../scripting/bindings/entity/ScGuest.hpp | 118 ++++---- .../scripting/bindings/entity/ScLitter.cpp | 29 +- .../scripting/bindings/entity/ScParticle.cpp | 15 +- .../scripting/bindings/entity/ScPeep.hpp | 59 ++-- .../scripting/bindings/entity/ScVehicle.cpp | 67 ++--- .../bindings/ride/ScTrackSegment.cpp | 23 +- .../scripting/bindings/world/ScPark.cpp | 31 +-- .../scripting/bindings/world/ScResearch.cpp | 43 +-- .../scripting/bindings/world/ScScenario.hpp | 29 +- 30 files changed, 569 insertions(+), 526 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfce0d2512..b2fc8bec59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,7 +129,7 @@ jobs: check-code-formatting: name: Check code formatting runs-on: ubuntu-latest - container: openrct2/openrct2-build:18-format + container: openrct2/openrct2-build:20-format defaults: run: shell: sh diff --git a/scripts/check-code-formatting b/scripts/check-code-formatting index e49439cac4..8712fbb335 100755 --- a/scripts/check-code-formatting +++ b/scripts/check-code-formatting @@ -16,4 +16,4 @@ fi basedir="$($readlink_bin -f `dirname $0`/..)" cd $basedir -scripts/run-clang-format.py --clang-format-executable /usr/lib/llvm19/bin/clang-format -r src test data/shaders --exclude src/thirdparty +scripts/run-clang-format.py --clang-format-executable /usr/lib/llvm20/bin/clang-format -r src test data/shaders --exclude src/thirdparty diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index 00993ddc87..f2f4656224 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -1271,8 +1271,9 @@ public: if (widget.left == -2) return; - GfxSetDirtyBlocks({ { w.windowPos + ScreenCoordsXY{ widget.left, widget.top } }, - { w.windowPos + ScreenCoordsXY{ widget.right + 1, widget.bottom + 1 } } }); + GfxSetDirtyBlocks( + { { w.windowPos + ScreenCoordsXY{ widget.left, widget.top } }, + { w.windowPos + ScreenCoordsXY{ widget.right + 1, widget.bottom + 1 } } }); } /** diff --git a/src/openrct2-ui/scripting/CustomMenu.cpp b/src/openrct2-ui/scripting/CustomMenu.cpp index 4e1588f3d8..b14dafd930 100644 --- a/src/openrct2-ui/scripting/CustomMenu.cpp +++ b/src/openrct2-ui/scripting/CustomMenu.cpp @@ -68,20 +68,21 @@ namespace OpenRCT2::Scripting "volcano_down", "walk_down", "paint_down", "entrance_down", "hand_open", "hand_closed", }; - static const DukEnumMap ToolFilterMap({ - { "terrain", ViewportInteractionItem::Terrain }, - { "entity", ViewportInteractionItem::Entity }, - { "ride", ViewportInteractionItem::Ride }, - { "water", ViewportInteractionItem::Water }, - { "scenery", ViewportInteractionItem::Scenery }, - { "footpath", ViewportInteractionItem::Footpath }, - { "footpath_item", ViewportInteractionItem::PathAddition }, - { "park_entrance", ViewportInteractionItem::ParkEntrance }, - { "wall", ViewportInteractionItem::Wall }, - { "large_scenery", ViewportInteractionItem::LargeScenery }, - { "label", ViewportInteractionItem::Label }, - { "banner", ViewportInteractionItem::Banner }, - }); + static const DukEnumMap ToolFilterMap( + { + { "terrain", ViewportInteractionItem::Terrain }, + { "entity", ViewportInteractionItem::Entity }, + { "ride", ViewportInteractionItem::Ride }, + { "water", ViewportInteractionItem::Water }, + { "scenery", ViewportInteractionItem::Scenery }, + { "footpath", ViewportInteractionItem::Footpath }, + { "footpath_item", ViewportInteractionItem::PathAddition }, + { "park_entrance", ViewportInteractionItem::ParkEntrance }, + { "wall", ViewportInteractionItem::Wall }, + { "large_scenery", ViewportInteractionItem::LargeScenery }, + { "label", ViewportInteractionItem::Label }, + { "banner", ViewportInteractionItem::Banner }, + }); template<> DukValue ToDuk(duk_context* ctx, const CursorID& cursorId) diff --git a/src/openrct2-ui/scripting/ScTitleSequence.hpp b/src/openrct2-ui/scripting/ScTitleSequence.hpp index ec061e35df..d9782420e6 100644 --- a/src/openrct2-ui/scripting/ScTitleSequence.hpp +++ b/src/openrct2-ui/scripting/ScTitleSequence.hpp @@ -47,18 +47,19 @@ namespace OpenRCT2::Scripting LoadSc, }; - static const DukEnumMap TitleScriptMap({ - { OpenRCT2::Title::LoadParkCommand::ScriptingName, TitleScript::Load }, - { OpenRCT2::Title::SetLocationCommand::ScriptingName, TitleScript::Location }, - { OpenRCT2::Title::RotateViewCommand::ScriptingName, TitleScript::Rotate }, - { OpenRCT2::Title::SetZoomCommand::ScriptingName, TitleScript::Zoom }, - { OpenRCT2::Title::FollowEntityCommand::ScriptingName, TitleScript::Follow }, - { OpenRCT2::Title::SetSpeedCommand::ScriptingName, TitleScript::Speed }, - { OpenRCT2::Title::WaitCommand::ScriptingName, TitleScript::Wait }, - { OpenRCT2::Title::LoadScenarioCommand::ScriptingName, TitleScript::LoadSc }, - { OpenRCT2::Title::RestartCommand::ScriptingName, TitleScript::Restart }, - { OpenRCT2::Title::EndCommand::ScriptingName, TitleScript::End }, - }); + static const DukEnumMap TitleScriptMap( + { + { OpenRCT2::Title::LoadParkCommand::ScriptingName, TitleScript::Load }, + { OpenRCT2::Title::SetLocationCommand::ScriptingName, TitleScript::Location }, + { OpenRCT2::Title::RotateViewCommand::ScriptingName, TitleScript::Rotate }, + { OpenRCT2::Title::SetZoomCommand::ScriptingName, TitleScript::Zoom }, + { OpenRCT2::Title::FollowEntityCommand::ScriptingName, TitleScript::Follow }, + { OpenRCT2::Title::SetSpeedCommand::ScriptingName, TitleScript::Speed }, + { OpenRCT2::Title::WaitCommand::ScriptingName, TitleScript::Wait }, + { OpenRCT2::Title::LoadScenarioCommand::ScriptingName, TitleScript::LoadSc }, + { OpenRCT2::Title::RestartCommand::ScriptingName, TitleScript::Restart }, + { OpenRCT2::Title::EndCommand::ScriptingName, TitleScript::End }, + }); template<> DukValue ToDuk(duk_context* ctx, const TitleScript& value) diff --git a/src/openrct2-ui/scripting/ScUi.hpp b/src/openrct2-ui/scripting/ScUi.hpp index 49611c99c2..965e88f3a4 100644 --- a/src/openrct2-ui/scripting/ScUi.hpp +++ b/src/openrct2-ui/scripting/ScUi.hpp @@ -40,28 +40,30 @@ namespace OpenRCT2::Ui::Windows namespace OpenRCT2::Scripting { - static const DukEnumMap ScenarioCategoryMap({ - { "beginner", ScenarioCategory::beginner }, - { "challenging", ScenarioCategory::challenging }, - { "expert", ScenarioCategory::expert }, - { "real", ScenarioCategory::real }, - { "other", ScenarioCategory::other }, - { "dlc", ScenarioCategory::dlc }, - { "build_your_own", ScenarioCategory::buildYourOwn }, - { "competitions", ScenarioCategory::competitions }, - }); + static const DukEnumMap ScenarioCategoryMap( + { + { "beginner", ScenarioCategory::beginner }, + { "challenging", ScenarioCategory::challenging }, + { "expert", ScenarioCategory::expert }, + { "real", ScenarioCategory::real }, + { "other", ScenarioCategory::other }, + { "dlc", ScenarioCategory::dlc }, + { "build_your_own", ScenarioCategory::buildYourOwn }, + { "competitions", ScenarioCategory::competitions }, + }); - static const DukEnumMap ScenarioSourceMap({ - { "rct1", ScenarioSource::RCT1 }, - { "rct1_aa", ScenarioSource::RCT1_AA }, - { "rct1_ll", ScenarioSource::RCT1_LL }, - { "rct2", ScenarioSource::RCT2 }, - { "rct2_ww", ScenarioSource::RCT2_WW }, - { "rct2_tt", ScenarioSource::RCT2_TT }, - { "real", ScenarioSource::Real }, - { "extras", ScenarioSource::Extras }, - { "other", ScenarioSource::Other }, - }); + static const DukEnumMap ScenarioSourceMap( + { + { "rct1", ScenarioSource::RCT1 }, + { "rct1_aa", ScenarioSource::RCT1_AA }, + { "rct1_ll", ScenarioSource::RCT1_LL }, + { "rct2", ScenarioSource::RCT2 }, + { "rct2_ww", ScenarioSource::RCT2_WW }, + { "rct2_tt", ScenarioSource::RCT2_TT }, + { "real", ScenarioSource::Real }, + { "extras", ScenarioSource::Extras }, + { "other", ScenarioSource::Other }, + }); template<> inline DukValue ToDuk(duk_context* ctx, const ScenarioCategory& value) diff --git a/src/openrct2-ui/windows/EditorParkEntrance.cpp b/src/openrct2-ui/windows/EditorParkEntrance.cpp index 86bc48a860..f07a362745 100644 --- a/src/openrct2-ui/windows/EditorParkEntrance.cpp +++ b/src/openrct2-ui/windows/EditorParkEntrance.cpp @@ -175,10 +175,12 @@ namespace OpenRCT2::Ui::Windows int32_t sideDirection = (parkEntrancePosition.direction + 1) & 3; gMapSelectionTiles.clear(); gMapSelectionTiles.push_back({ parkEntrancePosition.x, parkEntrancePosition.y }); - gMapSelectionTiles.push_back({ parkEntrancePosition.x + CoordsDirectionDelta[sideDirection].x, - parkEntrancePosition.y + CoordsDirectionDelta[sideDirection].y }); - gMapSelectionTiles.push_back({ parkEntrancePosition.x - CoordsDirectionDelta[sideDirection].x, - parkEntrancePosition.y - CoordsDirectionDelta[sideDirection].y }); + gMapSelectionTiles.push_back( + { parkEntrancePosition.x + CoordsDirectionDelta[sideDirection].x, + parkEntrancePosition.y + CoordsDirectionDelta[sideDirection].y }); + gMapSelectionTiles.push_back( + { parkEntrancePosition.x - CoordsDirectionDelta[sideDirection].x, + parkEntrancePosition.y - CoordsDirectionDelta[sideDirection].y }); gMapSelectArrowPosition = parkEntrancePosition; gMapSelectArrowDirection = parkEntrancePosition.direction; diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index 71076f4fd2..3d35de07d6 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -1420,8 +1420,9 @@ namespace OpenRCT2::Ui::Windows int32_t direction = _footpathConstructDirection; gMapSelectionTiles.clear(); - gMapSelectionTiles.push_back({ gFootpathConstructFromPosition.x + CoordsDirectionDelta[direction].x, - gFootpathConstructFromPosition.y + CoordsDirectionDelta[direction].y }); + gMapSelectionTiles.push_back( + { gFootpathConstructFromPosition.x + CoordsDirectionDelta[direction].x, + gFootpathConstructFromPosition.y + CoordsDirectionDelta[direction].y }); MapInvalidateMapSelectionTiles(); } diff --git a/src/openrct2/core/Json.cpp b/src/openrct2/core/Json.cpp index 4912797bfb..d30ba56d13 100644 --- a/src/openrct2/core/Json.cpp +++ b/src/openrct2/core/Json.cpp @@ -37,8 +37,9 @@ namespace OpenRCT2::Json } catch (const json_t::exception& e) { - throw JsonException(String::stdFormat( - "Unable to parse JSON file (%.*s)\n\t%s", static_cast(path.length()), path.data(), e.what())); + throw JsonException( + String::stdFormat( + "Unable to parse JSON file (%.*s)\n\t%s", static_cast(path.length()), path.data(), e.what())); } return json; diff --git a/src/openrct2/entity/EntityTweener.cpp b/src/openrct2/entity/EntityTweener.cpp index 8b013ff94c..460a318393 100644 --- a/src/openrct2/entity/EntityTweener.cpp +++ b/src/openrct2/entity/EntityTweener.cpp @@ -153,9 +153,10 @@ namespace OpenRCT2 if (posA == posB) continue; - ent->MoveTo({ static_cast(std::round(posB.x * alpha + posA.x * inv)), - static_cast(std::round(posB.y * alpha + posA.y * inv)), - static_cast(std::round(posB.z * alpha + posA.z * inv)) }); + ent->MoveTo( + { static_cast(std::round(posB.x * alpha + posA.x * inv)), + static_cast(std::round(posB.y * alpha + posA.y * inv)), + static_cast(std::round(posB.z * alpha + posA.z * inv)) }); } } diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index b9fc095952..24f6684802 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -741,8 +741,10 @@ static void ConsoleSetVariableAction(InteractiveConsole& console, std::string va auto action = TAction(std::forward(args)...); action.SetCallback([&console, var](const GameAction*, const GameActions::Result* res) { if (res->Error != GameActions::Status::Ok) - console.WriteLineError(String::stdFormat( - "set %s command failed: %s - %s.", var.c_str(), res->GetErrorTitle().c_str(), res->GetErrorMessage().c_str())); + console.WriteLineError( + String::stdFormat( + "set %s command failed: %s - %s.", var.c_str(), res->GetErrorTitle().c_str(), + res->GetErrorMessage().c_str())); else console.Execute(String::stdFormat("get %s", var.c_str())); console.EndAsyncExecution(); @@ -1618,8 +1620,9 @@ static void ConsoleCommandAddNewsItem([[maybe_unused]] InteractiveConsole& conso console.WriteLine(" 9 (News::ItemType::graph)"); console.WriteLine(" 10 (News::ItemType::campaign)"); console.WriteLine("message is the message to display, wrapped in quotes for multiple words"); - console.WriteLine("assoc is the associated id of ride/peep/tile/etc. If the selected ItemType doesn't need an assoc " - "(Null, Money, Award, Graph), you can leave this field blank"); + console.WriteLine( + "assoc is the associated id of ride/peep/tile/etc. If the selected ItemType doesn't need an assoc " + "(Null, Money, Award, Graph), you can leave this field blank"); return; } diff --git a/src/openrct2/network/Socket.cpp b/src/openrct2/network/Socket.cpp index f72386acbb..063b0ffe1a 100644 --- a/src/openrct2/network/Socket.cpp +++ b/src/openrct2/network/Socket.cpp @@ -930,8 +930,9 @@ std::vector> GetBroadcastAddresses() memcpy(&address, &ifo.iiAddress.Address, sizeof(sockaddr)); (reinterpret_cast(&address))->sin_addr.s_addr = ifo.iiAddress.AddressIn.sin_addr.s_addr | ~ifo.iiNetmask.AddressIn.sin_addr.s_addr; - baddresses.push_back(std::make_unique( - reinterpret_cast(&address), static_cast(sizeof(sockaddr)))); + baddresses.push_back( + std::make_unique( + reinterpret_cast(&address), static_cast(sizeof(sockaddr)))); } #else int sock = socket(AF_INET, SOCK_DGRAM, 0); diff --git a/src/openrct2/object/ImageTable.cpp b/src/openrct2/object/ImageTable.cpp index f2e7a723cd..873e8ec0c8 100644 --- a/src/openrct2/object/ImageTable.cpp +++ b/src/openrct2/object/ImageTable.cpp @@ -102,9 +102,10 @@ std::vector> ImageTable::ParseImages( { for (auto i : range) { - result.push_back(std::make_unique( - static_cast(SPR_CSG_BEGIN + i), - [](uint32_t idx) -> const G1Element* { return GfxGetG1Element(idx); })); + result.push_back( + std::make_unique( + static_cast(SPR_CSG_BEGIN + i), + [](uint32_t idx) -> const G1Element* { return GfxGetG1Element(idx); })); } } else @@ -129,8 +130,9 @@ std::vector> ImageTable::ParseImages( auto range = ParseRange(rangeString); for (auto i : range) { - result.push_back(std::make_unique( - static_cast(i), [](uint32_t idx) -> const G1Element* { return GfxGetG1Element(idx); })); + result.push_back( + std::make_unique( + static_cast(i), [](uint32_t idx) -> const G1Element* { return GfxGetG1Element(idx); })); } } } @@ -313,8 +315,9 @@ std::vector> ImageTable::LoadObjectIm { if (i >= 0 && i < numImages) { - result.push_back(std::make_unique( - static_cast(i), [images](uint32_t idx) -> const G1Element* { return &images[idx]; })); + result.push_back( + std::make_unique( + static_cast(i), [images](uint32_t idx) -> const G1Element* { return &images[idx]; })); } else { diff --git a/src/openrct2/object/PeepAnimationsObject.cpp b/src/openrct2/object/PeepAnimationsObject.cpp index ac2f931a21..9be8a5380d 100644 --- a/src/openrct2/object/PeepAnimationsObject.cpp +++ b/src/openrct2/object/PeepAnimationsObject.cpp @@ -20,13 +20,14 @@ using namespace OpenRCT2; -static const EnumMap animationPeepTypeMap({ - { "guest", AnimationPeepType::Guest }, - { "handyman", AnimationPeepType::Handyman }, - { "mechanic", AnimationPeepType::Mechanic }, - { "security", AnimationPeepType::Security }, - { "entertainer", AnimationPeepType::Entertainer }, -}); +static const EnumMap animationPeepTypeMap( + { + { "guest", AnimationPeepType::Guest }, + { "handyman", AnimationPeepType::Handyman }, + { "mechanic", AnimationPeepType::Mechanic }, + { "security", AnimationPeepType::Security }, + { "entertainer", AnimationPeepType::Entertainer }, + }); void PeepAnimationsObject::Load() { diff --git a/src/openrct2/paint/track/thrill/GoKarts.cpp b/src/openrct2/paint/track/thrill/GoKarts.cpp index cec48b09ee..6a8e7cc3e2 100644 --- a/src/openrct2/paint/track/thrill/GoKarts.cpp +++ b/src/openrct2/paint/track/thrill/GoKarts.cpp @@ -1568,7 +1568,7 @@ static void PaintGoKartsStation( bool hasFence; ImageId imageId; - const uint32_t(*sprites)[2] = go_karts_track_pieces_starting_grid; + const uint32_t (*sprites)[2] = go_karts_track_pieces_starting_grid; if (trackElement.GetTrackType() == TrackElemType::EndStation) { diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 8e7bc7958f..bd9f21f485 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -41,8 +41,9 @@ namespace OpenRCT2::PathFinding static constexpr uint8_t kMaxJunctionsGuestLeavingParkLost = 8; // Maximum amount of junctions. - static constexpr uint8_t kMaxJunctions = std::max({ kMaxJunctionsStaff, kMaxJunctionsGuest, kMaxJunctionsGuestWithMap, - kMaxJunctionsGuestLeavingPark, kMaxJunctionsGuestLeavingParkLost }); + static constexpr uint8_t kMaxJunctions = std::max( + { kMaxJunctionsStaff, kMaxJunctionsGuest, kMaxJunctionsGuestWithMap, kMaxJunctionsGuestLeavingPark, + kMaxJunctionsGuestLeavingParkLost }); struct PathFindingState { diff --git a/src/openrct2/peep/PeepAnimations.cpp b/src/openrct2/peep/PeepAnimations.cpp index 392eba62cd..c528925ad7 100644 --- a/src/openrct2/peep/PeepAnimations.cpp +++ b/src/openrct2/peep/PeepAnimations.cpp @@ -23,75 +23,80 @@ namespace OpenRCT2 { - static const EnumMap availableGuestAnimations({ - { "walking", PeepAnimationType::Walking }, - { "checkTime", PeepAnimationType::CheckTime }, - { "watchRide", PeepAnimationType::WatchRide }, - { "eatFood", PeepAnimationType::EatFood }, - { "shakeHead", PeepAnimationType::ShakeHead }, - { "emptyPockets", PeepAnimationType::EmptyPockets }, - { "holdMat", PeepAnimationType::HoldMat }, - { "sittingIdle", PeepAnimationType::SittingIdle }, - { "sittingEatFood", PeepAnimationType::SittingEatFood }, - { "sittingLookAroundLeft", PeepAnimationType::SittingLookAroundLeft }, - { "sittingLookAroundRight", PeepAnimationType::SittingLookAroundRight }, - { "hanging", PeepAnimationType::Hanging }, - { "wow", PeepAnimationType::Wow }, - { "throwUp", PeepAnimationType::ThrowUp }, - { "jump", PeepAnimationType::Jump }, - { "drowning", PeepAnimationType::Drowning }, - { "joy", PeepAnimationType::Joy }, - { "readMap", PeepAnimationType::ReadMap }, - { "wave", PeepAnimationType::Wave }, - { "wave2", PeepAnimationType::Wave2 }, - { "takePhoto", PeepAnimationType::TakePhoto }, - { "clap", PeepAnimationType::Clap }, - { "disgust", PeepAnimationType::Disgust }, - { "drawPicture", PeepAnimationType::DrawPicture }, - { "beingWatched", PeepAnimationType::BeingWatched }, - { "withdrawMoney", PeepAnimationType::WithdrawMoney }, - }); + static const EnumMap availableGuestAnimations( + { + { "walking", PeepAnimationType::Walking }, + { "checkTime", PeepAnimationType::CheckTime }, + { "watchRide", PeepAnimationType::WatchRide }, + { "eatFood", PeepAnimationType::EatFood }, + { "shakeHead", PeepAnimationType::ShakeHead }, + { "emptyPockets", PeepAnimationType::EmptyPockets }, + { "holdMat", PeepAnimationType::HoldMat }, + { "sittingIdle", PeepAnimationType::SittingIdle }, + { "sittingEatFood", PeepAnimationType::SittingEatFood }, + { "sittingLookAroundLeft", PeepAnimationType::SittingLookAroundLeft }, + { "sittingLookAroundRight", PeepAnimationType::SittingLookAroundRight }, + { "hanging", PeepAnimationType::Hanging }, + { "wow", PeepAnimationType::Wow }, + { "throwUp", PeepAnimationType::ThrowUp }, + { "jump", PeepAnimationType::Jump }, + { "drowning", PeepAnimationType::Drowning }, + { "joy", PeepAnimationType::Joy }, + { "readMap", PeepAnimationType::ReadMap }, + { "wave", PeepAnimationType::Wave }, + { "wave2", PeepAnimationType::Wave2 }, + { "takePhoto", PeepAnimationType::TakePhoto }, + { "clap", PeepAnimationType::Clap }, + { "disgust", PeepAnimationType::Disgust }, + { "drawPicture", PeepAnimationType::DrawPicture }, + { "beingWatched", PeepAnimationType::BeingWatched }, + { "withdrawMoney", PeepAnimationType::WithdrawMoney }, + }); - static const EnumMap availableHandymanAnimations({ - { "walking", PeepAnimationType::Walking }, - { "watchRide", PeepAnimationType::WatchRide }, - { "hanging", PeepAnimationType::Hanging }, - { "staffMower", PeepAnimationType::StaffMower }, - { "staffSweep", PeepAnimationType::StaffSweep }, - { "drowning", PeepAnimationType::Drowning }, - { "staffWatering", PeepAnimationType::StaffWatering }, - { "staffEmptyBin", PeepAnimationType::StaffEmptyBin }, - }); + static const EnumMap availableHandymanAnimations( + { + { "walking", PeepAnimationType::Walking }, + { "watchRide", PeepAnimationType::WatchRide }, + { "hanging", PeepAnimationType::Hanging }, + { "staffMower", PeepAnimationType::StaffMower }, + { "staffSweep", PeepAnimationType::StaffSweep }, + { "drowning", PeepAnimationType::Drowning }, + { "staffWatering", PeepAnimationType::StaffWatering }, + { "staffEmptyBin", PeepAnimationType::StaffEmptyBin }, + }); - static const EnumMap availableMechanicAnimations({ - { "walking", PeepAnimationType::Walking }, - { "watchRide", PeepAnimationType::WatchRide }, - { "hanging", PeepAnimationType::Hanging }, - { "drowning", PeepAnimationType::Drowning }, - { "staffAnswerCall", PeepAnimationType::StaffAnswerCall }, - { "staffAnswerCall2", PeepAnimationType::StaffAnswerCall2 }, - { "staffCheckBoard", PeepAnimationType::StaffCheckBoard }, - { "staffFix", PeepAnimationType::StaffFix }, - { "staffFix2", PeepAnimationType::StaffFix2 }, - { "staffFixGround", PeepAnimationType::StaffFixGround }, - { "staffFix3", PeepAnimationType::StaffFix3 }, - }); + static const EnumMap availableMechanicAnimations( + { + { "walking", PeepAnimationType::Walking }, + { "watchRide", PeepAnimationType::WatchRide }, + { "hanging", PeepAnimationType::Hanging }, + { "drowning", PeepAnimationType::Drowning }, + { "staffAnswerCall", PeepAnimationType::StaffAnswerCall }, + { "staffAnswerCall2", PeepAnimationType::StaffAnswerCall2 }, + { "staffCheckBoard", PeepAnimationType::StaffCheckBoard }, + { "staffFix", PeepAnimationType::StaffFix }, + { "staffFix2", PeepAnimationType::StaffFix2 }, + { "staffFixGround", PeepAnimationType::StaffFixGround }, + { "staffFix3", PeepAnimationType::StaffFix3 }, + }); - static const EnumMap availableSecurityAnimations({ - { "walking", PeepAnimationType::Walking }, - { "watchRide", PeepAnimationType::WatchRide }, - { "hanging", PeepAnimationType::Hanging }, - { "drowning", PeepAnimationType::Drowning }, - }); + static const EnumMap availableSecurityAnimations( + { + { "walking", PeepAnimationType::Walking }, + { "watchRide", PeepAnimationType::WatchRide }, + { "hanging", PeepAnimationType::Hanging }, + { "drowning", PeepAnimationType::Drowning }, + }); - static const EnumMap availableEntertainerAnimations({ - { "walking", PeepAnimationType::Walking }, - { "watchRide", PeepAnimationType::WatchRide }, - { "hanging", PeepAnimationType::Hanging }, - { "drowning", PeepAnimationType::Drowning }, - { "joy", PeepAnimationType::Joy }, - { "wave2", PeepAnimationType::Wave2 }, - }); + static const EnumMap availableEntertainerAnimations( + { + { "walking", PeepAnimationType::Walking }, + { "watchRide", PeepAnimationType::WatchRide }, + { "hanging", PeepAnimationType::Hanging }, + { "drowning", PeepAnimationType::Drowning }, + { "joy", PeepAnimationType::Joy }, + { "wave2", PeepAnimationType::Wave2 }, + }); const EnumMap& getAnimationsByPeepType(AnimationPeepType peepType) { @@ -223,12 +228,13 @@ namespace OpenRCT2 if (scriptName.empty()) continue; - groups.push_back({ - .objectId = ObjectEntryIndex(i), - .group = group, - .legacyPosition = animObj->GetLegacyPosition(group), - .scriptName = scriptName, - }); + groups.push_back( + { + .objectId = ObjectEntryIndex(i), + .group = group, + .legacyPosition = animObj->GetLegacyPosition(group), + .scriptName = scriptName, + }); } } @@ -254,12 +260,13 @@ namespace OpenRCT2 out << ' '; out << baseName; - availableCostumes.push_back({ - .index = availCostumeIndexes[i], - .object = availCostumeObjects[i], - .rawName = baseName, - .friendlyName = out.str(), - }); + availableCostumes.push_back( + { + .index = availCostumeIndexes[i], + .object = availCostumeObjects[i], + .rawName = baseName, + .friendlyName = out.str(), + }); } std::sort(availableCostumes.begin(), availableCostumes.end(), [](const auto& a, const auto& b) { diff --git a/src/openrct2/platform/Crash.cpp b/src/openrct2/platform/Crash.cpp index 29dcc98d88..ddb9b2c96a 100644 --- a/src/openrct2/platform/Crash.cpp +++ b/src/openrct2/platform/Crash.cpp @@ -71,8 +71,9 @@ static bool UploadMinidump(const std::map& files, in { wprintf(L"files[%s] = %s\n", file.first.c_str(), file.second.c_str()); } - std::wstring url(L"https://openrct2.sp.backtrace.io:6098/" - L"post?format=minidump&token=" BACKTRACE_TOKEN); + std::wstring url( + L"https://openrct2.sp.backtrace.io:6098/" + L"post?format=minidump&token=" BACKTRACE_TOKEN); std::map parameters; parameters[L"product_name"] = L"openrct2"; parameters[L"version"] = String::toWideChar(gVersionInfoFull); diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index f8dc1b4e48..e5c596129c 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -410,14 +410,15 @@ namespace OpenRCT2::RCT1 void AddDefaultEntries() { // Add default scenery groups - _sceneryGroupEntries.AddRange({ - "rct2.scenery_group.scgtrees", - "rct2.scenery_group.scgshrub", - "rct2.scenery_group.scggardn", - "rct2.scenery_group.scgfence", - "rct2.scenery_group.scgwalls", - "rct2.scenery_group.scgpathx", - }); + _sceneryGroupEntries.AddRange( + { + "rct2.scenery_group.scgtrees", + "rct2.scenery_group.scgshrub", + "rct2.scenery_group.scggardn", + "rct2.scenery_group.scgfence", + "rct2.scenery_group.scgwalls", + "rct2.scenery_group.scgpathx", + }); // Add default footpaths _footpathSurfaceEntries.AddRange( @@ -428,8 +429,9 @@ namespace OpenRCT2::RCT1 "rct1ll.footpath_surface.tiles_red", "rct1.footpath_surface.queue_blue", "rct1aa.footpath_surface.queue_red", "rct1aa.footpath_surface.queue_yellow", "rct1aa.footpath_surface.queue_green" }); - _footpathRailingsEntries.AddRange({ "rct2.footpath_railings.wood", "rct1ll.footpath_railings.space", - "rct1ll.footpath_railings.bamboo", "rct2.footpath_railings.concrete" }); + _footpathRailingsEntries.AddRange( + { "rct2.footpath_railings.wood", "rct1ll.footpath_railings.space", "rct1ll.footpath_railings.bamboo", + "rct2.footpath_railings.concrete" }); // Add default surfaces _terrainSurfaceEntries.AddRange( @@ -441,12 +443,12 @@ namespace OpenRCT2::RCT1 "rct1ll.terrain_surface.roof_grey", "rct1ll.terrain_surface.rust", "rct1ll.terrain_surface.wood" }); // Add default edges - _terrainEdgeEntries.AddRange({ "rct2.terrain_edge.rock", "rct2.terrain_edge.wood_red", - "rct2.terrain_edge.wood_black", "rct2.terrain_edge.ice", "rct1.terrain_edge.brick", - "rct1.terrain_edge.iron", "rct1aa.terrain_edge.grey", "rct1aa.terrain_edge.yellow", - "rct1aa.terrain_edge.red", "rct1ll.terrain_edge.purple", "rct1ll.terrain_edge.green", - "rct1ll.terrain_edge.stone_brown", "rct1ll.terrain_edge.stone_grey", - "rct1ll.terrain_edge.skyscraper_a", "rct1ll.terrain_edge.skyscraper_b" }); + _terrainEdgeEntries.AddRange( + { "rct2.terrain_edge.rock", "rct2.terrain_edge.wood_red", "rct2.terrain_edge.wood_black", + "rct2.terrain_edge.ice", "rct1.terrain_edge.brick", "rct1.terrain_edge.iron", "rct1aa.terrain_edge.grey", + "rct1aa.terrain_edge.yellow", "rct1aa.terrain_edge.red", "rct1ll.terrain_edge.purple", + "rct1ll.terrain_edge.green", "rct1ll.terrain_edge.stone_brown", "rct1ll.terrain_edge.stone_grey", + "rct1ll.terrain_edge.skyscraper_a", "rct1ll.terrain_edge.skyscraper_b" }); } void AddAvailableEntriesFromResearchList() diff --git a/src/openrct2/scripting/HookEngine.cpp b/src/openrct2/scripting/HookEngine.cpp index 169ddc3292..0a3ad83c13 100644 --- a/src/openrct2/scripting/HookEngine.cpp +++ b/src/openrct2/scripting/HookEngine.cpp @@ -18,24 +18,25 @@ using namespace OpenRCT2::Scripting; -static const EnumMap HooksLookupTable({ - { "action.query", HookType::actionQuery }, - { "action.execute", HookType::actionExecute }, - { "interval.tick", HookType::intervalTick }, - { "interval.day", HookType::intervalDay }, - { "network.chat", HookType::networkChat }, - { "network.authenticate", HookType::networkAuthenticate }, - { "network.join", HookType::networkJoin }, - { "network.leave", HookType::networkLeave }, - { "ride.ratings.calculate", HookType::rideRatingsCalculate }, - { "action.location", HookType::actionLocation }, - { "guest.generation", HookType::guestGeneration }, - { "vehicle.crash", HookType::vehicleCrash }, - { "map.change", HookType::mapChange }, - { "map.changed", HookType::mapChanged }, - { "map.save", HookType::mapSave }, - { "park.guest.softcap.calculate", HookType::parkCalculateGuestCap }, -}); +static const EnumMap HooksLookupTable( + { + { "action.query", HookType::actionQuery }, + { "action.execute", HookType::actionExecute }, + { "interval.tick", HookType::intervalTick }, + { "interval.day", HookType::intervalDay }, + { "network.chat", HookType::networkChat }, + { "network.authenticate", HookType::networkAuthenticate }, + { "network.join", HookType::networkJoin }, + { "network.leave", HookType::networkLeave }, + { "ride.ratings.calculate", HookType::rideRatingsCalculate }, + { "action.location", HookType::actionLocation }, + { "guest.generation", HookType::guestGeneration }, + { "vehicle.crash", HookType::vehicleCrash }, + { "map.change", HookType::mapChange }, + { "map.changed", HookType::mapChanged }, + { "map.save", HookType::mapSave }, + { "park.guest.softcap.calculate", HookType::parkCalculateGuestCap }, + }); HookType OpenRCT2::Scripting::GetHookType(const std::string& name) { diff --git a/src/openrct2/scripting/bindings/entity/ScGuest.cpp b/src/openrct2/scripting/bindings/entity/ScGuest.cpp index fd49d36079..cfd1aeea15 100644 --- a/src/openrct2/scripting/bindings/entity/ScGuest.cpp +++ b/src/openrct2/scripting/bindings/entity/ScGuest.cpp @@ -21,133 +21,134 @@ namespace OpenRCT2::Scripting { - static const DukEnumMap ThoughtTypeMap({ - { "cant_afford_ride", PeepThoughtType::CantAffordRide }, - { "spent_money", PeepThoughtType::SpentMoney }, - { "sick", PeepThoughtType::Sick }, - { "very_sick", PeepThoughtType::VerySick }, - { "more_thrilling", PeepThoughtType::MoreThrilling }, - { "intense", PeepThoughtType::Intense }, - { "havent_finished", PeepThoughtType::HaventFinished }, - { "sickening", PeepThoughtType::Sickening }, - { "bad_value", PeepThoughtType::BadValue }, - { "go_home", PeepThoughtType::GoHome }, - { "good_value", PeepThoughtType::GoodValue }, - { "already_got", PeepThoughtType::AlreadyGot }, - { "cant_afford_item", PeepThoughtType::CantAffordItem }, - { "not_hungry", PeepThoughtType::NotHungry }, - { "not_thirsty", PeepThoughtType::NotThirsty }, - { "drowning", PeepThoughtType::Drowning }, - { "lost", PeepThoughtType::Lost }, - { "was_great", PeepThoughtType::WasGreat }, - { "queuing_ages", PeepThoughtType::QueuingAges }, - { "tired", PeepThoughtType::Tired }, - { "hungry", PeepThoughtType::Hungry }, - { "thirsty", PeepThoughtType::Thirsty }, - { "toilet", PeepThoughtType::Toilet }, - { "cant_find", PeepThoughtType::CantFind }, - { "not_paying", PeepThoughtType::NotPaying }, - { "not_while_raining", PeepThoughtType::NotWhileRaining }, - { "bad_litter", PeepThoughtType::BadLitter }, - { "cant_find_exit", PeepThoughtType::CantFindExit }, - { "get_off", PeepThoughtType::GetOff }, - { "get_out", PeepThoughtType::GetOut }, - { "not_safe", PeepThoughtType::NotSafe }, - { "path_disgusting", PeepThoughtType::PathDisgusting }, - { "crowded", PeepThoughtType::Crowded }, - { "vandalism", PeepThoughtType::Vandalism }, - { "scenery", PeepThoughtType::Scenery }, - { "very_clean", PeepThoughtType::VeryClean }, - { "fountains", PeepThoughtType::Fountains }, - { "music", PeepThoughtType::Music }, - { "balloon", PeepThoughtType::Balloon }, - { "toy", PeepThoughtType::Toy }, - { "map", PeepThoughtType::Map }, - { "photo", PeepThoughtType::Photo }, - { "umbrella", PeepThoughtType::Umbrella }, - { "drink", PeepThoughtType::Drink }, - { "burger", PeepThoughtType::Burger }, - { "chips", PeepThoughtType::Chips }, - { "ice_cream", PeepThoughtType::IceCream }, - { "candyfloss", PeepThoughtType::Candyfloss }, - { "pizza", PeepThoughtType::Pizza }, - { "popcorn", PeepThoughtType::Popcorn }, - { "hot_dog", PeepThoughtType::HotDog }, - { "tentacle", PeepThoughtType::Tentacle }, - { "hat", PeepThoughtType::Hat }, - { "toffee_apple", PeepThoughtType::ToffeeApple }, - { "tshirt", PeepThoughtType::Tshirt }, - { "doughnut", PeepThoughtType::Doughnut }, - { "coffee", PeepThoughtType::Coffee }, - { "chicken", PeepThoughtType::Chicken }, - { "lemonade", PeepThoughtType::Lemonade }, - { "wow", PeepThoughtType::Wow }, - { "wow2", PeepThoughtType::Wow2 }, - { "watched", PeepThoughtType::Watched }, - { "balloon_much", PeepThoughtType::BalloonMuch }, - { "toy_much", PeepThoughtType::ToyMuch }, - { "map_much", PeepThoughtType::MapMuch }, - { "photo_much", PeepThoughtType::PhotoMuch }, - { "umbrella_much", PeepThoughtType::UmbrellaMuch }, - { "drink_much", PeepThoughtType::DrinkMuch }, - { "burger_much", PeepThoughtType::BurgerMuch }, - { "chips_much", PeepThoughtType::ChipsMuch }, - { "ice_cream_much", PeepThoughtType::IceCreamMuch }, - { "candyfloss_much", PeepThoughtType::CandyflossMuch }, - { "pizza_much", PeepThoughtType::PizzaMuch }, - { "popcorn_much", PeepThoughtType::PopcornMuch }, - { "hot_dog_much", PeepThoughtType::HotDogMuch }, - { "tentacle_much", PeepThoughtType::TentacleMuch }, - { "hat_much", PeepThoughtType::HatMuch }, - { "toffee_apple_much", PeepThoughtType::ToffeeAppleMuch }, - { "tshirt_much", PeepThoughtType::TshirtMuch }, - { "doughnut_much", PeepThoughtType::DoughnutMuch }, - { "coffee_much", PeepThoughtType::CoffeeMuch }, - { "chicken_much", PeepThoughtType::ChickenMuch }, - { "lemonade_much", PeepThoughtType::LemonadeMuch }, - { "photo2", PeepThoughtType::Photo2 }, - { "photo3", PeepThoughtType::Photo3 }, - { "photo4", PeepThoughtType::Photo4 }, - { "pretzel", PeepThoughtType::Pretzel }, - { "hot_chocolate", PeepThoughtType::HotChocolate }, - { "iced_tea", PeepThoughtType::IcedTea }, - { "funnel_cake", PeepThoughtType::FunnelCake }, - { "sunglasses", PeepThoughtType::Sunglasses }, - { "beef_noodles", PeepThoughtType::BeefNoodles }, - { "fried_rice_noodles", PeepThoughtType::FriedRiceNoodles }, - { "wonton_soup", PeepThoughtType::WontonSoup }, - { "meatball_soup", PeepThoughtType::MeatballSoup }, - { "fruit_juice", PeepThoughtType::FruitJuice }, - { "soybean_milk", PeepThoughtType::SoybeanMilk }, - { "sujongkwa", PeepThoughtType::Sujongkwa }, - { "sub_sandwich", PeepThoughtType::SubSandwich }, - { "cookie", PeepThoughtType::Cookie }, - { "roast_sausage", PeepThoughtType::RoastSausage }, - { "photo2_much", PeepThoughtType::Photo2Much }, - { "photo3_much", PeepThoughtType::Photo3Much }, - { "photo4_much", PeepThoughtType::Photo4Much }, - { "pretzel_much", PeepThoughtType::PretzelMuch }, - { "hot_chocolate_much", PeepThoughtType::HotChocolateMuch }, - { "iced_tea_much", PeepThoughtType::IcedTeaMuch }, - { "funnel_cake_much", PeepThoughtType::FunnelCakeMuch }, - { "sunglasses_much", PeepThoughtType::SunglassesMuch }, - { "beef_noodles_much", PeepThoughtType::BeefNoodlesMuch }, - { "fried_rice_noodles_much", PeepThoughtType::FriedRiceNoodlesMuch }, - { "wonton_soup_much", PeepThoughtType::WontonSoupMuch }, - { "meatball_soup_much", PeepThoughtType::MeatballSoupMuch }, - { "fruit_juice_much", PeepThoughtType::FruitJuiceMuch }, - { "soybean_milk_much", PeepThoughtType::SoybeanMilkMuch }, - { "sujongkwa_much", PeepThoughtType::SujongkwaMuch }, - { "sub_sandwich_much", PeepThoughtType::SubSandwichMuch }, - { "cookie_much", PeepThoughtType::CookieMuch }, - { "roast_sausage_much", PeepThoughtType::RoastSausageMuch }, - { "help", PeepThoughtType::Help }, - { "running_out", PeepThoughtType::RunningOut }, - { "new_ride", PeepThoughtType::NewRide }, - { "nice_ride_deprecated", PeepThoughtType::NiceRideDeprecated }, - { "excited_deprecated", PeepThoughtType::ExcitedDeprecated }, - { "here_we_are", PeepThoughtType::HereWeAre }, - }); + static const DukEnumMap ThoughtTypeMap( + { + { "cant_afford_ride", PeepThoughtType::CantAffordRide }, + { "spent_money", PeepThoughtType::SpentMoney }, + { "sick", PeepThoughtType::Sick }, + { "very_sick", PeepThoughtType::VerySick }, + { "more_thrilling", PeepThoughtType::MoreThrilling }, + { "intense", PeepThoughtType::Intense }, + { "havent_finished", PeepThoughtType::HaventFinished }, + { "sickening", PeepThoughtType::Sickening }, + { "bad_value", PeepThoughtType::BadValue }, + { "go_home", PeepThoughtType::GoHome }, + { "good_value", PeepThoughtType::GoodValue }, + { "already_got", PeepThoughtType::AlreadyGot }, + { "cant_afford_item", PeepThoughtType::CantAffordItem }, + { "not_hungry", PeepThoughtType::NotHungry }, + { "not_thirsty", PeepThoughtType::NotThirsty }, + { "drowning", PeepThoughtType::Drowning }, + { "lost", PeepThoughtType::Lost }, + { "was_great", PeepThoughtType::WasGreat }, + { "queuing_ages", PeepThoughtType::QueuingAges }, + { "tired", PeepThoughtType::Tired }, + { "hungry", PeepThoughtType::Hungry }, + { "thirsty", PeepThoughtType::Thirsty }, + { "toilet", PeepThoughtType::Toilet }, + { "cant_find", PeepThoughtType::CantFind }, + { "not_paying", PeepThoughtType::NotPaying }, + { "not_while_raining", PeepThoughtType::NotWhileRaining }, + { "bad_litter", PeepThoughtType::BadLitter }, + { "cant_find_exit", PeepThoughtType::CantFindExit }, + { "get_off", PeepThoughtType::GetOff }, + { "get_out", PeepThoughtType::GetOut }, + { "not_safe", PeepThoughtType::NotSafe }, + { "path_disgusting", PeepThoughtType::PathDisgusting }, + { "crowded", PeepThoughtType::Crowded }, + { "vandalism", PeepThoughtType::Vandalism }, + { "scenery", PeepThoughtType::Scenery }, + { "very_clean", PeepThoughtType::VeryClean }, + { "fountains", PeepThoughtType::Fountains }, + { "music", PeepThoughtType::Music }, + { "balloon", PeepThoughtType::Balloon }, + { "toy", PeepThoughtType::Toy }, + { "map", PeepThoughtType::Map }, + { "photo", PeepThoughtType::Photo }, + { "umbrella", PeepThoughtType::Umbrella }, + { "drink", PeepThoughtType::Drink }, + { "burger", PeepThoughtType::Burger }, + { "chips", PeepThoughtType::Chips }, + { "ice_cream", PeepThoughtType::IceCream }, + { "candyfloss", PeepThoughtType::Candyfloss }, + { "pizza", PeepThoughtType::Pizza }, + { "popcorn", PeepThoughtType::Popcorn }, + { "hot_dog", PeepThoughtType::HotDog }, + { "tentacle", PeepThoughtType::Tentacle }, + { "hat", PeepThoughtType::Hat }, + { "toffee_apple", PeepThoughtType::ToffeeApple }, + { "tshirt", PeepThoughtType::Tshirt }, + { "doughnut", PeepThoughtType::Doughnut }, + { "coffee", PeepThoughtType::Coffee }, + { "chicken", PeepThoughtType::Chicken }, + { "lemonade", PeepThoughtType::Lemonade }, + { "wow", PeepThoughtType::Wow }, + { "wow2", PeepThoughtType::Wow2 }, + { "watched", PeepThoughtType::Watched }, + { "balloon_much", PeepThoughtType::BalloonMuch }, + { "toy_much", PeepThoughtType::ToyMuch }, + { "map_much", PeepThoughtType::MapMuch }, + { "photo_much", PeepThoughtType::PhotoMuch }, + { "umbrella_much", PeepThoughtType::UmbrellaMuch }, + { "drink_much", PeepThoughtType::DrinkMuch }, + { "burger_much", PeepThoughtType::BurgerMuch }, + { "chips_much", PeepThoughtType::ChipsMuch }, + { "ice_cream_much", PeepThoughtType::IceCreamMuch }, + { "candyfloss_much", PeepThoughtType::CandyflossMuch }, + { "pizza_much", PeepThoughtType::PizzaMuch }, + { "popcorn_much", PeepThoughtType::PopcornMuch }, + { "hot_dog_much", PeepThoughtType::HotDogMuch }, + { "tentacle_much", PeepThoughtType::TentacleMuch }, + { "hat_much", PeepThoughtType::HatMuch }, + { "toffee_apple_much", PeepThoughtType::ToffeeAppleMuch }, + { "tshirt_much", PeepThoughtType::TshirtMuch }, + { "doughnut_much", PeepThoughtType::DoughnutMuch }, + { "coffee_much", PeepThoughtType::CoffeeMuch }, + { "chicken_much", PeepThoughtType::ChickenMuch }, + { "lemonade_much", PeepThoughtType::LemonadeMuch }, + { "photo2", PeepThoughtType::Photo2 }, + { "photo3", PeepThoughtType::Photo3 }, + { "photo4", PeepThoughtType::Photo4 }, + { "pretzel", PeepThoughtType::Pretzel }, + { "hot_chocolate", PeepThoughtType::HotChocolate }, + { "iced_tea", PeepThoughtType::IcedTea }, + { "funnel_cake", PeepThoughtType::FunnelCake }, + { "sunglasses", PeepThoughtType::Sunglasses }, + { "beef_noodles", PeepThoughtType::BeefNoodles }, + { "fried_rice_noodles", PeepThoughtType::FriedRiceNoodles }, + { "wonton_soup", PeepThoughtType::WontonSoup }, + { "meatball_soup", PeepThoughtType::MeatballSoup }, + { "fruit_juice", PeepThoughtType::FruitJuice }, + { "soybean_milk", PeepThoughtType::SoybeanMilk }, + { "sujongkwa", PeepThoughtType::Sujongkwa }, + { "sub_sandwich", PeepThoughtType::SubSandwich }, + { "cookie", PeepThoughtType::Cookie }, + { "roast_sausage", PeepThoughtType::RoastSausage }, + { "photo2_much", PeepThoughtType::Photo2Much }, + { "photo3_much", PeepThoughtType::Photo3Much }, + { "photo4_much", PeepThoughtType::Photo4Much }, + { "pretzel_much", PeepThoughtType::PretzelMuch }, + { "hot_chocolate_much", PeepThoughtType::HotChocolateMuch }, + { "iced_tea_much", PeepThoughtType::IcedTeaMuch }, + { "funnel_cake_much", PeepThoughtType::FunnelCakeMuch }, + { "sunglasses_much", PeepThoughtType::SunglassesMuch }, + { "beef_noodles_much", PeepThoughtType::BeefNoodlesMuch }, + { "fried_rice_noodles_much", PeepThoughtType::FriedRiceNoodlesMuch }, + { "wonton_soup_much", PeepThoughtType::WontonSoupMuch }, + { "meatball_soup_much", PeepThoughtType::MeatballSoupMuch }, + { "fruit_juice_much", PeepThoughtType::FruitJuiceMuch }, + { "soybean_milk_much", PeepThoughtType::SoybeanMilkMuch }, + { "sujongkwa_much", PeepThoughtType::SujongkwaMuch }, + { "sub_sandwich_much", PeepThoughtType::SubSandwichMuch }, + { "cookie_much", PeepThoughtType::CookieMuch }, + { "roast_sausage_much", PeepThoughtType::RoastSausageMuch }, + { "help", PeepThoughtType::Help }, + { "running_out", PeepThoughtType::RunningOut }, + { "new_ride", PeepThoughtType::NewRide }, + { "nice_ride_deprecated", PeepThoughtType::NiceRideDeprecated }, + { "excited_deprecated", PeepThoughtType::ExcitedDeprecated }, + { "here_we_are", PeepThoughtType::HereWeAre }, + }); ScGuest::ScGuest(EntityId id) : ScPeep(id) diff --git a/src/openrct2/scripting/bindings/entity/ScGuest.hpp b/src/openrct2/scripting/bindings/entity/ScGuest.hpp index 9ee593e220..ceb5dc78fc 100644 --- a/src/openrct2/scripting/bindings/entity/ScGuest.hpp +++ b/src/openrct2/scripting/bindings/entity/ScGuest.hpp @@ -19,68 +19,70 @@ enum class PeepAnimationType : uint8_t; namespace OpenRCT2::Scripting { - static const DukEnumMap ShopItemMap({ - { "beef_noodles", ShopItem::BeefNoodles }, - { "burger", ShopItem::Burger }, - { "candyfloss", ShopItem::Candyfloss }, - { "chicken", ShopItem::Chicken }, - { "chips", ShopItem::Chips }, - { "chocolate", ShopItem::Chocolate }, - { "cookie", ShopItem::Cookie }, - { "doughnut", ShopItem::Doughnut }, - { "hot_dog", ShopItem::HotDog }, - { "fried_rice_noodles", ShopItem::FriedRiceNoodles }, - { "funnel_cake", ShopItem::FunnelCake }, - { "ice_cream", ShopItem::IceCream }, - { "meatball_soup", ShopItem::MeatballSoup }, - { "pizza", ShopItem::Pizza }, - { "popcorn", ShopItem::Popcorn }, - { "pretzel", ShopItem::Pretzel }, - { "roast_sausage", ShopItem::RoastSausage }, - { "sub_sandwich", ShopItem::SubSandwich }, - { "tentacle", ShopItem::Tentacle }, - { "toffee_apple", ShopItem::ToffeeApple }, - { "wonton_soup", ShopItem::WontonSoup }, - { "coffee", ShopItem::Coffee }, - { "drink", ShopItem::Drink }, - { "fruit_juice", ShopItem::FruitJuice }, - { "iced_tea", ShopItem::IcedTea }, - { "lemonade", ShopItem::Lemonade }, - { "soybean_milk", ShopItem::SoybeanMilk }, - { "sujeonggwa", ShopItem::Sujeonggwa }, - { "balloon", ShopItem::Balloon }, - { "hat", ShopItem::Hat }, - { "map", ShopItem::Map }, - { "sunglasses", ShopItem::Sunglasses }, - { "toy", ShopItem::Toy }, - { "tshirt", ShopItem::TShirt }, - { "umbrella", ShopItem::Umbrella }, - { "photo1", ShopItem::Photo }, - { "photo2", ShopItem::Photo2 }, - { "photo3", ShopItem::Photo3 }, - { "photo4", ShopItem::Photo4 }, - { "voucher", ShopItem::Voucher }, - { "empty_bottle", ShopItem::EmptyBottle }, - { "empty_bowl_blue", ShopItem::EmptyBowlBlue }, - { "empty_bowl_red", ShopItem::EmptyBowlRed }, - { "empty_box", ShopItem::EmptyBox }, - { "empty_burger_box", ShopItem::EmptyBurgerBox }, - { "empty_can", ShopItem::EmptyCan }, - { "empty_cup", ShopItem::EmptyCup }, - { "empty_drink_carton", ShopItem::EmptyDrinkCarton }, - { "empty_juice_cup", ShopItem::EmptyJuiceCup }, - { "rubbish", ShopItem::Rubbish }, - }); + static const DukEnumMap ShopItemMap( + { + { "beef_noodles", ShopItem::BeefNoodles }, + { "burger", ShopItem::Burger }, + { "candyfloss", ShopItem::Candyfloss }, + { "chicken", ShopItem::Chicken }, + { "chips", ShopItem::Chips }, + { "chocolate", ShopItem::Chocolate }, + { "cookie", ShopItem::Cookie }, + { "doughnut", ShopItem::Doughnut }, + { "hot_dog", ShopItem::HotDog }, + { "fried_rice_noodles", ShopItem::FriedRiceNoodles }, + { "funnel_cake", ShopItem::FunnelCake }, + { "ice_cream", ShopItem::IceCream }, + { "meatball_soup", ShopItem::MeatballSoup }, + { "pizza", ShopItem::Pizza }, + { "popcorn", ShopItem::Popcorn }, + { "pretzel", ShopItem::Pretzel }, + { "roast_sausage", ShopItem::RoastSausage }, + { "sub_sandwich", ShopItem::SubSandwich }, + { "tentacle", ShopItem::Tentacle }, + { "toffee_apple", ShopItem::ToffeeApple }, + { "wonton_soup", ShopItem::WontonSoup }, + { "coffee", ShopItem::Coffee }, + { "drink", ShopItem::Drink }, + { "fruit_juice", ShopItem::FruitJuice }, + { "iced_tea", ShopItem::IcedTea }, + { "lemonade", ShopItem::Lemonade }, + { "soybean_milk", ShopItem::SoybeanMilk }, + { "sujeonggwa", ShopItem::Sujeonggwa }, + { "balloon", ShopItem::Balloon }, + { "hat", ShopItem::Hat }, + { "map", ShopItem::Map }, + { "sunglasses", ShopItem::Sunglasses }, + { "toy", ShopItem::Toy }, + { "tshirt", ShopItem::TShirt }, + { "umbrella", ShopItem::Umbrella }, + { "photo1", ShopItem::Photo }, + { "photo2", ShopItem::Photo2 }, + { "photo3", ShopItem::Photo3 }, + { "photo4", ShopItem::Photo4 }, + { "voucher", ShopItem::Voucher }, + { "empty_bottle", ShopItem::EmptyBottle }, + { "empty_bowl_blue", ShopItem::EmptyBowlBlue }, + { "empty_bowl_red", ShopItem::EmptyBowlRed }, + { "empty_box", ShopItem::EmptyBox }, + { "empty_burger_box", ShopItem::EmptyBurgerBox }, + { "empty_can", ShopItem::EmptyCan }, + { "empty_cup", ShopItem::EmptyCup }, + { "empty_drink_carton", ShopItem::EmptyDrinkCarton }, + { "empty_juice_cup", ShopItem::EmptyJuiceCup }, + { "rubbish", ShopItem::Rubbish }, + }); // Since the ShopItem enum is missing values and includes ShopItem::Admission (something a // guest cannot carry), 6 is subtracted from the value. static_assert((EnumValue(ShopItem::Count) - 6) == 50, "ShopItem::Count changed, update scripting binding!"); - static const DukEnumMap VoucherTypeMap({ - { "entry_free", VOUCHER_TYPE_PARK_ENTRY_FREE }, - { "entry_half_price", VOUCHER_TYPE_PARK_ENTRY_HALF_PRICE }, - { "ride_free", VOUCHER_TYPE_RIDE_FREE }, - { "food_drink_free", VOUCHER_TYPE_FOOD_OR_DRINK_FREE }, - }); + static const DukEnumMap VoucherTypeMap( + { + { "entry_free", VOUCHER_TYPE_PARK_ENTRY_FREE }, + { "entry_half_price", VOUCHER_TYPE_PARK_ENTRY_HALF_PRICE }, + { "ride_free", VOUCHER_TYPE_RIDE_FREE }, + { "food_drink_free", VOUCHER_TYPE_FOOD_OR_DRINK_FREE }, + }); class ScThought { diff --git a/src/openrct2/scripting/bindings/entity/ScLitter.cpp b/src/openrct2/scripting/bindings/entity/ScLitter.cpp index f602632d65..86dc36d6c6 100644 --- a/src/openrct2/scripting/bindings/entity/ScLitter.cpp +++ b/src/openrct2/scripting/bindings/entity/ScLitter.cpp @@ -15,20 +15,21 @@ namespace OpenRCT2::Scripting { - static const DukEnumMap LitterTypeMap({ - { "vomit", Litter::Type::Vomit }, - { "vomit_alt", Litter::Type::VomitAlt }, - { "empty_can", Litter::Type::EmptyCan }, - { "rubbish", Litter::Type::Rubbish }, - { "burger_box", Litter::Type::BurgerBox }, - { "empty_cup", Litter::Type::EmptyCup }, - { "empty_box", Litter::Type::EmptyBox }, - { "empty_bottle", Litter::Type::EmptyBottle }, - { "empty_bowl_red", Litter::Type::EmptyBowlRed }, - { "empty_drink_carton", Litter::Type::EmptyDrinkCarton }, - { "empty_juice_cup", Litter::Type::EmptyJuiceCup }, - { "empty_bowl_blue", Litter::Type::EmptyBowlBlue }, - }); + static const DukEnumMap LitterTypeMap( + { + { "vomit", Litter::Type::Vomit }, + { "vomit_alt", Litter::Type::VomitAlt }, + { "empty_can", Litter::Type::EmptyCan }, + { "rubbish", Litter::Type::Rubbish }, + { "burger_box", Litter::Type::BurgerBox }, + { "empty_cup", Litter::Type::EmptyCup }, + { "empty_box", Litter::Type::EmptyBox }, + { "empty_bottle", Litter::Type::EmptyBottle }, + { "empty_bowl_red", Litter::Type::EmptyBowlRed }, + { "empty_drink_carton", Litter::Type::EmptyDrinkCarton }, + { "empty_juice_cup", Litter::Type::EmptyJuiceCup }, + { "empty_bowl_blue", Litter::Type::EmptyBowlBlue }, + }); ScLitter::ScLitter(EntityId Id) : ScEntity(Id) diff --git a/src/openrct2/scripting/bindings/entity/ScParticle.cpp b/src/openrct2/scripting/bindings/entity/ScParticle.cpp index 4c624b378d..f4250c6e0e 100644 --- a/src/openrct2/scripting/bindings/entity/ScParticle.cpp +++ b/src/openrct2/scripting/bindings/entity/ScParticle.cpp @@ -15,13 +15,14 @@ namespace OpenRCT2::Scripting { - static const DukEnumMap CrashParticleTypeMap({ - { "corner", 0 }, - { "rod", 1 }, - { "wheel", 2 }, - { "panel", 3 }, - { "seat", 4 }, - }); + static const DukEnumMap CrashParticleTypeMap( + { + { "corner", 0 }, + { "rod", 1 }, + { "wheel", 2 }, + { "panel", 3 }, + { "seat", 4 }, + }); ScCrashedVehicleParticle::ScCrashedVehicleParticle(EntityId id) : ScEntity(id) diff --git a/src/openrct2/scripting/bindings/entity/ScPeep.hpp b/src/openrct2/scripting/bindings/entity/ScPeep.hpp index dc4baa8877..3ee1bbd344 100644 --- a/src/openrct2/scripting/bindings/entity/ScPeep.hpp +++ b/src/openrct2/scripting/bindings/entity/ScPeep.hpp @@ -15,35 +15,36 @@ namespace OpenRCT2::Scripting { - static const DukEnumMap PeepFlagMap({ - { "leavingPark", PEEP_FLAGS_LEAVING_PARK }, - { "slowWalk", PEEP_FLAGS_SLOW_WALK }, - { "tracking", PEEP_FLAGS_TRACKING }, - { "waving", PEEP_FLAGS_WAVING }, - { "hasPaidForParkEntry", PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY }, - { "photo", PEEP_FLAGS_PHOTO }, - { "painting", PEEP_FLAGS_PAINTING }, - { "wow", PEEP_FLAGS_WOW }, - { "litter", PEEP_FLAGS_LITTER }, - { "lost", PEEP_FLAGS_LOST }, - { "hunger", PEEP_FLAGS_HUNGER }, - { "toilet", PEEP_FLAGS_TOILET }, - { "crowded", PEEP_FLAGS_CROWDED }, - { "happiness", PEEP_FLAGS_HAPPINESS }, - { "nausea", PEEP_FLAGS_NAUSEA }, - { "purple", PEEP_FLAGS_PURPLE }, - { "pizza", PEEP_FLAGS_PIZZA }, - { "explode", PEEP_FLAGS_EXPLODE }, - { "rideShouldBeMarkedAsFavourite", PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE }, - { "parkEntranceChosen", PEEP_FLAGS_PARK_ENTRANCE_CHOSEN }, - { "contagious", PEEP_FLAGS_CONTAGIOUS }, - { "joy", PEEP_FLAGS_JOY }, - { "angry", PEEP_FLAGS_ANGRY }, - { "iceCream", PEEP_FLAGS_ICE_CREAM }, - { "hereWeAre", PEEP_FLAGS_HERE_WE_ARE }, - { "positionFrozen", PEEP_FLAGS_POSITION_FROZEN }, - { "animationFrozen", PEEP_FLAGS_ANIMATION_FROZEN }, - }); + static const DukEnumMap PeepFlagMap( + { + { "leavingPark", PEEP_FLAGS_LEAVING_PARK }, + { "slowWalk", PEEP_FLAGS_SLOW_WALK }, + { "tracking", PEEP_FLAGS_TRACKING }, + { "waving", PEEP_FLAGS_WAVING }, + { "hasPaidForParkEntry", PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY }, + { "photo", PEEP_FLAGS_PHOTO }, + { "painting", PEEP_FLAGS_PAINTING }, + { "wow", PEEP_FLAGS_WOW }, + { "litter", PEEP_FLAGS_LITTER }, + { "lost", PEEP_FLAGS_LOST }, + { "hunger", PEEP_FLAGS_HUNGER }, + { "toilet", PEEP_FLAGS_TOILET }, + { "crowded", PEEP_FLAGS_CROWDED }, + { "happiness", PEEP_FLAGS_HAPPINESS }, + { "nausea", PEEP_FLAGS_NAUSEA }, + { "purple", PEEP_FLAGS_PURPLE }, + { "pizza", PEEP_FLAGS_PIZZA }, + { "explode", PEEP_FLAGS_EXPLODE }, + { "rideShouldBeMarkedAsFavourite", PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE }, + { "parkEntranceChosen", PEEP_FLAGS_PARK_ENTRANCE_CHOSEN }, + { "contagious", PEEP_FLAGS_CONTAGIOUS }, + { "joy", PEEP_FLAGS_JOY }, + { "angry", PEEP_FLAGS_ANGRY }, + { "iceCream", PEEP_FLAGS_ICE_CREAM }, + { "hereWeAre", PEEP_FLAGS_HERE_WE_ARE }, + { "positionFrozen", PEEP_FLAGS_POSITION_FROZEN }, + { "animationFrozen", PEEP_FLAGS_ANIMATION_FROZEN }, + }); class ScPeep : public ScEntity { diff --git a/src/openrct2/scripting/bindings/entity/ScVehicle.cpp b/src/openrct2/scripting/bindings/entity/ScVehicle.cpp index b0ef6eb28c..ba32b67f3d 100644 --- a/src/openrct2/scripting/bindings/entity/ScVehicle.cpp +++ b/src/openrct2/scripting/bindings/entity/ScVehicle.cpp @@ -20,39 +20,40 @@ using namespace OpenRCT2::TrackMetaData; namespace OpenRCT2::Scripting { - static const DukEnumMap VehicleStatusMap({ - { "moving_to_end_of_station", Vehicle::Status::MovingToEndOfStation }, - { "waiting_for_passengers", Vehicle::Status::WaitingForPassengers }, - { "waiting_to_depart", Vehicle::Status::WaitingToDepart }, - { "departing", Vehicle::Status::Departing }, - { "travelling", Vehicle::Status::Travelling }, - { "arriving", Vehicle::Status::Arriving }, - { "unloading_passengers", Vehicle::Status::UnloadingPassengers }, - { "travelling_boat", Vehicle::Status::TravellingBoat }, - { "crashing", Vehicle::Status::Crashing }, - { "crashed", Vehicle::Status::Crashed }, - { "travelling_dodgems", Vehicle::Status::TravellingDodgems }, - { "swinging", Vehicle::Status::Swinging }, - { "rotating", Vehicle::Status::Rotating }, - { "ferris_wheel_rotating", Vehicle::Status::FerrisWheelRotating }, - { "simulator_operating", Vehicle::Status::SimulatorOperating }, - { "showing_film", Vehicle::Status::ShowingFilm }, - { "space_rings_operating", Vehicle::Status::SpaceRingsOperating }, - { "top_spin_operating", Vehicle::Status::TopSpinOperating }, - { "haunted_house_operating", Vehicle::Status::HauntedHouseOperating }, - { "doing_circus_show", Vehicle::Status::DoingCircusShow }, - { "crooked_house_operating", Vehicle::Status::CrookedHouseOperating }, - { "waiting_for_cable_lift", Vehicle::Status::WaitingForCableLift }, - { "travelling_cable_lift", Vehicle::Status::TravellingCableLift }, - { "stopping", Vehicle::Status::Stopping }, - { "waiting_for_passengers_17", Vehicle::Status::WaitingForPassengers17 }, - { "waiting_to_start", Vehicle::Status::WaitingToStart }, - { "starting", Vehicle::Status::Starting }, - { "operating_1a", Vehicle::Status::Operating1A }, - { "stopping_1b", Vehicle::Status::Stopping1B }, - { "unloading_passengers_1c", Vehicle::Status::UnloadingPassengers1C }, - { "stopped_by_block_brake", Vehicle::Status::StoppedByBlockBrakes }, - }); + static const DukEnumMap VehicleStatusMap( + { + { "moving_to_end_of_station", Vehicle::Status::MovingToEndOfStation }, + { "waiting_for_passengers", Vehicle::Status::WaitingForPassengers }, + { "waiting_to_depart", Vehicle::Status::WaitingToDepart }, + { "departing", Vehicle::Status::Departing }, + { "travelling", Vehicle::Status::Travelling }, + { "arriving", Vehicle::Status::Arriving }, + { "unloading_passengers", Vehicle::Status::UnloadingPassengers }, + { "travelling_boat", Vehicle::Status::TravellingBoat }, + { "crashing", Vehicle::Status::Crashing }, + { "crashed", Vehicle::Status::Crashed }, + { "travelling_dodgems", Vehicle::Status::TravellingDodgems }, + { "swinging", Vehicle::Status::Swinging }, + { "rotating", Vehicle::Status::Rotating }, + { "ferris_wheel_rotating", Vehicle::Status::FerrisWheelRotating }, + { "simulator_operating", Vehicle::Status::SimulatorOperating }, + { "showing_film", Vehicle::Status::ShowingFilm }, + { "space_rings_operating", Vehicle::Status::SpaceRingsOperating }, + { "top_spin_operating", Vehicle::Status::TopSpinOperating }, + { "haunted_house_operating", Vehicle::Status::HauntedHouseOperating }, + { "doing_circus_show", Vehicle::Status::DoingCircusShow }, + { "crooked_house_operating", Vehicle::Status::CrookedHouseOperating }, + { "waiting_for_cable_lift", Vehicle::Status::WaitingForCableLift }, + { "travelling_cable_lift", Vehicle::Status::TravellingCableLift }, + { "stopping", Vehicle::Status::Stopping }, + { "waiting_for_passengers_17", Vehicle::Status::WaitingForPassengers17 }, + { "waiting_to_start", Vehicle::Status::WaitingToStart }, + { "starting", Vehicle::Status::Starting }, + { "operating_1a", Vehicle::Status::Operating1A }, + { "stopping_1b", Vehicle::Status::Stopping1B }, + { "unloading_passengers_1c", Vehicle::Status::UnloadingPassengers1C }, + { "stopped_by_block_brake", Vehicle::Status::StoppedByBlockBrakes }, + }); ScVehicle::ScVehicle(EntityId id) : ScEntity(id) diff --git a/src/openrct2/scripting/bindings/ride/ScTrackSegment.cpp b/src/openrct2/scripting/bindings/ride/ScTrackSegment.cpp index 27da8c20cc..afa982c48b 100644 --- a/src/openrct2/scripting/bindings/ride/ScTrackSegment.cpp +++ b/src/openrct2/scripting/bindings/ride/ScTrackSegment.cpp @@ -197,17 +197,18 @@ std::vector ScTrackSegment::getSubpositions(uint8_t trackSubposition, static DukValue _trackCurveToString(duk_context* ctx, TrackCurve curve) { - static const EnumMap map({ - { "straight", TrackCurve::None }, - { "left", TrackCurve::Left }, - { "right", TrackCurve::Right }, - { "left_small", TrackCurve::LeftSmall }, - { "right_small", TrackCurve::RightSmall }, - { "left_very_small", TrackCurve::LeftVerySmall }, - { "right_very_small", TrackCurve::RightVerySmall }, - { "left_large", TrackCurve::LeftLarge }, - { "right_large", TrackCurve::RightLarge }, - }); + static const EnumMap map( + { + { "straight", TrackCurve::None }, + { "left", TrackCurve::Left }, + { "right", TrackCurve::Right }, + { "left_small", TrackCurve::LeftSmall }, + { "right_small", TrackCurve::RightSmall }, + { "left_very_small", TrackCurve::LeftVerySmall }, + { "right_very_small", TrackCurve::RightVerySmall }, + { "left_large", TrackCurve::LeftLarge }, + { "right_large", TrackCurve::RightLarge }, + }); u8string text = u8string(map[curve]); return ToDuk(ctx, text); diff --git a/src/openrct2/scripting/bindings/world/ScPark.cpp b/src/openrct2/scripting/bindings/world/ScPark.cpp index 5dabf66f1c..c115667795 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.cpp +++ b/src/openrct2/scripting/bindings/world/ScPark.cpp @@ -28,21 +28,22 @@ namespace OpenRCT2::Scripting { - static const DukEnumMap ParkFlagMap({ - { "open", PARK_FLAGS_PARK_OPEN }, - { "scenarioCompleteNameInput", PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT }, - { "forbidLandscapeChanges", PARK_FLAGS_FORBID_LANDSCAPE_CHANGES }, - { "forbidTreeRemoval", PARK_FLAGS_FORBID_TREE_REMOVAL }, - { "forbidHighConstruction", PARK_FLAGS_FORBID_HIGH_CONSTRUCTION }, - { "preferLessIntenseRides", PARK_FLAGS_PREF_LESS_INTENSE_RIDES }, - { "forbidMarketingCampaigns", PARK_FLAGS_FORBID_MARKETING_CAMPAIGN }, - { "preferMoreIntenseRides", PARK_FLAGS_PREF_MORE_INTENSE_RIDES }, - { "noMoney", PARK_FLAGS_NO_MONEY }, - { "difficultGuestGeneration", PARK_FLAGS_DIFFICULT_GUEST_GENERATION }, - { "freeParkEntry", PARK_FLAGS_PARK_FREE_ENTRY }, - { "difficultParkRating", PARK_FLAGS_DIFFICULT_PARK_RATING }, - { "unlockAllPrices", PARK_FLAGS_UNLOCK_ALL_PRICES }, - }); + static const DukEnumMap ParkFlagMap( + { + { "open", PARK_FLAGS_PARK_OPEN }, + { "scenarioCompleteNameInput", PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT }, + { "forbidLandscapeChanges", PARK_FLAGS_FORBID_LANDSCAPE_CHANGES }, + { "forbidTreeRemoval", PARK_FLAGS_FORBID_TREE_REMOVAL }, + { "forbidHighConstruction", PARK_FLAGS_FORBID_HIGH_CONSTRUCTION }, + { "preferLessIntenseRides", PARK_FLAGS_PREF_LESS_INTENSE_RIDES }, + { "forbidMarketingCampaigns", PARK_FLAGS_FORBID_MARKETING_CAMPAIGN }, + { "preferMoreIntenseRides", PARK_FLAGS_PREF_MORE_INTENSE_RIDES }, + { "noMoney", PARK_FLAGS_NO_MONEY }, + { "difficultGuestGeneration", PARK_FLAGS_DIFFICULT_GUEST_GENERATION }, + { "freeParkEntry", PARK_FLAGS_PARK_FREE_ENTRY }, + { "difficultParkRating", PARK_FLAGS_DIFFICULT_PARK_RATING }, + { "unlockAllPrices", PARK_FLAGS_UNLOCK_ALL_PRICES }, + }); ScPark::ScPark(duk_context* ctx) : _context(ctx) diff --git a/src/openrct2/scripting/bindings/world/ScResearch.cpp b/src/openrct2/scripting/bindings/world/ScResearch.cpp index 08b273f2a2..b6f718b5b7 100644 --- a/src/openrct2/scripting/bindings/world/ScResearch.cpp +++ b/src/openrct2/scripting/bindings/world/ScResearch.cpp @@ -24,28 +24,31 @@ using namespace OpenRCT2; namespace OpenRCT2::Scripting { - static const DukEnumMap ResearchStageMap({ - { "initial_research", RESEARCH_STAGE_INITIAL_RESEARCH }, - { "designing", RESEARCH_STAGE_DESIGNING }, - { "completing_design", RESEARCH_STAGE_COMPLETING_DESIGN }, - { "unknown", RESEARCH_STAGE_UNKNOWN }, - { "finished_all", RESEARCH_STAGE_FINISHED_ALL }, - }); + static const DukEnumMap ResearchStageMap( + { + { "initial_research", RESEARCH_STAGE_INITIAL_RESEARCH }, + { "designing", RESEARCH_STAGE_DESIGNING }, + { "completing_design", RESEARCH_STAGE_COMPLETING_DESIGN }, + { "unknown", RESEARCH_STAGE_UNKNOWN }, + { "finished_all", RESEARCH_STAGE_FINISHED_ALL }, + }); - static const DukEnumMap ResearchCategoryMap({ - { "transport", ResearchCategory::Transport }, - { "gentle", ResearchCategory::Gentle }, - { "rollercoaster", ResearchCategory::Rollercoaster }, - { "thrill", ResearchCategory::Thrill }, - { "water", ResearchCategory::Water }, - { "shop", ResearchCategory::Shop }, - { "scenery", ResearchCategory::SceneryGroup }, - }); + static const DukEnumMap ResearchCategoryMap( + { + { "transport", ResearchCategory::Transport }, + { "gentle", ResearchCategory::Gentle }, + { "rollercoaster", ResearchCategory::Rollercoaster }, + { "thrill", ResearchCategory::Thrill }, + { "water", ResearchCategory::Water }, + { "shop", ResearchCategory::Shop }, + { "scenery", ResearchCategory::SceneryGroup }, + }); - static const DukEnumMap ResearchEntryTypeMap({ - { "ride", Research::EntryType::Ride }, - { "scenery", Research::EntryType::Scenery }, - }); + static const DukEnumMap ResearchEntryTypeMap( + { + { "ride", Research::EntryType::Ride }, + { "scenery", Research::EntryType::Scenery }, + }); template<> inline DukValue ToDuk(duk_context* ctx, const ResearchItem& value) diff --git a/src/openrct2/scripting/bindings/world/ScScenario.hpp b/src/openrct2/scripting/bindings/world/ScScenario.hpp index 345faeea75..f6babef307 100644 --- a/src/openrct2/scripting/bindings/world/ScScenario.hpp +++ b/src/openrct2/scripting/bindings/world/ScScenario.hpp @@ -20,20 +20,21 @@ namespace OpenRCT2::Scripting { - static const DukEnumMap ScenarioObjectiveTypeMap({ - { "none", OBJECTIVE_NONE }, - { "guestsBy", OBJECTIVE_GUESTS_BY }, - { "parkValueBy", OBJECTIVE_PARK_VALUE_BY }, - { "haveFun", OBJECTIVE_HAVE_FUN }, - { "buildTheBest", OBJECTIVE_BUILD_THE_BEST }, - { "10Rollercoasters", OBJECTIVE_10_ROLLERCOASTERS }, - { "guestsAndRating", OBJECTIVE_GUESTS_AND_RATING }, - { "monthlyRideIncome", OBJECTIVE_MONTHLY_RIDE_INCOME }, - { "10RollercoastersLength", OBJECTIVE_10_ROLLERCOASTERS_LENGTH }, - { "finish5Rollercoasters", OBJECTIVE_FINISH_5_ROLLERCOASTERS }, - { "repayLoanAndParkValue", OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE }, - { "monthlyFoodIncome", OBJECTIVE_MONTHLY_FOOD_INCOME }, - }); + static const DukEnumMap ScenarioObjectiveTypeMap( + { + { "none", OBJECTIVE_NONE }, + { "guestsBy", OBJECTIVE_GUESTS_BY }, + { "parkValueBy", OBJECTIVE_PARK_VALUE_BY }, + { "haveFun", OBJECTIVE_HAVE_FUN }, + { "buildTheBest", OBJECTIVE_BUILD_THE_BEST }, + { "10Rollercoasters", OBJECTIVE_10_ROLLERCOASTERS }, + { "guestsAndRating", OBJECTIVE_GUESTS_AND_RATING }, + { "monthlyRideIncome", OBJECTIVE_MONTHLY_RIDE_INCOME }, + { "10RollercoastersLength", OBJECTIVE_10_ROLLERCOASTERS_LENGTH }, + { "finish5Rollercoasters", OBJECTIVE_FINISH_5_ROLLERCOASTERS }, + { "repayLoanAndParkValue", OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE }, + { "monthlyFoodIncome", OBJECTIVE_MONTHLY_FOOD_INCOME }, + }); class ScScenarioObjective { From ed5d372edb3f8f0b19711d11221ba1252ccd0106 Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Fri, 1 Aug 2025 04:23:23 +0000 Subject: [PATCH 85/95] Merge Localisation/master into OpenRCT2/develop --- data/language/cs-CZ.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/data/language/cs-CZ.txt b/data/language/cs-CZ.txt index fb8ae3639f..3700160272 100644 --- a/data/language/cs-CZ.txt +++ b/data/language/cs-CZ.txt @@ -82,7 +82,7 @@ STR_0077 :Svislá dráha na stlačený vzduch STR_0078 :Ostrá zavěšená horská dráha STR_0079 :Kouzelný koberec STR_0080 :Podmořská jízda -STR_0081 :Říční rafty +STR_0081 :Říční vory STR_0082 :Neznámá atrakce (50) STR_0083 :Loď Enterprise STR_0084 :Neznámá atrakce (52) @@ -124,8 +124,8 @@ STR_0531 :Malá ocelová horská dráha, na které vlak projíždí smyčky a STR_0532 :Bludiště z šest stop vysokých zdí nebo živého plotu. Návštěvníci bloudí dokud nenajdou východ STR_0533 :Dřevěná budova s krytým schodištěm a venkovní skluzavkou s koberečky STR_0534 :Návštěvníci závodí v motokárách po asfaltovém okruhu -STR_0535 :Lodě plují ve vodním kanále a sjíždí strmé klesání, až z toho jsou návštěvníci mokří. -STR_0536 :Loď pluje po širokých meandrech, přes stříkající vodopády a po vzrušujících pěnících peřejích +STR_0535 :Lodě plují ve vodním kanále a sjíždí strmé klesání, voda při tom stříká na všechny strany a smáčí návštěvníky +STR_0536 :Lodě plují po širokých meandrech, přes stříkající vodopády a po divokých pěnících peřejích STR_0537 :Návštěvníci do sebe bourají v autíčcích na autodromu STR_0538 :Velká houpající se pirátská kocábka STR_0539 :Loď je připevněna k rameni s protiváhou. Loď se houpe a může se zhoupnout až o 360 stupňů @@ -156,7 +156,7 @@ STR_0566 :Malá horská dráha, na které vozy po jednom projíždí cik-cak STR_0567 :Vozy se sedadly schopny otáčet návštěvníky vzhůru nohama STR_0569 :Jízda ve speciálních postrojích zavěšených pod tratí, poskytuje pocit letu jako pták STR_0571 :Kulaté vozy se otáčejí dokola při jízdě klikatou dřevěnou tratí -STR_0572 :Lodě s velkou kapacitou jedou po širokém vodním kanále, vzhůru poháněné běžícím pásem, zrychlují z prudkých svahů, aby obrovským šplouchnutím namočily všechny návštěvníky +STR_0572 :Velkokapacitní lodě se plaví po širokém kanále, stoupání vyjíždí po dopravníkovém pásu, na konci klesání pořádně šplouchnou a smáčí návštěvníky STR_0573 :Vozy ve tvaru helikoptér, poháněné šlapáním, jezdí po ocelové dráze STR_0574 :Návštěvníci ve speciálních postrojích zavěšení v leže pod tratí, jedou přes zatáčky a obraty pozadu nebo čelem k zemi STR_0575 :Trakční vlaky zavěšné pod kolejí převážejí návštěvníky po parku @@ -173,8 +173,8 @@ STR_0586 :Vozy ve tvaru lodí jedou po trati horské dráhy, což umožňuje STR_0587 :Po mocném startu na stlačený vzduch se vozy rozjedou po svislé dráze, přes vrchol a svisle dolů zpět do stanice STR_0588 :Vozy po jednom jedou pod cik-cak tratí s ostrými zatáčkami a pády STR_0589 :Vozy připomínající létající koberce se pohybují nahoru a dolů -STR_0590 :Návštěvníci vyrazí na podvodní jízdu v ponorce -STR_0591 :Rafty se plaví po meandrech na vodním kanále +STR_0590 :Návštěvníci vyrazí na podvodní plavbu v ponorce +STR_0591 :Vory se plaví po meandrech na vodním kanále STR_0593 :Řetízkáč s náklonem STR_0598 :Vozy vyrazí vstříc jednomu konci trati, poté prosviští pozpátku stanicí a vyletí až na druhý konec trati STR_0599 :Malá horská dráha, na které vozy po jednom projíždí trať s kroucenými pády From ee23d47276a74212d502fa5d806b7205aba6ba70 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Fri, 1 Aug 2025 08:07:19 -0500 Subject: [PATCH 86/95] android: `null` response body on error (#24854) --- .../app/src/main/java/io/openrct2/HttpAndroid.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/openrct2-android/app/src/main/java/io/openrct2/HttpAndroid.java b/src/openrct2-android/app/src/main/java/io/openrct2/HttpAndroid.java index ffb58a1062..5f3fa9bf3d 100644 --- a/src/openrct2-android/app/src/main/java/io/openrct2/HttpAndroid.java +++ b/src/openrct2-android/app/src/main/java/io/openrct2/HttpAndroid.java @@ -67,6 +67,7 @@ public class HttpAndroid { Response response = new Response(); response.status = Status.Invalid; response.error = "Request failed"; + response.body = null; try { InputStream inputStream = null; try { From a8767ec4d8f518e340c3630e7571d9bf75295c76 Mon Sep 17 00:00:00 2001 From: Garrett Leach <66348375+garrettleach@users.noreply.github.com> Date: Fri, 1 Aug 2025 10:03:30 -0500 Subject: [PATCH 87/95] Only add full initialized windows to the window list (#24859) This removes the possibility of a race condition where a window is added to the window list but OnOpen has not been called. Many windows use OnOpen to set up required members so if say OnDraw is called it may use uninitialized members. For an example see ProgressWindow. --- src/openrct2-ui/WindowManager.cpp | 35 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index f2f4656224..0f01bcb7fa 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -895,34 +895,33 @@ public: } } - auto itNew = g_window_list.insert(itDestPos, std::move(wp)); - auto w = itNew->get(); - // Setup window - w->classification = cls; - w->flags = flags; + wp->classification = cls; + wp->flags = flags; // Play sounds and flash the window if (!(flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) { - w->flags |= WF_WHITE_BORDER_MASK; + wp->flags |= WF_WHITE_BORDER_MASK; OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::WindowOpen, 0, pos.x + (windowSize.width / 2)); } - w->windowPos = pos; - w->width = windowSize.width; - w->height = windowSize.height; - w->min_width = windowSize.width; - w->max_width = windowSize.width; - w->min_height = windowSize.height; - w->max_height = windowSize.height; + wp->windowPos = pos; + wp->width = windowSize.width; + wp->height = windowSize.height; + wp->min_width = windowSize.width; + wp->max_width = windowSize.width; + wp->min_height = windowSize.height; + wp->max_height = windowSize.height; - w->focus = std::nullopt; + wp->focus = std::nullopt; - ColourSchemeUpdate(w); - w->Invalidate(); - w->OnOpen(); - return w; + ColourSchemeUpdate(wp.get()); + wp->Invalidate(); + wp->OnOpen(); + + auto itNew = g_window_list.insert(itDestPos, std::move(wp)); + return itNew->get(); } /** From b8e163ffcfcc3bca2c2763ae97da429433675c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=AD=C5=A1a=20Szlachta?= Date: Fri, 1 Aug 2025 17:05:39 +0200 Subject: [PATCH 88/95] Fix #24821: Unclear guest spawn point placement error message (#24827) * Create named constant from previously commented-out line for string id 2251 * Change error message when trying to build spawn point outside footpath Error message change to STR_2251 :Can only be built on paths! --- src/openrct2/actions/PeepSpawnPlaceAction.cpp | 2 +- src/openrct2/localisation/StringIds.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2/actions/PeepSpawnPlaceAction.cpp b/src/openrct2/actions/PeepSpawnPlaceAction.cpp index f9a0c9ec35..1a07fb787d 100644 --- a/src/openrct2/actions/PeepSpawnPlaceAction.cpp +++ b/src/openrct2/actions/PeepSpawnPlaceAction.cpp @@ -67,7 +67,7 @@ GameActions::Result PeepSpawnPlaceAction::Query() const if (pathElement == nullptr) { return GameActions::Result( - GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_CAN_ONLY_BE_BUILT_ACROSS_PATHS); + GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_CAN_ONLY_BE_BUILT_ON_PATHS); } // Verify location is unowned diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index f8868b66ee..c370f33185 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -914,7 +914,7 @@ enum : StringId STR_CANT_DEMOLISH_RIDE = 2248, STR_NEWS_ITEM_RESEARCH_NEW_RIDE_AVAILABLE = 2249, STR_NEWS_ITEM_RESEARCH_NEW_SCENERY_SET_AVAILABLE = 2250, - // STR_2251 :Can only be built on paths! + STR_CAN_ONLY_BE_BUILT_ON_PATHS = 2251, STR_CAN_ONLY_BE_BUILT_ACROSS_PATHS = 2252, STR_RESEARCH_NEW_TRANSPORT_RIDES = 2253, STR_RESEARCH_NEW_GENTLE_RIDES = 2254, From 9b2657ac620f264922904d1a505d4eacd7416049 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Sat, 2 Aug 2025 04:26:33 -0500 Subject: [PATCH 89/95] Update android targetsdk to 36 (#24843) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update targetsdk to 36 * Combine duplicate code into a method * Update dependencies and cmake * Update Android base image * Add TODO note above all file access intent --------- Co-authored-by: Michał Janiszewski --- .github/workflows/ci.yml | 2 +- distribution/changelog.txt | 1 + src/openrct2-android/app/build.gradle | 16 +++--- .../app/src/main/AndroidManifest.xml | 13 +++-- .../main/java/io/openrct2/GameActivity.java | 23 ++++----- .../main/java/io/openrct2/MainActivity.java | 49 +++++++++++++++---- src/openrct2-android/build.gradle | 4 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- 8 files changed, 74 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2fc8bec59..d8d906ad8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -605,7 +605,7 @@ jobs: name: Android runs-on: ubuntu-latest needs: [check-code-formatting, build_variables] - container: openrct2/openrct2-build:18-android + container: openrct2/openrct2-build:20-android steps: - name: Checkout uses: actions/checkout@v4 diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 0a507ed367..3f756a6f32 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -6,6 +6,7 @@ - Improved: [#24812] Taiwan Park has been added to the Extras tab if it is present. - Improved: [OpenSFX#12] Add Brake Fix, Buy and Dinghy Slide running sounds. - Change: [#24730] Security guards now only walk slowly in crowded areas. +- Change: [#24843] Update android targetSDK to 36. - Fix: [#24598] Cannot load .park files that use official legacy footpaths by accident. - Fix: [#24611] The confirmation prompt for track file deletion is not vertically aligned. - Fix: [#24711] The map smoothing function only partially works for custom height map image files. diff --git a/src/openrct2-android/app/build.gradle b/src/openrct2-android/app/build.gradle index 2edad3fb43..a541437327 100644 --- a/src/openrct2-android/app/build.gradle +++ b/src/openrct2-android/app/build.gradle @@ -1,14 +1,13 @@ apply plugin: 'com.android.application' android { - compileSdk 35 - buildToolsVersion "35.0.0" - ndkVersion "27.2.12479018" // Latest r27c (LTS), to be synced with CI container image + compileSdk 36 + ndkVersion "27.3.13750724" // Latest r27d (LTS), to be synced with CI container image namespace "io.openrct2" defaultConfig { applicationId 'io.openrct2' minSdkVersion 24 - targetSdkVersion 28 + targetSdkVersion 36 versionCode 12 versionName '0.4.24' @@ -35,6 +34,7 @@ android { } externalNativeBuild { cmake { + version "4.0.3" path 'src/main/CMakeLists.txt' } } @@ -45,8 +45,12 @@ android { } dependencies { - implementation 'commons-io:commons-io:2.13.0' - implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'commons-io:commons-io:2.20.0' + implementation 'androidx.appcompat:appcompat:1.7.1' implementation fileTree(include: ['*.jar'], dir: 'libs') } +configurations.implementation { + exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8' +} + diff --git a/src/openrct2-android/app/src/main/AndroidManifest.xml b/src/openrct2-android/app/src/main/AndroidManifest.xml index f2b3034d05..1969d9cdf4 100644 --- a/src/openrct2-android/app/src/main/AndroidManifest.xml +++ b/src/openrct2-android/app/src/main/AndroidManifest.xml @@ -1,10 +1,15 @@ - + - - + + + + tools:targetApi="36"> = Build.VERSION_CODES.N) { - deviceLocale = getResources().getConfiguration().getLocales().get(0); + return getResources().getConfiguration().getLocales().get(0); } else { - deviceLocale = getResources().getConfiguration().locale; + return getResources().getConfiguration().locale; } + } + public String getDefaultLocale(String[] supportedTags) { + Locale deviceLocale = getDeviceLocale(); for (String supportedTag : supportedTags) { if (supportedTag.isEmpty()) continue; @@ -51,26 +55,19 @@ public class GameActivity extends SDLActivity { } public String getLocaleCurrency() { - Locale deviceLocale; + Locale deviceLocale = getDeviceLocale(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - deviceLocale = getResources().getConfiguration().getLocales().get(0); return Currency.getInstance(deviceLocale).getCurrencyCode(); } else { - deviceLocale = getResources().getConfiguration().locale; return java.util.Currency.getInstance(deviceLocale).getCurrencyCode(); } } public boolean isImperialLocaleMeasurementFormat() { - Locale deviceLocale; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { return LocaleData.getMeasurementSystem(ULocale.forLocale(getResources().getConfiguration().getLocales().get(0))) == LocaleData.MeasurementSystem.US; } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - deviceLocale = getResources().getConfiguration().getLocales().get(0); - } else { - deviceLocale = getResources().getConfiguration().locale; - } + Locale deviceLocale = getDeviceLocale(); String localeCountry = deviceLocale.getCountry(); return localeCountry.equals(Locale.US.getCountry()) || localeCountry.equals(new Locale("xx", "LR").getCountry()) || localeCountry.equals(new Locale("xx", "MM").getCountry()); } diff --git a/src/openrct2-android/app/src/main/java/io/openrct2/MainActivity.java b/src/openrct2-android/app/src/main/java/io/openrct2/MainActivity.java index cb4a584566..708d7d7fb2 100644 --- a/src/openrct2-android/app/src/main/java/io/openrct2/MainActivity.java +++ b/src/openrct2-android/app/src/main/java/io/openrct2/MainActivity.java @@ -6,6 +6,7 @@ import android.content.pm.PackageManager; import android.content.res.AssetManager; import android.graphics.Point; import android.graphics.PointF; +import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -94,22 +95,52 @@ public class MainActivity extends AppCompatActivity { super.onStart(); if (!hasRequiredPermissions()) { - ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + /* + TODO - This is a temporary solution + Ideally, OpenRCT2 assets should be shipped in the apk and we should ask + the user for their rct2 assets directory on boot (similar to windows). + Save data should be stored under the "external data directory", + which you can get via `getExternalFilesDir(null).getAbsolutePath()` + */ + Intent intent = new Intent(android.provider.Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION); + intent.addCategory("android.intent.category.DEFAULT"); + intent.setData(Uri.fromParts("package", getPackageName(), null)); + startActivity(intent); + } else { + ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); + } } else { startGame(); } } + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (requestCode == 0) { + if (!hasRequiredPermissions()) { + Log.d(TAG, "User denied storage permission!"); + } else { + startGame(); + } + } + } + private boolean hasRequiredPermissions() { - if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) { - return false; - } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + return Environment.isExternalStorageManager(); + } else { + if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) { + return false; + } - if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) { - return false; - } + if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) { + return false; + } - return true; + return true; + } } private void startGame() { @@ -162,7 +193,7 @@ public class MainActivity extends AppCompatActivity { for (String fileName : list) { // This ternary expression makes sure that this string does not begin with a slash - String destination = destPath + (destPath.equals("") ? "" : File.separator) + fileName; + String destination = destPath + (destPath.isEmpty() ? "" : File.separator) + fileName; copyAsset(assets, srcPath + File.separator + fileName, dataDir, destination); } } diff --git a/src/openrct2-android/build.gradle b/src/openrct2-android/build.gradle index ed2299cb0d..80450e4144 100644 --- a/src/openrct2-android/build.gradle +++ b/src/openrct2-android/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:8.7.3' + classpath 'com.android.tools.build:gradle:8.11.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -20,6 +20,6 @@ allprojects { } } -task clean(type: Delete) { +tasks.register('clean', Delete) { delete rootProject.buildDir } diff --git a/src/openrct2-android/gradle/wrapper/gradle-wrapper.properties b/src/openrct2-android/gradle/wrapper/gradle-wrapper.properties index e2847c8200..d4081da476 100644 --- a/src/openrct2-android/gradle/wrapper/gradle-wrapper.properties +++ b/src/openrct2-android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 559e1bf2ce851e50a104a0fe34b9f5d9eed1e418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 31 Jul 2025 22:48:28 +0200 Subject: [PATCH 90/95] Use static keystore for signing Android builds Fixes #22861 GitHub Actions CI uses ephemeral debug keystore resulting in APKs being signed differently each time. This results in user not having trust in where the builds come from and Android rejecting the update due to mismatched keys. This commit introduces a script to (re)create a keystore to be used for signing APKs in GitHub Actions, sets environment variables for CI job with generated key and modifies gradle project to consume those variables. I have generated the keystore with aforementioned script and set secrects in the main repository with both the keystore password and keystore contents. --- .github/workflows/ci.yml | 5 +++ scripts/create-android-keystore | 48 +++++++++++++++++++++++++++ src/openrct2-android/app/build.gradle | 14 +++++++- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100755 scripts/create-android-keystore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8d906ad8d..926c350cac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -613,6 +613,11 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.18 with: key: android + - name: Setup keystore + run: | + echo "${{ secrets.OPENRCT2_KEYSTORE_CONTENTS }}" | base64 -d > keystore.jks + echo "OPENRCT2_KEYSTORE_FILE=${{ github.workspace }}/keystore.jks" >> $GITHUB_ENV + echo "OPENRCT2_KEYSTORE_PASSWORD=${{ secrets.OPENRCT2_KEYSTORE_PASSWORD }}" >> $GITHUB_ENV - name: Install GCC problem matcher uses: ammaraskar/gcc-problem-matcher@master - name: Build OpenRCT2 diff --git a/scripts/create-android-keystore b/scripts/create-android-keystore new file mode 100755 index 0000000000..2bc47634a2 --- /dev/null +++ b/scripts/create-android-keystore @@ -0,0 +1,48 @@ +#!/bin/bash +# OpenRCT2 Android Keystore Creation Script +# This script creates a sample keystore for signing Android APKs + +set -e + +# Configuration - modify these values as needed +KEYSTORE_FILE="openrct2-release-key.keystore" +KEY_ALIAS="openrct2" +KEY_ALGORITHM="RSA" +KEY_SIZE="2048" +VALIDITY_DAYS="10950" # 30 years + +# Certificate details +CERT_DNAME="CN=OpenRCT2 Team, OU=Development, O=OpenRCT2 Team" + +if [ -z "$KEYSTORE_PASSWORD" ]; then + echo "Error: KEYSTORE_PASSWORD environment variable must be set" + echo "Usage: KEYSTORE_PASSWORD='your_secure_password' $0" + exit 1 +fi + +echo "Creating OpenRCT2 release keystore..." +echo "File: $KEYSTORE_FILE" +echo "Alias: $KEY_ALIAS" +echo "Algorithm: $KEY_ALGORITHM $KEY_SIZE" +echo "Validity: $VALIDITY_DAYS days" +echo "DN: $CERT_DNAME" + +# Create the keystore +keytool -genkeypair \ + -keystore "$KEYSTORE_FILE" \ + -alias "$KEY_ALIAS" \ + -keyalg "$KEY_ALGORITHM" \ + -keysize "$KEY_SIZE" \ + -validity "$VALIDITY_DAYS" \ + -dname "$CERT_DNAME" \ + -storetype PKCS12 \ + -storepass "$KEYSTORE_PASSWORD" \ + -keypass "$KEYSTORE_PASSWORD" \ + -noprompt + +echo "Keystore created successfully: $KEYSTORE_FILE" + +# Verify the keystore +echo "" +echo "Keystore information:" +keytool -list -v -keystore "$KEYSTORE_FILE" -storepass "$KEYSTORE_PASSWORD" diff --git a/src/openrct2-android/app/build.gradle b/src/openrct2-android/app/build.gradle index a541437327..eb5fa96ac2 100644 --- a/src/openrct2-android/app/build.gradle +++ b/src/openrct2-android/app/build.gradle @@ -4,6 +4,18 @@ android { compileSdk 36 ndkVersion "27.3.13750724" // Latest r27d (LTS), to be synced with CI container image namespace "io.openrct2" + + signingConfigs { + release { + if (System.getenv('OPENRCT2_KEYSTORE_FILE') && System.getenv('OPENRCT2_KEYSTORE_PASSWORD')) { + storeFile file(System.getenv('OPENRCT2_KEYSTORE_FILE')) + storePassword System.getenv('OPENRCT2_KEYSTORE_PASSWORD') + keyAlias "openrct2" + keyPassword System.getenv('OPENRCT2_KEYSTORE_PASSWORD') // Same as keystore password in PKCS12 + } + } + } + defaultConfig { applicationId 'io.openrct2' minSdkVersion 24 @@ -22,7 +34,7 @@ android { } buildTypes { release { - signingConfig signingConfigs.debug + signingConfig signingConfigs.release } } From 80cd7e1fb80c2d0c47df4ee375d557dc9305f583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 31 Jul 2025 23:30:58 +0200 Subject: [PATCH 91/95] Fallback to ephemeral debug signing if keystore is unavailable --- src/openrct2-android/app/build.gradle | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/openrct2-android/app/build.gradle b/src/openrct2-android/app/build.gradle index eb5fa96ac2..404d980840 100644 --- a/src/openrct2-android/app/build.gradle +++ b/src/openrct2-android/app/build.gradle @@ -34,7 +34,12 @@ android { } buildTypes { release { - signingConfig signingConfigs.release + if (System.getenv('OPENRCT2_KEYSTORE_FILE') && System.getenv('OPENRCT2_KEYSTORE_PASSWORD')) { + signingConfig signingConfigs.release + } else { + // Fallback to ephemeral debug signing when keystore is not available + signingConfig signingConfigs.debug + } } } From 2fa9b7eb8e04fae2904b4f82ecbf17b0322037b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sat, 2 Aug 2025 11:43:18 +0200 Subject: [PATCH 92/95] Display sha256 digests instead of sha1 for releases (#24871) As github now automatically displays sha256 checksums of uploaded artifacts [1], lets match what they display. [1] https://github.blog/changelog/2025-06-03-releases-now-expose-digests-for-release-assets/ --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8d906ad8d..b2b0c4a554 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -670,11 +670,11 @@ jobs: - name: Remove unsigned artifacts run: | rm -rf *unsigned* - - name: Concatenate sha1 files + - name: Concatenate sha256 files run: | ls -lR pushd ${{ github.workspace }} - sha1sum OpenRCT2-* > OpenRCT2-${{ needs.build_variables.outputs.name }}-sha1sums.txt + sha256sum OpenRCT2-* > OpenRCT2-${{ needs.build_variables.outputs.name }}-sha256sums.txt popd - name: Create release notes run: | @@ -685,9 +685,9 @@ jobs: echo "Release created in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> release_notes.txt echo "" >> release_notes.txt - echo "SHA1 checksums:" >> release_notes.txt + echo "SHA256 checksums:" >> release_notes.txt echo "\`\`\`" >> release_notes.txt - cat OpenRCT2-${{ needs.build_variables.outputs.name }}-sha1sums.txt >> release_notes.txt + cat OpenRCT2-${{ needs.build_variables.outputs.name }}-sha256sums.txt >> release_notes.txt echo "\`\`\`" >> release_notes.txt echo "" >> release_notes.txt @@ -722,7 +722,7 @@ jobs: repository: OpenRCT2/OpenRCT2-binaries token: ${{ secrets.OPENRCT2_BINARIES_CI_UPLOAD }} files: | - openrct2-${{ needs.build_variables.outputs.name }}-sha1sums.txt + openrct2-${{ needs.build_variables.outputs.name }}-sha256sums.txt OpenRCT2-${{ needs.build_variables.outputs.name }}-* body_path: release_notes.txt tag_name: ${{ needs.build_variables.outputs.name }} From 379ef5585ca5d728e6b45b241a337b752c5aea4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sat, 2 Aug 2025 11:44:07 +0200 Subject: [PATCH 93/95] Use images v20 in CI (#24862) --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2b0c4a554..0375e2fd0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -315,7 +315,7 @@ jobs: name: Windows (${{ matrix.platform_name }}) using mingw runs-on: ubuntu-latest needs: [check-code-formatting, build_variables] - container: openrct2/openrct2-build:18-mingw + container: openrct2/openrct2-build:20-mingw strategy: fail-fast: false matrix: @@ -453,12 +453,12 @@ jobs: - platform: x86_64 distro: Ubuntu release: noble - image: openrct2/openrct2-build:18-noble + image: openrct2/openrct2-build:20-noble build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments" - platform: x86_64 distro: Debian release: bookworm - image: openrct2/openrct2-build:18-bookworm + image: openrct2/openrct2-build:20-bookworm build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments" -DWITH_TESTS=off steps: - name: Checkout @@ -548,7 +548,7 @@ jobs: name: Ubuntu Linux (noble, debug, [http, network, flac, vorbis OpenGL] disabled) using clang runs-on: ubuntu-latest needs: [check-code-formatting, build_variables] - container: openrct2/openrct2-build:18-noble + container: openrct2/openrct2-build:20-noble steps: - name: Checkout uses: actions/checkout@v4 @@ -564,7 +564,7 @@ jobs: name: Ubuntu Linux (debug) using clang, coverage enabled runs-on: ubuntu-latest needs: [check-code-formatting, build_variables] - container: openrct2/openrct2-build:18-noble + container: openrct2/openrct2-build:20-noble steps: - name: Checkout uses: actions/checkout@v4 @@ -633,7 +633,7 @@ jobs: name: Emscripten runs-on: ubuntu-latest needs: [check-code-formatting, build_variables] - container: openrct2/openrct2-build:19-emscripten + container: openrct2/openrct2-build:20-emscripten steps: - name: Checkout uses: actions/checkout@v4 From 61f9ecb313154391e0554a6a578060894edf19d1 Mon Sep 17 00:00:00 2001 From: Llewelyn Gareth Griffiths Date: Sat, 2 Aug 2025 14:55:11 +0200 Subject: [PATCH 94/95] Fix #24777: Random checkbox ticked now cycles between possible colours in preview (#24865) * alternating between possible colours based on currentTick * updating changelog --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/Ride.cpp | 11 +---------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 3f756a6f32..e6e2abaac9 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -13,6 +13,7 @@ - Fix: [#24761] The reliability bar in the ride window visually does not go below 10%. - Fix: [#24773] The new ride window debug authors does not show the correct authors for non legacy ride objects. - Fix: [#24775] The scenery and new ride windows do not filter by file name or identifier correctly for non legacy objects. +- Fix: [#24777] The stall item preview cycles between all possible colours when random checkbox is ticked. - Fix: [#24794] The load/save browser does not resize cleanly when toggling the preview sidebar. - Fix: [#24824] The Air Powered Vertical Coaster top section track piece has vertical tunnels (original bug). - Fix: [#24825] The River Rapids flat-to-gentle track piece tunnels are incorrect on the gentle side. diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index a4f1dd89e0..103f5fda04 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -4873,16 +4873,7 @@ namespace OpenRCT2::Ui::Windows : rideEntry->shop_item[1]; if (ride->hasLifecycleFlag(RIDE_LIFECYCLE_RANDOM_SHOP_COLOURS)) { - colour_t spriteColour = COLOUR_BLACK; - // Limit update rate of preview to avoid making people dizzy. - if ((getGameState().currentTicks % 64) == 0) - { - spriteColour++; - if (spriteColour >= kColourNumNormal) - { - spriteColour = COLOUR_BLACK; - } - } + colour_t spriteColour = (getGameState().currentTicks / 32) % COLOUR_COUNT; GfxDrawSprite(rt, ImageId(GetShopItemDescriptor(shopItem).Image, spriteColour), screenCoords); } From 3028579c803bff20fad9564e18f99db3caca2f8c Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 3 Aug 2025 06:49:22 -0300 Subject: [PATCH 95/95] Update backtrace token for upcoming v0.4.25 release --- src/openrct2/platform/Crash.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/platform/Crash.cpp b/src/openrct2/platform/Crash.cpp index ddb9b2c96a..5264414ca3 100644 --- a/src/openrct2/platform/Crash.cpp +++ b/src/openrct2/platform/Crash.cpp @@ -56,7 +56,7 @@ static const wchar_t* _wszCommitSha1Short = WSZ(""); static const wchar_t* _wszArchitecture = WSZ(OPENRCT2_ARCHITECTURE); static std::map _uploadFiles; - #define BACKTRACE_TOKEN "bcf0d172ee9f047048427f4bd18345fff28396fe9880af11dfa1f3beefc56a2f" + #define BACKTRACE_TOKEN "04d8cfb780c59ed8dcb87311d9d04a2d82a012571dd3be7ece9b205944afa65a" using namespace OpenRCT2;