aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-09-02 21:58:32 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-09-02 21:58:32 +0200
commit2fec5e4509aeb4520691bce57016707a399dffa6 (patch)
tree35e4c5b26bee2a0f99e982f790d9460f57d62525 /planetwars-server
parentd95eedcc83f8d07a49c25c5240beb8a0105d877a (diff)
downloadplanetwars.dev-2fec5e4509aeb4520691bce57016707a399dffa6.tar.xz
planetwars.dev-2fec5e4509aeb4520691bce57016707a399dffa6.zip
implement map selection in cli
Diffstat (limited to 'planetwars-server')
-rw-r--r--planetwars-server/src/modules/client_api.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/planetwars-server/src/modules/client_api.rs b/planetwars-server/src/modules/client_api.rs
index 0efc000..3402964 100644
--- a/planetwars-server/src/modules/client_api.rs
+++ b/planetwars-server/src/modules/client_api.rs
@@ -111,8 +111,11 @@ impl pb::client_api_service_server::ClientApiService for ClientApiServer {
db::bots::find_bot_with_version_by_name(&match_request.opponent_name, &conn)
.map_err(|_| Status::not_found("opponent not found"))?;
- // TODO: allow map as parameter here
- let map = db::maps::find_map_by_name(&"hex", &conn)
+ let map_name = match match_request.map_name.as_str() {
+ "" => "hex",
+ name => name,
+ };
+ let map = db::maps::find_map_by_name(map_name, &conn)
.map_err(|_| Status::not_found("map not found"))?;
let player_key = gen_alphanumeric(32);