1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-13 01:29:10 +00:00

(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.

This commit is contained in:
celestar
2006-04-19 16:02:07 +00:00
parent 0c889ec8c6
commit 1b1e519b76

View File

@@ -1759,6 +1759,7 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
} break; } break;
default: { default: {
int32 val = (int32)ReadValue(ce->variable, ce->type); int32 val = (int32)ReadValue(ce->variable, ce->type);
char buf[512];
/* Draw [<][>] boxes for settings of an integer-type */ /* Draw [<][>] boxes for settings of an integer-type */
DrawArrowButtons(x + 20, y, 3, clk - (i * 2), true); 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 */ /* Draw colored flag for change player cheat */
case STR_CHEAT_CHANGE_PLAYER: case STR_CHEAT_CHANGE_PLAYER:
SetDParam(0, val); SetDParam(0, val);
DrawPlayerIcon(_current_player, 156, y + 2); GetString(buf, STR_CHEAT_CHANGE_PLAYER);
DrawPlayerIcon(_current_player, 60 + GetStringWidth(buf), y + 2);
break; break;
/* Set correct string for switch climate cheat */ /* Set correct string for switch climate cheat */
case STR_CHEAT_SWITCH_CLIMATE: val += STR_TEMPERATE_LANDSCAPE; case STR_CHEAT_SWITCH_CLIMATE: val += STR_TEMPERATE_LANDSCAPE;