Clear runtime saves after editor save

This commit is contained in:
Your Name 2026-08-11 16:37:11 -04:00
parent 858775fdc8
commit d426306c94
2 changed files with 9 additions and 1 deletions

View file

@ -480,6 +480,11 @@ local function saveRoomFromEditor()
removeFromSource("rooms/" .. oldName .. ".sav") removeFromSource("rooms/" .. oldName .. ".sav")
gameWorld:renameRoom(oldName, name) gameWorld:renameRoom(oldName, name)
end 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) gameWorld:invalidatePreview(name)
if editorView == "world" then rebuildWorldRoomButtons() end if editorView == "world" then rebuildWorldRoomButtons() end
currentRoom.name = name currentRoom.name = name
@ -506,6 +511,7 @@ local function clearRuntimeSaves()
end end
local removed = clearRuntimeSaveData(clearAll and nil or roomName) local removed = clearRuntimeSaveData(clearAll and nil or roomName)
suppressRuntimeAutosave = true
clearSaveConfirmationExpires = 0 clearSaveConfirmationExpires = 0
clearSaveConfirmationScope = nil clearSaveConfirmationScope = nil
if roomName then if roomName then

View file

@ -55,7 +55,9 @@ end
-- Autosave on close so a position reached by moving within a room (short of a -- 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. -- room-to-room transition, which already autosaves in nextRoom) survives.
function love.quit() 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() currentRoom:save()
if gameWorld then gameWorld:setLastRoom(currentRoom.name) end if gameWorld then gameWorld:setLastRoom(currentRoom.name) end
end end