Translated using Weblate (Japanese)
[oweals/minetest.git] / src / client.h
index 87cf8ce4533b176a2dd525041b945a201953b0ae..5b57aa52a6e345a9ead4456086e13e4e2fab4b55 100644 (file)
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "network/connection.h"
 #include "environment.h"
 #include "irrlichttypes_extrabloated.h"
-#include "jthread/jmutex.h"
+#include "threading/mutex.h"
 #include <ostream>
 #include <map>
 #include <set>
@@ -48,6 +48,8 @@ struct MapDrawControl;
 class MtEventManager;
 struct PointedThing;
 class Database;
+class Mapper;
+struct MinimapMapblock;
 
 struct QueuedMeshUpdate
 {
@@ -87,14 +89,14 @@ public:
 
        u32 size()
        {
-               JMutexAutoLock lock(m_mutex);
+               MutexAutoLock lock(m_mutex);
                return m_queue.size();
        }
 
 private:
        std::vector<QueuedMeshUpdate*> m_queue;
        std::set<v3s16> m_urgents;
-       JMutex m_mutex;
+       Mutex m_mutex;
 };
 
 struct MeshUpdateResult
@@ -111,23 +113,22 @@ struct MeshUpdateResult
        }
 };
 
-class MeshUpdateThread : public JThread
+class MeshUpdateThread : public UpdateThread
 {
-public:
+private:
+       MeshUpdateQueue m_queue_in;
 
-       MeshUpdateThread(IGameDef *gamedef):
-               m_gamedef(gamedef)
-       {
-       }
+protected:
+       virtual void doUpdate();
 
-       void * Thread();
+public:
 
-       MeshUpdateQueue m_queue_in;
+       MeshUpdateThread() : UpdateThread("Mesh") {}
 
+       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 +406,13 @@ public:
        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 +484,8 @@ public:
        bool accessDenied()
        { return m_access_denied; }
 
+       bool reconnectRequested() { return m_access_denied_reconnect; }
+
        std::string accessDeniedReason()
        { return m_access_denied_reason; }
 
@@ -493,6 +496,9 @@ public:
        bool mediaReceived()
        { return m_media_downloader == NULL; }
 
+       u8 getProtoVersion()
+       { return m_proto_ver; }
+
        float mediaReceiveProgress();
 
        void afterContentReceived(IrrlichtDevice *device);
@@ -501,6 +507,12 @@ public:
        float getCurRate(void);
        float getAvgRate(void);
 
+       Mapper* getMapper ()
+       { return m_mapper; }
+
+       bool isMinimapDisabledByServer()
+       { return m_minimap_disabled_by_server; }
+
        // IGameDef interface
        virtual IItemDefManager* getItemDefManager();
        virtual INodeDefManager* getNodeDefManager();
@@ -580,10 +592,18 @@ private:
        ParticleManager m_particle_manager;
        con::Connection m_con;
        IrrlichtDevice *m_device;
+       Mapper *m_mapper;
+       bool m_minimap_disabled_by_server;
        // 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 +637,7 @@ private:
 
 
        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 +669,7 @@ private:
        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;