Fix Lint broken by b662a4577d692329b9ca83525e6039f2ddcd1ac1
[oweals/minetest.git] / src / clientenvironment.cpp
index 29ecd2dfe97cd71aaa971495fa482bb216c5e13a..cc75fd2d639fde2c8a297b0f015d8eb8c7d241a7 100644 (file)
@@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "clientenvironment.h"
 #include "clientsimpleobject.h"
 #include "clientmap.h"
-#include "clientscripting.h"
+#include "scripting_client.h"
 #include "mapblock_mesh.h"
 #include "event.h"
 #include "collision.h"
@@ -66,6 +66,8 @@ ClientEnvironment::~ClientEnvironment()
 
        // Drop/delete map
        m_map->drop();
+
+       delete m_local_player;
 }
 
 Map & ClientEnvironment::getMap()
@@ -250,37 +252,31 @@ void ClientEnvironment::step(float dtime)
                m_script->environment_step(dtime);
        }
 
-       /*
-               A quick draft of lava damage
-       */
-       if(m_lava_hurt_interval.step(dtime, 1.0))
-       {
-               v3f pf = lplayer->getPosition();
-
-               // Feet, middle and head
-               v3s16 p1 = floatToInt(pf + v3f(0, BS*0.1, 0), BS);
-               MapNode n1 = m_map->getNodeNoEx(p1);
-               v3s16 p2 = floatToInt(pf + v3f(0, BS*0.8, 0), BS);
-               MapNode n2 = m_map->getNodeNoEx(p2);
-               v3s16 p3 = floatToInt(pf + v3f(0, BS*1.6, 0), BS);
-               MapNode n3 = m_map->getNodeNoEx(p3);
-
-               u32 damage_per_second = 0;
-               damage_per_second = MYMAX(damage_per_second,
-                       m_client->ndef()->get(n1).damage_per_second);
-               damage_per_second = MYMAX(damage_per_second,
-                       m_client->ndef()->get(n2).damage_per_second);
-               damage_per_second = MYMAX(damage_per_second,
-                       m_client->ndef()->get(n3).damage_per_second);
-
-               if(damage_per_second != 0)
-               {
-                       damageLocalPlayer(damage_per_second, true);
-               }
-       }
-
        // Protocol v29 make this behaviour obsolete
        if (getGameDef()->getProtoVersion() < 29) {
+               if (m_lava_hurt_interval.step(dtime, 1.0)) {
+                       v3f pf = lplayer->getPosition();
+
+                       // Feet, middle and head
+                       v3s16 p1 = floatToInt(pf + v3f(0, BS * 0.1, 0), BS);
+                       MapNode n1 = m_map->getNodeNoEx(p1);
+                       v3s16 p2 = floatToInt(pf + v3f(0, BS * 0.8, 0), BS);
+                       MapNode n2 = m_map->getNodeNoEx(p2);
+                       v3s16 p3 = floatToInt(pf + v3f(0, BS * 1.6, 0), BS);
+                       MapNode n3 = m_map->getNodeNoEx(p3);
+
+                       u32 damage_per_second = 0;
+                       damage_per_second = MYMAX(damage_per_second,
+                               m_client->ndef()->get(n1).damage_per_second);
+                       damage_per_second = MYMAX(damage_per_second,
+                               m_client->ndef()->get(n2).damage_per_second);
+                       damage_per_second = MYMAX(damage_per_second,
+                               m_client->ndef()->get(n3).damage_per_second);
+
+                       if (damage_per_second != 0)
+                               damageLocalPlayer(damage_per_second, true);
+               }
+
                /*
                        Drowning
                */