summaryrefslogtreecommitdiff
path: root/tools/undo.sh
blob: 889d6b811f48d425079ce7cc4ed34a1f88b89279 (plain)
1
2
3
4
5
6
7
8
9
10
#!/bin/bash
if [ -n "$1" ]
then
	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 '{"validate_actions":false}'
else
	echo "usage: bash tools/undo.sh GAME"
fi