Skip to content

Commit

Permalink
Merge pull request #75 from Jupeyy/pr_various_small_fixes
Browse files Browse the repository at this point in the history
Various small fixes
  • Loading branch information
Jupeyy authored Jan 17, 2025
2 parents daaf522 + d15a796 commit 4537b1e
Show file tree
Hide file tree
Showing 25 changed files with 46 additions and 31 deletions.
2 changes: 1 addition & 1 deletion game/client-console/src/console/local_console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub enum LocalConsoleEvent {
// The bind was added to the player's profile
was_player_profile: bool,
},
/// A unbind command was executed
/// An unbind command was executed
Unbind {
// The bind was added to the player's profile
was_player_profile: bool,
Expand Down
4 changes: 2 additions & 2 deletions game/client-containers/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ struct DefaultItem<L> {
///
/// # Users
/// Users of the containers must call [Container::get_or_default] to get
/// access to a resource. It accepts a file name and a optional hash.
/// access to a resource. It accepts a file name and an optional hash.
/// The hash must be used if the resource is forced by a game server,
/// else it's optional.
/// Calling [Container::update] causes the container to remove unused
Expand Down Expand Up @@ -460,7 +460,7 @@ where
// also check if only allowed characters are inside the strings
{
for char in line.chars() {
if !char.is_ascii_graphic() || !char.is_ascii_whitespace() {
if !char.is_ascii_graphic() && !char.is_ascii_whitespace() {
log::warn!(
"downloaded text resource (txt) \
({}) contains an unallowed character: \"{}\"",
Expand Down
2 changes: 1 addition & 1 deletion game/client-ui/src/ingame_menu/game/main_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub fn render(ui: &mut egui::Ui, ui_state: &mut UiState, pipe: &mut UiRenderPipe
});
}
if ui.button("Join other team").clicked() {
// Show a overview over all teams
// Show an overview over all teams
config
.path()
.add_query(("team_select".to_string(), "1".to_string()));
Expand Down
2 changes: 1 addition & 1 deletion game/client-ui/src/scoreboard/content/list/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn calc_font_size_index(
} else {
// font is already smallest
let next_col_count = cur_column_count + 1;
// check if a additional column would fit somehow
// check if an additional column would fit somehow
let required_size =
next_col_count as f32 * min_table_width + (next_col_count - 1) as f32 * spacing_x;
if height < full_height && required_size <= width {
Expand Down
2 changes: 1 addition & 1 deletion game/demo/src/recorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl DemoRecorder {
} else if let Some(mem) = &mut mem {
Box::new(mem)
} else {
panic!("Neither memory nor file could be written for the demo. This is a implementation bug");
panic!("Neither memory nor file could be written for the demo. This is an implementation bug");
};
let size = Cell::new(0);

Expand Down
18 changes: 16 additions & 2 deletions game/editor/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,14 @@ impl EditorClient {
act,
map,
) {
self.notifications.push(EditorNotification::Error(format!("There has been an critical error while processing a action of the server: {err}.\nThis usually indicates a bug in the editor code.\nCan not continue.")));
self.notifications.push(EditorNotification::Error(
format!(
"There has been an critical error while \
processing an action of the server: {err}.\n\
This usually indicates a bug in the \
editor code.\nCan not continue."
),
));
return Err(anyhow!("critical error during do_action"));
}
}
Expand All @@ -149,7 +156,14 @@ impl EditorClient {
act,
map,
) {
self.notifications.push(EditorNotification::Error(format!("There has been an critical error while processing a action of the server: {err}.\nThis usually indicates a bug in the editor code.\nCan not continue.")));
self.notifications.push(EditorNotification::Error(
format!(
"There has been an critical error while \
processing an action of the server: {err}.\n\
This usually indicates a bug in the editor code.\n\
Can not continue."
),
));
return Err(anyhow!("critical error during do_action"));
}
}
Expand Down
2 changes: 1 addition & 1 deletion game/editor/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::actions::actions::EditorActionGroup;
/// An editor command is the way the user expresses to
/// issue a certain state change.
///
/// E.g. a undo command means that the server should try to
/// E.g. an undo command means that the server should try to
/// undo the last action.
/// It's basically the logic of the editor ui which does not diretly affect
/// the state of the map.
Expand Down
2 changes: 1 addition & 1 deletion game/editor/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub trait EditorDesignLayerInterface {
#[derive(Debug, Default, Clone)]
pub struct EditorCommonGroupOrLayerAttr {
pub hidden: bool,
// active layer/group, e.g. a brush on a active tile layer would have effect
// active layer/group, e.g. a brush on an active tile layer would have effect
pub active: bool,
}

Expand Down
2 changes: 1 addition & 1 deletion game/game-base/src/network/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub struct MsgSvServerInfo {
/// A server should provide these resource itself.
pub required_resources: RequiredResources,
/// - if this is `Some`, it is the port to the fallback resource download server.
/// - if this is `None`, either resources are downloaded from a official resource
/// - if this is `None`, either resources are downloaded from an official resource
/// server or from a resource server stored in the server
/// browser information of this server.
///
Expand Down
4 changes: 2 additions & 2 deletions game/game-interface/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ pub enum GameWorldAction {
pub enum GameWorldNotificationEvent {
/// A system message
System(GameWorldSystemMessage),
/// A action that is displayed in an action feed, kill message or finish time etc.
/// An action that is displayed in an action feed, kill message or finish time etc.
Action(GameWorldAction),
/// Message of the day
Motd { msg: MtPoolNetworkString<1024> },
Expand All @@ -396,7 +396,7 @@ pub enum GameWorldEvent {

/// # ID (Event-ID)
/// All events have an ID, this ID is always unique across all worlds on the server for every single event.
/// The client tries to match a event by its ID, the client might reset the id generator tho, if
/// The client tries to match an event by its ID, the client might reset the id generator tho, if
/// the server is out of sync.
#[derive(Debug, Hiarc, Clone, Serialize, Deserialize)]
pub struct GameWorldEvents {
Expand Down
2 changes: 1 addition & 1 deletion game/game-interface/src/votes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub struct PlayerVoteKey {
pub struct RandomUnfinishedMapKey {
/// A category in which this vote was called.
pub category: NetworkString<MAX_CATEGORY_NAME_LEN>,
/// A optional difficulty for the random map
/// An optional difficulty for the random map
pub difficulty: Option<MapDifficulty>,
}

Expand Down
6 changes: 3 additions & 3 deletions game/map/src/map/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ use base::{hash::Hash, reduced_ascii_str::ReducedAsciiString};
use hiarc::Hiarc;
use serde::{Deserialize, Serialize};

/// a reference to a external resource
/// a reference to an external resource
#[derive(Debug, Hiarc, Clone, Serialize, Deserialize)]
pub struct MapResourceMetaData {
pub blake3_hash: Hash,
pub ty: ReducedAsciiString,
}

/// a reference to a external resource
/// a reference to an external resource
#[derive(Debug, Hiarc, Clone, Serialize, Deserialize)]
pub struct MapResourceRef {
pub name: ReducedAsciiString,
Expand All @@ -20,7 +20,7 @@ pub struct MapResourceRef {
pub hq_meta: Option<MapResourceMetaData>,
}

/// a reference to a external resource
/// a reference to an external resource
#[derive(Debug, Hiarc, Clone, Serialize, Deserialize)]
pub struct Resources {
pub images: Vec<MapResourceRef>,
Expand Down
5 changes: 3 additions & 2 deletions lib/command-parser/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,9 @@ fn parse_command<const S: usize>(
parse_command_ident(tokens, commands)
.map(|(s, range)| SynOrErr::Syn((Syn::Text(s), range)))
.unwrap_or_else(|range_err| {
let (err, range) = range_err
.unwrap_or_else(|| (anyhow!("No text was given"), range.clone()));
let (err, range) = range_err.unwrap_or_else(|| {
(anyhow!("No text was given"), range.end + 1..range.end + 2)
});
SynOrErr::ParseRes(CommandParseResult::InvalidCommandIdent {
range,
err: err.to_string(),
Expand Down
2 changes: 1 addition & 1 deletion lib/game-database/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl DbStatementResultInterface for () {
{
anyhow::ensure!(
results.is_empty(),
"for a empty result, the result set should be empty as well."
"for an empty result the result set should be empty as well."
);
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion lib/graphics-backend-traits/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub trait BackendRenderExecuteInterface {
/// the color attachment of the previous render pass
fn set_color_attachment_as_texture(&mut self, index: u64, address_mode_index: u64);

/// the color attachment of a offscreen buffer
/// the color attachment of an offscreen buffer
fn set_offscreen_attachment_as_texture(
&mut self,
offscreen_id: u128,
Expand Down
2 changes: 1 addition & 1 deletion lib/graphics-backend-traits/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub trait GraphicsBackendMtInterface: Debug {
/// normally (create texture, create buffer).
/// The rule of thumb is to always try to call this, when you are loading inside
/// a thread
/// `do_expensive_flushing` determines if the implementation is allowed to use a expensive flushing mechanism
/// `do_expensive_flushing` determines if the implementation is allowed to use an expensive flushing mechanism
/// this is generally recommended since this function should only be called from a function anyway,
/// but it might cost more performance in some cases which makes it undesirable for situations where
/// it is better to have fewest possible runtime (e.g. loading a map, which is required to proceed the game)
Expand Down
2 changes: 1 addition & 1 deletion lib/graphics-backend/src/backends/vulkan/render_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ impl OffscreenSurface {
#[derive(Debug, Hiarc)]
pub struct RenderSetupSwitchingPass {
pub surface: Arc<OffscreenSurface>,
// render into a offscreen framebuffer first
// render into an offscreen framebuffer first
pub render_pass: Arc<RenderPass>,
pub framebuffer_list: Vec<Framebuffer>,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ impl SubRenderPass {
)
}

/// `stop_execution_flag` will be checked after every pipeline created (which might be a expensive operation) to allow earlier cancelation if desired
/// `stop_execution_flag` will be checked after every pipeline created (which might be an expensive operation) to allow earlier cancellation if desired
pub fn create_pipelines(
&mut self,
logical_device: &Arc<LogicalDevice>,
Expand Down
2 changes: 1 addition & 1 deletion lib/hiarc-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub fn hiarc(attr: TokenStream, tokens: TokenStream) -> TokenStream {
///
/// This attribute purposely does not re-implement the `Drop`-trait on the outer struct
///
/// You can additionally not pass any closures, closures can have bindings to a instance of the annotated struct and call
/// You can additionally not pass any closures, closures can have bindings to an instance of the annotated struct and call
/// a function on it, which leads to panics.
/// Even fruther, all function parameters must implement hiarc and their hiarc value must be smaller than
/// the annotated struct => the parameter can not be a struct that keeps a reference to the annotated struct.
Expand Down
2 changes: 1 addition & 1 deletion lib/hiarc-macro/src/safe_wrapper/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub(crate) fn hiarc_safer_wrapper(
(true, false)
}
_ => {
// ignore rest, except it's a trait, or it has a attr called `hiarc_force_impl`
// ignore rest, except it's a trait, or it has an attr called `hiarc_force_impl`
let mut found_force = false;
let mut found_trait_is_immutable_self = false;
f.attrs.retain_mut(|attr| {
Expand Down
2 changes: 1 addition & 1 deletion lib/hiarc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ pub enum HiUnsafeSyncSendCellCastError {
FailedToUnwrap,
}

/// This struct takes a instance of [`HiUnsafeRefCell`] () and _tries_ wrap it's inner value into a wrapper,
/// This struct takes an instance of [`HiUnsafeRefCell`] () and _tries_ wrap it's inner value into a wrapper,
/// that is [`Sync`] + [`Send`].
///
/// It fails if the outer wrappers are not the only owners of the value (e.g. [`Rc`]).
Expand Down
2 changes: 1 addition & 1 deletion lib/network/src/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ pub mod tests {
{
notifier_server.wait_for_event(None);
}
// reliable in order a on different channel
// reliable in order an on different channel
*game_event_generator_server.cur_test_name.blocking_lock() =
"reliable in order on different channel".to_string();
for channel in 10..12 {
Expand Down
2 changes: 1 addition & 1 deletion lib/sound-backend/src/backend/kira/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ impl Instance {

pub fn process_samples(&mut self, samples: u32) -> anyhow::Result<Vec<kira::Frame>> {
let AudioManagerTy::OffAir(manager) = &mut self.manager else {
return Err(anyhow!("Not a off-air scene."));
return Err(anyhow!("Not an off-air scene."));
};

manager.backend_mut().on_start_processing();
Expand Down
2 changes: 1 addition & 1 deletion lib/sound/src/ogg_vorbis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn verify_ogg_vorbis(file: &[u8]) -> anyhow::Result<()> {
)?;
anyhow::ensure!(
reader.tracks().len() == 1,
"currently exactly one track in a ogg vorbis file is allowed."
"currently exactly one track in an ogg vorbis file is allowed."
);
let mut decoder = VorbisDecoder::try_new(
&reader
Expand Down
2 changes: 1 addition & 1 deletion src/client/input/input_handling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ impl InputHandling {
}
}

/// returns a list of immediate events that are a result of a input
/// returns a list of immediate events that are a result of an input
pub fn handle_player_binds(
&mut self,
game_data: &mut GameData,
Expand Down

0 comments on commit 4537b1e

Please sign in to comment.