X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fmisc.c;h=c59749ff92e94c71888d2dad04dc23d6d76df1cf;hb=86e110774e5210b326e6867b134bd638d93554d3;hp=4f201d97fd015712dafd2cd555fe8a03edd44623;hpb=1101077a226b09854650662759bf12caf7c84f8d;p=rocksndiamonds.git diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 4f201d97..c59749ff 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -14,9 +14,6 @@ #include #include #include -/* -#include -*/ #include #include #include @@ -115,7 +112,7 @@ static void sleep_milliseconds(unsigned long milliseconds_delay) boolean do_busy_waiting = (milliseconds_delay < 5 ? TRUE : FALSE); #if defined(PLATFORM_MSDOS) - /* don't use select() to perform waiting operations under DOS/Windows + /* don't use select() to perform waiting operations under DOS environment; always use a busy loop for waiting instead */ do_busy_waiting = TRUE; #endif @@ -437,6 +434,7 @@ void GetOptions(char *argv[]) options.network = FALSE; options.verbose = FALSE; options.debug = FALSE; + options.debug_command = NULL; while (*options_left) { @@ -474,19 +472,23 @@ void GetOptions(char *argv[]) Error(ERR_EXIT_HELP, "unrecognized option '%s'", option); else if (strncmp(option, "-help", option_len) == 0) { - printf("Usage: %s [options] [server.name [port]]\n" + printf("Usage: %s [options] [ []]\n" "Options:\n" " -d, --display [:] X server display\n" " -b, --basepath alternative base directory\n" " -l, --level alternative level directory\n" " -g, --graphics alternative graphics directory\n" - " -s, --sounds alternative graphics directory\n" - " -m, --music alternative graphics directory\n" + " -s, --sounds alternative sounds directory\n" + " -m, --music alternative music directory\n" " -n, --network network multiplayer game\n" " --serveronly only start network server\n" " -v, --verbose verbose mode\n" " --debug display debugging information\n", program.command_basename); + + if (options.debug) + printf(" --debug-command execute special command\n"); + exit(0); } else if (strncmp(option, "-display", option_len) == 0) @@ -565,6 +567,15 @@ void GetOptions(char *argv[]) { options.debug = TRUE; } + else if (strncmp(option, "-debug-command", option_len) == 0) + { + if (option_arg == NULL) + Error(ERR_EXIT_HELP, "option '%s' requires an argument", option_str); + + options.debug_command = option_arg; + if (option_arg == next_option) + options_left++; + } else if (*option == '-') { Error(ERR_EXIT_HELP, "unrecognized option '%s'", option_str);