From a45b34ec421e7828b4167bb0a816b7380ba99586 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Wed, 12 Jun 2024 12:28:42 -0600 Subject: [PATCH] all platforms load party from command line --- src/game/boe.main.cpp | 23 +++++++++++++++++++++++ src/game/boe.menus.win.cpp | 15 +-------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/game/boe.main.cpp b/src/game/boe.main.cpp index 7568c863..d1b3bbff 100644 --- a/src/game/boe.main.cpp +++ b/src/game/boe.main.cpp @@ -215,7 +215,30 @@ static void init_ui() { init_buttons(); } +void process_args(int argc, char* argv[]) { + // Command line usage: + // "Blades of Exile" # basic launch + // "Blades of Exile" # launch and load save file + + if (argc > 1) { + if(!load_party(argv[1], univ)) { + std::cout << "Failed to load save file: " << argv[1] << std::endl; + return; + } + + if(!finished_init) { + ae_loading = true; + overall_mode = MODE_STARTUP; + } else finish_load_party(); + if(overall_mode != MODE_STARTUP) + end_startup(); + if(overall_mode != MODE_STARTUP) + post_load(); + } +} + void init_boe(int argc, char* argv[]) { + process_args(argc, argv); set_up_apple_events(argc, argv); init_directories(argv[0]); #ifdef __APPLE__ diff --git a/src/game/boe.menus.win.cpp b/src/game/boe.menus.win.cpp index 7e491de0..4e3c6401 100644 --- a/src/game/boe.menus.win.cpp +++ b/src/game/boe.menus.win.cpp @@ -318,19 +318,6 @@ LRESULT CALLBACK menuProc(HWND handle, UINT message, WPARAM wParam, LPARAM lPara #include "boe.actions.hpp" #include "boe.fileio.hpp" -extern bool ae_loading, finished_init; void set_up_apple_events(int argc, char* argv[]) { - if(argc > 1) { - if(!load_party(argv[1], univ)) - return; - if(!finished_init) { - ae_loading = true; - overall_mode = MODE_STARTUP; - } else finish_load_party(); - if(overall_mode != MODE_STARTUP) - end_startup(); - if(overall_mode != MODE_STARTUP) - post_load(); - } -} +} \ No newline at end of file