aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2015-02-17 20:09:36 +0100
committerLoic Blot <loic.blot@unix-experience.fr>2015-02-18 09:28:39 +0100
commit27d4e89d326337c8d8cafc681acde8bfbde7de77 (patch)
tree05122a05a2178adf57c5ac8b1038fb8eaefef46b /src/script
parentb019221c30f58ce1944d8f2421b40b31ba364716 (diff)
downloadminetest-27d4e89d326337c8d8cafc681acde8bfbde7de77.tar.gz
minetest-27d4e89d326337c8d8cafc681acde8bfbde7de77.tar.bz2
minetest-27d4e89d326337c8d8cafc681acde8bfbde7de77.zip
Fix unused (and so, broken) enable_rollback_recording. This option must be reloaded at server loop but loaded when server starts, for data consistency (not a hot load variable)
ok @ShadowNinja
Diffstat (limited to 'src/script')
-rw-r--r--src/script/lua_api/l_rollback.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/script/lua_api/l_rollback.cpp b/src/script/lua_api/l_rollback.cpp
index f55a72d1b..5744e6813 100644
--- a/src/script/lua_api/l_rollback.cpp
+++ b/src/script/lua_api/l_rollback.cpp
@@ -44,6 +44,9 @@ int ModApiRollback::l_rollback_get_node_actions(lua_State *L)
int limit = luaL_checknumber(L, 4);
Server *server = getServer(L);
IRollbackManager *rollback = server->getRollbackManager();
+ if (rollback == NULL) {
+ return 0;
+ }
std::list<RollbackAction> actions = rollback->getNodeActors(pos, range, seconds, limit);
std::list<RollbackAction>::iterator iter = actions.begin();
@@ -80,6 +83,13 @@ int ModApiRollback::l_rollback_revert_actions_by(lua_State *L)
int seconds = luaL_checknumber(L, 2);
Server *server = getServer(L);
IRollbackManager *rollback = server->getRollbackManager();
+
+ // If rollback is disabled, tell it's not a success.
+ if (rollback == NULL) {
+ lua_pushboolean(L, false);
+ lua_newtable(L);
+ return 2;
+ }
std::list<RollbackAction> actions = rollback->getRevertActions(actor, seconds);
std::list<std::string> log;
bool success = server->rollbackRevertActions(actions, &log);