]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/content_sao.h
Prevent world creation if the world already exists
[dragonfireclient.git] / src / content_sao.h
index 55d0637ae4706ffcbaeffc1d4a359b41fd635027..ff427bac63c5d0b64c51bd3a68c18baaf7002ba2 100644 (file)
@@ -3,16 +3,16 @@ Minetest-c55
 Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
 
 This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+GNU Lesser General Public License for more details.
 
-You should have received a copy of the GNU General Public License along
+You should have received a copy of the GNU Lesser General Public License along
 with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
@@ -106,7 +106,7 @@ class PlayerSAO : public ServerActiveObject
 {
 public:
        PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
-                       const std::set<std::string> &privs);
+                       const std::set<std::string> &privs, bool is_singleplayer);
        ~PlayerSAO();
        u8 getType() const
        { return ACTIVEOBJECT_TYPE_PLAYER; }
@@ -163,8 +163,6 @@ class PlayerSAO : public ServerActiveObject
 
        void disconnected();
 
-       void createCreativeInventory();
-
        Player* getPlayer()
        {
                return m_player;
@@ -173,6 +171,9 @@ class PlayerSAO : public ServerActiveObject
        {
                return m_peer_id;
        }
+
+       // Cheat prevention
+
        v3f getLastGoodPosition() const
        {
                return m_last_good_position;
@@ -183,9 +184,31 @@ class PlayerSAO : public ServerActiveObject
                m_time_from_last_punch = 0.0;
                return r;
        }
-       void updatePrivileges(const std::set<std::string> &privs)
+       void noCheatDigStart(v3s16 p)
+       {
+               m_nocheat_dig_pos = p;
+               m_nocheat_dig_time = 0;
+       }
+       v3s16 getNoCheatDigPos()
+       {
+               return m_nocheat_dig_pos;
+       }
+       float getNoCheatDigTime()
+       {
+               return m_nocheat_dig_time;
+       }
+       void noCheatDigEnd()
+       {
+               m_nocheat_dig_pos = v3s16(32767, 32767, 32767);
+       }
+
+       // Other
+
+       void updatePrivileges(const std::set<std::string> &privs,
+                       bool is_singleplayer)
        {
                m_privs = privs;
+               m_is_singleplayer = is_singleplayer;
        }
 
 private:
@@ -194,9 +217,14 @@ class PlayerSAO : public ServerActiveObject
        Player *m_player;
        u16 m_peer_id;
        Inventory *m_inventory;
+
+       // Cheat prevention
        v3f m_last_good_position;
        float m_last_good_position_age;
        float m_time_from_last_punch;
+       v3s16 m_nocheat_dig_pos;
+       float m_nocheat_dig_time;
+
        int m_wield_index;
        bool m_position_not_sent;
        ItemGroupList m_armor_groups;
@@ -205,6 +233,7 @@ class PlayerSAO : public ServerActiveObject
        struct ObjectProperties m_prop;
        // Cached privileges for enforcement
        std::set<std::string> m_privs;
+       bool m_is_singleplayer;
 
 public:
        // Some flags used by Server