From 58ccc68c81b62e3826a7367c38871324ce1eab86 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Wed, 22 Dec 2010 17:58:02 +0200 Subject: server starting on port 0 on invalid settings --- minetest.conf.example | 1 + src/defaultsettings.cpp | 2 ++ src/map.cpp | 27 +++++++++++++++++++++------ src/mapnode.h | 9 ++++++++- src/server.cpp | 2 +- src/servermain.cpp | 4 ++-- 6 files changed, 35 insertions(+), 10 deletions(-) diff --git a/minetest.conf.example b/minetest.conf.example index 3e9f49b0e..30716cf7d 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -42,6 +42,7 @@ #height_base = linear 0 0 0 #plants_amount = 1.0 #ravines_amount = 1.0 +#coal_amount = 1.0 # Set to true to enable creative mode (unlimited inventory) #creative_mode = false diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 065ff2e44..0b8d9e924 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -46,6 +46,8 @@ void set_default_settings() g_settings.setDefault("height_base", "linear 0 0 0"); g_settings.setDefault("plants_amount", "1.0"); g_settings.setDefault("ravines_amount", "1.0"); + g_settings.setDefault("coal_amount", "1.0"); + g_settings.setDefault("objectdata_interval", "0.2"); g_settings.setDefault("active_object_range", "2"); g_settings.setDefault("max_simultaneous_block_sends_per_client", "1"); diff --git a/src/map.cpp b/src/map.cpp index 700312fb2..acaf8436a 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1950,6 +1950,10 @@ MapBlock * ServerMap::emergeBlock( if(some_part_underground) { s16 underground_level = (lowest_ground_y/MAP_BLOCKSIZE - block_y)+1; + + /* + Add meseblocks + */ for(s16 i=0; igetNode(p2).d)) + if(is_ground_content(sector->getNode(p2).d) + && !is_mineral(sector->getNode(p2).d)) sector->setNode(p2, n); } { v3s16 p2 = p + v3s16(x,y,z-1); - if(is_ground_content(sector->getNode(p2).d)) + if(is_ground_content(sector->getNode(p2).d) + && !is_mineral(sector->getNode(p2).d)) sector->setNode(p2, n2); } { v3s16 p2 = p + v3s16(x,y,z+0); - if(is_ground_content(sector->getNode(p2).d)) + if(is_ground_content(sector->getNode(p2).d) + && !is_mineral(sector->getNode(p2).d)) sector->setNode(p2, n2); } { v3s16 p2 = p + v3s16(x,y,z+1); - if(is_ground_content(sector->getNode(p2).d)) + if(is_ground_content(sector->getNode(p2).d) + && !is_mineral(sector->getNode(p2).d)) sector->setNode(p2, n); } diff --git a/src/mapnode.h b/src/mapnode.h index 20634bf76..ad85d88e8 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -158,10 +158,17 @@ inline bool is_ground_content(u8 m) m == CONTENT_GRASS || m == CONTENT_GRASS_FOOTSTEPS || m == CONTENT_MESE || - m == CONTENT_MUD + m == CONTENT_MUD || + m == CONTENT_COALSTONE ); } +inline bool is_mineral(u8 c) +{ + return(c == CONTENT_MESE + || c == CONTENT_COALSTONE); +} + /*inline bool content_has_faces(u8 c) { return (m != CONTENT_IGNORE diff --git a/src/server.cpp b/src/server.cpp index ddef11ae4..f99aefb88 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -927,7 +927,7 @@ Server::Server( m_con(PROTOCOL_ID, 512, CONNECTION_TIMEOUT, this), m_thread(this), m_emergethread(this), - m_time_of_day(12000), + m_time_of_day(8000), m_time_counter(0), m_time_of_day_send_timer(0) { diff --git a/src/servermain.cpp b/src/servermain.cpp index 0c2faa7ec..24d3b24e8 100644 --- a/src/servermain.cpp +++ b/src/servermain.cpp @@ -277,11 +277,11 @@ int main(int argc, char *argv[]) // Port? u16 port = 30000; - if(cmd_args.exists("port")) + if(cmd_args.exists("port") && cmd_args.getU16("port") != 0) { port = cmd_args.getU16("port"); } - else if(g_settings.exists("port")) + else if(g_settings.exists("port") && g_settings.getU16("port") != 0) { port = g_settings.getU16("port"); } -- cgit v1.2.3