small fixes here and there
authorPerttu Ahola <celeron55@gmail.com>
Sun, 23 Jan 2011 23:58:15 +0000 (01:58 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 23 Jan 2011 23:58:15 +0000 (01:58 +0200)
src/main.cpp
src/map.cpp
src/mapblock.cpp
src/mapnode.h
src/server.cpp

index f9b66ad028084192be4f689daf91afa2887fe01c..7c5f6bf3e0ec608748dab2e59710eccfc7abfc04 100644 (file)
@@ -2114,11 +2114,9 @@ int main(int argc, char *argv[])
                camera_direction.rotateXZBy(camera_yaw);\r
                \r
                // This is at the height of the eyes of the current figure\r
-               v3f camera_position =\r
-                               player_position + v3f(0, BS+BS/2, 0);\r
+               v3f camera_position = player_position + v3f(0, BS+BS/2, 0);\r
                // This is more like in minecraft\r
-               /*v3f camera_position =\r
-                               player_position + v3f(0, BS+BS*0.65, 0);*/\r
+               //v3f camera_position = player_position + v3f(0, BS+BS*0.625, 0);\r
 \r
                camera->setPosition(camera_position);\r
                // *100.0 helps in large map coordinates\r
@@ -2828,29 +2826,7 @@ int main(int argc, char *argv[])
        catch(con::PeerNotFoundException &e)\r
        {\r
                dstream<<DTIME<<"Connection timed out."<<std::endl;\r
-               \r
-               /*if(g_device)\r
-               {\r
-                       GUIMessageMenu *menu =\r
-                                       new GUIMessageMenu(guienv, guiroot, -1, \r
-                                               &g_menumgr,\r
-                                               L"Connection timed out");\r
-\r
-                       video::IVideoDriver* driver = g_device->getVideoDriver();\r
-                       \r
-                       dstream<<"Created menu"<<std::endl;\r
-\r
-                       while(g_device->run() && menu->getStatus() == false)\r
-                       {\r
-                               driver->beginScene(true, true, video::SColor(255,0,0,0));\r
-                               guienv->drawAll();\r
-                               driver->endScene();\r
-                       }\r
-                       \r
-                       dstream<<"Dropping menu"<<std::endl;\r
-\r
-                       menu->drop();\r
-               }*/\r
+               error_message = L"Connection timed out.";\r
        }\r
 \r
        } // Menu-game loop\r
index 973e126787f893057284606c6e3b14d135fcdff7..5655ee9ec8d638e862cfe475fe547da731daad01 100644 (file)
@@ -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);
index 5cfb60aa288898c502bf9db5a2102b397346654b..f18cb2fdd305c31665534d821985a5b5cc7f85dd 100644 (file)
@@ -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()));
index e3b921a66604405c5bc44f4f6a89330f7774bdcc..286edcc2bb86adca87582a86c1fbab1c451f4105 100644 (file)
@@ -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;
 
index a979086ea769794e80338214c46eae2d8176d366..65e3903459903593b6371f1b9dc15bf403c2dc41 100644 (file)
@@ -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