diff options
| author | metamuffin <metamuffin@disroot.org> | 2025-10-20 00:20:25 +0200 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2025-10-20 00:20:25 +0200 |
| commit | 8961db68d063a2dda427e80601650e4674772685 (patch) | |
| tree | 5bff20f6f6965c2c93e41005850d10ef269d346f /server/src/server.rs | |
| parent | ab83f982601d93b2399102c4d030fd6e13c4c735 (diff) | |
| download | hurrycurry-8961db68d063a2dda427e80601650e4674772685.tar hurrycurry-8961db68d063a2dda427e80601650e4674772685.tar.bz2 hurrycurry-8961db68d063a2dda427e80601650e4674772685.tar.zst | |
tick perf logging
Diffstat (limited to 'server/src/server.rs')
| -rw-r--r-- | server/src/server.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/server/src/server.rs b/server/src/server.rs index 45f31e0b..f273564e 100644 --- a/server/src/server.rs +++ b/server/src/server.rs @@ -58,6 +58,7 @@ pub enum AnnounceState { } pub struct Server { + pub tick_perf: (Duration, usize), pub tx: Sender<PacketC>, pub connections: HashMap<ConnectionID, ConnectionData>, pub paused: bool, @@ -120,6 +121,7 @@ impl GameServerExt for Game { self.environment_effects.clear(); self.walkable.clear(); self.tile_index.clear(); + self.item_locations_index.clear(); } fn load( &mut self, @@ -161,6 +163,10 @@ impl GameServerExt for Game { if !self.data_index.tile_collide[tile.0] { self.walkable.insert(p); } + self.tile_index.entry(*tile).or_default().insert(p); + if item.is_some() { + self.item_locations_index.insert(ItemLocation::Tile(p)); + } } for (id, (name, character, class)) in players { self.join_player(id, name, character, class, serverdata, None, None); @@ -309,6 +315,7 @@ impl Server { pub fn new(data_path: PathBuf, tx: Sender<PacketC>) -> Result<Self> { Ok(Self { game: Game::default(), + tick_perf: (Duration::ZERO, 0), index: DataIndex::new(data_path).context("Failed to load data index")?, tx, announce_state: AnnounceState::Done, |