From 194df177ab56f1600f0c000ce3ebc613b725a19d Mon Sep 17 00:00:00 2001 From: Daan Vanden Bosch Date: Wed, 7 Aug 2019 14:22:47 +0200 Subject: [PATCH] When creating a new quest and saving it, the filename of a quest that was loaded earlier was shown. This is now fixed. --- src/stores/QuestEditorStore.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/stores/QuestEditorStore.ts b/src/stores/QuestEditorStore.ts index 04e4ec4f..58acd938 100644 --- a/src/stores/QuestEditorStore.ts +++ b/src/stores/QuestEditorStore.ts @@ -82,8 +82,7 @@ class QuestEditorStore { try { const buffer = yield read_file(file); const quest = parse_quest(new ArrayBufferCursor(buffer, Endianness.Little)); - this.current_quest_filename = filename; - this.set_quest(quest); + this.set_quest(quest, filename); } catch (e) { logger.error("Couldn't read file.", e); } @@ -146,7 +145,13 @@ class QuestEditorStore { }; @action - private set_quest = flow(function* set_quest(this: QuestEditorStore, quest?: Quest) { + private set_quest = flow(function* set_quest( + this: QuestEditorStore, + quest?: Quest, + filename?: string + ) { + this.current_quest_filename = filename; + if (quest !== this.current_quest) { this.undo.reset(); this.script_undo.reset();