# HG changeset patch # User rubidium # Date 1156941424 0 # Node ID 8a1a34a58821cbc8e73eefb35ae8da0c934bb412 # Parent 97bd0009311b5dd22dbfc36b19240699a05a5c89 (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. diff --git a/genworld_gui.c b/genworld_gui.c --- a/genworld_gui.c +++ b/genworld_gui.c @@ -420,7 +420,12 @@ 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: