]> git.lizzy.rs Git - minetest.git/blobdiff - src/client.h
Rollback: Fail on bad precondition instead of causing assertion error
[minetest.git] / src / client.h
index 87cf8ce4533b176a2dd525041b945a201953b0ae..547edfeabe48d308617ab1fe54888a1833fb411e 100644 (file)
@@ -48,6 +48,8 @@ struct MapDrawControl;
 class MtEventManager;
 struct PointedThing;
 class Database;
+class Mapper;
+struct MinimapMapblock;
 
 struct QueuedMeshUpdate
 {
@@ -111,23 +113,27 @@ struct MeshUpdateResult
        }
 };
 
-class MeshUpdateThread : public JThread
+class MeshUpdateThread : public UpdateThread
 {
+private:
+       MeshUpdateQueue m_queue_in;
+
+protected:
+       const char *getName()
+       { return "MeshUpdateThread"; }
+       virtual void doUpdate();
+
 public:
 
-       MeshUpdateThread(IGameDef *gamedef):
-               m_gamedef(gamedef)
+       MeshUpdateThread()
        {
        }
 
-       void * Thread();
-
-       MeshUpdateQueue m_queue_in;
+       void enqueueUpdate(v3s16 p, MeshMakeData *data,
+                       bool ack_block_to_server, bool urgent);
 
        MutexedQueue<MeshUpdateResult> m_queue_out;
 
-       IGameDef *m_gamedef;
-
        v3s16 m_camera_offset;
 };
 
@@ -405,13 +411,13 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        void interact(u8 action, const PointedThing& pointed);
 
        void sendNodemetaFields(v3s16 p, const std::string &formname,
-                       const std::map<std::string, std::string> &fields);
+               const StringMap &fields);
        void sendInventoryFields(const std::string &formname,
-                       const std::map<std::string, std::string> &fields);
+               const StringMap &fields);
        void sendInventoryAction(InventoryAction *a);
        void sendChatMessage(const std::wstring &message);
        void sendChangePassword(const std::string &oldpassword,
-                               const std::string &newpassword);
+               const std::string &newpassword);
        void sendDamage(u8 damage);
        void sendBreath(u16 breath);
        void sendRespawn();
@@ -483,6 +489,8 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        bool accessDenied()
        { return m_access_denied; }
 
+       bool reconnectRequested() { return m_access_denied_reconnect; }
+
        std::string accessDeniedReason()
        { return m_access_denied_reason; }
 
@@ -493,6 +501,9 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        bool mediaReceived()
        { return m_media_downloader == NULL; }
 
+       u8 getProtoVersion()
+       { return m_proto_ver; }
+
        float mediaReceiveProgress();
 
        void afterContentReceived(IrrlichtDevice *device);
@@ -501,6 +512,9 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        float getCurRate(void);
        float getAvgRate(void);
 
+       Mapper* getMapper ()
+       { return m_mapper; }
+
        // IGameDef interface
        virtual IItemDefManager* getItemDefManager();
        virtual INodeDefManager* getNodeDefManager();
@@ -580,10 +594,17 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        ParticleManager m_particle_manager;
        con::Connection m_con;
        IrrlichtDevice *m_device;
+       Mapper *m_mapper;
        // Server serialization version
        u8 m_server_ser_ver;
+
        // Used version of the protocol with server
+       // Values smaller than 25 only mean they are smaller than 25,
+       // and aren't accurate. We simply just don't know, because
+       // the server didn't send the version back then.
+       // If 0, server init hasn't been received yet.
        u8 m_proto_ver;
+
        u16 m_playeritem;
        bool m_inventory_updated;
        Inventory *m_inventory_from_server;
@@ -617,6 +638,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
 
 
        bool m_access_denied;
+       bool m_access_denied_reconnect;
        std::string m_access_denied_reason;
        std::queue<ClientEvent> m_client_event_queue;
        bool m_itemdef_received;
@@ -648,7 +670,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        std::map<std::string, Inventory*> m_detached_inventories;
 
        // Storage for mesh data for creating multiple instances of the same mesh
-       std::map<std::string, std::string> m_mesh_data;
+       StringMap m_mesh_data;
 
        // own state
        LocalClientState m_state;