Falling sand and gravel
[oweals/minetest.git] / src / server.h
index ab8c31a00a0a57186692d91eba573269d64874c1..7620f5341bb291c4fa8fb1a9e24953d71d3765ac 100644 (file)
@@ -29,8 +29,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "inventory.h"
 #include "auth.h"
 #include "ban.h"
+#include "gamedef.h"
+#include "serialization.h" // For SER_FMT_VER_INVALID
 struct LuaState;
 typedef struct lua_State lua_State;
+class IWritableToolDefManager;
+class IWritableNodeDefManager;
+class IWritableCraftDefManager;
 
 /*
        Some random functions
@@ -361,7 +366,7 @@ private:
 };
 
 class Server : public con::PeerHandler, public MapEventReceiver,
-               public InventoryManager
+               public InventoryManager, public IGameDef
 {
 public:
        /*
@@ -481,6 +486,18 @@ public:
        
        // Envlock and conlock should be locked when using Lua
        lua_State *getLua(){ return m_lua; }
+       
+       // IGameDef interface
+       // Under envlock
+       virtual IToolDefManager* getToolDefManager();
+       virtual INodeDefManager* getNodeDefManager();
+       virtual ICraftDefManager* getCraftDefManager();
+       virtual ITextureSource* getTextureSource();
+       virtual u16 allocateUnknownNodeId(const std::string &name);
+       
+       IWritableToolDefManager* getWritableToolDefManager();
+       IWritableNodeDefManager* getWritableNodeDefManager();
+       IWritableCraftDefManager* getWritableCraftDefManager();
 
 private:
 
@@ -499,9 +516,16 @@ private:
                        const std::wstring &reason);
        static void SendDeathscreen(con::Connection &con, u16 peer_id,
                        bool set_camera_point_target, v3f camera_point_target);
+       static void SendToolDef(con::Connection &con, u16 peer_id,
+                       IToolDefManager *tooldef);
+       static void SendNodeDef(con::Connection &con, u16 peer_id,
+                       INodeDefManager *nodedef);
        
        /*
-               Non-static send methods
+               Non-static send methods.
+               Conlock should be always used.
+               Envlock usage is documented badly but it's easy to figure out
+               which ones access the environment.
        */
 
        // Envlock and conlock should be locked when calling these
@@ -532,6 +556,8 @@ private:
        
        // Sends blocks to clients (locks env and con on its own)
        void SendBlocks(float dtime);
+       
+       void SendTextures(u16 peer_id);
 
        /*
                Something random
@@ -605,6 +631,15 @@ private:
        // Scripting
        // Envlock and conlock should be locked when using Lua
        lua_State *m_lua;
+
+       // Tool definition manager
+       IWritableToolDefManager *m_toolmgr;
+       
+       // Node definition manager
+       IWritableNodeDefManager *m_nodedef;
+       
+       // Craft definition manager
+       IWritableCraftDefManager *m_craftdef;
        
        /*
                Threads
@@ -662,6 +697,9 @@ private:
 
        // Configuration path ("" = no configuration file)
        std::string m_configpath;
+       
+       // Mod parent directory paths
+       core::list<std::string> m_modspaths;
 
        bool m_shutdown_requested;
        
@@ -692,8 +730,6 @@ private:
        */
        u16 m_ignore_map_edit_events_peer_id;
 
-       Profiler *m_profiler;
-
        friend class EmergeThread;
        friend class RemoteClient;
 };