From f4134b1911d4cdf33cf0bc7ea169d76d8d7c8555 Mon Sep 17 00:00:00 2001 From: rasul Date: Tue, 7 Apr 2020 20:10:17 -0500 Subject: [PATCH] add player config section and move starting_location there with the other new player related configs --- src/config/config.rs | 4 ++-- src/config/mod.rs | 2 ++ src/config/player.rs | 28 ++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 src/config/player.rs diff --git a/src/config/config.rs b/src/config/config.rs index 12e21ba..e73574b 100644 --- a/src/config/config.rs +++ b/src/config/config.rs @@ -21,8 +21,8 @@ pub struct Config { /// Logging configuration pub logging: Logging, - /// Default starting location - pub starting_location: Id, + /// Player configuration + pub player: Player, } impl Config { diff --git a/src/config/mod.rs b/src/config/mod.rs index 72808cb..7c32e2b 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -4,9 +4,11 @@ mod config; mod logging; mod loglevel; +mod player; mod server; pub use config::Config; pub use logging::Logging; pub use loglevel::LogLevel; +pub use player::Player; pub use server::Server; diff --git a/src/config/player.rs b/src/config/player.rs new file mode 100644 index 0000000..c934824 --- /dev/null +++ b/src/config/player.rs @@ -0,0 +1,28 @@ +use serde_derive::Deserialize; + +use crate::id::Id; + +/// Player configuration +#[derive(Clone, Debug, Deserialize)] +pub struct Player { + /// Default starting location + pub starting_location: Id, + + /// Minimum length of player name + pub name_min: usize, + + /// Maximum length of player name + pub name_max: usize, + + /// Allowed characters in player name + pub name_chars: String, + + /// Minimum length of password + pub pass_min: usize, + + /// Maximum length of password + pub pass_max: usize, + + /// Allowed characters in password + pub pass_chars: String, +}