mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-31 18:55:23 +01:00
Fix scan-objects CLI action
Ensure a context is available when objects are loaded.
This commit is contained in:
@@ -15,12 +15,13 @@
|
||||
#pragma endregion
|
||||
|
||||
#include <ctime>
|
||||
#include <memory>
|
||||
|
||||
#include "../config/Config.h"
|
||||
#include "../Context.h"
|
||||
#include "../platform/Crash.h"
|
||||
#include "../platform/platform.h"
|
||||
#include "../localisation/Language.h"
|
||||
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Memory.hpp"
|
||||
#include "../core/Path.hpp"
|
||||
@@ -394,12 +395,14 @@ static exitcode_t HandleCommandScanObjects(CommandLineArgEnumerator * enumerator
|
||||
return result;
|
||||
}
|
||||
|
||||
auto env = OpenRCT2::CreatePlatformEnvironment();
|
||||
gOpenRCT2Headless = true;
|
||||
|
||||
// HACK: set gCurrentLanguage otherwise it be wrong for the index file
|
||||
gCurrentLanguage = gConfigGeneral.language;
|
||||
|
||||
auto objectRepository = CreateObjectRepository(env);
|
||||
auto context = std::unique_ptr<OpenRCT2::IContext>(OpenRCT2::CreateContext());
|
||||
auto env = context->GetPlatformEnvironment();
|
||||
auto objectRepository = std::unique_ptr<IObjectRepository>(CreateObjectRepository(env));
|
||||
objectRepository->Construct();
|
||||
return EXITCODE_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user