Browse Source

lint src/ship/packet/builder/*

jake 4 years ago
committed by andy
parent
commit
4306830092
  1. 4
      src/ship/packet/builder/lobby.rs
  2. 4
      src/ship/packet/builder/message.rs
  3. 2
      src/ship/packet/builder/quest.rs
  4. 4
      src/ship/packet/builder/room.rs

4
src/ship/packet/builder/lobby.rs

@ -18,7 +18,7 @@ pub fn join_lobby(id: ClientId,
let playerinfo = lobby_clients.iter() let playerinfo = lobby_clients.iter()
.map(|area_client| { .map(|area_client| {
let client = clients.get(&area_client.client).ok_or(ShipError::ClientNotFound(area_client.client)).unwrap(); let client = clients.get(&area_client.client).ok_or(ShipError::ClientNotFound(area_client.client)).unwrap();
player_info(0x100, &client, area_client, item_manager, level_table)
player_info(0x100, client, area_client, item_manager, level_table)
}); });
let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id)).unwrap(); let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id)).unwrap();
@ -55,7 +55,7 @@ pub fn add_to_lobby(id: ClientId,
block: client.block as u16, block: client.block as u16,
event: 0, event: 0,
padding: 0, padding: 0,
playerinfo: player_info(0x100, &client, &area_client, item_manager, level_table),
playerinfo: player_info(0x100, client, &area_client, item_manager, level_table),
}) })
} }

4
src/ship/packet/builder/message.rs

@ -142,8 +142,8 @@ pub fn player_no_longer_has_item(area_client: AreaClient, item_id: ClientItemId,
} }
} }
pub fn shop_list<I: ShopItem>(shop_type: u8, items: &Vec<I>) -> ShopList {
let items = items.into_iter()
pub fn shop_list<I: ShopItem>(shop_type: u8, items: &[I]) -> ShopList {
let items = items.iter()
.enumerate() .enumerate()
.map(|(i, item)| { .map(|(i, item)| {
ShopListItem { ShopListItem {

2
src/ship/packet/builder/quest.rs

@ -22,7 +22,7 @@ pub fn quest_category_list(quests: &QuestList) -> QuestCategoryList {
} }
} }
pub fn quest_list(category_id: u32, quests: &Vec<Quest>) -> QuestOptionList {
pub fn quest_list(category_id: u32, quests: &[Quest]) -> QuestOptionList {
let quest_entries = quests.iter() let quest_entries = quests.iter()
.map(|quest| { .map(|quest| {
QuestEntry { QuestEntry {

4
src/ship/packet/builder/room.rs

@ -20,7 +20,7 @@ pub fn join_room(id: ClientId,
let header_client = clients.get(&c.client).ok_or(ShipError::ClientNotFound(id))?; let header_client = clients.get(&c.client).ok_or(ShipError::ClientNotFound(id))?;
let header_area_client = client_location.get_local_client(id).map_err(|err| -> ClientLocationError { err.into() })?; let header_area_client = client_location.get_local_client(id).map_err(|err| -> ClientLocationError { err.into() })?;
acc.map(|mut a| { acc.map(|mut a| {
a[i] = player_header(0x10000, &header_client, &header_area_client);
a[i] = player_header(0x10000, header_client, &header_area_client);
a a
}) })
})?; })?;
@ -67,7 +67,7 @@ pub fn add_to_room(_id: ClientId,
block: 0, block: 0,
event: 0, event: 0,
padding: 0, padding: 0,
playerinfo: player_info(0x10000, client, &area_client, item_manager, level_table),
playerinfo: player_info(0x10000, client, area_client, item_manager, level_table),
}) })
} }
Loading…
Cancel
Save