Mercurial > hg > openttd
changeset 6197:0abad04ce18e draft
(svn r8977) -Codechange: Remove the hardcoded maximum width for some drawstrings and replace them with a portion of w->width. Only visible improvement is QueryWndProc which will not write exactly to the edge of the window anymore.
author | Darkvater <Darkvater@openttd.org> |
---|---|
date | Fri, 02 Mar 2007 17:54:52 +0000 |
parents | a68986f10bb5 |
children | a2cdd211d091 |
files | src/misc_gui.cpp src/news_gui.cpp |
diffstat | 2 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -61,7 +61,7 @@ DoDrawStringCentered(140, 38, _landinfo_data[2], 0); DoDrawStringCentered(140, 49, _landinfo_data[3], 0); DoDrawStringCentered(140, 60, _landinfo_data[4], 0); - if (_landinfo_data[5][0] != '\0') DrawStringMultiCenter(140, 76, BindCString(_landinfo_data[5]), 276); + if (_landinfo_data[5][0] != '\0') DrawStringMultiCenter(140, 76, BindCString(_landinfo_data[5]), w->width - 4); if (_landinfo_data[6][0] != '\0') DoDrawStringCentered(140, 71, _landinfo_data[6], 0); } } @@ -505,13 +505,13 @@ 120, (_errmsg_message_1 == INVALID_STRING_ID ? 25 : 15), _errmsg_message_2, - 238); + w->width - 2); if (_errmsg_message_1 != INVALID_STRING_ID) DrawStringMultiCenter( 120, 30, _errmsg_message_1, - 238); + w->width - 2); } else { const Player *p = GetPlayer((PlayerID)GetDParamX(_errmsg_decode_params,2)); DrawPlayerFace(p->face, p->player_color, 2, 16); @@ -520,13 +520,13 @@ 214, (_errmsg_message_1 == INVALID_STRING_ID ? 65 : 45), _errmsg_message_2, - 238); + w->width - 2); if (_errmsg_message_1 != INVALID_STRING_ID) DrawStringMultiCenter( 214, 90, _errmsg_message_1, - 238); + w->width - 2); } break; @@ -657,7 +657,7 @@ for (arg = 0; arg < WP(w, tooltips_d).paramcount; arg++) { SetDParam(arg, WP(w, tooltips_d).params[arg]); } - DrawStringMultiCenter((w->width >> 1), (w->height >> 1) - 5, WP(w, tooltips_d).string_id, 197); + DrawStringMultiCenter((w->width >> 1), (w->height >> 1) - 5, WP(w, tooltips_d).string_id, w->width - 2); break; } @@ -1210,7 +1210,7 @@ DrawWindowWidgets(w); COPY_IN_DPARAM(0, q->params, lengthof(q->params)); - DrawStringMultiCenter(w->width / 2, (w->height / 2) - 10, q->message, w->width); + DrawStringMultiCenter(w->width / 2, (w->height / 2) - 10, q->message, w->width - 2); break; case WE_CLICK: @@ -1800,7 +1800,7 @@ DrawWindowWidgets(w); - DrawStringMultiCenter(200, 25, STR_CHEATS_WARNING, 350); + DrawStringMultiCenter(200, 25, STR_CHEATS_WARNING, w->width - 50); x = 0; y = 45;
--- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -135,7 +135,7 @@ if (!(ni->flags & NF_VIEWPORT)) { COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56, - ni->string_id, 426); + ni->string_id, w->width - 4); } else { byte bk = _display_opt; _display_opt &= ~DO_TRANS_BUILDINGS; @@ -150,7 +150,7 @@ ); COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); - DrawStringMultiCenter(w->width / 2, 20, ni->string_id, 428); + DrawStringMultiCenter(w->width / 2, 20, ni->string_id, w->width - 4); } break; } @@ -168,7 +168,7 @@ } else { DrawWindowViewport(w); COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); - DrawStringMultiCenter(w->width / 2, w->height - 16, ni->string_id, 276); + DrawStringMultiCenter(w->width / 2, w->height - 16, ni->string_id, w->width - 4); } break; }