X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=cl_screen.c;h=4768f4b7d6b46c55c4b9491b14e1395ef50c33d9;hb=bba5486f1a7a3d9942fc6632b662003e300e7309;hp=4d0d7709f19ba99dc12684399f251e6eff86ee28;hpb=3ae5a27bc289ce5c7be2955c2865239317db0295;p=xonotic%2Fdarkplaces.git diff --git a/cl_screen.c b/cl_screen.c index 4d0d7709..4768f4b7 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -106,7 +106,6 @@ void SCR_CenterPrint(char *str) void SCR_DrawCenterString (void) { char *start; - int l; int x, y; int remaining; int color; @@ -132,17 +131,10 @@ void SCR_DrawCenterString (void) do { // scan the number of characters on the line, not counting color codes - int chars = 0; - for (l=0 ; l= '0' && start[l+1] <= '9')) - l++; - else - chars++; - } + char *newline = strchr(start, '\n'); + int l = newline ? (newline - start) : (int)strlen(start); + int chars = COM_StringLengthNoColors(start, l, NULL); + x = (vid_conwidth.integer - chars*8)/2; if (l > 0) { @@ -153,15 +145,11 @@ void SCR_DrawCenterString (void) if (remaining <= 0) return; } - y += 8; - while (*start && *start != '\n') - start++; - - if (!*start) + if (!newline) break; - start++; // skip the \n + start = newline + 1; // skip the \n } while (1); }