stage_init_array really does go first

This commit is contained in:
Andrei "Akari" Alexeyev 2017-04-03 02:50:48 +03:00
parent d41bb02753
commit ecc1997852
2 changed files with 10 additions and 9 deletions

View file

@ -149,11 +149,13 @@ int cli_args(int argc, char **argv, CLIAction *a) {
}
}
if(stageid != -1 && a->type != CLI_PlayReplay && a->type != CLI_SelectStage)
log_warn("--sid was ignored");
if(stageid != -1 && !stage_get(stageid))
log_fatal("Invalid stage id: %x",stageid);
if(stageid != -1) {
if(a->type != CLI_PlayReplay && a->type != CLI_SelectStage) {
log_warn("--sid was ignored");
} else if(!stage_get(stageid)) {
log_fatal("Invalid stage id: %x", stageid);
}
}
if(a->type != CLI_SelectStage && (cha != INVALID_CHAR || shot != INVALID_SHOT))
log_warn("--shotmode was ignored");

View file

@ -119,6 +119,8 @@ int main(int argc, char **argv) {
return 0;
}
stage_init_array(); // cli_args depends on this
// commandline arguments should be parsed as early as possible
CLIAction a;
cli_args(argc, argv, &a); // stage_init_array goes first!
@ -127,11 +129,9 @@ int main(int argc, char **argv) {
return 1;
if(a.type == CLI_DumpStages) {
stage_init_array();
for(StageInfo *stg = stages; stg->procs; ++stg) {
tsfprintf(stdout, "%x %s: %s\n", stg->id, stg->title, stg->subtitle);
}
stage_free_array();
return 0;
} else if(a.type == CLI_PlayReplay) {
if(!replay_load(&replay, a.filename, REPLAY_READ_ALL | REPLAY_READ_RAWPATH)) {
@ -166,8 +166,7 @@ int main(int argc, char **argv) {
audio_init();
load_resources();
gamepad_init();
stage_init_array();
progress_load(); // stage_init_array goes first!
progress_load();
set_transition(TransLoader, 0, FADE_TIME*2);