summaryrefslogtreecommitdiff
path: root/bin/rtt-undo
blob: 2f69eed8c6395583c00da35974496056219a631e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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