From 32b73796daaec812e42356975c79bb01b8b10c8f Mon Sep 17 00:00:00 2001 From: oc Date: Wed, 17 Apr 2019 13:40:48 +0800 Subject: [PATCH] autosave in events --- libs/control.js | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/libs/control.js b/libs/control.js index 1871249e..0bc3a878 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1480,29 +1480,21 @@ control.prototype._replayAction_key = function (action) { ////// 自动存档 ////// control.prototype.autosave = function (removeLast) { - var inEvent = false; // 检测是否是事件中的自动存档 - if (core.status.event.id!=null) { - if (core.status.event.id!='action') return; - inEvent = true; - } var x=null; - if (removeLast) x=core.status.route.pop(); - if (inEvent) { - core.setFlag("__events__", core.clone(core.status.event.data)); - } - else { + if (removeLast) { + x=core.status.route.pop(); core.status.route.push("turn:"+core.getHeroLoc('direction')); } + if (core.status.event.id == 'action') // 事件中的自动存档 + core.setFlag("__events__", core.clone(core.status.event.data)); core.saves.autosave.data = core.saveData(); core.saves.autosave.updated = true; core.saves.ids[0] = true; - if (inEvent) { - core.removeFlag("__events__"); - } - else { + core.removeFlag("__events__"); + if (removeLast) { core.status.route.pop(); + if (x) core.status.route.push(x); } - if (x) core.status.route.push(x); } /////// 实际进行自动存档 //////