USER=rustcargo target/debug/otter --scope-server reset dummy --reset-table ~ian/Rustup/Game/server/demo/test.{table,game}.toml
generates what is now in save/
however, the server doesn't load it ?
+loading does not seem to work
+
+templates directory not found unless we symlink it
+
+
token in main url
client ? struct ?
instance struct
set_config(config);
};
- xxx_global_setup().expect("global setup failed");
-
let cl = CommandListener::new()?;
cl.spawn()?;
let kd : slotmap::KeyData = p.into();
VisiblePieceId(kd)
}
-
-pub fn xxx_gamestate_init() -> GameState {
- let mut pieces = DenseSlotMap::with_key();
- let mut gen = Generation(0);
- for (pos, p) in xxx_make_pieces().expect("make pieces") {
- let pr = PieceState {
- pos, p,
- face : 0.into(),
- held : None,
- lastclient : Default::default(),
- zlevel : ZLevel{ z: 0f64 .try_into().unwrap(), zg: gen },
- gen,
- gen_before_lastclient : Generation(0),
- };
- gen.increment();
- pieces.insert(pr);
- }
- GameState { table_size : DEFAULT_TABLE_SIZE,
- pieces, gen, players : Default::default(),
- max_z: ZCoord(0.),
- log : Default::default(), }
-}
toml::de::from_str("").expect("parse empty string as ServerConfig")
}
}
-
-// ========== ad-hoc and temporary ==========
-
-const XXX_PLAYERS_TOKENS : &[(&str, &str)] = &[
- ("kmqAKPwK4TfReFjMor8MJhdRPBcwIBpe", "alice"),
- ("ccg9kzoTh758QrVE1xMY7BQWB36dNJTx", "bob"),
-];
-
-#[throws(AE)]
-pub fn xxx_global_setup() {
- let gs = xxx_gamestate_init();
- let gref = Instance::new(InstanceName {
- scope: ManagementScope::Server,
- scoped_name: "dummy".to_string()
- }, gs)?;
- let mut g = gref.lock()?;
- for (token, nick) in XXX_PLAYERS_TOKENS {
- let player = g.player_new(PlayerState {
- nick : nick.to_string(),
- })?;
- g.player_access_register_fixed(player, RawToken(token.to_string()),
- Authorised::authorise())?;
- }
- g.save_access_now().unwrap();
-}
use serde::{Serialize,Deserialize};
use fehler::throws;
-use index_vec::{define_index_type,IndexVec,index_vec};
+use index_vec::{define_index_type,IndexVec};
use crate::gamestate::PieceSpec;
use std::fmt::Debug;
use implementation::PlayerAccessSpec;
}
}
}
-
-#[allow(clippy::type_complexity)]
-pub fn xxx_make_pieces() -> Result<Vec<(Pos, Box<dyn crate::gamestate::Piece>)>,crate::pieces::SVGProcessingError> {
- use crate::imports::*;
- Ok(vec![
- ([ 90, 80 ],
- piece_specs::Disc {
- diam : 20,
- faces : index_vec![ ColourSpec("red".to_string()), ColourSpec("grey".to_string()) ],
- }.load()?),
- ([ 90, 60 ],
- piece_specs::Square {
- size : vec![20],
- faces : index_vec![ ColourSpec("blue".to_string()), ColourSpec("grey".to_string()) ],
- }.load()?),
- ])
-}