1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-29 01:35:06 +01:00

Remove S6Exporter

This commit is contained in:
Ted John
2021-04-03 03:37:57 +01:00
parent d70abcc84e
commit 8ff525270d
8 changed files with 46 additions and 1922 deletions

View File

@@ -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;
}

View File

@@ -21,6 +21,7 @@ enum
FILE_EXTENSION_SC6,
FILE_EXTENSION_SV6,
FILE_EXTENSION_TD6,
FILE_EXTENSION_PARK,
};
#include <string>

View File

@@ -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);

View File

@@ -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

View File

@@ -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();
};