aboutsummaryrefslogtreecommitdiff
path: root/server/src/server.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/server.rs')
-rw-r--r--server/src/server.rs7
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,