mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add common load method for S4 importer
This commit is contained in:
parent
04a2734593
commit
f30a3b315c
|
@ -138,6 +138,23 @@ public:
|
||||||
_s4Path = path;
|
_s4Path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Load(const utf8 * path) override
|
||||||
|
{
|
||||||
|
const utf8 * extension = Path::GetExtension(path);
|
||||||
|
if (String::Equals(extension, ".sc4"))
|
||||||
|
{
|
||||||
|
LoadScenario(path);
|
||||||
|
}
|
||||||
|
else if (String::Equals(extension, ".sv4"))
|
||||||
|
{
|
||||||
|
LoadSavedGame(path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw Exception("Invalid RCT1 park extension.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Import() override
|
void Import() override
|
||||||
{
|
{
|
||||||
Initialise();
|
Initialise();
|
||||||
|
|
|
@ -28,6 +28,7 @@ public:
|
||||||
virtual ~IS4Importer() { }
|
virtual ~IS4Importer() { }
|
||||||
virtual void LoadSavedGame(const utf8 * path) abstract;
|
virtual void LoadSavedGame(const utf8 * path) abstract;
|
||||||
virtual void LoadScenario(const utf8 * path) abstract;
|
virtual void LoadScenario(const utf8 * path) abstract;
|
||||||
|
virtual void Load(const utf8 * path) abstract;
|
||||||
virtual void Import() abstract;
|
virtual void Import() abstract;
|
||||||
virtual bool GetDetails(scenario_index_entry * dst) abstract;
|
virtual bool GetDetails(scenario_index_entry * dst) abstract;
|
||||||
};
|
};
|
||||||
|
|
|
@ -361,16 +361,8 @@ private:
|
||||||
{
|
{
|
||||||
bool isScenario = String::Equals(extension, ".sc4", true);
|
bool isScenario = String::Equals(extension, ".sc4", true);
|
||||||
IS4Importer * s4Importer = CreateS4Importer();
|
IS4Importer * s4Importer = CreateS4Importer();
|
||||||
if (isScenario)
|
s4Importer->Load(path);
|
||||||
{
|
s4Importer->Import();
|
||||||
s4Importer->LoadScenario(path);
|
|
||||||
s4Importer->Import();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s4Importer->LoadSavedGame(path);
|
|
||||||
s4Importer->Import();
|
|
||||||
}
|
|
||||||
PrepareParkForPlayback(isScenario);
|
PrepareParkForPlayback(isScenario);
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue