Browse Source

clippy

pull/139/head
jake 2 years ago
parent
commit
0c074e45ee
  1. 30
      src/entity/room.rs
  2. 1
      src/ship/items/actions.rs
  3. 4
      src/ship/items/tasks.rs
  4. 2
      src/ship/packet/handler/quest.rs
  5. 3
      src/ship/packet/handler/room.rs
  6. 4
      src/ship/room.rs
  7. 2
      src/ship/ship.rs

30
src/entity/room.rs

@ -2,7 +2,7 @@ use serde::{Serialize, Deserialize};
use crate::entity::character::{CharacterEntityId, SectionID};
use crate::ship::room::{Episode, Difficulty, RoomMode};
use crate::ship::room::{Episode, Difficulty};
#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash, PartialOrd, Ord, Serialize, Deserialize)]
@ -62,34 +62,6 @@ pub struct NewRoomEntity {
pub difficulty: Difficulty,
}
impl NewRoomEntity {
fn new(name: String, section_id: SectionID, mode: RoomMode) -> NewRoomEntity {
NewRoomEntity {
name: name,
section_id: section_id,
mode: match mode {
RoomMode::Single {..} => RoomEntityMode::Single,
RoomMode::Multi {..} => RoomEntityMode::Multi,
RoomMode::Challenge {..} => RoomEntityMode::Challenge,
RoomMode::Battle {..} => RoomEntityMode::Battle,
},
episode: match mode {
RoomMode::Single { episode, .. } => episode,
RoomMode::Multi { episode, ..} => episode ,
RoomMode::Challenge { episode, ..} => episode,
RoomMode::Battle { episode, ..} => episode,
},
difficulty: match mode {
RoomMode::Single { difficulty, .. } => difficulty,
RoomMode::Multi { difficulty, ..} => difficulty ,
RoomMode::Challenge {..} => Difficulty::Normal,
RoomMode::Battle { difficulty, ..} => difficulty,
},
}
}
}
#[derive(Debug, Copy, Clone, Serialize)]
pub enum RoomNote {
Create {

1
src/ship/items/actions.rs

@ -909,7 +909,6 @@ where
pub(super) fn convert_item_drop_to_floor_item<'a, EG, TR>(
character_id: CharacterEntityId,
item_drop: ItemDrop,
) -> impl Fn((ItemStateProxy, TR), ())
-> BoxFuture<'a, Result<((ItemStateProxy, TR), FloorItem), anyhow::Error>> + Clone

4
src/ship/items/tasks.rs

@ -477,7 +477,7 @@ where
entity_gateway.with_transaction(move |transaction| async move {
let item_state_proxy = ItemStateProxy::new(item_state.clone());
let ((item_state_proxy, transaction), floor_item) = ItemStateAction::default()
.act(actions::convert_item_drop_to_floor_item(character_id, item_drop))
.act(actions::convert_item_drop_to_floor_item(item_drop))
.act(actions::item_note_enemy_drop(character_id, room_id, monster_type))
.act(actions::add_item_to_local_floor(character_id))
.commit((item_state_proxy, transaction))
@ -501,7 +501,7 @@ where
entity_gateway.with_transaction(move |transaction| async move {
let item_state_proxy = ItemStateProxy::new(item_state.clone());
let ((item_state_proxy, transaction), floor_item) = ItemStateAction::default()
.act(actions::convert_item_drop_to_floor_item(character_id, item_drop))
.act(actions::convert_item_drop_to_floor_item(item_drop))
.act(actions::item_note_box_drop(character_id, room_id))
.act(actions::add_item_to_local_floor(character_id))
.commit((item_state_proxy, transaction))

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

@ -3,7 +3,7 @@ use futures::stream::{FuturesOrdered, StreamExt};
use libpso::packet::ship::*;
use crate::common::serverstate::ClientId;
use crate::ship::ship::{SendShipPacket, ShipError, Clients, ShipEvent};
use crate::ship::room::{Rooms, QuestCategoryType};
use crate::ship::room::Rooms;
use crate::ship::map::enemy::RareMonsterAppearTable;
use crate::ship::location::{ClientLocation};
use crate::ship::packet::builder::quest;

3
src/ship/packet/handler/room.rs

@ -9,7 +9,7 @@ use crate::common::serverstate::ClientId;
use crate::common::leveltable::LEVEL_TABLE;
use crate::entity::gateway::EntityGateway;
use crate::entity::character::SectionID;
use crate::entity::room::{RoomEntity, RoomEntityId, NewRoomEntity, RoomEntityMode, RoomNote};
use crate::entity::room::{NewRoomEntity, RoomEntityMode, RoomNote};
use crate::ship::drops::DropTable;
use crate::ship::ship::{SendShipPacket, Clients, ShipEvent};
use crate::ship::room::{Rooms, Episode, Difficulty, RoomState, RoomMode};
@ -124,6 +124,7 @@ pub async fn room_name_request(id: ClientId,
}
}
#[allow(clippy::too_many_arguments)]
pub async fn join_room<EG>(id: ClientId,
pkt: MenuSelect,
entity_gateway: &mut EG,

4
src/ship/room.rs

@ -1,6 +1,5 @@
use std::collections::HashMap;
use std::convert::{From, Into, TryFrom, TryInto};
use std::path::PathBuf;
use std::convert::{From, Into, TryFrom};
use async_std::sync::{Arc, RwLock, RwLockReadGuard};
use futures::future::BoxFuture;
use futures::stream::{FuturesOrdered, Stream};
@ -361,6 +360,7 @@ impl RoomState {
}
}
#[allow(clippy::too_many_arguments)]
pub fn new (room_id: RoomEntityId,
mode: RoomEntityMode,
episode: Episode,

2
src/ship/ship.rs

@ -859,7 +859,7 @@ impl<EG: EntityGateway + Clone> ServerState for ShipServerState<EG> {
let mut entity_gateway = self.entity_gateway.clone();
Box::pin(async move {
entity_gateway.add_room_note(room.room_id, RoomNote::PlayerJoin {
character_id: character_id,
character_id,
}).await
})}).await;
if neighbors.is_empty() {

Loading…
Cancel
Save