X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=console.c;h=9856e8e3bf307bd482c6f3486447773e75991b26;hb=f8310c7ac538900f83222787acc7971d113f79b7;hp=ccdd38da2f1554dff9e64e798071eb25a75a459c;hpb=5e61ba1b0bf8387dc28a22dce5e236a558c140b3;p=xonotic%2Fdarkplaces.git diff --git a/console.c b/console.c index ccdd38da..9856e8e3 100644 --- a/console.c +++ b/console.c @@ -126,8 +126,10 @@ ConBuffer_Shutdown void ConBuffer_Shutdown(conbuffer_t *buf) { buf->active = false; - Mem_Free(buf->text); - Mem_Free(buf->lines); + if (buf->text) + Mem_Free(buf->text); + if (buf->lines) + Mem_Free(buf->lines); buf->text = NULL; buf->lines = NULL; } @@ -1048,8 +1050,6 @@ void Con_MaskPrint(int additionalmask, const char *msg) for (;*msg;msg++) { Con_Rcon_AddChar(*msg); - if (index == 0) - mask |= additionalmask; // if this is the beginning of a new line, print timestamp if (index == 0) { @@ -1094,6 +1094,8 @@ void Con_MaskPrint(int additionalmask, const char *msg) for (;*timestamp;index++, timestamp++) if (index < (int)sizeof(line) - 2) line[index] = *timestamp; + // add the mask + mask |= additionalmask; } // append the character line[index++] = *msg; @@ -1108,16 +1110,29 @@ void Con_MaskPrint(int additionalmask, const char *msg) if (con_initialized && cls.state != ca_dedicated) { Con_PrintToHistory(line, mask); - mask = 0; } // send to terminal or dedicated server window if (!sys_nostdout) + if (developer.integer || !(mask & CON_MASK_DEVELOPER)) { - unsigned char *p; if(sys_specialcharactertranslation.integer) { - for (p = (unsigned char *) line;*p; p++) - *p = qfont_table[*p]; + char *p; + const char *q; + p = line; + while(*p) + { + int ch = u8_getchar(p, &q); + if(ch >= 0xE000 && ch <= 0xE0FF) + { + *p = qfont_table[ch - 0xE000]; + if(q > p+1) + memmove(p+1, q, strlen(q)+1); + p = p + 1; + } + else + p = p + (q - p); + } } if(sys_colortranslation.integer == 1) // ANSI @@ -1295,6 +1310,7 @@ void Con_MaskPrint(int additionalmask, const char *msg) } // empty the line buffer index = 0; + mask = 0; } } }