summaryrefslogtreecommitdiff
path: root/server/bot/src/algos/simple.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-12-25 19:37:20 +0100
committermetamuffin <metamuffin@disroot.org>2024-12-25 20:01:43 +0100
commit4083df5cfe76e42506c5356cf23d3dc9f3b6e6bf (patch)
tree5ec12de003c38f0891c215721593c7ea49ff2c16 /server/bot/src/algos/simple.rs
parent15be00667282a253fb438fec9d6347f5af89d9a0 (diff)
downloadhurrycurry-4083df5cfe76e42506c5356cf23d3dc9f3b6e6bf.tar
hurrycurry-4083df5cfe76e42506c5356cf23d3dc9f3b6e6bf.tar.bz2
hurrycurry-4083df5cfe76e42506c5356cf23d3dc9f3b6e6bf.tar.zst
variable hand count
Diffstat (limited to 'server/bot/src/algos/simple.rs')
-rw-r--r--server/bot/src/algos/simple.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/server/bot/src/algos/simple.rs b/server/bot/src/algos/simple.rs
index 5a7e61a0..452f59d3 100644
--- a/server/bot/src/algos/simple.rs
+++ b/server/bot/src/algos/simple.rs
@@ -21,7 +21,7 @@ use crate::{
};
use hurrycurry_client_lib::Game;
use hurrycurry_protocol::{
- glam::IVec2, Hand, ItemIndex, Message, PlayerID, Recipe, RecipeIndex, TileIndex,
+ glam::IVec2, ItemIndex, Message, PlayerID, Recipe, RecipeIndex, TileIndex,
};
use log::{debug, warn};
@@ -106,17 +106,16 @@ impl State for Simple {
impl<S> Context<'_, S> {
pub fn is_hand_item(&self, item: ItemIndex) -> bool {
- self.game.players.get(&self.me).is_some_and(|p| {
- p.items[Hand::Left.index()]
- .as_ref()
- .is_some_and(|i| i.kind == item)
- })
+ self.game
+ .players
+ .get(&self.me)
+ .is_some_and(|p| p.items[0].as_ref().is_some_and(|i| i.kind == item))
}
pub fn is_hand_occupied(&self) -> bool {
self.game
.players
.get(&self.me)
- .map(|p| p.items[Hand::Left.index()].is_some())
+ .map(|p| p.items[0].is_some())
.unwrap_or(false)
}
pub fn find_demand(&self) -> Option<(ItemIndex, IVec2)> {