summaryrefslogtreecommitdiff
path: root/bin/rtt-undo
diff options
context:
space:
mode:
Diffstat (limited to 'bin/rtt-undo')
-rwxr-xr-xbin/rtt-undo15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/rtt-undo b/bin/rtt-undo
new file mode 100755
index 0000000..2f69eed
--- /dev/null
+++ b/bin/rtt-undo
@@ -0,0 +1,15 @@
+#!/bin/bash
+if [ -n "$1" ]
+then
+ if [ -n "$2" ]
+ then
+ COUNT=$2
+ else
+ COUNT=$(sqlite3 db "select coalesce(max(replay_id),0) from game_replay where game_id=$1")
+ echo Game has $COUNT actions.
+ fi
+ sqlite3 db "delete from game_replay where game_id=$1 and replay_id>=$COUNT"
+ ./bin/rtt-patch $1 '{"validate_actions":false}'
+else
+ echo "usage: rtt-undo GAME"
+fi