fix ready up clone

This commit is contained in:
ntr 2019-03-14 16:22:49 +11:00
parent 43775ea23d
commit 2eae21f12f
3 changed files with 7 additions and 8 deletions

View File

@ -9,7 +9,7 @@ const Combat = require('./combat');
function renderCryps() { function renderCryps() {
const config = { const config = {
type: Phaser.AUTO, type: Phaser.CANVAS,
// backgroundColor: '#181818', // backgroundColor: '#181818',
resolution: window.devicePixelRatio, resolution: window.devicePixelRatio,
scale: { scale: {

View File

@ -11,7 +11,6 @@
## NOW ## NOW
cost system for items cost system for items
be able to reclaim skills / specs from cryp be able to reclaim skills / specs from cryp
design / implement specs
combo specs combo specs
randomise skill speed randomise skill speed

View File

@ -85,7 +85,7 @@ impl Instance {
Ok(self) 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 { if self.phase != InstancePhase::Vbox {
return Err(err_msg("instance not in vbox phase")); return Err(err_msg("instance not in vbox phase"));
} }
@ -97,7 +97,7 @@ impl Instance {
player.set_ready(true); player.set_ready(true);
self.players[i] = player; self.players[i] = player.clone();
Ok(self) 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<Game, Error> { pub fn instance_ready(params: InstanceReadyParams, tx: &mut Transaction, account: &Account) -> Result<Game, Error> {
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 mut instance = instance_get(tx, params.instance_id)?;
let game_id = instance.current_round(&player).game_id; let game_id = instance.current_round(&player).game_id;
// attempting to re-ready // attempting to re-ready
// send game state // send game state
match instance.player_ready(player.clone()) { match instance.player_ready(&mut player) {
Ok(_) => (), Ok(_) => (),
Err(_) => return game_get(tx, game_id), Err(_) => return game_get(tx, game_id),
}; };
@ -524,8 +524,8 @@ mod tests {
instance.start(); instance.start();
assert_eq!(instance.rounds[0].len(), 8); assert_eq!(instance.rounds[0].len(), 8);
let player = instance.players.clone().into_iter().find(|p| p.account == player_id).unwrap(); let mut player = instance.players.clone().into_iter().find(|p| p.account == player_id).unwrap();
instance.player_ready(player).unwrap(); instance.player_ready(&mut player).unwrap();
assert!(instance.vbox_phase_finished()); assert!(instance.vbox_phase_finished());
instance.games_phase_start(); instance.games_phase_start();