summaryrefslogtreecommitdiff
path: root/misc_gui.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-04-19 16:02:07 +0000
committercelestar <celestar@openttd.org>2006-04-19 16:02:07 +0000
commitffc04f0889bc73a8d7bad43356395973151c6540 (patch)
treed04202897bcd53e127aba5b2fcfa8d602c7d7219 /misc_gui.c
parent1f2a41bc9b28b906286ef52c4bac8ac31e596d1d (diff)
downloadopenttd-ffc04f0889bc73a8d7bad43356395973151c6540.tar.xz
(svn r4478) -Fix (FS#107) In the cheat menu, don't hard-code the player icon, but compute its position from the length of the string.
Diffstat (limited to 'misc_gui.c')
-rw-r--r--misc_gui.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/misc_gui.c b/misc_gui.c
index 3f4e8161a..c39cfb067 100644
--- a/misc_gui.c
+++ b/misc_gui.c
@@ -1759,6 +1759,7 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
} break;
default: {
int32 val = (int32)ReadValue(ce->variable, ce->type);
+ char buf[512];
/* Draw [<][>] boxes for settings of an integer-type */
DrawArrowButtons(x + 20, y, 3, clk - (i * 2), true);
@@ -1769,7 +1770,8 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
/* Draw colored flag for change player cheat */
case STR_CHEAT_CHANGE_PLAYER:
SetDParam(0, val);
- DrawPlayerIcon(_current_player, 156, y + 2);
+ GetString(buf, STR_CHEAT_CHANGE_PLAYER);
+ DrawPlayerIcon(_current_player, 60 + GetStringWidth(buf), y + 2);
break;
/* Set correct string for switch climate cheat */
case STR_CHEAT_SWITCH_CLIMATE: val += STR_TEMPERATE_LANDSCAPE;