mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(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.
This commit is contained in:
parent
991fbeaefa
commit
0961e1bc56
@ -61,7 +61,7 @@ static void LandInfoWndProc(Window *w, WindowEvent *e)
|
|||||||
DoDrawStringCentered(140, 38, _landinfo_data[2], 0);
|
DoDrawStringCentered(140, 38, _landinfo_data[2], 0);
|
||||||
DoDrawStringCentered(140, 49, _landinfo_data[3], 0);
|
DoDrawStringCentered(140, 49, _landinfo_data[3], 0);
|
||||||
DoDrawStringCentered(140, 60, _landinfo_data[4], 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);
|
if (_landinfo_data[6][0] != '\0') DoDrawStringCentered(140, 71, _landinfo_data[6], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -505,13 +505,13 @@ static void ErrmsgWndProc(Window *w, WindowEvent *e)
|
|||||||
120,
|
120,
|
||||||
(_errmsg_message_1 == INVALID_STRING_ID ? 25 : 15),
|
(_errmsg_message_1 == INVALID_STRING_ID ? 25 : 15),
|
||||||
_errmsg_message_2,
|
_errmsg_message_2,
|
||||||
238);
|
w->width - 2);
|
||||||
if (_errmsg_message_1 != INVALID_STRING_ID)
|
if (_errmsg_message_1 != INVALID_STRING_ID)
|
||||||
DrawStringMultiCenter(
|
DrawStringMultiCenter(
|
||||||
120,
|
120,
|
||||||
30,
|
30,
|
||||||
_errmsg_message_1,
|
_errmsg_message_1,
|
||||||
238);
|
w->width - 2);
|
||||||
} else {
|
} else {
|
||||||
const Player *p = GetPlayer((PlayerID)GetDParamX(_errmsg_decode_params,2));
|
const Player *p = GetPlayer((PlayerID)GetDParamX(_errmsg_decode_params,2));
|
||||||
DrawPlayerFace(p->face, p->player_color, 2, 16);
|
DrawPlayerFace(p->face, p->player_color, 2, 16);
|
||||||
@ -520,13 +520,13 @@ static void ErrmsgWndProc(Window *w, WindowEvent *e)
|
|||||||
214,
|
214,
|
||||||
(_errmsg_message_1 == INVALID_STRING_ID ? 65 : 45),
|
(_errmsg_message_1 == INVALID_STRING_ID ? 65 : 45),
|
||||||
_errmsg_message_2,
|
_errmsg_message_2,
|
||||||
238);
|
w->width - 2);
|
||||||
if (_errmsg_message_1 != INVALID_STRING_ID)
|
if (_errmsg_message_1 != INVALID_STRING_ID)
|
||||||
DrawStringMultiCenter(
|
DrawStringMultiCenter(
|
||||||
214,
|
214,
|
||||||
90,
|
90,
|
||||||
_errmsg_message_1,
|
_errmsg_message_1,
|
||||||
238);
|
w->width - 2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -657,7 +657,7 @@ static void TooltipsWndProc(Window *w, WindowEvent *e)
|
|||||||
for (arg = 0; arg < WP(w, tooltips_d).paramcount; arg++) {
|
for (arg = 0; arg < WP(w, tooltips_d).paramcount; arg++) {
|
||||||
SetDParam(arg, WP(w, tooltips_d).params[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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1210,7 +1210,7 @@ static void QueryWndProc(Window *w, WindowEvent *e)
|
|||||||
DrawWindowWidgets(w);
|
DrawWindowWidgets(w);
|
||||||
COPY_IN_DPARAM(0, q->params, lengthof(q->params));
|
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;
|
break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
@ -1800,7 +1800,7 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
|
|||||||
|
|
||||||
DrawWindowWidgets(w);
|
DrawWindowWidgets(w);
|
||||||
|
|
||||||
DrawStringMultiCenter(200, 25, STR_CHEATS_WARNING, 350);
|
DrawStringMultiCenter(200, 25, STR_CHEATS_WARNING, w->width - 50);
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 45;
|
y = 45;
|
||||||
|
@ -135,7 +135,7 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
|
|||||||
if (!(ni->flags & NF_VIEWPORT)) {
|
if (!(ni->flags & NF_VIEWPORT)) {
|
||||||
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params));
|
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params));
|
||||||
DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56,
|
DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56,
|
||||||
ni->string_id, 426);
|
ni->string_id, w->width - 4);
|
||||||
} else {
|
} else {
|
||||||
byte bk = _display_opt;
|
byte bk = _display_opt;
|
||||||
_display_opt &= ~DO_TRANS_BUILDINGS;
|
_display_opt &= ~DO_TRANS_BUILDINGS;
|
||||||
@ -150,7 +150,7 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
|
|||||||
);
|
);
|
||||||
|
|
||||||
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params));
|
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;
|
break;
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
|
|||||||
} else {
|
} else {
|
||||||
DrawWindowViewport(w);
|
DrawWindowViewport(w);
|
||||||
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params));
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user