diff options
Diffstat (limited to 'planetwars-server/src/modules')
-rw-r--r-- | planetwars-server/src/modules/client_api.rs | 1 | ||||
-rw-r--r-- | planetwars-server/src/modules/matches.rs | 10 | ||||
-rw-r--r-- | planetwars-server/src/modules/ranking.rs | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/planetwars-server/src/modules/client_api.rs b/planetwars-server/src/modules/client_api.rs index 7026671..f960e1b 100644 --- a/planetwars-server/src/modules/client_api.rs +++ b/planetwars-server/src/modules/client_api.rs @@ -119,6 +119,7 @@ impl pb::client_api_service_server::ClientApiService for ClientApiServer { }); let run_match = RunMatch::from_players( self.runner_config.clone(), + false, vec![ MatchPlayer::BotSpec { spec: remote_bot_spec, 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 diff --git a/planetwars-server/src/modules/ranking.rs b/planetwars-server/src/modules/ranking.rs index cb699fe..dff3a72 100644 --- a/planetwars-server/src/modules/ranking.rs +++ b/planetwars-server/src/modules/ranking.rs @@ -53,7 +53,7 @@ async fn play_ranking_match( players.push(player); } - let (_, handle) = RunMatch::from_players(config, players) + let (_, handle) = RunMatch::from_players(config, true, players) .run(db_pool.clone()) .await .expect("failed to run match"); |