1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-17 21:12:34 +01:00

Move legacy identifier interpreting to separate file from parkfile

This commit is contained in:
duncanspumpkin
2021-11-26 16:08:48 +00:00
parent 01722cc85d
commit 7e7947fe8b
11 changed files with 105 additions and 66 deletions

View File

@@ -9,11 +9,11 @@
#include "FileClassifier.h" #include "FileClassifier.h"
#include "ParkFile.h"
#include "core/Console.hpp" #include "core/Console.hpp"
#include "core/FileStream.h" #include "core/FileStream.h"
#include "core/Path.hpp" #include "core/Path.hpp"
#include "core/String.hpp" #include "core/String.hpp"
#include "park/ParkFile.h"
#include "rct12/SawyerChunkReader.h" #include "rct12/SawyerChunkReader.h"
#include "scenario/Scenario.h" #include "scenario/Scenario.h"
#include "util/SawyerCoding.h" #include "util/SawyerCoding.h"

View File

@@ -13,7 +13,6 @@
#include "Game.h" #include "Game.h"
#include "GameStateSnapshots.h" #include "GameStateSnapshots.h"
#include "OpenRCT2.h" #include "OpenRCT2.h"
#include "ParkFile.h"
#include "ParkImporter.h" #include "ParkImporter.h"
#include "PlatformEnvironment.h" #include "PlatformEnvironment.h"
#include "actions/FootpathPlaceAction.h" #include "actions/FootpathPlaceAction.h"
@@ -31,6 +30,7 @@
#include "management/NewsItem.h" #include "management/NewsItem.h"
#include "object/ObjectManager.h" #include "object/ObjectManager.h"
#include "object/ObjectRepository.h" #include "object/ObjectRepository.h"
#include "park/ParkFile.h"
#include "scenario/Scenario.h" #include "scenario/Scenario.h"
#include "world/Park.h" #include "world/Park.h"
#include "zlib.h" #include "zlib.h"

View File

@@ -10,13 +10,13 @@
#include "../Context.h" #include "../Context.h"
#include "../FileClassifier.h" #include "../FileClassifier.h"
#include "../OpenRCT2.h" #include "../OpenRCT2.h"
#include "../ParkFile.h"
#include "../ParkImporter.h" #include "../ParkImporter.h"
#include "../common.h" #include "../common.h"
#include "../core/Console.hpp" #include "../core/Console.hpp"
#include "../core/Path.hpp" #include "../core/Path.hpp"
#include "../interface/Window.h" #include "../interface/Window.h"
#include "../object/ObjectManager.h" #include "../object/ObjectManager.h"
#include "../park/ParkFile.h"
#include "../scenario/Scenario.h" #include "../scenario/Scenario.h"
#include "CommandLine.hpp" #include "CommandLine.hpp"

View File

@@ -304,8 +304,10 @@
<ClInclude Include="paint\tile_element\Paint.Surface.h" /> <ClInclude Include="paint\tile_element\Paint.Surface.h" />
<ClInclude Include="paint\tile_element\Paint.TileElement.h" /> <ClInclude Include="paint\tile_element\Paint.TileElement.h" />
<ClInclude Include="paint\VirtualFloor.h" /> <ClInclude Include="paint\VirtualFloor.h" />
<ClInclude Include="ParkFile.h" />
<ClInclude Include="ParkImporter.h" /> <ClInclude Include="ParkImporter.h" />
<ClInclude Include="park\Legacy.h" />
<ClInclude Include="park\ParkFile.h" />
<ClInclude Include="peep\Guest.h" />
<ClInclude Include="peep\GuestPathfinding.h" /> <ClInclude Include="peep\GuestPathfinding.h" />
<ClInclude Include="peep\RideUseSystem.h" /> <ClInclude Include="peep\RideUseSystem.h" />
<ClInclude Include="PlatformEnvironment.h" /> <ClInclude Include="PlatformEnvironment.h" />
@@ -771,8 +773,9 @@
<ClCompile Include="paint\tile_element\Paint.TileElement.cpp" /> <ClCompile Include="paint\tile_element\Paint.TileElement.cpp" />
<ClCompile Include="paint\tile_element\Paint.Wall.cpp" /> <ClCompile Include="paint\tile_element\Paint.Wall.cpp" />
<ClCompile Include="paint\VirtualFloor.cpp" /> <ClCompile Include="paint\VirtualFloor.cpp" />
<ClCompile Include="ParkFile.cpp" />
<ClCompile Include="ParkImporter.cpp" /> <ClCompile Include="ParkImporter.cpp" />
<ClCompile Include="park\Legacy.cpp" />
<ClCompile Include="park\ParkFile.cpp" />
<ClCompile Include="peep\GuestPathfinding.cpp" /> <ClCompile Include="peep\GuestPathfinding.cpp" />
<ClCompile Include="peep\PeepData.cpp" /> <ClCompile Include="peep\PeepData.cpp" />
<ClCompile Include="peep\RideUseSystem.cpp" /> <ClCompile Include="peep\RideUseSystem.cpp" />
@@ -943,4 +946,4 @@
<ClCompile Include="world\Wall.cpp" /> <ClCompile Include="world\Wall.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project> </Project>

View File

@@ -13,7 +13,6 @@
#include "../Game.h" #include "../Game.h"
#include "../GameStateSnapshots.h" #include "../GameStateSnapshots.h"
#include "../OpenRCT2.h" #include "../OpenRCT2.h"
#include "../ParkFile.h"
#include "../PlatformEnvironment.h" #include "../PlatformEnvironment.h"
#include "../actions/LoadOrQuitAction.h" #include "../actions/LoadOrQuitAction.h"
#include "../actions/NetworkModifyGroupAction.h" #include "../actions/NetworkModifyGroupAction.h"
@@ -24,6 +23,7 @@
#include "../entity/EntityRegistry.h" #include "../entity/EntityRegistry.h"
#include "../entity/EntityTweener.h" #include "../entity/EntityTweener.h"
#include "../localisation/Formatting.h" #include "../localisation/Formatting.h"
#include "../park/ParkFile.h"
#include "../platform/Platform2.h" #include "../platform/Platform2.h"
#include "../scenario/Scenario.h" #include "../scenario/Scenario.h"
#include "../scripting/ScriptEngine.h" #include "../scripting/ScriptEngine.h"

View File

@@ -1,3 +1,19 @@
/*****************************************************************************
* Copyright (c) 2014-2021 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 "Legacy.h"
#include "../object/ObjectList.h"
#include "../rct2/RCT2.h"
#include <map>
static std::map<std::string_view, std::string_view> oldObjectIds = { static std::map<std::string_view, std::string_view> oldObjectIds = {
{ "official.scgpanda", "rct2dlc.scenery_group.scgpanda" }, { "official.scgpanda", "rct2dlc.scenery_group.scgpanda" },
{ "official.wtrpink", "rct2dlc.water.wtrpink" }, { "official.wtrpink", "rct2dlc.water.wtrpink" },
@@ -2196,7 +2212,7 @@ static std::map<std::string_view, std::string_view> oldObjectIds = {
{ "rct1.pathsurface.tile.brown", "rct1.footpath_surface.tiles_brown" }, { "rct1.pathsurface.tile.brown", "rct1.footpath_surface.tiles_brown" },
}; };
static std::string_view MapToNewObjectIdentifier(std::string_view s) std::string_view MapToNewObjectIdentifier(std::string_view s)
{ {
auto it = oldObjectIds.find(s); auto it = oldObjectIds.find(s);
if (it != oldObjectIds.end()) if (it != oldObjectIds.end())
@@ -2214,7 +2230,7 @@ static std::map<std::string_view, std::string_view> DATPathNames = {
{ "rct2.medipath", "MEDIPATH" }, { "rct2.mythpath", "MYTHPATH" }, { "rct2.ranbpath", "RANBPATH" }, { "rct2.medipath", "MEDIPATH" }, { "rct2.mythpath", "MYTHPATH" }, { "rct2.ranbpath", "RANBPATH" },
}; };
static std::optional<std::string_view> GetDATPathName(std::string_view newPathName) std::optional<std::string_view> GetDATPathName(std::string_view newPathName)
{ {
auto it = DATPathNames.find(newPathName); auto it = DATPathNames.find(newPathName);
if (it != DATPathNames.end()) if (it != DATPathNames.end())
@@ -2228,7 +2244,7 @@ static RCT2::FootpathMapping _extendedFootpathMappings[] = {
{ "rct1.path.tarmac", "rct1.footpath_surface.tarmac", "rct1.footpath_surface.queue_blue", "rct2.footpath_railings.wood" }, { "rct1.path.tarmac", "rct1.footpath_surface.tarmac", "rct1.footpath_surface.queue_blue", "rct2.footpath_railings.wood" },
}; };
static const RCT2::FootpathMapping* GetFootpathMapping(const ObjectEntryDescriptor& desc) const RCT2::FootpathMapping* GetFootpathMapping(const ObjectEntryDescriptor& desc)
{ {
for (const auto& mapping : _extendedFootpathMappings) for (const auto& mapping : _extendedFootpathMappings)
{ {
@@ -2257,7 +2273,7 @@ static const RCT2::FootpathMapping* GetFootpathMapping(const ObjectEntryDescript
return RCT2::GetFootpathSurfaceId(desc); return RCT2::GetFootpathSurfaceId(desc);
} }
static void UpdateFootpathsFromMapping( void UpdateFootpathsFromMapping(
ObjectEntryIndex* pathToSurfaceMap, ObjectEntryIndex* pathToQueueSurfaceMap, ObjectEntryIndex* pathToRailingsMap, ObjectEntryIndex* pathToSurfaceMap, ObjectEntryIndex* pathToQueueSurfaceMap, ObjectEntryIndex* pathToRailingsMap,
ObjectList& requiredObjects, ObjectEntryIndex& surfaceCount, ObjectEntryIndex& railingCount, ObjectEntryIndex entryIndex, ObjectList& requiredObjects, ObjectEntryIndex& surfaceCount, ObjectEntryIndex& railingCount, ObjectEntryIndex entryIndex,
const RCT2::FootpathMapping* footpathMapping) const RCT2::FootpathMapping* footpathMapping)

View File

@@ -0,0 +1,28 @@
/*****************************************************************************
* Copyright (c) 2014-2021 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 "../object/Object.h"
#include <optional>
#include <string_view>
namespace RCT2
{
struct FootpathMapping;
}
struct ObjectEntryDescriptor;
class ObjectList;
std::string_view MapToNewObjectIdentifier(std::string_view s);
std::optional<std::string_view> GetDATPathName(std::string_view newPathName);
const RCT2::FootpathMapping* GetFootpathMapping(const ObjectEntryDescriptor& desc);
void UpdateFootpathsFromMapping(
ObjectEntryIndex* pathToSurfaceMap, ObjectEntryIndex* pathToQueueSurfaceMap, ObjectEntryIndex* pathToRailingsMap,
ObjectList& requiredObjects, ObjectEntryIndex& surfaceCount, ObjectEntryIndex& railingCount, ObjectEntryIndex entryIndex,
const RCT2::FootpathMapping* footpathMapping);

View File

@@ -1,5 +1,5 @@
/***************************************************************************** /*****************************************************************************
* Copyright (c) 2014-2019 OpenRCT2 developers * Copyright (c) 2014-2021 OpenRCT2 developers
* *
* For a complete list of all authors, please refer to contributors.md * For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
@@ -9,49 +9,50 @@
#include "ParkFile.h" #include "ParkFile.h"
#include "Cheats.h" #include "../Cheats.h"
#include "Context.h" #include "../Context.h"
#include "Editor.h" #include "../Editor.h"
#include "GameState.h" #include "../GameState.h"
#include "OpenRCT2.h" #include "../OpenRCT2.h"
#include "ParkImporter.h" #include "../ParkImporter.h"
#include "Version.h" #include "../Version.h"
#include "core/Console.hpp" #include "../core/Console.hpp"
#include "core/Crypt.h" #include "../core/Crypt.h"
#include "core/DataSerialiser.h" #include "../core/DataSerialiser.h"
#include "core/File.h" #include "../core/File.h"
#include "core/OrcaStream.hpp" #include "../core/OrcaStream.hpp"
#include "core/Path.hpp" #include "../core/Path.hpp"
#include "drawing/Drawing.h" #include "../drawing/Drawing.h"
#include "entity/Balloon.h" #include "../entity/Balloon.h"
#include "entity/Duck.h" #include "../entity/Duck.h"
#include "entity/EntityList.h" #include "../entity/EntityList.h"
#include "entity/EntityRegistry.h" #include "../entity/EntityRegistry.h"
#include "entity/Fountain.h" #include "../entity/Fountain.h"
#include "entity/Litter.h" #include "../entity/Litter.h"
#include "entity/MoneyEffect.h" #include "../entity/MoneyEffect.h"
#include "entity/Particle.h" #include "../entity/Particle.h"
#include "entity/Staff.h" #include "../entity/Staff.h"
#include "interface/Viewport.h" #include "../interface/Viewport.h"
#include "interface/Window.h" #include "../interface/Window.h"
#include "localisation/Date.h" #include "../localisation/Date.h"
#include "localisation/Localisation.h" #include "../localisation/Localisation.h"
#include "management/Award.h" #include "../management/Award.h"
#include "management/Finance.h" #include "../management/Finance.h"
#include "management/NewsItem.h" #include "../management/NewsItem.h"
#include "object/Object.h" #include "../object/Object.h"
#include "object/ObjectManager.h" #include "../object/ObjectManager.h"
#include "object/ObjectRepository.h" #include "../object/ObjectRepository.h"
#include "peep/RideUseSystem.h" #include "../peep/RideUseSystem.h"
#include "ride/ShopItem.h" #include "../ride/ShopItem.h"
#include "ride/Vehicle.h" #include "../ride/Vehicle.h"
#include "scenario/Scenario.h" #include "../scenario/Scenario.h"
#include "scenario/ScenarioRepository.h" #include "../scenario/ScenarioRepository.h"
#include "world/Climate.h" #include "../world/Climate.h"
#include "world/Entrance.h" #include "../world/Entrance.h"
#include "world/Map.h" #include "../world/Map.h"
#include "world/Park.h" #include "../world/Park.h"
#include "world/Scenery.h" #include "../world/Scenery.h"
#include "Legacy.h"
#include <cstdint> #include <cstdint>
#include <ctime> #include <ctime>
@@ -62,14 +63,6 @@
using namespace OpenRCT2; using namespace OpenRCT2;
static std::string_view MapToNewObjectIdentifier(std::string_view s);
static std::optional<std::string_view> GetDATPathName(std::string_view newPathName);
static const RCT2::FootpathMapping* GetFootpathMapping(const ObjectEntryDescriptor& desc);
static void UpdateFootpathsFromMapping(
ObjectEntryIndex* pathToSurfaceMap, ObjectEntryIndex* pathToQueueSurfaceMap, ObjectEntryIndex* pathToRailingsMap,
ObjectList& requiredObjects, ObjectEntryIndex& surfaceCount, ObjectEntryIndex& railingCount, ObjectEntryIndex entryIndex,
const RCT2::FootpathMapping* footpathMapping);
namespace OpenRCT2 namespace OpenRCT2
{ {
// Current version that is saved. // Current version that is saved.
@@ -2342,4 +2335,3 @@ std::unique_ptr<IParkImporter> ParkImporter::CreateParkFile(IObjectRepository& o
{ {
return std::make_unique<ParkFileImporter>(objectRepository); return std::make_unique<ParkFileImporter>(objectRepository);
} }

View File

@@ -27,7 +27,6 @@
# include "../Context.h" # include "../Context.h"
# include "../Game.h" # include "../Game.h"
# include "../OpenRCT2.h" # include "../OpenRCT2.h"
# include "../ParkFile.h"
# include "../PlatformEnvironment.h" # include "../PlatformEnvironment.h"
# include "../Version.h" # include "../Version.h"
# include "../config/Config.h" # include "../config/Config.h"
@@ -38,6 +37,7 @@
# include "../interface/Screenshot.h" # include "../interface/Screenshot.h"
# include "../localisation/Language.h" # include "../localisation/Language.h"
# include "../object/ObjectManager.h" # include "../object/ObjectManager.h"
# include "../park/ParkFile.h"
# include "../scenario/Scenario.h" # include "../scenario/Scenario.h"
# include "../util/SawyerCoding.h" # include "../util/SawyerCoding.h"
# include "../util/Util.h" # include "../util/Util.h"

View File

@@ -16,7 +16,6 @@
#include <openrct2/GameState.h> #include <openrct2/GameState.h>
#include <openrct2/GameStateSnapshots.h> #include <openrct2/GameStateSnapshots.h>
#include <openrct2/OpenRCT2.h> #include <openrct2/OpenRCT2.h>
#include <openrct2/ParkFile.h>
#include <openrct2/ParkImporter.h> #include <openrct2/ParkImporter.h>
#include <openrct2/audio/AudioContext.h> #include <openrct2/audio/AudioContext.h>
#include <openrct2/config/Config.h> #include <openrct2/config/Config.h>
@@ -29,6 +28,7 @@
#include <openrct2/entity/EntityTweener.h> #include <openrct2/entity/EntityTweener.h>
#include <openrct2/network/network.h> #include <openrct2/network/network.h>
#include <openrct2/object/ObjectManager.h> #include <openrct2/object/ObjectManager.h>
#include <openrct2/park/ParkFile.h>
#include <openrct2/platform/platform.h> #include <openrct2/platform/platform.h>
#include <openrct2/ride/Ride.h> #include <openrct2/ride/Ride.h>
#include <openrct2/scenario/Scenario.h> #include <openrct2/scenario/Scenario.h>