From 9ab689527b3ede7750579b1a926cf0cf88813463 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Wed, 3 Feb 2021 16:26:59 +0100 Subject: Add capability to draw rooms --- src/client/editor.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/client/editor.rs') diff --git a/src/client/editor.rs b/src/client/editor.rs index 0fb5794..e416339 100644 --- a/src/client/editor.rs +++ b/src/client/editor.rs @@ -127,6 +127,8 @@ impl Editor { snapper: &Snapper, input: &mut Input, ) { + self.poll_net(); + // Handle keybindings for tool change for (&tool_type, (_, activation_bind)) in self.tools.iter() { if input.poll_global(&activation_bind) { @@ -163,6 +165,21 @@ impl Editor { active_tool.handle_custom_bindings(&mut self.map, &self.server, input); } + fn poll_net(&mut self) { + while let Some(cargo) = self.server().next_packet() { + match cargo { + Cargo::SetRoom((id, new_room)) => { + if let Some(mark) = self.map.get_room_mut(id) { + mark.set_room(new_room); + } else { + self.map.add_room(id, new_room); + } + } + other => error!("Unknown packet received: {:?}", other), + } + } + } + /// Draw all tools and in case of the active tool also what is currently being edited by it, if /// that exists. pub fn draw_tools(&self, rld: &mut RaylibDrawHandle, transform: &Transform) { -- cgit v1.2.3-70-g09d2