1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-29 17:54:50 +01:00

Merge pull request #5361 from Broxzier/fix_sprite_commands

Fix sprite commands
This commit is contained in:
Ted John
2017-04-13 23:13:33 +01:00
committed by GitHub
2 changed files with 10 additions and 7 deletions

View File

@@ -40,9 +40,12 @@ static exitcode_t HandleSprite(CommandLineArgEnumerator *argEnumerator);
const CommandLineCommand CommandLine::SpriteCommands[]
{
// Main commands
DefineCommand("details", "<spritefile> [idx]", SpriteOptions, HandleSprite),
DefineCommand("export", "<spritefile> <idx> <output>", SpriteOptions, HandleSprite),
DefineCommand("build", "<spritefile> <resourcedir> [silent]", SpriteOptions, HandleSprite),
DefineCommand("append", "<spritefile> <input>", SpriteOptions, HandleSprite),
DefineCommand("build", "<spritefile> <resourcedir> [silent]", SpriteOptions, HandleSprite),
DefineCommand("create", "<spritefile>", SpriteOptions, HandleSprite),
DefineCommand("details", "<spritefile> [idx]", SpriteOptions, HandleSprite),
DefineCommand("export", "<spritefile> <idx> <output>", SpriteOptions, HandleSprite),
DefineCommand("exportall", "<spritefile> <outputdir>", SpriteOptions, HandleSprite),
CommandTableEnd
};

View File

@@ -527,16 +527,16 @@ sint32 cmdline_for_sprite(const char **argv, sint32 argc)
return -1;
}
if (!platform_ensure_directory_exists(argv[2])){
safe_strcpy(outputPath, argv[2], MAX_PATH);
path_end_with_separator(outputPath, MAX_PATH);
if (!platform_ensure_directory_exists(outputPath)){
fprintf(stderr, "Unable to create directory.\n");
return -1;
}
sint32 maxIndex = (sint32)spriteFileHeader.num_entries;
sint32 numbers = (sint32)floor(log(maxIndex));
safe_strcpy(outputPath, argv[2], MAX_PATH);
size_t pathLen = strlen(outputPath);
if (pathLen >= (size_t)(MAX_PATH - numbers - 5)) {