From 3d6e71a7d0d100e4d59464adcf8f0a09e6a20ad8 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 1 Feb 2011 20:28:21 +0200 Subject: [PATCH] end-of-day. --- src/map.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++++------ src/server.cpp | 21 +++++++++++++++++-- 2 files changed, 68 insertions(+), 8 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index a6269426..84658130 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1914,7 +1914,8 @@ ServerMap::ServerMap(std::string savedir, HMParams hmp, MapParams mp): // Add only one entry list_baseheight->addPoint(v3s16(0,0,0), Attribute(0)); - list_randmax->addPoint(v3s16(0,0,0), Attribute(30)); + list_randmax->addPoint(v3s16(0,0,0), Attribute(22)); + //list_randmax->addPoint(v3s16(0,0,0), Attribute(0)); list_randfactor->addPoint(v3s16(0,0,0), Attribute(0.45)); // Easy spawn point @@ -2304,6 +2305,22 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos, }//timer1 + /* + Randomize some parameters + */ + + // 0-100 + // Usually little, sometimes huge + //u32 stone_obstacle_amount = myrand_range(0, myrand_range(0, 100)); + u32 stone_obstacle_amount = myrand_range(0, 100); + + /* + Loop this part, it will make stuff look older and newer nicely + */ + + for(u32 i_age=0; i_age<2; i_age++) + { // Aging loop + // This is set during the next operation. // Maximum height of the stone surface and obstacles. // This is used to disable dungeon generation from going too high. @@ -2316,11 +2333,14 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos, /* Add some random stone obstacles */ - - for(u32 ri=0; ri<15; ri++) + + for(u32 ri=0; rid == CONTENT_GRASS) + n->d = CONTENT_MUD; + } + /* Add mud on ground */ @@ -2779,9 +2815,12 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos, // If not mud, do nothing to it MapNode *n = &vmanip.m_data[i]; - if(n->d != CONTENT_MUD) + if(n->d != CONTENT_MUD && n->d != CONTENT_GRASS) continue; + // Make it exactly mud + n->d = CONTENT_MUD; + v3s16 dirs4[4] = { v3s16(0,0,1), // back v3s16(1,0,0), // right @@ -2923,6 +2962,9 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos, } }//timer1 + + } // Aging loop + { // 1ms @cs=8 //TimeTaker timer1("plant trees"); @@ -2951,6 +2993,7 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos, } }//timer1 + { // 19ms @cs=8 //TimeTaker timer1("grow grass"); diff --git a/src/server.cpp b/src/server.cpp index 669266cf..d71a6c05 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -568,6 +568,11 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime, continue; } +#if 0 + /* + NOTE: We can't know the ground level this way with the + new generator. + */ if(haxmode) { /* @@ -586,6 +591,7 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime, continue; } } +#endif /* Check if map has this block @@ -2093,7 +2099,18 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) // Don't add a node if this is not a free space MapNode n2 = m_env.getMap().getNode(p_over); if(content_buildable_to(n2.d) == false) + { + // Client probably has wrong data. + // Set block not sent, so that client will get + // a valid one. + dstream<<"Client "<SetBlockNotSent(blockpos); return; + } } catch(InvalidPositionException &e) { @@ -3189,7 +3206,7 @@ Player *Server::emergePlayer(const char *name, const char *password, */ player->setPosition(intToFloat(v3s16( 0, - 50, + 64, 0 ))); @@ -3227,7 +3244,7 @@ Player *Server::emergePlayer(const char *name, const char *password, #if 1 player->setPosition(intToFloat(v3s16( 0, - 50, + 64, 0 ))); #endif