From 1d9ab02ff3c3e34dd67bd13b17c3acaa1334ccbc Mon Sep 17 00:00:00 2001 From: ntr Date: Wed, 5 Feb 2020 20:35:37 +1000 Subject: [PATCH 1/5] upkeep game id --- core/src/game.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/game.rs b/core/src/game.rs index 0140e7a2..cbeebe84 100644 --- a/core/src/game.rs +++ b/core/src/game.rs @@ -835,7 +835,7 @@ impl Game { return self; } - info!("upkeep game: {:} vs {:}", self.players[0].name, self.players[1].name); + info!("upkeep {:?} {:} vs {:}", self.id, self.players[0].name, self.players[1].name); for player in self.players.iter_mut() { if !player.ready { @@ -2348,7 +2348,7 @@ mod tests { game.new_resolve(Cast::new(target, player_id, target, Skill::Absorb)); assert!(game.construct_by_id(target).unwrap().affected(Effect::Absorb)); - + game.new_resolve(Cast::new(source, target_player_id, target, Skill::Silence)); assert!(game.construct_by_id(target).unwrap().affected(Effect::Silence)); assert!(game.construct_by_id(target).unwrap().affected(Effect::Absorption)); From c39cfba9701555a9031996ec5e397603347a7030 Mon Sep 17 00:00:00 2001 From: Mashy Date: Wed, 5 Feb 2020 20:37:17 +1000 Subject: [PATCH 2/5] fix aside scrollbar shit --- client/assets/styles/controls.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/assets/styles/controls.less b/client/assets/styles/controls.less index a5938475..e0fca483 100644 --- a/client/assets/styles/controls.less +++ b/client/assets/styles/controls.less @@ -27,7 +27,7 @@ aside { flex-flow: column;; } - grid-template-rows: min-content 3fr 3fr 1fr; + grid-template-rows: min-content 1fr 1fr min-content; grid-gap: 0.5em 0; } @@ -132,7 +132,7 @@ aside { .ready { flex: 1; - font-size: 200%; + font-size: 2.5em; } .quit { From 077b79e49fbd06866b81116b3896e75d232cb753 Mon Sep 17 00:00:00 2001 From: ntr Date: Thu, 6 Feb 2020 14:10:46 +1000 Subject: [PATCH 3/5] v1.14.1 --- VERSION | 2 +- acp/package.json | 2 +- client/package.json | 2 +- core/Cargo.toml | 2 +- ops/package.json | 2 +- server/Cargo.toml | 2 +- studios/package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index cd99d386..30f101cb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.14.0 \ No newline at end of file +1.14.1 \ No newline at end of file diff --git a/acp/package.json b/acp/package.json index 42d68b36..71b94753 100644 --- a/acp/package.json +++ b/acp/package.json @@ -1,6 +1,6 @@ { "name": "mnml-client", - "version": "1.14.0", + "version": "1.14.1", "description": "", "main": "index.js", "scripts": { diff --git a/client/package.json b/client/package.json index c603670b..6cbd9ae5 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "mnml-client", - "version": "1.14.0", + "version": "1.14.1", "description": "", "main": "index.js", "scripts": { diff --git a/core/Cargo.toml b/core/Cargo.toml index dc97bf1a..9b41f066 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mnml_core" -version = "1.14.0" +version = "1.14.1" authors = ["ntr ", "mashy "] [dependencies] diff --git a/ops/package.json b/ops/package.json index bd5b728b..21612bde 100644 --- a/ops/package.json +++ b/ops/package.json @@ -1,6 +1,6 @@ { "name": "mnml-ops", - "version": "1.14.0", + "version": "1.14.1", "description": "", "main": "index.js", "scripts": { diff --git a/server/Cargo.toml b/server/Cargo.toml index 01ca5d67..f8a489ed 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mnml" -version = "1.14.0" +version = "1.14.1" authors = ["ntr "] [dependencies] diff --git a/studios/package.json b/studios/package.json index 2bac12e1..0224a1f2 100644 --- a/studios/package.json +++ b/studios/package.json @@ -1,6 +1,6 @@ { "name": "mnml-studios", - "version": "1.14.0", + "version": "1.14.1", "description": "", "main": "index.js", "scripts": { From 36b5b5088b99fe46a32556ff4c2f28a4dc12c3c7 Mon Sep 17 00:00:00 2001 From: ntr Date: Thu, 6 Feb 2020 14:37:43 +1000 Subject: [PATCH 4/5] wrap invite copy navigator clipboard check --- client/src/events.jsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/events.jsx b/client/src/events.jsx index 72609eb0..6af704bd 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -166,9 +166,12 @@ function registerEvents(store) { function setInvite(code) { if (!code) return store.dispatch(actions.setInvite(null)); const link = `${document.location.origin}#join=${code}`; - navigator.clipboard.writeText(link).then(() => { - notify('Invite link copied to clipboard.'); - }, () => {}); + + if (navigator.clipboard) { + navigator.clipboard.writeText(link).then(() => { + notify('Invite link copied to clipboard.'); + }, () => {}); + } return store.dispatch(actions.setInvite(code)); } From 9ed191d9ae0f16449b9a707cf061b2c678b7d16d Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 10 Feb 2020 13:05:33 +1000 Subject: [PATCH 5/5] finish games when finishing idle instances --- core/src/game.rs | 2 +- server/src/warden.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/game.rs b/core/src/game.rs index cbeebe84..2ee6de59 100644 --- a/core/src/game.rs +++ b/core/src/game.rs @@ -804,7 +804,7 @@ impl Game { } } - fn finish(mut self) -> Game { + pub fn finish(mut self) -> Game { self.phase = Phase::Finished; // self.log.push(format!("Game finished.")); diff --git a/server/src/warden.rs b/server/src/warden.rs index 644e78db..33f6d712 100644 --- a/server/src/warden.rs +++ b/server/src/warden.rs @@ -13,6 +13,7 @@ use pg::{ PgPool, games_need_upkeep, + game_get, game_update, game_write, game_delete, @@ -157,6 +158,12 @@ fn fetch_instances(mut tx: Transaction) -> Result { } for mut instance in instances_idle(&mut tx)? { + if let Some(game_id) = instance.current_game_id() { + let mut game = game_get(&mut tx, game_id)?; + game = game.finish(); + game_update(&mut tx, &game)?; + } + instance.finish(); instance_update(&mut tx, instance)?; }