From 74166074606cdba810b1b42f87af8cbe0bab6519 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 2 Jan 2022 17:59:07 +0100 Subject: Add game replay functionality. Handle missing replay data. Add replay/rematch/exit buttons on game-over. Set 'player' to active player during replays. Replace space with underscore in role class names. Fix critical undo bug! Set game_over state during replays. Fix jumpy view in battle replays. Nuke undo states from all actions, not just 'undo'. Log play and replay page requests. Clean up client.js and allow selecting replay viewpoint. Add debug mode to replay prompt showing active, state, and next action. Init client roles from HTML structure. Remove unused rematch functions. Drop /info/ prefix on game pages. Update body role classList when replay viewpoint changes. --- views/head.pug | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'views/head.pug') diff --git a/views/head.pug b/views/head.pug index 68fa904..df1b762 100644 --- a/views/head.pug +++ b/views/head.pug @@ -15,7 +15,7 @@ mixin social(title,description,game) meta(property="og:description" content=description) mixin gamecover(title_id) - a(href="/info/"+title_id) + a(href="/"+title_id) img(src=`/${title_id}/cover.1x.jpg` srcset=`/${title_id}/cover.2x.jpg 2x`) mixin forumpost(row,show_buttons) @@ -57,7 +57,7 @@ mixin gametable(status,table,hide_title=0) tr td= row.game_id unless hide_title - td.w: a(href="/info/"+row.title_id)= row.title_name + td.w: a(href="/"+row.title_id)= row.title_name td.w= row.scenario td!= row.player_names td= row.description @@ -76,15 +76,16 @@ mixin gametable(status,table,hide_title=0) td.command if status === 0 a(href="/join/"+row.game_id) Join - else - - let cmd = status === 1 ? "Play" : "View" + else if status === 1 if row.is_yours if row.is_shared - a(href="/join/"+row.game_id)= cmd + a(href="/join/"+row.game_id)= "Play" else - a(href=`/${row.title_id}/play:${row.game_id}:${row.your_role}`)= cmd + a(href=`/${row.title_id}/play:${row.game_id}:${row.your_role}`)= "Play" else a(href=`/${row.title_id}/play:${row.game_id}`) View + else if status >= 2 + a(href=`/${row.title_id}/replay:${row.game_id}`) View else tr case status -- cgit v1.2.3