aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkwolekr <mirrorisim@gmail.com>2012-10-28 23:41:48 -0400
committerPerttu Ahola <celeron55@gmail.com>2013-01-21 21:41:09 +0200
commit736b386554a6b385a34f40c0411c6e466ebec30a (patch)
treecef2c50109763c6060872c625e0494d1f47ddeb5
parenta785522194f98f2a0d7799c20dbfaaa55730870e (diff)
downloadminetest-736b386554a6b385a34f40c0411c6e466ebec30a.tar.gz
minetest-736b386554a6b385a34f40c0411c6e466ebec30a.tar.bz2
minetest-736b386554a6b385a34f40c0411c6e466ebec30a.zip
Make WATER_LEVEL configurable, fix slight comparison bug in findSpawnPos()
-rw-r--r--src/defaultsettings.cpp1
-rw-r--r--src/server.cpp6
2 files changed, 5 insertions, 2 deletions
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index db7df6edc..5a1b76b4a 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -163,6 +163,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("max_block_generate_distance", "7");
settings->setDefault("time_send_interval", "5");
settings->setDefault("time_speed", "72");
+ settings->setDefault("water_level", "1");
settings->setDefault("server_unload_unused_data_timeout", "29");
settings->setDefault("server_map_save_interval", "5.3");
settings->setDefault("full_block_send_enable_min_time_from_building", "2.0");
diff --git a/src/server.cpp b/src/server.cpp
index 853d0a486..a7767842d 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -4832,6 +4832,8 @@ v3f findSpawnPos(ServerMap &map)
#endif
#if 1
+ s16 water_level = g_settings->getS16("water_level");
+
// Try to find a good place a few times
for(s32 i=0; i<1000; i++)
{
@@ -4843,13 +4845,13 @@ v3f findSpawnPos(ServerMap &map)
// Get ground height at point (fallbacks to heightmap function)
s16 groundheight = map.findGroundLevel(nodepos2d);
// Don't go underwater
- if(groundheight < WATER_LEVEL)
+ if(groundheight <= water_level)
{
//infostream<<"-> Underwater"<<std::endl;
continue;
}
// Don't go to high places
- if(groundheight > WATER_LEVEL + 4)
+ if(groundheight > water_level + 6)
{
//infostream<<"-> Underwater"<<std::endl;
continue;