From 4a952f22d779cdce27dbfc68a23a7d13d3e62c0d Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 24 Jan 2011 01:58:15 +0200 Subject: [PATCH] small fixes here and there --- src/main.cpp | 30 +++--------------------------- src/map.cpp | 36 ++++++++++++++++++------------------ src/mapblock.cpp | 2 ++ src/mapnode.h | 6 ++++++ src/server.cpp | 3 ++- 5 files changed, 31 insertions(+), 46 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f9b66ad0..7c5f6bf3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2114,11 +2114,9 @@ int main(int argc, char *argv[]) camera_direction.rotateXZBy(camera_yaw); // This is at the height of the eyes of the current figure - v3f camera_position = - player_position + v3f(0, BS+BS/2, 0); + v3f camera_position = player_position + v3f(0, BS+BS/2, 0); // This is more like in minecraft - /*v3f camera_position = - player_position + v3f(0, BS+BS*0.65, 0);*/ + //v3f camera_position = player_position + v3f(0, BS+BS*0.625, 0); camera->setPosition(camera_position); // *100.0 helps in large map coordinates @@ -2828,29 +2826,7 @@ int main(int argc, char *argv[]) catch(con::PeerNotFoundException &e) { dstream<getVideoDriver(); - - dstream<<"Created menu"<run() && menu->getStatus() == false) - { - driver->beginScene(true, true, video::SColor(255,0,0,0)); - guienv->drawAll(); - driver->endScene(); - } - - dstream<<"Dropping menu"<drop(); - }*/ + error_message = L"Connection timed out."; } } // Menu-game loop diff --git a/src/map.cpp b/src/map.cpp index 973e1267..5655ee9e 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1689,7 +1689,7 @@ ServerMap::ServerMap(std::string savedir, HMParams hmp, MapParams mp): list_plants_amount->addPoint(p, Attribute(plants_amount));*/ float plants_amount = 0; - if(myrand()%5 == 0) + if(myrand()%4 == 0) { plants_amount = 1.5; } @@ -2880,16 +2880,16 @@ continue_generating: n.d = CONTENT_LEAVES; - if(rand()%4!=0) sector->setNode(gp+v3s16(0,5,0), n); + if(myrand()%4!=0) sector->setNode(gp+v3s16(0,5,0), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(-1,5,0), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(1,5,0), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(0,5,-1), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(0,5,1), n); - /*if(rand()%3!=0) sector->setNode(gp+v3s16(1,5,1), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(-1,5,1), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(-1,5,-1), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(1,5,-1), n);*/ + if(myrand()%3!=0) sector->setNode(gp+v3s16(-1,5,0), n); + if(myrand()%3!=0) sector->setNode(gp+v3s16(1,5,0), n); + if(myrand()%3!=0) sector->setNode(gp+v3s16(0,5,-1), n); + if(myrand()%3!=0) sector->setNode(gp+v3s16(0,5,1), n); + /*if(myrand()%3!=0) sector->setNode(gp+v3s16(1,5,1), n); + if(myrand()%3!=0) sector->setNode(gp+v3s16(-1,5,1), n); + if(myrand()%3!=0) sector->setNode(gp+v3s16(-1,5,-1), n); + if(myrand()%3!=0) sector->setNode(gp+v3s16(1,5,-1), n);*/ sector->setNode(gp+v3s16(0,4,0), n); @@ -2911,14 +2911,14 @@ continue_generating: sector->setNode(gp+v3s16(-1,3,-1), n); sector->setNode(gp+v3s16(1,3,-1), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(-1,2,0), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(1,2,0), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(0,2,-1), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(0,2,1), n); - /*if(rand()%3!=0) sector->setNode(gp+v3s16(1,2,1), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(-1,2,1), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(-1,2,-1), n); - if(rand()%3!=0) sector->setNode(gp+v3s16(1,2,-1), n);*/ + if(myrand()%3!=0) sector->setNode(gp+v3s16(-1,2,0), n); + if(myrand()%3!=0) sector->setNode(gp+v3s16(1,2,0), n); + if(myrand()%3!=0) sector->setNode(gp+v3s16(0,2,-1), n); + if(myrand()%3!=0) sector->setNode(gp+v3s16(0,2,1), n); + /*if(myrand()%3!=0) sector->setNode(gp+v3s16(1,2,1), n); + if(myrand()%3!=0) sector->setNode(gp+v3s16(-1,2,1), n); + if(myrand()%3!=0) sector->setNode(gp+v3s16(-1,2,-1), n); + if(myrand()%3!=0) sector->setNode(gp+v3s16(1,2,-1), n);*/ // Objects are identified by wanted position objects_to_remove.push_back(p); diff --git a/src/mapblock.cpp b/src/mapblock.cpp index 5cfb60aa..f18cb2fd 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -969,6 +969,7 @@ void MapBlock::updateMesh(u32 daynight_ratio) material.setFlag(video::EMF_LIGHTING, false); material.setFlag(video::EMF_BACK_FACE_CULLING, false); material.setFlag(video::EMF_BILINEAR_FILTER, false); + material.setFlag(video::EMF_FOG_ENABLE, true); material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA; material.setTexture(0, g_irrlicht->getTexture(porting::getDataPath("water.png").c_str())); @@ -1005,6 +1006,7 @@ void MapBlock::updateMesh(u32 daynight_ratio) material.setFlag(video::EMF_LIGHTING, false); material.setFlag(video::EMF_BACK_FACE_CULLING, false); material.setFlag(video::EMF_BILINEAR_FILTER, false); + material.setFlag(video::EMF_FOG_ENABLE, true); material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA; material.setTexture(0, g_irrlicht->getTexture(porting::getDataPath("water.png").c_str())); diff --git a/src/mapnode.h b/src/mapnode.h index e3b921a6..286edcc2 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -211,6 +211,12 @@ inline u8 face_contents(u8 m1, u8 m2) return 0; bool contents_differ = (m1 != m2); + + // Contents don't differ for different forms of same liquid + if(content_liquid(m1) && content_liquid(m2) + && make_liquid_flowing(m1) == make_liquid_flowing(m2)) + contents_differ = false; + bool solidness_differs = (content_solidness(m1) != content_solidness(m2)); bool makes_face = contents_differ && solidness_differs; diff --git a/src/server.cpp b/src/server.cpp index a979086e..65e39034 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3406,7 +3406,8 @@ void Server::handlePeerChange(PeerChange &c) // Set player client disconnected { Player *player = m_env.getPlayer(c.peer_id); - player->peer_id = 0; + if(player != NULL) + player->peer_id = 0; } // Delete client -- 2.30.2