diff --git a/client/src/components/game.component.jsx b/client/src/components/game.component.jsx
index 338f6121..ae6bf0b8 100644
--- a/client/src/components/game.component.jsx
+++ b/client/src/components/game.component.jsx
@@ -73,14 +73,14 @@ function GamePanel(props) {
);
function findCryp(id) {
- const team = game.teams.find(t => t.cryps.find(c => c.id === id));
+ const team = game.players.find(t => t.cryps.find(c => c.id === id));
if (team) return team.cryps.find(c => c.id === id);
return null;
}
- const otherTeams = game.teams.filter(t => t.id !== account.id);
+ const otherTeams = game.players.filter(t => t.id !== account.id);
- const playerTeam = game.teams.find(t => t.id === account.id);
+ const playerTeam = game.players.find(t => t.id === account.id);
function stackElement(c, i) {
let skills = game.stack.filter(s => s.source_cryp_id === c.id).map((s, j) => {
diff --git a/client/src/components/menu.component.jsx b/client/src/components/menu.component.jsx
index 0e5177dd..b05c7acd 100644
--- a/client/src/components/menu.component.jsx
+++ b/client/src/components/menu.component.jsx
@@ -58,14 +58,14 @@ function Menu(args) {
const instanceJoinHidden = !selectedCryps.every(c => !!c);
- const mmSet = (
-
- );
+ // const mmSet = (
+ //
+ // );
return (
@@ -85,7 +85,6 @@ function Menu(args) {
- {mmSet}
);
}
diff --git a/server/src/game.rs b/server/src/game.rs
index d1b88f8f..2dfd5755 100644
--- a/server/src/game.rs
+++ b/server/src/game.rs
@@ -692,89 +692,89 @@ pub fn game_delete(tx: &mut Transaction, id: Uuid) -> Result<(), Error> {
return Ok(());
}
-pub fn game_global_startup(tx: &mut Transaction) -> Result<(), Error> {
- if game_global_get(tx).is_ok() {
- println!("global mm game exists");
- return Ok(());
- }
+// pub fn game_global_startup(tx: &mut Transaction) -> Result<(), Error> {
+// if game_global_get(tx).is_ok() {
+// println!("global mm game exists");
+// return Ok(());
+// }
- let mut game = Game::new();
+// let mut game = Game::new();
- game
- .set_player_num(2)
- .set_player_cryps(3)
- .set_mode(GameMode::Pvp);
+// game
+// .set_player_num(2)
+// .set_player_cryps(3)
+// .set_mode(GameMode::Pvp);
- game_write(tx, &game)?;
+// game_write(tx, &game)?;
- let query = "
- INSERT INTO matchmaking (id, game)
- VALUES ($1, $2)
- RETURNING id;
- ";
+// let query = "
+// INSERT INTO matchmaking (id, game)
+// VALUES ($1, $2)
+// RETURNING id;
+// ";
- let result = tx
- .query(query, &[&Uuid::nil(), &game.id])?;
+// let result = tx
+// .query(query, &[&Uuid::nil(), &game.id])?;
- result.iter().next().ok_or(format_err!("no game written"))?;
+// result.iter().next().ok_or(format_err!("no game written"))?;
- println!("{:} wrote global mm startup", game.id);
+// println!("{:} wrote global mm startup", game.id);
- return Ok(());
-}
+// return Ok(());
+// }
-pub fn game_global_set(tx: &mut Transaction, game: &Game) -> Result<(), Error> {
- let query = "
- UPDATE matchmaking
- SET game = $1
- WHERE id = $2
- RETURNING id, game;
- ";
+// pub fn game_global_set(tx: &mut Transaction, game: &Game) -> Result<(), Error> {
+// let query = "
+// UPDATE matchmaking
+// SET game = $1
+// WHERE id = $2
+// RETURNING id, game;
+// ";
- let result = tx
- .query(query, &[&game.id, &Uuid::nil()])?;
+// let result = tx
+// .query(query, &[&game.id, &Uuid::nil()])?;
- result.iter()
- .next()
- .ok_or(err_msg("could not set global game mm"))?;
+// result.iter()
+// .next()
+// .ok_or(err_msg("could not set global game mm"))?;
- return Ok(());
-}
+// return Ok(());
+// }
-pub fn game_global_get(tx: &mut Transaction) -> Result {
- let query = "
- SELECT * from games
- WHERE id = (
- SELECT game
- FROM matchmaking
- WHERE id = $1
- );
- ";
+// pub fn game_global_get(tx: &mut Transaction) -> Result {
+// let query = "
+// SELECT * from games
+// WHERE id = (
+// SELECT game
+// FROM matchmaking
+// WHERE id = $1
+// );
+// ";
- let delete_query = "
- DELETE from matchmaking;
- ";
+// let delete_query = "
+// DELETE from matchmaking;
+// ";
- let result = tx
- .query(query, &[&Uuid::nil()])?;
+// let result = tx
+// .query(query, &[&Uuid::nil()])?;
- let returned = match result.iter().next() {
- Some(row) => row,
- None => return Err(err_msg("game not found")),
- };
+// let returned = match result.iter().next() {
+// Some(row) => row,
+// None => return Err(err_msg("game not found")),
+// };
- // tells from_slice to cast into a cryp
- let game_bytes: Vec = returned.get("data");
- let game = match from_slice::(&game_bytes) {
- Ok(g) => g,
- Err(_) => {
- tx.query(delete_query, &[])?;
- return Err(err_msg("matchmaking game was invalid"))
- }
- };
+// // tells from_slice to cast into a cryp
+// let game_bytes: Vec = returned.get("data");
+// 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);
-}
+// return Ok(game);
+// }
pub fn game_update(tx: &mut Transaction, game: &Game) -> Result<(), Error> {
diff --git a/server/src/instance.rs b/server/src/instance.rs
index e483c886..6c732f1f 100644
--- a/server/src/instance.rs
+++ b/server/src/instance.rs
@@ -14,7 +14,7 @@ use account::Account;
use player::{Player, player_create, player_get, player_global_update};
use cryp::{Cryp, cryp_get};
use mob::{instance_mobs};
-use game::{Game, Phase, game_get, game_write, game_instance_new, game_instance_join, game_global_get, game_global_set};
+use game::{Game, Phase, game_get, game_write, game_instance_new, game_instance_join};
use vbox::{Var};
use rpc::{RpcResult};
use names::{name};
@@ -612,26 +612,26 @@ pub fn instance_join(params: InstanceJoinParams, tx: &mut Transaction, account:
instance_update(tx, instance)
}
-pub fn instance_ready_global(tx: &mut Transaction, _account: &Account, player: Player) -> Result {
- // get the game
- let game = match game_global_get(tx) {
- Ok(g) => {
- println!("received global game {:?}", g.id);
- // if there is one try to join
- match game_instance_join(tx, player.clone(), g.id) {
- Ok(g) => g,
- // if fails make a new one
- Err(_e) => game_instance_new(tx, vec![player], Uuid::new_v4(), Uuid::nil())?,
- }
- },
- // if not found make a new one
- Err(_) => game_instance_new(tx, vec![player], Uuid::new_v4(), Uuid::nil())?,
- };
+// pub fn instance_ready_global(tx: &mut Transaction, _account: &Account, player: Player) -> Result {
+// // get the game
+// let game = match game_global_get(tx) {
+// Ok(g) => {
+// println!("received global game {:?}", g.id);
+// // if there is one try to join
+// match game_instance_join(tx, player.clone(), g.id) {
+// Ok(g) => g,
+// // if fails make a new one
+// Err(_e) => game_instance_new(tx, vec![player], Uuid::new_v4(), Uuid::nil())?,
+// }
+// },
+// // if not found make a new one
+// Err(_) => game_instance_new(tx, vec![player], Uuid::new_v4(), Uuid::nil())?,
+// };
- // set the current game
- game_global_set(tx, &game)?;
- Ok(game)
-}
+// // set the current game
+// game_global_set(tx, &game)?;
+// Ok(game)
+// }
pub fn instance_ready(params: InstanceReadyParams, tx: &mut Transaction, account: &Account) -> Result {
let mut instance = instance_get(tx, params.instance_id)?;
diff --git a/server/src/util.rs b/server/src/util.rs
index 89a20b4a..f278ae2c 100644
--- a/server/src/util.rs
+++ b/server/src/util.rs
@@ -2,14 +2,14 @@ use net::Db;
// Db Commons
use failure::Error;
-use game::{game_global_startup};
+// use game::{game_global_startup};
pub fn startup(db: Db) -> Result<(), Error> {
let mut tx = db.transaction()?;
println!("running startup fns");
- game_global_startup(&mut tx)?;
+ // game_global_startup(&mut tx)?;
match tx.commit() {
Ok(_) => {