X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fmisc.c;h=7863159bf22ca434afb0952cc7b4bb0e9962b2e2;hb=9d23eac9de03f91cf0ac094786ab30cdd589ac49;hp=a09bc20e53f8ea90e4116013054e8005fd106521;hpb=52cd236064fb831a25881e6288762e96c67f985c;p=rocksndiamonds.git diff --git a/src/libgame/misc.c b/src/libgame/misc.c index a09bc20e..7863159b 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -363,6 +363,38 @@ static void Log(int log_level, char *mode, char *format, ...) va_end(ap); } +void DebugContinued(char *mode, char *format, ...) +{ + static char message[MAX_LINE_LEN] = { 0 }; + + // initialize message (optional) + if (strEqual(format, "")) + { + message[0] = '\0'; + + return; + } + + char *message_ptr = message + strlen(message); + int size_left = MAX_LINE_LEN - strlen(message); + va_list ap; + + // append message + va_start(ap, format); + vsnprintf(message_ptr, size_left, format, ap); + va_end(ap); + + // finalize message + if (strSuffix(format, "\n")) + { + message[strlen(message) - 1] = '\0'; + + Debug(mode, message); + + message[0] = '\0'; + } +} + void Debug(char *mode, char *format, ...) { va_list ap; @@ -3753,7 +3785,7 @@ void NotifyUserAboutErrorFile(void) #if DEBUG -#define DEBUG_PRINT_INIT_TIMESTAMPS FALSE +#define DEBUG_PRINT_INIT_TIMESTAMPS TRUE #define DEBUG_PRINT_INIT_TIMESTAMPS_DEPTH 10 #define DEBUG_NUM_TIMESTAMPS 10 @@ -3821,7 +3853,7 @@ void debug_print_timestamp(int counter_nr, char *message) counter[counter_nr][1] = counter[counter_nr][0]; if (message) - Debug("time", "%s%s%s %.3f %s", + Debug("time:init", "%s%s%s %.3f %s", debug_print_timestamp_get_padding(counter_nr * indent_size), message, debug_print_timestamp_get_padding(padding_size - strlen(message)),