Mercurial > hg > openttd
changeset 9901:8f22efcc1dcc draft
(svn r14051) -Codechange: enumify the DrawString buffer length.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Tue, 12 Aug 2008 11:21:37 +0000 |
parents | 8ac644b5a2ef |
children | 98786b2f29f2 |
files | src/gfx.cpp src/gfx_func.h src/network/network_chat_gui.cpp |
diffstat | 3 files changed, 17 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -320,7 +320,7 @@ */ int DrawString(int x, int y, StringID str, uint16 color) { - char buffer[512]; + char buffer[DRAW_STRING_BUFFER]; GetString(buffer, str, lastof(buffer)); return DoDrawString(buffer, x, y, color); @@ -339,7 +339,7 @@ */ int DrawStringTruncated(int x, int y, StringID str, uint16 color, uint maxw) { - char buffer[512]; + char buffer[DRAW_STRING_BUFFER]; TruncateStringID(str, buffer, maxw, lastof(buffer)); return DoDrawString(buffer, x, y, color); } @@ -356,7 +356,7 @@ */ int DrawStringRightAligned(int x, int y, StringID str, uint16 color) { - char buffer[512]; + char buffer[DRAW_STRING_BUFFER]; int w; GetString(buffer, str, lastof(buffer)); @@ -377,7 +377,7 @@ */ void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw) { - char buffer[512]; + char buffer[DRAW_STRING_BUFFER]; TruncateStringID(str, buffer, maxw, lastof(buffer)); DoDrawString(buffer, x - GetStringBoundingBox(buffer).width, y, color); @@ -409,7 +409,7 @@ */ int DrawStringCentered(int x, int y, StringID str, uint16 color) { - char buffer[512]; + char buffer[DRAW_STRING_BUFFER]; int w; GetString(buffer, str, lastof(buffer)); @@ -433,7 +433,7 @@ */ int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, uint16 color) { - char buffer[512]; + char buffer[DRAW_STRING_BUFFER]; int w = TruncateStringID(str, buffer, xr - xl, lastof(buffer)); return DoDrawString(buffer, (xl + xr - w) / 2, y, color); } @@ -595,7 +595,7 @@ */ int GetStringHeight(StringID str, int maxw) { - char buffer[512]; + char buffer[DRAW_STRING_BUFFER]; GetString(buffer, str, lastof(buffer)); @@ -612,7 +612,7 @@ * @param maxw Maximum width the string can have before it is wrapped */ void DrawStringMultiCenter(int x, int y, StringID str, int maxw) { - char buffer[512]; + char buffer[DRAW_STRING_BUFFER]; uint32 tmp; int num, w, mt; const char *src; @@ -655,7 +655,7 @@ uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh) { - char buffer[512]; + char buffer[DRAW_STRING_BUFFER]; uint32 tmp; int num, mt; uint total_height; @@ -878,7 +878,7 @@ */ int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw) { - char buffer[512]; + char buffer[DRAW_STRING_BUFFER]; ttd_strlcpy(buffer, str, sizeof(buffer)); TruncateString(buffer, maxw); return DoDrawString(buffer, x, y, color);
--- a/src/gfx_func.h +++ b/src/gfx_func.h @@ -75,6 +75,11 @@ void GameSizeChanged(); void UndrawMouseCursor(); +enum { + /* Size of the buffer used for drawing strings. */ + DRAW_STRING_BUFFER = 1024, +}; + void RedrawScreenRect(int left, int top, int right, int bottom); void GfxScroll(int left, int top, int width, int height, int xo, int yo);