X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fmisc.c;h=c5067fb9b8e78a3aa0e1e162b4a284d536f21e61;hb=a99a1803e5097bc598b4c6f73259715da148ab27;hp=e3983f6d8e98b43b7e93414e6cf2800015f5c581;hpb=e702d1812014b83e4a41c91c2d6a57f2b2f48e39;p=rocksndiamonds.git diff --git a/src/libgame/misc.c b/src/libgame/misc.c index e3983f6d..c5067fb9 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -340,6 +340,9 @@ void Debug(char *mode, char *format, ...) { va_list ap; + if (!options.debug) + return; + // if optional debug mode specified, limit debug output accordingly if (options.debug_mode != NULL && !strEqual(options.debug_mode, mode)) @@ -571,10 +574,15 @@ void SkipUntilDelayReached(unsigned int *counter_var, unsigned int delay, #if 0 #if DEBUG - printf("::: %d: %d ms", *loop_var, delay); if (skip_frames) - printf(" -> SKIP %d FRAME(S) [%d ms]", skip_frames, skip_frames * delay); - printf("\n"); + Debug("internal:SkipUntilDelayReached", + "%d: %d ms -> SKIP %d FRAME(S) [%d ms]", + *loop_var, delay, + skip_frames, skip_frames * delay); + else + Debug("internal:SkipUntilDelayReached", + "%d: %d ms", + *loop_var, delay); #endif #endif @@ -2247,12 +2255,12 @@ static void dumpList(ListNode *node_first) while (node) { - printf("['%s' (%d)]\n", node->key, - ((struct ListNodeInfo *)node->content)->num_references); + Debug("internal:dumpList", "['%s' (%d)]", node->key, + ((struct ListNodeInfo *)node->content)->num_references); node = node->next; } - printf("[%d nodes]\n", getNumNodes(node_first)); + Debug("internal:dumpList", "[%d nodes]", getNumNodes(node_first)); } #endif @@ -3853,12 +3861,12 @@ void debug_print_timestamp(int counter_nr, char *message) counter[counter_nr][1] = counter[counter_nr][0]; if (message) - Error(ERR_DEBUG, "%s%s%s %.3f %s", - debug_print_timestamp_get_padding(counter_nr * indent_size), - message, - debug_print_timestamp_get_padding(padding_size - strlen(message)), - timestamp_interval / 1000, - unit); + Debug("time", "%s%s%s %.3f %s", + debug_print_timestamp_get_padding(counter_nr * indent_size), + message, + debug_print_timestamp_get_padding(padding_size - strlen(message)), + timestamp_interval / 1000, + unit); } #if 0