Skip to content

Commit 4b6b930

Browse files
committed
Fixes the --help argument so that it doesn't display audio settings on top of the help text, which seems a little out of place.
1 parent 6bc4ec8 commit 4b6b930

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

Pilot_Episode/pilot_episode.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ int main(int argc, char** argv)
482482
params.screen_bg_color_instructions = Color::Black;
483483

484484
bool use_audio = true;
485+
bool show_help = false;
485486

486487
for (int i = 1; i < argc; ++i)
487488
{
@@ -499,22 +500,24 @@ int main(int argc, char** argv)
499500
}
500501
else if (std::strcmp(argv[i], "--disable_audio") == 0)
501502
use_audio = false;
503+
else if (std::strcmp(argv[i], "--help") == 0)
504+
show_help = true;
502505
}
503506

507+
if (show_help)
508+
use_audio = false;
509+
504510
Game game(argc, argv, params, use_audio);
505511

506-
for (int i = 1; i < argc; ++i)
512+
if (show_help)
507513
{
508-
if (std::strcmp(argv[i], "--help") == 0)
509-
{
510-
std::cout << "demo --help | [--log_mode (record | replay)] [--suppress_tty_output] [--suppress_tty_input] [--altitude_start_km <altitude_km>] [--disable_altitude_limiting] [--set_fps <fps>] [--set_sim_delay_us <delay_us>] [--disable_audio]" << std::endl;
511-
std::cout << " default values:" << std::endl;
512-
// Will unfortunately report the wrong default value for <altitude_km> if ordering the arguments like this "--altitude_start_km <altitude_km> --help".
513-
std::cout << " <altitude_km> : " << game.get_alt_km() << std::endl;
514-
std::cout << " <fps> : " << game.get_real_fps() << std::endl;
515-
std::cout << " <delay_us> : " << game.get_sim_delay_us() << std::endl;
516-
return EXIT_SUCCESS;
517-
}
514+
std::cout << "pilot_episode --help | [--log_mode (record | replay)] [--suppress_tty_output] [--suppress_tty_input] [--altitude_start_km <altitude_km>] [--disable_altitude_limiting] [--set_fps <fps>] [--set_sim_delay_us <delay_us>] [--disable_audio]" << std::endl;
515+
std::cout << " default values:" << std::endl;
516+
// Will unfortunately report the wrong default value for <altitude_km> if ordering the arguments like this "--altitude_start_km <altitude_km> --help".
517+
std::cout << " <altitude_km> : " << game.get_alt_km() << std::endl;
518+
std::cout << " <fps> : " << game.get_real_fps() << std::endl;
519+
std::cout << " <delay_us> : " << game.get_sim_delay_us() << std::endl;
520+
return EXIT_SUCCESS;
518521
}
519522

520523
for (int i = 1; i < argc; ++i)

0 commit comments

Comments
 (0)