all platforms load party from command line

This commit is contained in:
2024-06-12 12:28:42 -06:00
parent 8ddb99361d
commit a45b34ec42
2 changed files with 24 additions and 14 deletions

View File

@@ -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" <save file> # 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__

View File

@@ -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();
}
}
}