From 69fdc7d3d2d8d682ae10fc14ab08bdd65c25ab49 Mon Sep 17 00:00:00 2001 From: dawnDus <96957561+dawndus@users.noreply.github.com> Date: Thu, 30 Jun 2022 11:39:56 -0400 Subject: [PATCH] Fix warnings from #141 --- src/menu/coop_menu.rs | 26 +++++++++++--------------- src/menu/save_select_menu.rs | 8 ++++---- src/scene/title_scene.rs | 8 ++++---- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/menu/coop_menu.rs b/src/menu/coop_menu.rs index f57f0b9..9ff88fd 100644 --- a/src/menu/coop_menu.rs +++ b/src/menu/coop_menu.rs @@ -1,10 +1,8 @@ use crate::framework::context::Context; use crate::framework::error::GameResult; -use crate::framework::filesystem; use crate::input::combined_menu_controller::CombinedMenuController; use crate::menu::MenuEntry; use crate::menu::{Menu, MenuSelectionResult}; -use crate::profile::GameProfile; use crate::shared_game_state::{PlayerCount, SharedGameState}; pub enum CurrentMenu { @@ -26,7 +24,7 @@ impl PlayerCountMenu { current_menu: CurrentMenu::CoopMenu, } } - pub fn init(&mut self, state: &mut SharedGameState, ctx: &Context) -> GameResult { + pub fn init(&mut self, state: &mut SharedGameState) -> GameResult { self.coop_menu = Menu::new(0, 0, 130, 0); self.skin_menu = Menu::new(0, 0, 130, 0); @@ -34,9 +32,9 @@ impl PlayerCountMenu { self.coop_menu.push_entry(MenuEntry::Active(state.t("menus.coop_menu.one"))); self.coop_menu.push_entry(MenuEntry::Active(state.t("menus.coop_menu.two"))); self.coop_menu.push_entry(MenuEntry::Active(state.t("common.back"))); - + self.coop_menu.selected = 1; - + self.skin_menu.push_entry(MenuEntry::Disabled(state.t("menus.skin_menu.title"))); self.skin_menu.push_entry(MenuEntry::PlayerSkin); self.skin_menu.push_entry(MenuEntry::Active(state.t("menus.main_menu.start"))); @@ -52,14 +50,12 @@ impl PlayerCountMenu { self.coop_menu.update_width(state); self.coop_menu.update_height(); self.coop_menu.x = ((state.canvas_size.0 - self.coop_menu.width as f32) / 2.3).floor() as isize; - self.coop_menu.y = - 30 + ((state.canvas_size.1 - self.coop_menu.height as f32) / 2.0).floor() as isize; + self.coop_menu.y = 30 + ((state.canvas_size.1 - self.coop_menu.height as f32) / 2.0).floor() as isize; self.skin_menu.update_width(state); self.skin_menu.update_height(); self.skin_menu.x = ((state.canvas_size.0 - self.coop_menu.width as f32) / 2.3).floor() as isize; - self.skin_menu.y = - 30 + ((state.canvas_size.1 - self.coop_menu.height as f32) / 2.0).floor() as isize; + self.skin_menu.y = 30 + ((state.canvas_size.1 - self.coop_menu.height as f32) / 2.0).floor() as isize; } pub fn tick( @@ -76,15 +72,15 @@ impl PlayerCountMenu { MenuSelectionResult::Selected(1, _) => { state.player_count = PlayerCount::One; state.reload_resources(ctx)?; - state.load_or_start_game(ctx)?; - } + state.load_or_start_game(ctx)?; + } MenuSelectionResult::Selected(2, _) => { if state.constants.is_cs_plus { self.current_menu = CurrentMenu::PlayerSkin; } else { state.player_count = PlayerCount::Two; state.reload_resources(ctx)?; - state.load_or_start_game(ctx)?; + state.load_or_start_game(ctx)?; } } _ => (), @@ -93,10 +89,10 @@ impl PlayerCountMenu { MenuSelectionResult::Selected(3, _) | MenuSelectionResult::Canceled => { self.current_menu = CurrentMenu::CoopMenu; } - MenuSelectionResult::Selected(1, _) =>{ + MenuSelectionResult::Selected(1, _) => { state.player2_skin += 2; } - MenuSelectionResult::Selected(2, _) =>{ + MenuSelectionResult::Selected(2, _) => { state.player_count = PlayerCount::Two; state.reload_resources(ctx)?; state.load_or_start_game(ctx)?; @@ -117,4 +113,4 @@ impl PlayerCountMenu { } Ok(()) } -} \ No newline at end of file +} diff --git a/src/menu/save_select_menu.rs b/src/menu/save_select_menu.rs index 42eb0a0..71fe5c4 100644 --- a/src/menu/save_select_menu.rs +++ b/src/menu/save_select_menu.rs @@ -2,11 +2,11 @@ use crate::framework::context::Context; use crate::framework::error::GameResult; use crate::framework::filesystem; use crate::input::combined_menu_controller::CombinedMenuController; -use crate::menu::MenuEntry; use crate::menu::coop_menu::PlayerCountMenu; +use crate::menu::MenuEntry; use crate::menu::{Menu, MenuSelectionResult}; use crate::profile::GameProfile; -use crate::shared_game_state::{GameDifficulty, PlayerCount, SharedGameState}; +use crate::shared_game_state::{GameDifficulty, SharedGameState}; #[derive(Clone, Copy)] pub struct MenuSaveInfo { @@ -63,7 +63,7 @@ impl SaveSelectMenu { pub fn init(&mut self, state: &mut SharedGameState, ctx: &Context) -> GameResult { self.save_menu = Menu::new(0, 0, 230, 0); self.save_detailed = Menu::new(0, 0, 230, 0); - self.coop_menu.init(state, ctx)?; + self.coop_menu.init(state)?; self.difficulty_menu = Menu::new(0, 0, 130, 0); self.delete_confirm = Menu::new(0, 0, 75, 0); self.load_confirm = Menu::new(0, 0, 75, 0); @@ -212,7 +212,7 @@ impl SaveSelectMenu { state, ctx, )?; - }, + } CurrentMenu::DeleteConfirm => match self.delete_confirm.tick(controller, state) { MenuSelectionResult::Selected(1, _) => { state.sound_manager.play_sfx(17); // Player Death sfx diff --git a/src/scene/title_scene.rs b/src/scene/title_scene.rs index fe7eea4..7bc19bb 100644 --- a/src/scene/title_scene.rs +++ b/src/scene/title_scene.rs @@ -8,8 +8,8 @@ use crate::framework::error::GameResult; use crate::input::combined_menu_controller::CombinedMenuController; use crate::input::touch_controls::TouchControlType; use crate::map::Map; -use crate::menu::save_select_menu::SaveSelectMenu; use crate::menu::coop_menu::PlayerCountMenu; +use crate::menu::save_select_menu::SaveSelectMenu; use crate::menu::settings_menu::SettingsMenu; use crate::menu::{Menu, MenuEntry, MenuSelectionResult}; use crate::scene::jukebox_scene::JukeboxScene; @@ -175,7 +175,7 @@ impl Scene for TitleScene { self.save_select_menu.init(state, ctx)?; - self.coop_menu.init(state, ctx)?; + self.coop_menu.init(state)?; let mut selected: usize = 0; let mut mutate_selection = true; @@ -357,7 +357,7 @@ impl Scene for TitleScene { self.current_menu = CurrentMenu::ChallengesMenu; } _ => (), - } + }, CurrentMenu::PlayerCountMenu => { let cm = &mut self.current_menu; let rm = CurrentMenu::ChallengeConfirmMenu; @@ -369,7 +369,7 @@ impl Scene for TitleScene { state, ctx, )?; - }, + } } self.confirm_menu.update_width(state);