standardize cross-platform command line args for the editors
This commit is contained in:
@@ -80,6 +80,21 @@ extern fs::path progDir;
|
|||||||
short specials_res_id;
|
short specials_res_id;
|
||||||
char start_name[256];
|
char start_name[256];
|
||||||
|
|
||||||
|
void process_args(int argc, char* argv[]) {
|
||||||
|
if(argc > 1) {
|
||||||
|
if(load_party(argv[1], univ)) {
|
||||||
|
file_in_mem = argv[1];
|
||||||
|
party_in_scen = !univ.party.scen_name.empty();
|
||||||
|
if(!party_in_scen) load_base_item_defs();
|
||||||
|
scen_items_loaded = true;
|
||||||
|
menu_activate();
|
||||||
|
} else {
|
||||||
|
std::cout << "Failed to load save file: " << argv[1] << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//MW specified return type was 'void', changed to ISO C style for Carbonisation -jmr
|
//MW specified return type was 'void', changed to ISO C style for Carbonisation -jmr
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
try {
|
try {
|
||||||
@@ -102,6 +117,7 @@ int main(int argc, char* argv[]) {
|
|||||||
srand(time(nullptr));
|
srand(time(nullptr));
|
||||||
|
|
||||||
set_up_apple_events();
|
set_up_apple_events();
|
||||||
|
process_args(argc, argv);
|
||||||
|
|
||||||
cDialog::init();
|
cDialog::init();
|
||||||
redraw_screen();
|
redraw_screen();
|
||||||
|
@@ -197,6 +197,21 @@ void adjust_windows (sf::RenderWindow & mainPtr, sf::View & mainView) {
|
|||||||
init_menubar();
|
init_menubar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void process_args(int argc, char* argv[]) {
|
||||||
|
if(argc > 1) {
|
||||||
|
if(load_scenario(argv[1], scenario)) {
|
||||||
|
set_current_town(scenario.last_town_edited);
|
||||||
|
cur_out = scenario.last_out_edited;
|
||||||
|
current_terrain = scenario.outdoors[cur_out.x][cur_out.y];
|
||||||
|
change_made = false;
|
||||||
|
ae_loading = true;
|
||||||
|
set_up_main_screen();
|
||||||
|
} else {
|
||||||
|
std::cout << "Failed to load scenario: " << argv[1] << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void init_scened(int argc, char* argv[]) {
|
void init_scened(int argc, char* argv[]) {
|
||||||
init_directories(argv[0]);
|
init_directories(argv[0]);
|
||||||
sync_prefs();
|
sync_prefs();
|
||||||
@@ -233,6 +248,7 @@ void init_scened(int argc, char* argv[]) {
|
|||||||
cDialog::defaultBackground = cDialog::BG_LIGHT;
|
cDialog::defaultBackground = cDialog::BG_LIGHT;
|
||||||
cDialog::doAnimations = true;
|
cDialog::doAnimations = true;
|
||||||
set_up_apple_events();
|
set_up_apple_events();
|
||||||
|
process_args(argc, argv);
|
||||||
init_fileio();
|
init_fileio();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user