From ac29473471d2553cfcb40141b4af7e866048228f Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 18 Mar 2019 22:16:49 +1100 Subject: [PATCH] mm invalid fix --- server/WORKLOG.md | 18 +----------------- server/src/cryp.rs | 3 --- server/src/game.rs | 12 +++++++++++- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/server/WORKLOG.md b/server/WORKLOG.md index 72bbd25d..2fde6f31 100644 --- a/server/WORKLOG.md +++ b/server/WORKLOG.md @@ -9,29 +9,13 @@ # WORK WORK ## NOW -combo specs - scoreboard - +cryp vbox constants - change to ownership pattern -round system for games - join instance - is pve? - add cryps to player - level bots every round - buy out vbox - find any combos - apply to random cryp - ## SOON -* clean up categories -* why is the text fucked? * iconography -* full svg buttons to not have to fuck around with text -* FAQ * aoe skills * combo skills diff --git a/server/src/cryp.rs b/server/src/cryp.rs index 69ef1de7..76407613 100644 --- a/server/src/cryp.rs +++ b/server/src/cryp.rs @@ -708,9 +708,6 @@ mod tests { cryp.apply_modifiers(&team_colours); - println!("{:?}", cryp.red_damage.value); - println!("{:?}", cryp.blue_damage.value); - assert_eq!(cryp.red_damage.value, cryp.red_damage.base + cryp.red_damage.base.pct(5)); assert_eq!(cryp.green_damage.value, cryp.green_damage.base + cryp.green_damage.base.pct(15)); assert_eq!(cryp.blue_damage.value, cryp.blue_damage.base + cryp.blue_damage.base.pct(20)); diff --git a/server/src/game.rs b/server/src/game.rs index fb774527..aca69a74 100644 --- a/server/src/game.rs +++ b/server/src/game.rs @@ -710,6 +710,10 @@ pub fn game_global_get(tx: &mut Transaction) -> Result { ); "; + let delete_query = " + DELETE from matchmaking; + "; + let result = tx .query(query, &[&Uuid::nil()])?; @@ -720,7 +724,13 @@ pub fn game_global_get(tx: &mut Transaction) -> Result { // tells from_slice to cast into a cryp let game_bytes: Vec = returned.get("data"); - let game = from_slice::(&game_bytes)?; + let game = match from_slice::(&game_bytes) { + Ok(g) => g, + Err(_) => { + tx.query(delete_query, &[])?; + return Err(err_msg("matchmaking game was invalid")) + } + }; return Ok(game); }