use crate::imports::*;
+use parking_lot::{RwLock, const_rwlock};
+
#[derive(Debug,Clone,Deserialize,Serialize)]
#[derive(Eq,PartialEq,Ord,PartialOrd,Hash)]
pub enum AccountScope {
ScopedName { scope, scoped_name }
}
}
+
+#[deerive(Serialize,Deserialize)]
+pub struct AccountRecord {
+ pub nick: String,
+ pub timezone: String,
+ pub access: Box<dyn PlayerAccessSpec>,
+}
+
+static ACCOUNTS : RwLock<Option<HashMap<AccountName, AccountRecord>>>
+ = const_rwlock_new(None);
pub struct GameState {
pub table_size : Pos,
pub pieces : Pieces,
- pub players : PlayerMap,
pub gen : Generation,
pub log : VecDeque<(Generation, Arc<CommittedLogEntry>)>,
pub max_z : ZCoord,
+ pub players : DenseSlotMap<PlayerId, AccountName>>,
}
#[derive(Debug,Serialize,Deserialize)]
pub gen_before_lastclient : Generation,
}
-pub type PlayerMap = DenseSlotMap<PlayerId,PlayerState>;
-
#[derive(Debug,Clone,Serialize,Deserialize)]
pub struct PlayerState {
- pub nick : String,
}
#[derive(Debug,Serialize,Deserialize)]
pub gs : GameState,
pub pieces : PiecesLoaded,
pub clients : DenseSlotMap<ClientId,Client>,
- pub updates : SecondarySlotMap<PlayerId, PlayerUpdates>,
+ pub players : SecondarySlotMap<PlayerId, PlayerRecord>,
pub tokens_players : TokenRegistry<PlayerId>,
pub tokens_clients : TokenRegistry<ClientId>,
}
+pub struct PlayerRecord {
+ pub u: PlayerUpdates,
+ pub st: PlayerState,
+}
+
+pub struct PlayerState {
+ pub account: AccountName,
+ pub nick: String,
+ pub tz: Timezone,
+}
+
#[derive(Debug,Serialize,Deserialize)]
#[serde(transparent)]
pub struct PiecesLoaded (ActualPiecesLoaded);
pub struct PlayerUpdates {
log : PlayerUpdatesLog,
cv : Arc<Condvar>,
- pub tz: Timezone,
}
#[derive(Debug)]