diff options
author | Perttu Ahola <celeron55@gmail.com> | 2010-12-22 17:58:02 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2010-12-22 17:58:02 +0200 |
commit | 58ccc68c81b62e3826a7367c38871324ce1eab86 (patch) | |
tree | 11645247bf3557692514f1fa46cfa6c8fa5b4065 /src | |
parent | 3de176cc587c4e0601c3c3f5a049e30db6bd2c17 (diff) | |
download | minetest-58ccc68c81b62e3826a7367c38871324ce1eab86.tar.gz minetest-58ccc68c81b62e3826a7367c38871324ce1eab86.tar.bz2 minetest-58ccc68c81b62e3826a7367c38871324ce1eab86.zip |
server starting on port 0 on invalid settings
Diffstat (limited to 'src')
-rw-r--r-- | src/defaultsettings.cpp | 2 | ||||
-rw-r--r-- | src/map.cpp | 27 | ||||
-rw-r--r-- | src/mapnode.h | 9 | ||||
-rw-r--r-- | src/server.cpp | 2 | ||||
-rw-r--r-- | src/servermain.cpp | 4 |
5 files changed, 34 insertions, 10 deletions
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; i<underground_level*1; i++) { if(rand()%2 == 0) @@ -1978,9 +1982,16 @@ MapBlock * ServerMap::emergeBlock( } } - if(rand()%3 == 0) + /* + Add coal + */ + u16 coal_amount = 30.0 * g_settings.getFloat("coal_amount"); + u16 coal_rareness = 60 / coal_amount; + if(coal_rareness == 0) + coal_rareness = 1; + if(rand()%coal_rareness == 0) { - for(s16 i=0; i<20; i++) + for(s16 i=0; i<coal_amount; i++) { v3s16 cp( (rand()%(MAP_BLOCKSIZE-2))+1, @@ -2157,22 +2168,26 @@ MapBlock * ServerMap::emergeBlock( <<std::endl;*/ { v3s16 p2 = p + v3s16(x,y,z-2); - 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); } { 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"); } |