X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fmisc.c;h=b344ba6f2a9e65365ea36b4fe7c14359b13c9aeb;hb=7891415ca10eb882506eaaa3bca720ec75723a0e;hp=4f201d97fd015712dafd2cd555fe8a03edd44623;hpb=1101077a226b09854650662759bf12caf7c84f8d;p=rocksndiamonds.git diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 4f201d97..b344ba6f 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); @@ -1195,6 +1206,17 @@ boolean FileIsMusic(char *basename) return FALSE; } +boolean FileIsArtworkType(char *basename, int type) +{ + if ((type == TREE_TYPE_GRAPHICS_DIR && FileIsGraphic(basename)) || + (type == TREE_TYPE_SOUNDS_DIR && FileIsSound(basename)) || + (type == TREE_TYPE_MUSIC_DIR && FileIsMusic(basename))) + return TRUE; + + return FALSE; +} + + /* ========================================================================= */ /* functions only needed for non-Unix (non-command-line) systems */ /* ========================================================================= */