mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-29 01:35:06 +01:00
Make CLI object scan a command instead of a flag.
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
extern "C"
|
||||
{
|
||||
#include "../config.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../platform/crash.h"
|
||||
}
|
||||
|
||||
@@ -31,6 +30,7 @@ extern "C"
|
||||
#include "../core/String.hpp"
|
||||
#include "../network/network.h"
|
||||
#include "../object/ObjectRepository.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "CommandLine.hpp"
|
||||
|
||||
#ifdef USE_BREAKPAD
|
||||
@@ -67,7 +67,6 @@ static utf8 * _userDataPath = nullptr;
|
||||
static utf8 * _openrctDataPath = nullptr;
|
||||
static utf8 * _rct2DataPath = nullptr;
|
||||
static bool _silentBreakpad = false;
|
||||
static bool _forceScan = false;
|
||||
|
||||
static const CommandLineOptionDefinition StandardOptions[]
|
||||
{
|
||||
@@ -91,7 +90,6 @@ static const CommandLineOptionDefinition StandardOptions[]
|
||||
#ifdef USE_BREAKPAD
|
||||
{ CMDLINE_TYPE_SWITCH, &_silentBreakpad, NAC, "silent-breakpad", "make breakpad crash reporting silent" },
|
||||
#endif // USE_BREAKPAD
|
||||
{ CMDLINE_TYPE_SWITCH, &_forceScan, 'f', "force-scan", "forces scanning of object repository" },
|
||||
OptionTableEnd
|
||||
};
|
||||
|
||||
@@ -101,6 +99,7 @@ static exitcode_t HandleCommandIntro(CommandLineArgEnumerator * enumerator);
|
||||
static exitcode_t HandleCommandHost(CommandLineArgEnumerator * enumerator);
|
||||
static exitcode_t HandleCommandJoin(CommandLineArgEnumerator * enumerator);
|
||||
static exitcode_t HandleCommandSetRCT2(CommandLineArgEnumerator * enumerator);
|
||||
static exitcode_t HandleCommandScanObjects(CommandLineArgEnumerator * enumerator);
|
||||
|
||||
#if defined(__WINDOWS__) && !defined(__MINGW32__)
|
||||
|
||||
@@ -131,6 +130,7 @@ const CommandLineCommand CommandLine::RootCommands[]
|
||||
#endif
|
||||
DefineCommand("set-rct2", "<path>", StandardOptions, HandleCommandSetRCT2),
|
||||
DefineCommand("convert", "<source> <destination>", StandardOptions, CommandLine::HandleCommandConvert),
|
||||
DefineCommand("scan-objects", "<path>", StandardOptions, HandleCommandScanObjects),
|
||||
|
||||
#if defined(__WINDOWS__) && !defined(__MINGW32__)
|
||||
DefineCommand("register-shell", "", RegisterShellOptions, HandleCommandRegisterShell),
|
||||
@@ -197,14 +197,6 @@ exitcode_t CommandLine::HandleCommandDefault()
|
||||
gOpenRCT2Headless = _headless;
|
||||
gOpenRCT2SilentBreakpad = _silentBreakpad || _headless;
|
||||
|
||||
if (_forceScan)
|
||||
{
|
||||
IObjectRepository * objectRepository = GetObjectRepository();
|
||||
objectRepository->LoadOrConstruct(true);
|
||||
|
||||
result = EXITCODE_OK;
|
||||
}
|
||||
|
||||
if (_userDataPath != nullptr)
|
||||
{
|
||||
String::Set(gCustomUserDataPath, sizeof(gCustomUserDataPath), _userDataPath);
|
||||
@@ -398,6 +390,20 @@ static exitcode_t HandleCommandSetRCT2(CommandLineArgEnumerator * enumerator)
|
||||
}
|
||||
}
|
||||
|
||||
static exitcode_t HandleCommandScanObjects(CommandLineArgEnumerator * enumerator)
|
||||
{
|
||||
exitcode_t result = CommandLine::HandleCommandDefault();
|
||||
if (result != EXITCODE_CONTINUE)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
IPlatformEnvironment * env = OpenRCT2::SetupEnvironment();
|
||||
IObjectRepository * objectRepository = CreateObjectRepository(env);
|
||||
objectRepository->Construct();
|
||||
return EXITCODE_OK;
|
||||
}
|
||||
|
||||
#if defined(__WINDOWS__) && !defined(__MINGW32__)
|
||||
static exitcode_t HandleCommandRegisterShell(CommandLineArgEnumerator * enumerator)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user