diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-07-03 16:45:43 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-07-10 13:10:34 +0200 |
commit | f6397dca9091cba8057f62815a9eabacf02ad098 (patch) | |
tree | edb346246cb3fb0042372c8245d7aa046683869d /tools | |
parent | 43a8cbae409aa0cfd777cbbabbc4280fe191ce1c (diff) | |
download | server-f6397dca9091cba8057f62815a9eabacf02ad098.tar.gz |
Don't delete undo by default when patching games.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/patchgame.js | 4 | ||||
-rw-r--r-- | tools/undo.sh | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/tools/patchgame.js b/tools/patchgame.js index 9751d26..6808704 100755 --- a/tools/patchgame.js +++ b/tools/patchgame.js @@ -86,7 +86,7 @@ function is_valid_action(rules, state, role, action, arg) { return false } -function patch_game(game_id, {validate_actions=true, save_snaps=true, delete_undo=true, delete_invalid=false}, verbose) { +function patch_game(game_id, {validate_actions=true, save_snaps=true, delete_undo=false, delete_invalid=false}, verbose) { let game = select_game.get(game_id) if (!game) { console.error("game not found:", game_id) @@ -203,7 +203,7 @@ if (process.argv.length < 3) { process.stderr.write("usage: ./tools/patchgame.js <game_id> '{options}'\n") process.stderr.write(" or: ./tools/patchgame.js <title_id> '{options}'\n") process.stderr.write(" or: ./tools/patchgame.js all '{options}'\n") - process.stderr.write('options: { "validate_actions":true, "delete_invalid":false, "save_snaps":true, "delete_undo":true }\n') + process.stderr.write('options: { "validate_actions":true, "delete_invalid":false, "save_snaps":true, "delete_undo":false }\n') process.exit(1) } diff --git a/tools/undo.sh b/tools/undo.sh index 716e88b..889d6b8 100644 --- a/tools/undo.sh +++ b/tools/undo.sh @@ -1,10 +1,10 @@ #!/bin/bash if [ -n "$1" ] then - COUNT=$(sqlite3 db "select count(1) from game_replay where game_id=$1") + COUNT=$(sqlite3 db "select coalesce(max(replay_id),0) from game_replay where game_id=$1") echo Game has $COUNT actions. sqlite3 db "delete from game_replay where game_id=$1 and replay_id=$COUNT" - node tools/patchgame.js $1 + node tools/patchgame.js $1 '{"validate_actions":false}' else echo "usage: bash tools/undo.sh GAME" fi |