Browse Source

save room name as string

pbs
jake 5 years ago
parent
commit
06e6888dbc
  1. 4
      src/ship/room.rs
  2. 2
      src/ship/ship.rs

4
src/ship/room.rs

@ -94,7 +94,7 @@ pub enum RoomMode {
#[derive(Debug)] #[derive(Debug)]
pub struct RoomState { pub struct RoomState {
mode: RoomMode, mode: RoomMode,
pub name: [u16; 16],
pub name: String,
password: [u16; 16], password: [u16; 16],
pub maps: [u32; 0x20], pub maps: [u32; 0x20],
// drop_table // drop_table
@ -140,7 +140,7 @@ impl RoomState {
Ok(RoomState { Ok(RoomState {
mode: room_mode, mode: room_mode,
name: create_room.name,
name: String::from_utf16_lossy(&create_room.name),
password: create_room.password, password: create_room.password,
maps: [0; 0x20], maps: [0; 0x20],
}) })

2
src/ship/ship.rs

@ -397,7 +397,7 @@ impl<EG: EntityGateway> ShipServerState<EG> {
fn room_name_request(&mut self, id: ClientId) -> Box<dyn Iterator<Item = (ClientId, SendShipPacket)>> { fn room_name_request(&mut self, id: ClientId) -> Box<dyn Iterator<Item = (ClientId, SendShipPacket)>> {
let area = self.client_location.get_area_by_user(id); let area = self.client_location.get_area_by_user(id);
let room_state = self.rooms[area.id()].as_ref().unwrap(); 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())
} }
} }

Loading…
Cancel
Save