"fix" some warnings

This commit is contained in:
griffi-gh 2024-05-03 01:39:47 +02:00
parent 0f55ff6210
commit 6a218352ab
12 changed files with 117 additions and 118 deletions

View file

@ -1,5 +1,5 @@
use glam::Mat4; use glam::Mat4;
use shipyard::{AllStoragesView, AllStoragesViewMut, Component, EntitiesViewMut, EntityId, Get, IntoIter, NonSendSync, Remove, Unique, UniqueView, UniqueViewMut, View, ViewMut}; use shipyard::{AllStoragesView, AllStoragesViewMut, Component, EntityId, Get, IntoIter, NonSendSync, Unique, UniqueView, UniqueViewMut, View, ViewMut};
use hashbrown::HashMap; use hashbrown::HashMap;
use uflow::{server::Event, SendMode}; use uflow::{server::Event, SendMode};
use std::net::SocketAddr; use std::net::SocketAddr;
@ -95,7 +95,8 @@ pub fn on_client_disconnect(
for event in &events.0 { for event in &events.0 {
if let Event::Disconnect(addr) = event { if let Event::Disconnect(addr) = event {
let net_client = server.0.client(addr).unwrap(); //XXX: do sth with this:
//let net_client = server.0.client(addr).unwrap();
let Some(&entity_id) = addr_map.0.get(addr) else { let Some(&entity_id) = addr_map.0.get(addr) else {
log::error!("Disconnected client not authenticated, moving on"); log::error!("Disconnected client not authenticated, moving on");
continue; continue;

View file

@ -102,7 +102,7 @@ fn process_chunk_requests(
).unwrap(); ).unwrap();
} }
} else { } else {
let mut chunk = Chunk::new(chunk_position); let mut chunk = Chunk::new();
chunk.state = ChunkState::Loading; chunk.state = ChunkState::Loading;
chunk.subscriptions.insert(message.client_id); chunk.subscriptions.insert(message.client_id);
chunk_manager.chunks.insert(chunk_position, chunk); chunk_manager.chunks.insert(chunk_position, chunk);

View file

@ -1,4 +1,3 @@
use glam::IVec3;
use hashbrown::HashSet; use hashbrown::HashSet;
use nohash_hasher::BuildNoHashHasher; use nohash_hasher::BuildNoHashHasher;
use kubi_shared::{ use kubi_shared::{
@ -14,15 +13,13 @@ pub enum ChunkState {
} }
pub struct Chunk { pub struct Chunk {
pub position: IVec3,
pub state: ChunkState, pub state: ChunkState,
pub blocks: Option<BlockData>, pub blocks: Option<BlockData>,
pub subscriptions: HashSet<ClientId, BuildNoHashHasher<ClientId>>, pub subscriptions: HashSet<ClientId, BuildNoHashHasher<ClientId>>,
} }
impl Chunk { impl Chunk {
pub fn new(position: IVec3) -> Self { pub fn new() -> Self {
Self { Self {
position,
state: ChunkState::Nothing, state: ChunkState::Nothing,
blocks: None, blocks: None,
subscriptions: HashSet::with_capacity_and_hasher(4, BuildNoHashHasher::default()), subscriptions: HashSet::with_capacity_and_hasher(4, BuildNoHashHasher::default()),

View file

@ -17,19 +17,20 @@ impl Health {
} }
} }
} }
impl PartialEq for Health {
fn eq(&self, other: &Self) -> bool { // impl PartialEq for Health {
self.current == other.current // fn eq(&self, other: &Self) -> bool {
} // self.current == other.current
} // }
impl Eq for Health {} // }
impl PartialOrd for Health { // impl Eq for Health {}
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { // impl PartialOrd for Health {
self.current.partial_cmp(&other.current) // fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
} // self.current.partial_cmp(&other.current)
} // }
impl Ord for Health { // }
fn cmp(&self, other: &Self) -> std::cmp::Ordering { // impl Ord for Health {
self.current.cmp(&other.current) // fn cmp(&self, other: &Self) -> std::cmp::Ordering {
} // self.current.cmp(&other.current)
} // }
// }

View file

@ -1,5 +1,5 @@
use fastnoise_lite::{FastNoiseLite, FractalType}; use fastnoise_lite::{FastNoiseLite, FractalType};
use glam::{ivec3, FloatExt, IVec3}; use glam::ivec3;
use crate::{block::Block, chunk::CHUNK_SIZE}; use crate::{block::Block, chunk::CHUNK_SIZE};
use super::super::{SeedThingy, WorldGenStep, WorldGenerator}; use super::super::{SeedThingy, WorldGenStep, WorldGenerator};

View file

@ -1,7 +1,6 @@
use bincode::de;
use fastnoise_lite::{FastNoiseLite, NoiseType}; use fastnoise_lite::{FastNoiseLite, NoiseType};
use glam::ivec3; use glam::ivec3;
use crate::{block::Block, chunk::CHUNK_SIZE, worldgen::SeedThingy}; use crate::{chunk::CHUNK_SIZE, worldgen::SeedThingy};
use super::_02_water::WATER_LEVEL; use super::_02_water::WATER_LEVEL;
use crate::worldgen::{ use crate::worldgen::{
WorldGenStep, WorldGenerator, WorldGenStep, WorldGenerator,

View file

@ -1,11 +1,11 @@
use shipyard::{AllStoragesView, UniqueViewMut}; use shipyard::{AllStoragesView, UniqueViewMut};
use std::{env, net::SocketAddr, fs::OpenOptions, path::{Path, PathBuf}, str::FromStr, sync::{Arc, RwLock}}; use std::{env, net::SocketAddr, fs::OpenOptions, path::Path};
use anyhow::Result; use anyhow::Result;
use crate::{ use crate::{
networking::{GameType, ServerAddress}, networking::{GameType, ServerAddress},
state::{GameState, NextState} state::{GameState, NextState}
}; };
use kubi_shared::data::{WorldSaveFile, SharedSaveFile}; use kubi_shared::data::WorldSaveFile;
fn open_local_save_file(path: &Path) -> Result<WorldSaveFile> { fn open_local_save_file(path: &Path) -> Result<WorldSaveFile> {
let mut save_file = WorldSaveFile::new({ let mut save_file = WorldSaveFile::new({

View file

@ -1,4 +1,8 @@
#![allow(clippy::too_many_arguments)] // allowed because systems often need a lot of arguments #![allow(
clippy::too_many_arguments, // allowed because systems often need a lot of argumentss
clippy::enum_variant_names,
clippy::type_complexity
)]
use shipyard::{ use shipyard::{
World, Workload, IntoWorkload, World, Workload, IntoWorkload,

View file

@ -1,5 +1,4 @@
use shipyard::{Unique, AllStoragesView, UniqueView, UniqueViewMut, Workload, IntoWorkload, EntitiesViewMut, Component, ViewMut, SystemModificator, View, IntoIter, WorkloadModificator}; use shipyard::{Unique, AllStoragesView, UniqueView, UniqueViewMut, Workload, IntoWorkload, EntitiesViewMut, Component, ViewMut, SystemModificator, View, IntoIter, WorkloadModificator};
use winit::event_loop::ControlFlow;
use std::net::SocketAddr; use std::net::SocketAddr;
use uflow::{ use uflow::{
client::{Client, Config as ClientConfig, Event as ClientEvent}, client::{Client, Config as ClientConfig, Event as ClientEvent},

View file

@ -1,4 +1,4 @@
use shipyard::{AllStoragesView, AllStoragesViewMut, IntoIter, Unique, UniqueView, UniqueViewMut, View}; use shipyard::{AllStoragesView, AllStoragesViewMut, IntoIter, Unique, UniqueViewMut, View};
use uflow::{client::Event as ClientEvent, SendMode}; use uflow::{client::Event as ClientEvent, SendMode};
use kubi_shared::networking::{ use kubi_shared::networking::{
messages::{ClientToServerMessage, ServerToClientMessage, ServerToClientMessageType}, messages::{ClientToServerMessage, ServerToClientMessage, ServerToClientMessageType},

View file

@ -1,9 +1,7 @@
use std::f32::consts::PI; use glam::uvec2;
use glam::{uvec2, Vec2};
use hui::{ use hui::{
draw::{ImageHandle, TextureFormat}, draw::{ImageHandle, TextureFormat},
element::{container::Container, image::Image, transformer::ElementTransformExt, UiElementExt}, element::{container::Container, image::Image, UiElementExt},
layout::Alignment, layout::Alignment,
size size
}; };

View file

@ -1,6 +1,6 @@
use glam::{IVec3, ivec3}; use glam::{IVec3, ivec3};
use strum::IntoEnumIterator; use strum::IntoEnumIterator;
use kubi_shared::block::{Block, BlockTexture, RenderType, Transparency}; use kubi_shared::block::{Block, RenderType, Transparency};
use crate::world::chunk::CHUNK_SIZE; use crate::world::chunk::CHUNK_SIZE;
use crate::rendering::world::ChunkVertex; use crate::rendering::world::ChunkVertex;