]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/server.h
Make shift the default descent control on ladders and when flying
[dragonfireclient.git] / src / server.h
index f170cf7e11908903020569187599084564fc58d0..223c1b0ffd1314ad76863f08017a4290455da8f8 100644 (file)
@@ -36,6 +36,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "sound.h"
 #include "util/thread.h"
 #include "util/string.h"
+#include "rollback_interface.h" // Needed for rollbackRevertActions()
+#include <list> // Needed for rollbackRevertActions()
 
 struct LuaState;
 typedef struct lua_State lua_State;
@@ -44,6 +46,7 @@ class IWritableNodeDefManager;
 class IWritableCraftDefManager;
 class EventManager;
 class PlayerSAO;
+class IRollbackManager;
 
 class ServerError : public std::exception
 {
@@ -538,8 +541,18 @@ class Server : public con::PeerHandler, public MapEventReceiver,
 
        void queueBlockEmerge(v3s16 blockpos, bool allow_generate);
        
+       // Creates or resets inventory
+       Inventory* createDetachedInventory(const std::string &name);
+       
        // Envlock and conlock should be locked when using Lua
        lua_State *getLua(){ return m_lua; }
+
+       // Envlock should be locked when using the rollback manager
+       IRollbackManager *getRollbackManager(){ return m_rollback; }
+       // actions: time-reversed list
+       // Return value: success/failure
+       bool rollbackRevertActions(const std::list<RollbackAction> &actions,
+                       std::list<std::string> *log);
        
        // IGameDef interface
        // Under envlock
@@ -550,6 +563,7 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        virtual u16 allocateUnknownNodeId(const std::string &name);
        virtual ISoundManager* getSoundManager();
        virtual MtEventManager* getEventManager();
+       virtual IRollbackReportSink* getRollbackReportSink();
        
        IWritableItemDefManager* getWritableItemDefManager();
        IWritableNodeDefManager* getWritableNodeDefManager();
@@ -627,6 +641,10 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        void sendMediaAnnouncement(u16 peer_id);
        void sendRequestedMedia(u16 peer_id,
                        const core::list<MediaRequest> &tosend);
+       
+       void sendDetachedInventory(const std::string &name, u16 peer_id);
+       void sendDetachedInventoryToAll(const std::string &name);
+       void sendDetachedInventories(u16 peer_id);
 
        /*
                Something random
@@ -713,6 +731,11 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        // Bann checking
        BanManager m_banmanager;
 
+       // Rollback manager (behind m_env_mutex)
+       IRollbackManager *m_rollback;
+       bool m_rollback_sink_enabled;
+       bool m_enable_rollback_recording; // Updated once in a while
+
        // Scripting
        // Envlock and conlock should be locked when using Lua
        lua_State *m_lua;
@@ -828,6 +851,12 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        */
        std::map<s32, ServerPlayingSound> m_playing_sounds;
        s32 m_next_sound_id;
+
+       /*
+               Detached inventories (behind m_env_mutex)
+       */
+       // key = name
+       std::map<std::string, Inventory*> m_detached_inventories;
 };
 
 /*