forked from rosebudai/OpenRCT2-Web
Make -force-scan command run without starting game
reformat object_list_load to use parameter instead of external flag boolean remove object_list_load_force_scan, call directly from RootCommands
This commit is contained in:
1 parent
5cd6c864a5
commit
6ba51e36da
4 files changed
+18
-21
No files matched your search
@@ -112,7 +112,7 @@ public:
|
||||
ClearItems();
|
||||
}
|
||||
|
||||
void LoadOrConstruct() override
|
||||
void LoadOrConstruct(bool forceScan) override
|
||||
{
|
||||
ClearItems();
|
||||
|
||||
@@ -123,8 +123,12 @@ public:
|
||||
QueryDirectory(&_queryDirectoryResult, rct2Path);
|
||||
QueryDirectory(&_queryDirectoryResult, openrct2Path);
|
||||
|
||||
if (!Load())
|
||||
if (forceScan || !Load())
|
||||
{
|
||||
if (forceScan)
|
||||
{
|
||||
Console::WriteLine("Forcing object repository scan.");
|
||||
}
|
||||
_languageId = gCurrentLanguage;
|
||||
|
||||
Construct();
|
||||
@@ -300,16 +304,6 @@ private:
|
||||
bool Load()
|
||||
{
|
||||
const std::string &path = _env->GetFilePath(PATHID::CACHE_OBJECTS);
|
||||
|
||||
// Override if force-flag is set.
|
||||
if (object_repository_force_scan_flag)
|
||||
{
|
||||
Console::WriteLine("Forcing object repository scan.");
|
||||
// This should only be called once, so set back to false.
|
||||
object_repository_force_scan_flag = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
@@ -659,8 +653,6 @@ static int GetObjectEntryIndex(uint8 objectType, uint8 entryIndex)
|
||||
|
||||
extern "C"
|
||||
{
|
||||
bool object_repository_force_scan_flag = false;
|
||||
|
||||
rct_object_entry * object_list_find(rct_object_entry * entry)
|
||||
{
|
||||
IObjectRepository * objRepo = GetObjectRepository();
|
||||
@@ -678,7 +670,7 @@ extern "C"
|
||||
void object_list_load()
|
||||
{
|
||||
IObjectRepository * objectRepository = GetObjectRepository();
|
||||
objectRepository->LoadOrConstruct();
|
||||
objectRepository->LoadOrConstruct(false);
|
||||
|
||||
IObjectManager * objectManager = GetObjectManager();
|
||||
objectManager->UnloadAll();
|
||||
|
||||
Reference in new issue
Block a user