From 2eae21f12f763d16686ee3f7f7553640e90ecc29 Mon Sep 17 00:00:00 2001 From: ntr Date: Thu, 14 Mar 2019 16:22:49 +1100 Subject: [PATCH] fix ready up clone --- client/src/scenes/cryps.js | 2 +- server/WORKLOG.md | 1 - server/src/instance.rs | 12 ++++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/client/src/scenes/cryps.js b/client/src/scenes/cryps.js index 04c286d6..b63c0512 100644 --- a/client/src/scenes/cryps.js +++ b/client/src/scenes/cryps.js @@ -9,7 +9,7 @@ const Combat = require('./combat'); function renderCryps() { const config = { - type: Phaser.AUTO, + type: Phaser.CANVAS, // backgroundColor: '#181818', resolution: window.devicePixelRatio, scale: { diff --git a/server/WORKLOG.md b/server/WORKLOG.md index c9ed473a..b6a7f6a4 100644 --- a/server/WORKLOG.md +++ b/server/WORKLOG.md @@ -11,7 +11,6 @@ ## NOW cost system for items be able to reclaim skills / specs from cryp -design / implement specs combo specs randomise skill speed diff --git a/server/src/instance.rs b/server/src/instance.rs index 3794834e..896bb2ca 100644 --- a/server/src/instance.rs +++ b/server/src/instance.rs @@ -85,7 +85,7 @@ impl Instance { Ok(self) } - fn player_ready(&mut self, mut player: Player) -> Result<&mut Instance, Error> { + fn player_ready(&mut self, player: &mut Player) -> Result<&mut Instance, Error> { if self.phase != InstancePhase::Vbox { return Err(err_msg("instance not in vbox phase")); } @@ -97,7 +97,7 @@ impl Instance { player.set_ready(true); - self.players[i] = player; + self.players[i] = player.clone(); Ok(self) } @@ -416,14 +416,14 @@ pub fn instance_join(params: InstanceJoinParams, tx: &mut Transaction, account: } pub fn instance_ready(params: InstanceReadyParams, tx: &mut Transaction, account: &Account) -> Result { - let player = player_get(tx, account.id, params.instance_id)?; + let mut player = player_get(tx, account.id, params.instance_id)?; let mut instance = instance_get(tx, params.instance_id)?; let game_id = instance.current_round(&player).game_id; // attempting to re-ready // send game state - match instance.player_ready(player.clone()) { + match instance.player_ready(&mut player) { Ok(_) => (), Err(_) => return game_get(tx, game_id), }; @@ -524,8 +524,8 @@ mod tests { instance.start(); assert_eq!(instance.rounds[0].len(), 8); - let player = instance.players.clone().into_iter().find(|p| p.account == player_id).unwrap(); - instance.player_ready(player).unwrap(); + let mut player = instance.players.clone().into_iter().find(|p| p.account == player_id).unwrap(); + instance.player_ready(&mut player).unwrap(); assert!(instance.vbox_phase_finished()); instance.games_phase_start();