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/map/mod.rs | 4 ++++ src/client/map/room_mark.rs | 6 ++++++ 2 files changed, 10 insertions(+) (limited to 'src/client/map') diff --git a/src/client/map/mod.rs b/src/client/map/mod.rs index 27cafc4..9589e59 100644 --- a/src/client/map/mod.rs +++ b/src/client/map/mod.rs @@ -166,6 +166,10 @@ impl Map { pub fn rooms(&self) -> &StableVec { &self.rooms } + /// Get a room with the given id mutably, in case it exists. + pub fn get_room_mut(&mut self, id: usize) -> Option<&mut RoomMark> { + self.rooms.get_mut(id) + } /// Get the walls of this map. pub fn walls(&self) -> &StableVec { diff --git a/src/client/map/room_mark.rs b/src/client/map/room_mark.rs index a9777fb..5c0ca98 100644 --- a/src/client/map/room_mark.rs +++ b/src/client/map/room_mark.rs @@ -29,6 +29,12 @@ impl RoomMark { } } + /// Replace the room this mark describes with the new room. + pub fn set_room(&mut self, room: Room) { + self.room = room; + self.retriangulate(); + } + /* When the internal polygon changes, it must be retriangulated to be drawn on the screen * properly, so this function must be called any time that happens. */ -- cgit v1.2.3-70-g09d2