From e885056229e7bd2a152dd860f05db65157d32a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sat, 14 Nov 2015 17:36:32 +0100 Subject: [PATCH] Fix exit code handling, sprite generation Make sprite generation not start UI --- src/cmdline.c | 5 ++++- src/cmdline_sprite.c | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/cmdline.c b/src/cmdline.c index 9f7a45427d..0b0eb4b232 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -121,7 +121,10 @@ int cmdline_run(const char **argv, int argc) if (argc != 0) { gExitCode = cmdline_call_action(argv, argc); - if (gExitCode != 0) { + if (gExitCode < 0) { + return 0; + } else if (gExitCode > 0) { + gExitCode = 0; return 0; } } diff --git a/src/cmdline_sprite.c b/src/cmdline_sprite.c index 0e8f84a83a..789a86fa0a 100644 --- a/src/cmdline_sprite.c +++ b/src/cmdline_sprite.c @@ -1,8 +1,29 @@ +/***************************************************************************** + * Copyright (c) 2015 Ted John + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * This file is part of OpenRCT2. + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ + #include #include "cmdline.h" #include "drawing/drawing.h" #include "platform/platform.h" #include "util/util.h" +#include "openrct2.h" #define MODE_DEFAULT 0 #define MODE_CLOSEST 1 @@ -397,6 +418,7 @@ bool sprite_file_import(const char *path, rct_g1_element *outElement, uint8 **ou int cmdline_for_sprite(const char **argv, int argc) { + gOpenRCT2Headless = true; if (argc == 0) return -1;