From 484f9c2eb2704b1c699c91ff9460ef42c4456787 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 22 Aug 2020 23:35:57 +0100 Subject: [PATCH] switch to results of otter reset 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 ? --- TODO | 5 +++++ save/g-dummy | Bin 658 -> 771 bytes src/bin/server.rs | 2 -- src/gamestate.rs | 22 ---------------------- src/global.rs | 25 ------------------------- src/spec.rs | 19 +------------------ 6 files changed, 6 insertions(+), 67 deletions(-) diff --git a/TODO b/TODO index d6a35fce..892c6a38 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,8 @@ +loading does not seem to work + +templates directory not found unless we symlink it + + token in main url client ? struct ? instance struct diff --git a/save/g-dummy b/save/g-dummy index 74968de25a83683d36a0f7062c8fac57730119fb..706272524b9c3f7bf5727edd4f9e5b3a9e82ba85 100644 GIT binary patch delta 192 zcmbQl+RP@U%V^VlbUWVD!U#<&Wr zOiwxc;+*{SNt2ixmt>UW=G;^d$w*a5OH9tp$t+1M$uCmSC`#2#&d*EBOfM};O;IQT YN~b60rcPofQNz;Q#EST;(=g`&0Hsq#bN~PV delta 77 zcmZo>o5af4I#J+_AOjREs!C^AoSvG;Fp0@xvMb{%WC=!)1mh&89#N*nIr-@mmgXi_ K#8;h$X$1iCdlRAn diff --git a/src/bin/server.rs b/src/bin/server.rs index e014a764..03c55031 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -81,8 +81,6 @@ fn main() { set_config(config); }; - xxx_global_setup().expect("global setup failed"); - let cl = CommandListener::new()?; cl.spawn()?; diff --git a/src/gamestate.rs b/src/gamestate.rs index 73d03025..178c4381 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -192,25 +192,3 @@ pub fn make_pieceid_visible(p : PieceId) -> VisiblePieceId { 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(), } -} diff --git a/src/global.rs b/src/global.rs index 8ef6eca8..b6d2a9c6 100644 --- a/src/global.rs +++ b/src/global.rs @@ -818,28 +818,3 @@ impl Default for ServerConfig { 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(); -} diff --git a/src/spec.rs b/src/spec.rs index e06f7a25..cbbe7ca0 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -2,7 +2,7 @@ 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; @@ -133,20 +133,3 @@ mod implementation { } } } - -#[allow(clippy::type_complexity)] -pub fn xxx_make_pieces() -> Result)>,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()?), - ]) -} -- 2.30.2