From 06e6888dbc9fbed1c5dee2ab8fb777f095784ee2 Mon Sep 17 00:00:00 2001 From: jake Date: Sat, 18 Jan 2020 23:49:15 -0800 Subject: [PATCH] save room name as string --- src/ship/room.rs | 4 ++-- src/ship/ship.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ship/room.rs b/src/ship/room.rs index 7f693c9..d67c963 100644 --- a/src/ship/room.rs +++ b/src/ship/room.rs @@ -94,7 +94,7 @@ pub enum RoomMode { #[derive(Debug)] pub struct RoomState { mode: RoomMode, - pub name: [u16; 16], + pub name: String, password: [u16; 16], pub maps: [u32; 0x20], // drop_table @@ -140,7 +140,7 @@ impl RoomState { Ok(RoomState { mode: room_mode, - name: create_room.name, + name: String::from_utf16_lossy(&create_room.name), password: create_room.password, maps: [0; 0x20], }) diff --git a/src/ship/ship.rs b/src/ship/ship.rs index 33df6ce..a6196b0 100644 --- a/src/ship/ship.rs +++ b/src/ship/ship.rs @@ -397,7 +397,7 @@ impl ShipServerState { fn room_name_request(&mut self, id: ClientId) -> Box> { let area = self.client_location.get_area_by_user(id); let room_state = self.rooms[area.id()].as_ref().unwrap(); - Box::new(vec![(id, SendShipPacket::RoomNameResponse(RoomNameResponse {name: String::from_utf16_lossy(&room_state.name)}))].into_iter()) + Box::new(vec![(id, SendShipPacket::RoomNameResponse(RoomNameResponse {name: room_state.name.clone()}))].into_iter()) } }