aboutsummaryrefslogtreecommitdiff
path: root/planetwars-cli/src/match_runner/mod.rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2021-12-28 14:57:41 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2021-12-28 14:57:41 +0100
commitdacc05a41b77bf2e86e27ac354db9b047c661a7d (patch)
tree3d71fa60ff3449f73ec8bb6066ae82733eb46ee4 /planetwars-cli/src/match_runner/mod.rs
parent5ca8dd4c842ee681ce81a6a7bbd5005cd5b98d3c (diff)
downloadplanetwars.dev-dacc05a41b77bf2e86e27ac354db9b047c661a7d.tar.xz
planetwars.dev-dacc05a41b77bf2e86e27ac354db9b047c661a7d.zip
refactor workspace code
Diffstat (limited to 'planetwars-cli/src/match_runner/mod.rs')
-rw-r--r--planetwars-cli/src/match_runner/mod.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/planetwars-cli/src/match_runner/mod.rs b/planetwars-cli/src/match_runner/mod.rs
index 50b7a3b..fdd02d5 100644
--- a/planetwars-cli/src/match_runner/mod.rs
+++ b/planetwars-cli/src/match_runner/mod.rs
@@ -12,7 +12,7 @@ use match_context::MatchCtx;
use planetwars_rules::PwConfig;
use serde::{Deserialize, Serialize};
-use crate::BotConfig;
+use crate::workspace::bot::WorkspaceBot;
use self::match_context::{EventBus, PlayerHandle};
@@ -20,7 +20,7 @@ pub struct MatchConfig {
pub map_name: String,
pub map_path: PathBuf,
pub log_path: PathBuf,
- pub players: Vec<MatchBot>,
+ pub players: Vec<MatchPlayer>,
}
#[derive(Serialize, Deserialize)]
@@ -35,9 +35,9 @@ pub struct PlayerInfo {
pub name: String,
}
-pub struct MatchBot {
+pub struct MatchPlayer {
pub name: String,
- pub bot_config: BotConfig,
+ pub bot: WorkspaceBot,
}
pub async fn run_match(config: MatchConfig) {
@@ -53,11 +53,11 @@ pub async fn run_match(config: MatchConfig) {
.players
.iter()
.enumerate()
- .map(|(player_id, bot)| {
+ .map(|(player_id, player)| {
let player_id = (player_id + 1) as u32;
let bot = bot_runner::Bot {
- working_dir: bot.bot_config.path.clone(),
- argv: bot.bot_config.argv.clone(),
+ working_dir: player.bot.path.clone(),
+ argv: player.bot.config.get_run_argv(),
};
let handle = bot_runner::run_local_bot(player_id, event_bus.clone(), bot);
(player_id, Box::new(handle) as Box<dyn PlayerHandle>)