summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2006-08-30 12:37:04 +0000
committerrubidium <rubidium@openttd.org>2006-08-30 12:37:04 +0000
commit0c13657e3ae874f31df5ad897ee8e38e7589fa59 (patch)
treede99227998ab2659f86dc851ea9c1184cd9fa8a6
parent484495d817d994b0378077a55eb60529d2ff5ee2 (diff)
downloadopenttd-0c13657e3ae874f31df5ad897ee8e38e7589fa59.tar.xz
(svn r6236) -Fix (FS#313): TGP generation seed edit box only accepted seeds up to 2^31-1, instead of up to 2^32-2.
-rw-r--r--genworld_gui.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/genworld_gui.c b/genworld_gui.c
index 92f1b680e..2a3870c51 100644
--- a/genworld_gui.c
+++ b/genworld_gui.c
@@ -420,7 +420,12 @@ void GenerateLandscapeWndProc(Window *w, WindowEvent *e)
case WE_KEYPRESS:
HandleEditBoxKey(w, &WP(w, querystr_d), SEED_EDIT, e, CS_NUMERAL);
- _patches_newgame.generation_seed = atoi(_edit_str_buf);
+ /* the seed is unsigned, therefore atoi cannot be used.
+ * As 2^32 - 1 (MAX_UVALUE(uint32)) is a 'magic' value
+ * (use random seed) it should not be possible to be
+ * entered into the input field; the generate seed
+ * button can be used instead. */
+ _patches_newgame.generation_seed = minu(strtoul(_edit_str_buf, NULL, 10), MAX_UVALUE(uint32) - 1);
break;
case WE_DROPDOWN_SELECT: