1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-20 06:37:45 +00:00

Run Clippy auto-fix, disable large enum size warning

This commit is contained in:
Joshua Goins 2025-03-23 18:14:14 -04:00
parent 70ec1b99c9
commit c29f8ad7df
10 changed files with 34 additions and 16 deletions

View file

@ -11,16 +11,15 @@ use kawari::packet::{
send_packet, send_packet,
}; };
use kawari::world::ipc::{ use kawari::world::ipc::{
ClientZoneIpcData, CommonSpawn, ContainerInfo, ContainerType, DisplayFlag, ClientZoneIpcData, CommonSpawn, DisplayFlag, GameMasterCommandType, GameMasterRank, ObjectKind,
GameMasterCommandType, GameMasterRank, ItemInfo, ObjectKind, OnlineStatus, PlayerSubKind, OnlineStatus, PlayerSubKind, ServerZoneIpcData, ServerZoneIpcSegment, ServerZoneIpcType,
ServerZoneIpcData, ServerZoneIpcSegment, ServerZoneIpcType, SocialListRequestType, SocialListRequestType, StatusEffect,
StatusEffect,
}; };
use kawari::world::{ use kawari::world::{
ChatHandler, Inventory, Zone, ZoneConnection, ChatHandler, Inventory, Zone, ZoneConnection,
ipc::{ ipc::{
ActorControl, ActorControlCategory, ActorControlSelf, PlayerEntry, PlayerSetup, ActorControlCategory, ActorControlSelf, PlayerEntry, PlayerSetup, PlayerSpawn, PlayerStats,
PlayerSpawn, PlayerStats, SocialList, SocialList,
}, },
}; };
use kawari::world::{PlayerData, WorldDatabase}; use kawari::world::{PlayerData, WorldDatabase};
@ -781,7 +780,7 @@ async fn main() {
"creating character from: {name} {chara_make_json}" "creating character from: {name} {chara_make_json}"
); );
let chara_make = CharaMake::from_json(&chara_make_json); let chara_make = CharaMake::from_json(chara_make_json);
let city_state = let city_state =
get_citystate(chara_make.classjob_id as u16); get_citystate(chara_make.classjob_id as u16);

View file

@ -1,5 +1,7 @@
//! A server replacement for a certain MMO. //! A server replacement for a certain MMO.
#![allow(clippy::large_enum_variant)]
use std::collections::HashMap; use std::collections::HashMap;
use minijinja::Environment; use minijinja::Environment;

View file

@ -14,6 +14,12 @@ pub enum LoginError {
InternalError, InternalError,
} }
impl Default for LoginDatabase {
fn default() -> Self {
Self::new()
}
}
impl LoginDatabase { impl LoginDatabase {
pub fn new() -> Self { pub fn new() -> Self {
let connection = Connection::open("login.db").expect("Failed to open database!"); let connection = Connection::open("login.db").expect("Failed to open database!");

View file

@ -1,6 +1,6 @@
mod packet; mod parsing;
use packet::PacketHeader; use parsing::PacketHeader;
pub use packet::{ pub use parsing::{
ConnectionType, PacketSegment, PacketState, SegmentType, parse_packet, send_keep_alive, ConnectionType, PacketSegment, PacketState, SegmentType, parse_packet, send_keep_alive,
send_packet, send_packet,
}; };

View file

@ -1,11 +1,11 @@
use crate::{ use crate::{
common::{CustomizeData, INVALID_OBJECT_ID, ObjectId, ObjectTypeId, Position, timestamp_secs}, common::{CustomizeData, ObjectId, ObjectTypeId, Position, timestamp_secs},
config::get_config, config::get_config,
packet::{PacketSegment, SegmentType}, packet::{PacketSegment, SegmentType},
world::ipc::{ world::ipc::{
ActorControl, ActorControlCategory, BattleNpcSubKind, CommonSpawn, DisplayFlag, NpcSpawn, ActorControl, ActorControlCategory, BattleNpcSubKind, CommonSpawn, DisplayFlag, NpcSpawn,
ObjectKind, PlayerSpawn, PlayerSubKind, ServerZoneIpcData, ServerZoneIpcSegment, ObjectKind, PlayerSpawn, PlayerSubKind, ServerZoneIpcData, ServerZoneIpcSegment,
ServerZoneIpcType, StatusEffectList, ServerZoneIpcType,
}, },
}; };
@ -135,7 +135,6 @@ impl ChatHandler {
warp_finish_anim: 0x0, warp_finish_anim: 0x0,
raise_anim: 0x0, raise_anim: 0x0,
}, },
..Default::default()
}), }),
}; };

View file

@ -174,7 +174,7 @@ impl ZoneConnection {
pub async fn send_inventory(&mut self) { pub async fn send_inventory(&mut self) {
// item list // item list
{ {
let equipped = self.inventory.equipped.clone(); let equipped = self.inventory.equipped;
let mut send_slot = async |slot_index: u16, item: &Item| { let mut send_slot = async |slot_index: u16, item: &Item| {
let ipc = ServerZoneIpcSegment { let ipc = ServerZoneIpcSegment {

View file

@ -21,6 +21,12 @@ pub struct CharacterData {
pub zone_id: u16, pub zone_id: u16,
} }
impl Default for WorldDatabase {
fn default() -> Self {
Self::new()
}
}
impl WorldDatabase { impl WorldDatabase {
pub fn new() -> Self { pub fn new() -> Self {
let connection = Connection::open("world.db").expect("Failed to open database!"); let connection = Connection::open("world.db").expect("Failed to open database!");

View file

@ -56,6 +56,12 @@ pub struct Inventory {
pub equipped: EquippedContainer, pub equipped: EquippedContainer,
} }
impl Default for Inventory {
fn default() -> Self {
Self::new()
}
}
impl Inventory { impl Inventory {
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {

View file

@ -3,8 +3,8 @@ use binrw::binrw;
use bitflags::bitflags; use bitflags::bitflags;
use crate::common::{ use crate::common::{
CHAR_NAME_MAX_LENGTH, CustomizeData, INVALID_OBJECT_ID, ObjectId, ObjectTypeId, Position, CHAR_NAME_MAX_LENGTH, CustomizeData, ObjectId, ObjectTypeId, Position, read_string,
read_string, write_string, write_string,
}; };
use super::StatusEffect; use super::StatusEffect;