1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 04:53:12 +01:00

Build image repository from object images (#23640)

This commit is contained in:
spacek531
2025-01-27 00:25:22 -08:00
committed by GitHub
parent 5b5d91abb0
commit f1148e310e
2 changed files with 9 additions and 1 deletions

View File

@@ -537,6 +537,9 @@ int32_t CommandLineForSprite(const char** argv, int32_t argc)
return -1;
}
if (jsonSprites.is_object() && !jsonSprites["images"].is_null())
jsonSprites = jsonSprites["images"];
if (!jsonSprites.is_array())
{
fprintf(stderr, "Error: expected array\n");
@@ -555,6 +558,8 @@ int32_t CommandLineForSprite(const char** argv, int32_t argc)
json_t sprite_description;
uint32_t numSuccessful = 0;
// Note: jsonSprite is deliberately left non-const: json_t behaviour changes when const
for (auto& [jsonKey, jsonSprite] : jsonSprites.items())
{
@@ -588,6 +593,8 @@ int32_t CommandLineForSprite(const char** argv, int32_t argc)
if (!silent)
fprintf(stdout, "Added: %s\n", imagePath.c_str());
numSuccessful++;
}
if (!spriteFile.Save(spriteFilePath))
@@ -596,7 +603,7 @@ int32_t CommandLineForSprite(const char** argv, int32_t argc)
return -1;
}
fprintf(stdout, "Finished\n");
fprintf(stdout, "Finished building graphics repository with %u images\n", numSuccessful);
return 1;
}