aboutsummaryrefslogtreecommitdiff
path: root/src/client/editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/editor.rs')
-rw-r--r--src/client/editor.rs17
1 files changed, 17 insertions, 0 deletions
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) {