aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/modules/matches.rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-07-30 17:03:32 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-07-30 17:03:32 +0200
commitee5c67c092acc57a6ef2b8f7934ba827df43add6 (patch)
tree83d8ac11ed7335ac9d992b06bd26e2906aa2a671 /planetwars-server/src/modules/matches.rs
parent1d280c62e23cf1f52398c4fe11474fdde4aaa74c (diff)
downloadplanetwars.dev-ee5c67c092acc57a6ef2b8f7934ba827df43add6.tar.xz
planetwars.dev-ee5c67c092acc57a6ef2b8f7934ba827df43add6.zip
add is_public to matches
Diffstat (limited to 'planetwars-server/src/modules/matches.rs')
-rw-r--r--planetwars-server/src/modules/matches.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/planetwars-server/src/modules/matches.rs b/planetwars-server/src/modules/matches.rs
index 4f538ed..3826abd 100644
--- a/planetwars-server/src/modules/matches.rs
+++ b/planetwars-server/src/modules/matches.rs
@@ -17,6 +17,7 @@ pub struct RunMatch {
log_file_name: String,
players: Vec<MatchPlayer>,
config: Arc<GlobalConfig>,
+ is_public: bool,
}
pub enum MatchPlayer {
@@ -30,12 +31,18 @@ pub enum MatchPlayer {
}
impl RunMatch {
- pub fn from_players(config: Arc<GlobalConfig>, players: Vec<MatchPlayer>) -> Self {
+ // TODO: create a MatchParams struct
+ pub fn from_players(
+ config: Arc<GlobalConfig>,
+ is_public: bool,
+ players: Vec<MatchPlayer>,
+ ) -> Self {
let log_file_name = format!("{}.log", gen_alphanumeric(16));
RunMatch {
config,
log_file_name,
players,
+ is_public,
}
}
@@ -80,6 +87,7 @@ impl RunMatch {
let new_match_data = db::matches::NewMatch {
state: db::matches::MatchState::Playing,
log_path: &self.log_file_name,
+ is_public: self.is_public,
};
let new_match_players = self
.players