aboutsummaryrefslogtreecommitdiff
path: root/server/src/entity/bot.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/entity/bot.rs')
-rw-r--r--server/src/entity/bot.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/src/entity/bot.rs b/server/src/entity/bot.rs
index 922cc55e..8d3994cb 100644
--- a/server/src/entity/bot.rs
+++ b/server/src/entity/bot.rs
@@ -18,7 +18,7 @@
use super::{Entity, EntityContext};
use anyhow::Result;
use hurrycurry_bot::{BotAlgo, DynBotAlgo};
-use hurrycurry_protocol::{Hand, PacketS, PlayerClass, PlayerID};
+use hurrycurry_protocol::{Character, Hand, PacketS, PlayerClass, PlayerID};
use log::info;
use rand::random;
use std::any::Any;
@@ -27,14 +27,14 @@ pub type DynBotDriver = BotDriver<DynBotAlgo>;
pub struct BotDriver<T> {
algo: T,
- join_data: Option<(String, i32, PlayerClass)>,
+ join_data: Option<(String, Character, PlayerClass)>,
id: PlayerID,
interacting: bool,
left: bool,
}
impl<T: BotAlgo> BotDriver<T> {
- pub fn new(name: String, character: i32, class: PlayerClass, algo: T) -> Self {
+ pub fn new(name: String, character: Character, class: PlayerClass, algo: T) -> Self {
Self {
algo,
id: PlayerID(0),
@@ -51,7 +51,7 @@ impl<T: BotAlgo + Any> Entity for BotDriver<T> {
fn tick(&mut self, c: EntityContext<'_>) -> Result<()> {
if let Some((name, character, class)) = self.join_data.take() {
self.id = PlayerID(random()); // TODO bad code, can collide
- info!("spawn {:?} ({name:?}, {character})", self.id);
+ info!("spawn {:?} ({name:?})", self.id);
c.packet_in.push_back(PacketS::Join {
name,
character,