summaryrefslogtreecommitdiff
path: root/tools/patchgame.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/patchgame.js')
-rwxr-xr-xtools/patchgame.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/patchgame.js b/tools/patchgame.js
index a28ce1f..bd719ba 100755
--- a/tools/patchgame.js
+++ b/tools/patchgame.js
@@ -74,7 +74,7 @@ function snapshot(state) {
function is_valid_action(rules, state, role, action, arg) {
if (action === "undo") // for jc, hots, r3, and cr compatibility
return true
- if (state.active !== role && state.active !== "Both")
+ if (state.active !== role && state.active !== "Both" && !state.active.includes(role))
return false
let view = rules.view(state, role)
let va = view.actions[action]
@@ -90,7 +90,7 @@ function is_valid_action(rules, state, role, action, arg) {
function dont_snap(rules, state, old_active) {
if (state.state === "game_over")
return true
- if (state.active === old_active)
+ if (String(state.active) === String(old_active))
return true
if (rules.dont_snap && rules.dont_snap(state))
return true
@@ -219,7 +219,7 @@ function patch_game(game_id, {validate_actions=true, save_snaps=true, delete_und
insert_snap.run(game_id, ++snap_id, item.replay_id, item.state)
}
- update_active.run(state.active, game_id)
+ update_active.run(String(state.active), game_id)
update_state.run(JSON.stringify(state), game_id)
if (state.state === "game_over")