mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 11:33:03 +01:00
Remove S6Exporter
This commit is contained in:
@@ -728,7 +728,6 @@
|
||||
F76C86B61EC4E88400FA49E2 /* SawyerChunkReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C846F1EC4E7CC00FA49E2 /* SawyerChunkReader.cpp */; };
|
||||
F76C86B81EC4E88400FA49E2 /* SawyerChunkWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C84711EC4E7CC00FA49E2 /* SawyerChunkWriter.cpp */; };
|
||||
F76C86BA1EC4E88400FA49E2 /* SawyerEncoding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C84731EC4E7CC00FA49E2 /* SawyerEncoding.cpp */; };
|
||||
F76C86C31EC4E88400FA49E2 /* S6Exporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C847D1EC4E7CC00FA49E2 /* S6Exporter.cpp */; };
|
||||
F76C86C51EC4E88400FA49E2 /* S6Importer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C847F1EC4E7CC00FA49E2 /* S6Importer.cpp */; };
|
||||
F76C871C1EC4E88400FA49E2 /* TrackDesignRepository.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C84DC1EC4E7CD00FA49E2 /* TrackDesignRepository.cpp */; };
|
||||
F76C87331EC4E88400FA49E2 /* ScenarioRepository.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C84F61EC4E7CD00FA49E2 /* ScenarioRepository.cpp */; };
|
||||
@@ -1751,8 +1750,6 @@
|
||||
F76C84721EC4E7CC00FA49E2 /* SawyerChunkWriter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SawyerChunkWriter.h; sourceTree = "<group>"; };
|
||||
F76C84731EC4E7CC00FA49E2 /* SawyerEncoding.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SawyerEncoding.cpp; sourceTree = "<group>"; };
|
||||
F76C84741EC4E7CC00FA49E2 /* SawyerEncoding.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SawyerEncoding.h; sourceTree = "<group>"; };
|
||||
F76C847D1EC4E7CC00FA49E2 /* S6Exporter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = S6Exporter.cpp; sourceTree = "<group>"; };
|
||||
F76C847E1EC4E7CC00FA49E2 /* S6Exporter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = S6Exporter.h; sourceTree = "<group>"; };
|
||||
F76C847F1EC4E7CC00FA49E2 /* S6Importer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = S6Importer.cpp; sourceTree = "<group>"; };
|
||||
F76C84DC1EC4E7CD00FA49E2 /* TrackDesignRepository.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TrackDesignRepository.cpp; sourceTree = "<group>"; };
|
||||
F76C84DD1EC4E7CD00FA49E2 /* TrackDesignRepository.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TrackDesignRepository.h; sourceTree = "<group>"; };
|
||||
@@ -2823,8 +2820,6 @@
|
||||
children = (
|
||||
4CB30178249E382B0034A7F6 /* RCT2.cpp */,
|
||||
4C7B54042004C58200A52E21 /* RCT2.h */,
|
||||
F76C847D1EC4E7CC00FA49E2 /* S6Exporter.cpp */,
|
||||
F76C847E1EC4E7CC00FA49E2 /* S6Exporter.h */,
|
||||
F76C847F1EC4E7CC00FA49E2 /* S6Importer.cpp */,
|
||||
933C55B424B858490057E64B /* SeaDecrypt.cpp */,
|
||||
01C6F0C522FD51FC0057E2F7 /* T6Exporter.cpp */,
|
||||
@@ -4168,7 +4163,6 @@
|
||||
C688784E202899CB0084B384 /* Date.cpp in Sources */,
|
||||
66A10F9B257F1E1800DD651A /* ParkSetResearchFundingAction.cpp in Sources */,
|
||||
F76C86BA1EC4E88400FA49E2 /* SawyerEncoding.cpp in Sources */,
|
||||
F76C86C31EC4E88400FA49E2 /* S6Exporter.cpp in Sources */,
|
||||
C68878E820289B9B0084B384 /* Platform.Win32.cpp in Sources */,
|
||||
C688791A20289B9B0084B384 /* SpaceRings.cpp in Sources */,
|
||||
C688790420289B9B0084B384 /* Steeplechase.cpp in Sources */,
|
||||
|
||||
@@ -213,5 +213,7 @@ uint32_t get_file_extension_type(const utf8* path)
|
||||
return FILE_EXTENSION_SV6;
|
||||
if (String::Equals(extension, ".td6", true))
|
||||
return FILE_EXTENSION_TD6;
|
||||
if (String::Equals(extension, ".park", true))
|
||||
return FILE_EXTENSION_PARK;
|
||||
return FILE_EXTENSION_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ enum
|
||||
FILE_EXTENSION_SC6,
|
||||
FILE_EXTENSION_SV6,
|
||||
FILE_EXTENSION_TD6,
|
||||
FILE_EXTENSION_PARK,
|
||||
};
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -7,14 +7,17 @@
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../Context.h"
|
||||
#include "../FileClassifier.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../ParkFile.h"
|
||||
#include "../ParkImporter.h"
|
||||
#include "../common.h"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Path.hpp"
|
||||
#include "../interface/Window.h"
|
||||
#include "../rct2/S6Exporter.h"
|
||||
#include "../object/ObjectManager.h"
|
||||
#include "../scenario/Scenario.h"
|
||||
#include "CommandLine.hpp"
|
||||
|
||||
#include <memory>
|
||||
@@ -55,9 +58,9 @@ exitcode_t CommandLine::HandleCommandConvert(CommandLineArgEnumerator* enumerato
|
||||
uint32_t destinationFileType = get_file_extension_type(destinationPath);
|
||||
|
||||
// Validate target type
|
||||
if (destinationFileType != FILE_EXTENSION_SC6 && destinationFileType != FILE_EXTENSION_SV6)
|
||||
if (destinationFileType != FILE_EXTENSION_PARK)
|
||||
{
|
||||
Console::Error::WriteLine("Only conversion to .SC6 or .SV4 is supported.");
|
||||
Console::Error::WriteLine("Only conversion to .PARK is supported.");
|
||||
return EXITCODE_FAIL;
|
||||
}
|
||||
|
||||
@@ -90,11 +93,18 @@ exitcode_t CommandLine::HandleCommandConvert(CommandLineArgEnumerator* enumerato
|
||||
WriteConvertFromAndToMessage(sourceFileType, destinationFileType);
|
||||
|
||||
gOpenRCT2Headless = true;
|
||||
auto context = OpenRCT2::CreateContext();
|
||||
context->Initialise();
|
||||
|
||||
auto& objManager = context->GetObjectManager();
|
||||
|
||||
try
|
||||
{
|
||||
auto importer = ParkImporter::Create(sourcePath);
|
||||
importer->Load(sourcePath);
|
||||
auto loadResult = importer->Load(sourcePath);
|
||||
|
||||
objManager.LoadObjects(loadResult.RequiredObjects);
|
||||
|
||||
importer->Import();
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
@@ -111,21 +121,13 @@ exitcode_t CommandLine::HandleCommandConvert(CommandLineArgEnumerator* enumerato
|
||||
|
||||
try
|
||||
{
|
||||
auto exporter = std::make_unique<S6Exporter>();
|
||||
auto exporter = std::make_unique<ParkFileExporter>();
|
||||
|
||||
// HACK remove the main window so it saves the park with the
|
||||
// correct initial view
|
||||
window_close_by_class(WC_MAIN_WINDOW);
|
||||
|
||||
exporter->Export();
|
||||
if (destinationFileType == FILE_EXTENSION_SC6)
|
||||
{
|
||||
exporter->SaveScenario(destinationPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
exporter->SaveGame(destinationPath);
|
||||
}
|
||||
exporter->Export(destinationPath);
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
@@ -157,6 +159,8 @@ static const utf8* GetFileTypeFriendlyName(uint32_t fileType)
|
||||
return "RollerCoaster Tycoon 2 scenario";
|
||||
case FILE_EXTENSION_SV6:
|
||||
return "RollerCoaster Tycoon 2 saved game";
|
||||
case FILE_EXTENSION_PARK:
|
||||
return "OpenRCT2 park";
|
||||
}
|
||||
|
||||
assert(false);
|
||||
|
||||
@@ -297,7 +297,6 @@
|
||||
<ClInclude Include="rct1\RCT1.h" />
|
||||
<ClInclude Include="rct1\Tables.h" />
|
||||
<ClInclude Include="rct2\RCT2.h" />
|
||||
<ClInclude Include="rct2\S6Exporter.h" />
|
||||
<ClInclude Include="rct2\T6Exporter.h" />
|
||||
<ClInclude Include="ReplayManager.h" />
|
||||
<ClInclude Include="ride\CableLift.h" />
|
||||
@@ -736,7 +735,6 @@
|
||||
<ClCompile Include="rct1\T4Importer.cpp" />
|
||||
<ClCompile Include="rct1\Tables.cpp" />
|
||||
<ClCompile Include="rct2\RCT2.cpp" />
|
||||
<ClCompile Include="rct2\S6Exporter.cpp" />
|
||||
<ClCompile Include="rct2\S6Importer.cpp" />
|
||||
<ClCompile Include="rct2\SeaDecrypt.cpp" />
|
||||
<ClCompile Include="rct2\T6Exporter.cpp" />
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,81 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2020 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 "../common.h"
|
||||
#include "../object/ObjectList.h"
|
||||
#include "../scenario/Scenario.h"
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
struct IStream;
|
||||
}
|
||||
|
||||
struct Litter;
|
||||
struct ObjectRepositoryItem;
|
||||
struct RCT12SpriteBase;
|
||||
union rct_sprite;
|
||||
struct SpriteBase;
|
||||
|
||||
/**
|
||||
* Class to export RollerCoaster Tycoon 2 scenarios (*.SC6) and saved games (*.SV6).
|
||||
*/
|
||||
class S6Exporter final
|
||||
{
|
||||
public:
|
||||
bool RemoveTracklessRides;
|
||||
std::vector<const ObjectRepositoryItem*> ExportObjectsList;
|
||||
|
||||
S6Exporter();
|
||||
|
||||
void SaveGame(const utf8* path);
|
||||
void SaveGame(OpenRCT2::IStream* stream);
|
||||
void SaveScenario(const utf8* path);
|
||||
void SaveScenario(OpenRCT2::IStream* stream);
|
||||
void Export();
|
||||
void ExportParkName();
|
||||
void ExportRides();
|
||||
void ExportRide(rct2_ride* dst, const Ride* src);
|
||||
void ExportEntities();
|
||||
template<typename RCT12_T, typename OpenRCT2_T> void ExportEntity(RCT12_T* dst, const OpenRCT2_T* src);
|
||||
void ExportEntityCommonProperties(RCT12SpriteBase* dst, const SpriteBase* src);
|
||||
void ExportEntityPeep(RCT2SpritePeep* dst, const Peep* src);
|
||||
|
||||
private:
|
||||
rct_s6_data _s6{};
|
||||
std::vector<std::string> _userStrings;
|
||||
|
||||
void Save(OpenRCT2::IStream* stream, bool isScenario);
|
||||
static uint32_t GetLoanHash(money32 initialCash, money32 bankLoan, uint32_t maxBankLoan);
|
||||
void ExportResearchedRideTypes();
|
||||
void ExportResearchedRideEntries();
|
||||
void ExportResearchedSceneryItems();
|
||||
void ExportResearchList();
|
||||
void ExportMarketingCampaigns();
|
||||
void ExportPeepSpawns();
|
||||
void ExportRideRatingsCalcData();
|
||||
void ExportRideMeasurements();
|
||||
void ExportRideMeasurement(RCT12RideMeasurement& dst, const RideMeasurement& src);
|
||||
void ExportBanners();
|
||||
void ExportBanner(RCT12Banner& dst, const Banner& src);
|
||||
void ExportMapAnimations();
|
||||
|
||||
void ExportTileElements();
|
||||
void ExportTileElement(RCT12TileElement* dst, TileElement* src);
|
||||
|
||||
std::optional<uint16_t> AllocateUserString(std::string_view value);
|
||||
void ExportUserStrings();
|
||||
void RebuildEntityLinks();
|
||||
};
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/OpenRCT2.h>
|
||||
#include <openrct2/ParkFile.h>
|
||||
#include <openrct2/ParkImporter.h>
|
||||
#include <openrct2/audio/AudioContext.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
@@ -26,8 +27,8 @@
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/object/ObjectManager.h>
|
||||
#include <openrct2/platform/platform.h>
|
||||
#include <openrct2/rct2/S6Exporter.h>
|
||||
#include <openrct2/ride/Ride.h>
|
||||
#include <openrct2/world/MapAnimation.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/Sprite.h>
|
||||
#include <stdio.h>
|
||||
@@ -75,7 +76,7 @@ static void GameInit(bool retainSpatialIndices)
|
||||
gGameSpeed = 1;
|
||||
}
|
||||
|
||||
static bool ImportSave(MemoryStream& stream, std::unique_ptr<IContext>& context, bool retainSpatialIndices)
|
||||
static bool ImportS6(MemoryStream& stream, std::unique_ptr<IContext>& context, bool retainSpatialIndices)
|
||||
{
|
||||
stream.SetPosition(0);
|
||||
|
||||
@@ -91,14 +92,29 @@ static bool ImportSave(MemoryStream& stream, std::unique_ptr<IContext>& context,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ImportPark(MemoryStream& stream, std::unique_ptr<IContext>& context, bool retainSpatialIndices)
|
||||
{
|
||||
stream.SetPosition(0);
|
||||
|
||||
auto& objManager = context->GetObjectManager();
|
||||
|
||||
auto importer = ParkImporter::CreateParkFile(context->GetObjectRepository());
|
||||
auto loadResult = importer->LoadFromStream(&stream, false);
|
||||
objManager.LoadObjects(loadResult.RequiredObjects);
|
||||
importer->Import();
|
||||
|
||||
GameInit(retainSpatialIndices);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ExportSave(MemoryStream& stream, std::unique_ptr<IContext>& context)
|
||||
{
|
||||
auto& objManager = context->GetObjectManager();
|
||||
|
||||
auto exporter = std::make_unique<S6Exporter>();
|
||||
auto exporter = std::make_unique<ParkFileExporter>();
|
||||
exporter->ExportObjectsList = objManager.GetPackableObjects();
|
||||
exporter->Export();
|
||||
exporter->SaveGame(&stream);
|
||||
exporter->Export(stream);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -499,7 +515,7 @@ TEST(S6ImportExportBasic, all)
|
||||
|
||||
std::string testParkPath = TestData::GetParkPath("BigMapTest.sv6");
|
||||
ASSERT_TRUE(LoadFileToBuffer(importBuffer, testParkPath));
|
||||
ASSERT_TRUE(ImportSave(importBuffer, context, false));
|
||||
ASSERT_TRUE(ImportS6(importBuffer, context, false));
|
||||
importedState = GetGameState(context);
|
||||
ASSERT_NE(importedState, nullptr);
|
||||
|
||||
@@ -514,7 +530,7 @@ TEST(S6ImportExportBasic, all)
|
||||
bool initialised = context->Initialise();
|
||||
ASSERT_TRUE(initialised);
|
||||
|
||||
ASSERT_TRUE(ImportSave(exportBuffer, context, true));
|
||||
ASSERT_TRUE(ImportPark(exportBuffer, context, true));
|
||||
|
||||
exportedState = GetGameState(context);
|
||||
ASSERT_NE(exportedState, nullptr);
|
||||
@@ -548,7 +564,7 @@ TEST(S6ImportExportAdvanceTicks, all)
|
||||
|
||||
std::string testParkPath = TestData::GetParkPath("BigMapTest.sv6");
|
||||
ASSERT_TRUE(LoadFileToBuffer(importBuffer, testParkPath));
|
||||
ASSERT_TRUE(ImportSave(importBuffer, context, false));
|
||||
ASSERT_TRUE(ImportS6(importBuffer, context, false));
|
||||
AdvanceGameTicks(1000, context);
|
||||
ASSERT_TRUE(ExportSave(exportBuffer, context));
|
||||
|
||||
@@ -564,7 +580,7 @@ TEST(S6ImportExportAdvanceTicks, all)
|
||||
bool initialised = context->Initialise();
|
||||
ASSERT_TRUE(initialised);
|
||||
|
||||
ASSERT_TRUE(ImportSave(exportBuffer, context, true));
|
||||
ASSERT_TRUE(ImportPark(exportBuffer, context, true));
|
||||
|
||||
exportedState = GetGameState(context);
|
||||
ASSERT_NE(exportedState, nullptr);
|
||||
|
||||
Reference in New Issue
Block a user