Skip to content

Commit

Permalink
all platforms load party from command line
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios committed Jun 12, 2024
1 parent 8ddb993 commit a45b34e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
23 changes: 23 additions & 0 deletions src/game/boe.main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down
17 changes: 2 additions & 15 deletions src/game/boe.menus.win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

}

0 comments on commit a45b34e

Please sign in to comment.