From 8c3419af5012bb6d1f43029ab56bbbb37f023372 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Thu, 6 Aug 2015 17:19:21 +0200 Subject: [PATCH] Load configuration before parsing command line options. Before, if there was a valid configuration file, then some command line options did not have any effect. --- src/init.cpp | 17 +++++++++++------ src/main.cpp | 2 ++ src/main.h | 1 + 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 10e7aeb..fd6ec71 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "init.h" +static bool displayLicense; + void checkForLicense() { if (!engine.loadData(_("data/license"))) @@ -252,18 +254,21 @@ int initMedalService(void *data) return 1; } +void initConfig() +{ + #if UNIX + setupUserHomeDirectory(); + #endif + + displayLicense = loadConfig(); +} + /* Chugg chugg chugg.... brrr... chugg chugg chugg...brrrrrr... chugg ch.. BRRRRRRRRRRRRRRRRRMMMMMMMMMMMMMMMMMMM!! Well, hopefully anyway! ;) */ void initSystem() { - #if UNIX - setupUserHomeDirectory(); - #endif - - bool displayLicense = loadConfig(); - long flags = SDL_INIT_VIDEO|SDL_INIT_JOYSTICK; if (engine.useAudio) diff --git a/src/main.cpp b/src/main.cpp index 951725a..e3844bb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -127,6 +127,8 @@ int main(int argc, char *argv[]) int recordMode = REPLAY_MODE::NONE; int requiredSection = SECTION_INTRO; + initConfig(); + for (int i = 1 ; i < argc ; i++) { if (strcmp(argv[i], "-fullscreen") == 0) engine.fullScreen = true; diff --git a/src/main.h b/src/main.h index 67c7e08..bf2bf22 100644 --- a/src/main.h +++ b/src/main.h @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "headers.h" +extern void initConfig(); extern void initSystem(); extern void cleanup(); -- 2.39.5