mm invalid fix

This commit is contained in:
ntr 2019-03-18 22:16:49 +11:00
parent d19391ea27
commit ac29473471
3 changed files with 12 additions and 21 deletions

View File

@ -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

View File

@ -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));

View File

@ -710,6 +710,10 @@ pub fn game_global_get(tx: &mut Transaction) -> Result<Game, Error> {
);
";
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<Game, Error> {
// tells from_slice to cast into a cryp
let game_bytes: Vec<u8> = returned.get("data");
let game = from_slice::<Game>(&game_bytes)?;
let game = match from_slice::<Game>(&game_bytes) {
Ok(g) => g,
Err(_) => {
tx.query(delete_query, &[])?;
return Err(err_msg("matchmaking game was invalid"))
}
};
return Ok(game);
}