Browse Source

put proper error strings on this struct

pull/113/head
jake 2 years ago
parent
commit
5b9ae1e9cc
  1. 35
      src/ship/ship.rs

35
src/ship/ship.rs

@ -41,41 +41,66 @@ pub type Rooms = [Option<room::RoomState>; MAX_ROOMS];
pub type Clients = HashMap<ClientId, ClientState>;
#[derive(Error, Debug)]
#[error("shiperror {0:?}")]
pub enum ShipError {
#[error("client not found {0}")]
ClientNotFound(ClientId),
#[error("no character in slot {0} {1}")]
NoCharacterInSlot(ClientId, u32),
#[error("invalid slot {0} {1}")]
InvalidSlot(ClientId, u32),
#[error("")]
#[error("too many clients")]
TooManyClients,
#[error("client error location {0}")]
ClientLocationError(#[from] ClientLocationError),
#[error("get neighbor error {0}")]
GetNeighborError(#[from] GetNeighborError),
#[error("get clients error {0}")]
GetClientsError(#[from] GetClientsError),
#[error("get area error {0}")]
GetAreaError(#[from] GetAreaError),
#[error("maps error {0}")]
MapsError(#[from] MapsError),
#[error("map area error {0}")]
MapAreaError(#[from] MapAreaError),
#[error("invalid room {0}")]
InvalidRoom(u32),
#[error("monster already droppped item {0} {1}")]
MonsterAlreadyDroppedItem(ClientId, u16),
#[error("slice error {0}")]
SliceError(#[from] std::array::TryFromSliceError),
#[error("")]
#[error("item error")]
ItemError, // TODO: refine this
#[error("pick up invalid item id {0}")]
PickUpInvalidItemId(u32),
#[error("drop invalid item id {0}")]
DropInvalidItemId(u32),
#[error("item state error {0}")]
ItemStateError(#[from] items::state::ItemStateError),
#[error("")]
#[error("item drop location not set")]
ItemDropLocationNotSet,
#[error("box already dropped item {0} {1}")]
BoxAlreadyDroppedItem(ClientId, u16),
#[error("invalid quest category {0}")]
InvalidQuestCategory(u32),
#[error("invalid quest {0}")]
InvalidQuest(u32),
#[error("invalid quest filename {0}")]
InvalidQuestFilename(String),
#[error("io error {0}")]
IoError(#[from] std::io::Error),
#[error("not enough meseta {0} {1}")]
NotEnoughMeseta(ClientId, u32),
#[error("")]
#[error("shop error")]
ShopError,
#[error("gateway error {0}")]
GatewayError(#[from] GatewayError),
#[error("unknown monster {0}")]
UnknownMonster(crate::ship::monster::MonsterType),
#[error("invalid ship {0}")]
InvalidShip(usize),
#[error("invalid block {0}")]
InvalidBlock(usize),
#[error("invalid item {0}")]
InvalidItem(items::ClientItemId),
#[error("trade error {0}")]
TradeError(#[from] crate::ship::packet::handler::trade::TradeError),

Loading…
Cancel
Save