Repository navigation
Keep the save through ztk::game and continue at the last entry - #19
Merged
Merged
Conversation
The save has version 2 and the entry that the player started last. Continue goes there when it is open and not done. A save of 0.1.0 is read and moved. The play page keeps app(save) in localStorage and gives it back as base64.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3. Based on #18.
The save goes through
ztk::game save lamplighterin the data folder of the app. It hasversion 2andlast, the entry that the player started last. Continue goes to that entry when it is open and not done, else to the first entry that is open and not done.At the start, the host reads the save of
ztk::game load. With none, it readslamplighter.saveof 0.1.0 and stores it throughztk::game save. A save of an unknown version, a text that is not a dict, or a badunlockedgives a new game.ztk.js of 1.0.0-beta.8 keeps no storage, so
ztk::game savein the browser lasts only for the page. The play page keeps the text ofapp(save)inlocalStorageand gives it to the game as base64 inapp(webSave), so the text cannot run as a script. A text with characters outside printable ASCII is dropped.What ran here:
ztcl test(78 tests pass, 8 new),tests/tk/smoke.tcland the newtests/tk/save.tclwith ztk 1.0.0-beta.8 headless, and two loads of the play page in headless Chromium with one profile: the second load continued at the entry of the first. CI runs the new save test. What did not run: a phone, and a desktop window across a real restart.