allow specifying a fixed seed in the config file for generating the map (fixed_map_seed)
authorKahrl <kahrl@gmx.net>
Wed, 31 Aug 2011 09:24:50 +0000 (11:24 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Tue, 6 Sep 2011 14:05:17 +0000 (17:05 +0300)
src/defaultsettings.cpp
src/map.cpp

index 8438bf4f54db190adcbbcb64f33653c8009f6974..1e17f2f3ac36922abc2b6d0e2937a38e9d0ebd4a 100644 (file)
@@ -85,6 +85,7 @@ void set_default_settings()
        g_settings.setDefault("default_privs", "build, shout");
        g_settings.setDefault("profiler_print_interval", "0");
        g_settings.setDefault("enable_mapgen_debug_info", "false");
+       g_settings.setDefault("fixed_map_seed", "");
 
        g_settings.setDefault("objectdata_interval", "0.2");
        g_settings.setDefault("active_object_range", "2");
index 27a491428dc812f18a24d217d651498a80d724bb..4204c2a02ee88b055e018284188c5b6e96c7bb85 100644 (file)
@@ -1879,10 +1879,17 @@ ServerMap::ServerMap(std::string savedir):
 
        //m_chunksize = 8; // Takes a few seconds
 
-       m_seed = (((u64)(myrand()%0xffff)<<0)
-                       + ((u64)(myrand()%0xffff)<<16)
-                       + ((u64)(myrand()%0xffff)<<32)
-                       + ((u64)(myrand()%0xffff)<<48));
+       if (g_settings.get("fixed_map_seed").empty())
+       {
+               m_seed = (((u64)(myrand()%0xffff)<<0)
+                               + ((u64)(myrand()%0xffff)<<16)
+                               + ((u64)(myrand()%0xffff)<<32)
+                               + ((u64)(myrand()%0xffff)<<48));
+       }
+       else
+       {
+               m_seed = g_settings.getU64("fixed_map_seed");
+       }
 
        /*
                Experimental and debug stuff