aboutsummaryrefslogtreecommitdiff
path: root/server/src/entity/customers.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2026-01-10 17:16:03 +0100
committertpart <tpart120@proton.me>2026-02-26 20:48:35 +0100
commitb634bad931f530ee0a207e1461ffc5e52ebb83e3 (patch)
tree90a45e8c67e6a7c66e49c7409f0c37881eade96e /server/src/entity/customers.rs
parent0ed9e8387a66b3af78412feea62fdc8b9804f793 (diff)
downloadhurrycurry-b634bad931f530ee0a207e1461ffc5e52ebb83e3.tar
hurrycurry-b634bad931f530ee0a207e1461ffc5e52ebb83e3.tar.bz2
hurrycurry-b634bad931f530ee0a207e1461ffc5e52ebb83e3.tar.zst
compiles with tile stacks
Diffstat (limited to 'server/src/entity/customers.rs')
-rw-r--r--server/src/entity/customers.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/server/src/entity/customers.rs b/server/src/entity/customers.rs
index c1bfb525..2e2f82af 100644
--- a/server/src/entity/customers.rs
+++ b/server/src/entity/customers.rs
@@ -20,7 +20,7 @@ use crate::random_float;
use anyhow::Result;
use hurrycurry_bot::algos::Customer;
use hurrycurry_locale::TrError;
-use hurrycurry_protocol::{Character, PlayerClass};
+use hurrycurry_protocol::{Character, PlayerClass, TileIndex};
use std::random::random;
pub struct Customers {
@@ -47,10 +47,14 @@ impl Entity for Customers {
fn tick(&mut self, mut c: EntityContext) -> Result<(), TrError> {
let chairs = *self.chair_count.get_or_insert_with(|| {
c.game
- .tiles
- .values()
- .filter(|t| c.game.data.tile_name(t.kind) == "chair")
- .count()
+ .tile_index
+ .get(
+ &c.game
+ .data
+ .get_tile_by_name("chair")
+ .unwrap_or(TileIndex(0)),
+ )
+ .map_or(0, |c| c.len())
});
let max_count = (self.scaling_factor * chairs as f32).max(1.) as usize;