diff --git a/level_editor/editor.lua b/level_editor/editor.lua index fac3a00..813a5f0 100644 --- a/level_editor/editor.lua +++ b/level_editor/editor.lua @@ -480,6 +480,11 @@ local function saveRoomFromEditor() removeFromSource("rooms/" .. oldName .. ".sav") gameWorld:renameRoom(oldName, name) end + -- The project source is now authoritative. Drop any runtime copy so it + -- cannot shadow this editor save the next time the game starts. + clearRuntimeSaveData(name) + if oldName and oldName ~= name then clearRuntimeSaveData(oldName) end + suppressRuntimeAutosave = true gameWorld:invalidatePreview(name) if editorView == "world" then rebuildWorldRoomButtons() end currentRoom.name = name @@ -506,6 +511,7 @@ local function clearRuntimeSaves() end local removed = clearRuntimeSaveData(clearAll and nil or roomName) + suppressRuntimeAutosave = true clearSaveConfirmationExpires = 0 clearSaveConfirmationScope = nil if roomName then diff --git a/main.lua b/main.lua index fbc5c3c..fb876d9 100644 --- a/main.lua +++ b/main.lua @@ -55,7 +55,9 @@ end -- Autosave on close so a position reached by moving within a room (short of a -- room-to-room transition, which already autosaves in nextRoom) survives. function love.quit() - if currentRoom then + -- An explicit editor save/clear removes the runtime copy intentionally; + -- don't immediately recreate it while shutting down. + if currentRoom and not suppressRuntimeAutosave then currentRoom:save() if gameWorld then gameWorld:setLastRoom(currentRoom.name) end end