mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-19 22:36:49 +00:00
Fix various Clippy warnings
This commit is contained in:
parent
f9aefab7b7
commit
96bcdf1238
6 changed files with 13 additions and 23 deletions
|
@ -68,7 +68,7 @@ async fn main_loop(mut recv: Receiver<ToServer>) -> Result<(), std::io::Error> {
|
|||
let msg =
|
||||
FromServer::ActorSpawn(Actor { id: *id, hp: 100 }, common.clone());
|
||||
|
||||
let _ = handle.send(msg).unwrap();
|
||||
handle.send(msg).unwrap();
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -724,7 +724,7 @@ async fn client_loop(
|
|||
}
|
||||
}
|
||||
|
||||
let actor = actor.clone();
|
||||
let actor = *actor;
|
||||
connection.update_hp_mp(actor.id, actor.hp, 10000).await;
|
||||
}
|
||||
|
||||
|
@ -784,7 +784,7 @@ async fn client_loop(
|
|||
ClientZoneIpcData::InventoryModify(action) => {
|
||||
tracing::info!("Client is modifying inventory! {action:#?}");
|
||||
|
||||
connection.player_data.inventory.process_action(&action);
|
||||
connection.player_data.inventory.process_action(action);
|
||||
connection.send_inventory(true).await;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ pub(crate) fn write_string(str: &String) -> Vec<u8> {
|
|||
|
||||
/// Converts a quantized rotation to degrees in f32
|
||||
pub(crate) fn read_quantized_rotation(quantized: u16) -> f32 {
|
||||
let max = std::u16::MAX as f32;
|
||||
let max = u16::MAX as f32;
|
||||
let pi = std::f32::consts::PI;
|
||||
|
||||
quantized as f32 / max * (2.0 * pi) - pi
|
||||
|
@ -71,7 +71,7 @@ pub(crate) fn read_quantized_rotation(quantized: u16) -> f32 {
|
|||
|
||||
/// Converts a rotation (in degrees) to
|
||||
pub(crate) fn write_quantized_rotation(quantized: &f32) -> u16 {
|
||||
let max = std::u16::MAX as f32;
|
||||
let max = u16::MAX as f32;
|
||||
let pi = std::f32::consts::PI;
|
||||
|
||||
((quantized + pi / (2.0 * pi)) * max) as u16
|
||||
|
|
|
@ -163,15 +163,13 @@ impl LoginDatabase {
|
|||
let accounts = stmt.query_map((user_id,), |row| row.get(0)).unwrap();
|
||||
|
||||
let mut service_accounts = Vec::new();
|
||||
let mut index = 0;
|
||||
for id in accounts {
|
||||
for (index, id) in accounts.enumerate() {
|
||||
service_accounts.push(ServiceAccount {
|
||||
id: id.unwrap(),
|
||||
unk1: 0,
|
||||
index,
|
||||
index: index as u32,
|
||||
name: format!("FINAL FANTASY XIV {}", index + 1), // TODO: don't add the "1" if you only have one service account
|
||||
});
|
||||
index += 1
|
||||
}
|
||||
|
||||
service_accounts
|
||||
|
|
|
@ -688,13 +688,7 @@ impl ZoneConnection {
|
|||
}
|
||||
|
||||
pub fn get_actor(&mut self, id: ObjectId) -> Option<&mut Actor> {
|
||||
for actor in &mut self.actors {
|
||||
if actor.id == id {
|
||||
return Some(actor);
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
self.actors.iter_mut().find(|actor| actor.id == id)
|
||||
}
|
||||
|
||||
pub async fn actor_control_self(&mut self, actor_control: ActorControlSelf) {
|
||||
|
@ -746,7 +740,7 @@ impl ZoneConnection {
|
|||
game_data.get_primary_model_id(equipped.left_ring.id) as u32,
|
||||
game_data.get_primary_model_id(equipped.right_ring.id) as u32,
|
||||
],
|
||||
pos: exit_position.unwrap_or(Position::default()),
|
||||
pos: exit_position.unwrap_or_default(),
|
||||
rotation: exit_rotation.unwrap_or(0.0),
|
||||
..Default::default()
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ use super::ipc::{ContainerType, InventoryModify};
|
|||
// TODO: rename to storage?
|
||||
pub trait Container {
|
||||
fn num_items(&self) -> u32;
|
||||
fn get_slot<'a>(&'a mut self, index: u16) -> &'a mut Item;
|
||||
fn get_slot(&mut self, index: u16) -> &mut Item;
|
||||
}
|
||||
|
||||
#[derive(Default, Copy, Clone, Serialize, Deserialize, Debug)]
|
||||
|
@ -176,7 +176,7 @@ impl Inventory {
|
|||
{
|
||||
let src_container = self.get_container(&action.src_storage_id);
|
||||
let src_slot = src_container.get_slot(action.src_container_index);
|
||||
src_item = src_slot.clone();
|
||||
src_item = *src_slot;
|
||||
}
|
||||
|
||||
let dst_item;
|
||||
|
@ -185,7 +185,7 @@ impl Inventory {
|
|||
let dst_container = self.get_container(&action.dst_storage_id);
|
||||
let dst_slot = dst_container.get_slot(action.dst_container_index);
|
||||
|
||||
dst_item = dst_slot.clone();
|
||||
dst_item = *dst_slot;
|
||||
dst_slot.clone_from(&src_item);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,9 +50,7 @@ impl Zone {
|
|||
let mut load_lgb = |name: &str| -> Option<LayerGroup> {
|
||||
let path = format!("bg/{}/level/{}.lgb", &bg_path[..level_index], name);
|
||||
tracing::info!("Loading {path}");
|
||||
let Some(lgb) = game_data.extract(&path) else {
|
||||
return None;
|
||||
};
|
||||
let lgb = game_data.extract(&path)?;
|
||||
LayerGroup::from_existing(&lgb)
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue