(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.
authorcelestar
Wed, 19 Apr 2006 16:02:07 +0000
changeset 3589 9d646fb01e17
parent 3588 69817310ddf8
child 3590 215fc77ee7c6
(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.
misc_gui.c
--- a/misc_gui.c	Wed Apr 19 07:50:16 2006 +0000
+++ b/misc_gui.c	Wed Apr 19 16:02:07 2006 +0000
@@ -1759,6 +1759,7 @@
 			} 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 @@
 				/* 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;