--- deliantra/server/random_maps/random_map.C 2010/07/04 22:12:26 1.71 +++ deliantra/server/random_maps/random_map.C 2012/10/29 23:55:54 1.82 @@ -1,31 +1,31 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. - * - * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * + * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2001 Mark Wedel & Crossfire Development Team * Copyright (©) 1992 Frank Tore Johansen - * + * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the Affero GNU General Public License * and the GNU General Public License along with this program. If not, see * . - * + * * The authors can be reached via e-mail to */ #include #include #include -#include +#include #include #include @@ -62,7 +62,6 @@ xsize = get_iv ("xsize"); ysize = get_iv ("ysize"); - expand2x = get_iv ("expand2x"); layoutoptions1 = get_iv ("layoutoptions1"); layoutoptions2 = get_iv ("layoutoptions2"); layoutoptions3 = get_iv ("layoutoptions3"); @@ -71,7 +70,6 @@ difficulty_increase = get_nv ("difficulty_increase"); dungeon_level = get_iv ("dungeon_level"); dungeon_depth = get_iv ("dungeon_depth"); - random_seed = get_uv ("random_seed"); total_map_hp = get_nv ("total_map_hp"); // actually val64, but I am too lazy symmetry_used = get_iv ("symmetry_used"); } @@ -90,7 +88,6 @@ set ("layoutoptions2" , layoutoptions2); set ("layoutoptions3" , layoutoptions3); set ("dungeon_depth" , dungeon_depth); - set ("random_seed" , (UV)random_seed); set ("difficulty" , difficulty && difficulty_given ? difficulty : 0); set ("difficulty_increase", difficulty_increase); set ("dungeon_level" , dungeon_level); @@ -114,7 +111,7 @@ } noinline SV * -random_map_params::get_sv (const char *option) const +random_map_params::opt_sv (const char *option) const { SV **he = hv_fetch (hv, option, strlen (option), 0); @@ -124,28 +121,28 @@ noinline const_utf8_string random_map_params::get_str (const char *option, const_utf8_string fallback) const { - SV *sv = get_sv (option); + SV *sv = opt_sv (option); return sv ? cfSvPVutf8_nolen (sv) : fallback; } noinline IV random_map_params::get_iv (const char *option, IV fallback) const { - SV *sv = get_sv (option); + SV *sv = opt_sv (option); return sv ? SvIV (sv) : fallback; } noinline UV random_map_params::get_uv (const char *option, UV fallback) const { - SV *sv = get_sv (option); + SV *sv = opt_sv (option); return sv ? SvUV (sv) : fallback; } noinline NV random_map_params::get_nv (const char *option, NV fallback) const { - SV *sv = get_sv (option); + SV *sv = opt_sv (option); return sv ? SvNV (sv) : fallback; } @@ -192,14 +189,16 @@ max_it (RP->dungeon_level, 1); + IV expand2x = RP->get_iv ("expand2x"); + UV random_seed = RP->get_uv ("random_seed"); + /* pick a random seed, or use the one from the input file */ - RP->random_seed = RP->random_seed - ? RP->random_seed + RP->dungeon_level - : pticks; + random_seed = random_seed + ? random_seed + RP->dungeon_level + : server_tick; // we run "single-threaded" - rmg_rndm.seed (RP->random_seed); - rmg_rndm.seed (RP->random_seed + pticks);//D + rmg_rndm.seed (random_seed); shstr buf = RP->as_shstr (); @@ -238,7 +237,7 @@ if (RP->symmetry_used == SYMMETRY_X || RP->symmetry_used == SYMMETRY_XY) RP->Xsize = RP->Xsize / 2 + 1; - if (RP->expand2x > 0) + if (expand2x) { RP->Xsize /= 2; RP->Ysize /= 2; @@ -275,7 +274,7 @@ maze.symmetrize (RP->symmetry_used); - if (RP->expand2x) + if (expand2x) maze.expand2x (); #if 0 @@ -345,7 +344,7 @@ CEDE; - const char *decorstyle = RP->get_str ("treasurestyle", ""); + const char *decorstyle = RP->get_str ("decorstyle", ""); /* create decor unless the decorstyle is "none" */ if (strcmp (decorstyle, "none")) @@ -361,7 +360,7 @@ unblock_exits (this, maze); msg = buf; - in_memory = MAP_ACTIVE; + state = MAP_INACTIVE; // this is probably a lie, but currently works with ext/map-random.ext CEDE;