forked from rosebudai/OpenRCT2-Web
Fix scan-objects CLI action
Ensure a context is available when objects are loaded.
This commit is contained in:
1 parent
2512e4959c
commit
6526f9f6cb
1 file changed
+6
-3
@@ -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