Add enable_rollback_recording setting, defaulting to false
authorPerttu Ahola <celeron55@gmail.com>
Sat, 28 Jul 2012 00:08:09 +0000 (03:08 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Sat, 28 Jul 2012 00:08:09 +0000 (03:08 +0300)
minetest.conf.example
src/defaultsettings.cpp
src/server.cpp
src/server.h

index fdfbf201cd39b562d5dcb44eedfee66a3be0daa1..adeb3c8f68274fe8c9360aa161c0b31d6a5d803d 100644 (file)
 #disallow_empty_password = false
 # If true, disable cheat prevention in multiplayer
 #disable_anticheat = false
+# If true, actions are recorded for rollback
+#enable_rollback_recording = false
 
 # Profiler data print interval. #0 = disable.
 #profiler_print_interval = 0
index dabdbb4aa5f46bc0b86011b9f05e58764876b14d..6b85feb600fc6ac3096b18ecc08ec76a596b99e9 100644 (file)
@@ -122,6 +122,7 @@ void set_default_settings(Settings *settings)
        settings->setDefault("enable_pvp", "true");
        settings->setDefault("disallow_empty_password", "false");
        settings->setDefault("disable_anticheat", "false");
+       settings->setDefault("enable_rollback_recording", "false");
 
        settings->setDefault("profiler_print_interval", "0");
        settings->setDefault("enable_mapgen_debug_info", "false");
index 6a126b60d1e0902025dfd8ce4920c2b113cefa47..05dff06c5cfcb2dc4843aad89e69617cf2cbe164 100644 (file)
@@ -937,6 +937,7 @@ Server::Server(
        m_banmanager(path_world+DIR_DELIM+"ipban.txt"),
        m_rollback(NULL),
        m_rollback_sink_enabled(true),
+       m_enable_rollback_recording(false),
        m_lua(NULL),
        m_itemdef(createItemDefManager()),
        m_nodedef(createNodeDefManager()),
@@ -1873,6 +1874,10 @@ void Server::AsyncRunStep()
                        counter = 0.0;
                        
                        m_emergethread.trigger();
+
+                       // Update m_enable_rollback_recording here too
+                       m_enable_rollback_recording =
+                                       g_settings->getBool("enable_rollback_recording");
                }
        }
 
@@ -4658,6 +4663,8 @@ MtEventManager* Server::getEventManager()
 }
 IRollbackReportSink* Server::getRollbackReportSink()
 {
+       if(!m_enable_rollback_recording)
+               return NULL;
        if(!m_rollback_sink_enabled)
                return NULL;
        return m_rollback;
index 668d424167a7ed695357dd05f927b3183c965671..223c1b0ffd1314ad76863f08017a4290455da8f8 100644 (file)
@@ -734,6 +734,7 @@ private:
        // 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