From cee3d315d8c8491d6bf4a10de540ef7c6b40d210 Mon Sep 17 00:00:00 2001 From: AlphaCodingPilot Date: Mon, 21 Aug 2023 00:29:02 +0200 Subject: [PATCH] fixed client --- client/src/advance_ui.rs | 6 +++--- client/src/construct_ui.rs | 2 +- client/src/happiness_ui.rs | 2 +- client/src/player_ui.rs | 2 +- server/edit-client.cmd | 1 + 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/client/src/advance_ui.rs b/client/src/advance_ui.rs index adffd03e..2047df73 100644 --- a/client/src/advance_ui.rs +++ b/client/src/advance_ui.rs @@ -5,7 +5,7 @@ use macroquad::hash; use macroquad::math::{bool, vec2}; use macroquad::ui::root_ui; use server::action::Action; -use server::content::advances::get_all_advances; +use server::content::advances::get_all; use server::game::Game; use server::playing_actions::PlayingAction; use server::resource_pile::AdvancePaymentOptions; @@ -29,7 +29,7 @@ impl AdvancePayment { AdvancePayment { name: name.to_string(), payment: AdvancePayment::new_payment( - &p.resources().get_advance_payment_options(cost), + &p.resources.get_advance_payment_options(cost), cost, ), cost, @@ -76,7 +76,7 @@ pub fn show_advance_menu(game: &Game, player_index: usize) -> StateUpdate { let mut updates = StateUpdates::new(); root_ui().window(hash!(), vec2(20., 900.), vec2(400., 200.), |ui| { - for a in get_all_advances() { + for a in get_all() { let name = a.name; let p = game.get_player(player_index); if can_play_action(game) && p.can_advance(&name) { diff --git a/client/src/construct_ui.rs b/client/src/construct_ui.rs index 3b36b2da..33384ebf 100644 --- a/client/src/construct_ui.rs +++ b/client/src/construct_ui.rs @@ -180,7 +180,7 @@ impl ConstructionPayment { .clone(), }; - let payment_options = p.resources().get_payment_options(&cost); + let payment_options = p.resources.get_payment_options(&cost); let payment = ConstructionPayment::new_payment(&payment_options); diff --git a/client/src/happiness_ui.rs b/client/src/happiness_ui.rs index 31da4857..b483972d 100644 --- a/client/src/happiness_ui.rs +++ b/client/src/happiness_ui.rs @@ -68,7 +68,7 @@ fn increase_happiness_new_steps( .expect("invalid steps"); } new_total += new_cost; - if player.resources().can_afford(&new_total) { + if player.resources.can_afford(&new_total) { return Some((new_steps, new_total)); } } diff --git a/client/src/player_ui.rs b/client/src/player_ui.rs index e5b3510d..25b497b1 100644 --- a/client/src/player_ui.rs +++ b/client/src/player_ui.rs @@ -69,7 +69,7 @@ pub fn show_wonders(game: &Game, player_index: usize) { pub fn show_resources(game: &Game, player_index: usize) { let player = game.get_player(player_index); - let r: &ResourcePile = player.resources(); + let r: &ResourcePile = &player.resources; let mut i: f32 = 0.; let mut res = |label: String| { diff --git a/server/edit-client.cmd b/server/edit-client.cmd index 359480df..af82a678 100644 --- a/server/edit-client.cmd +++ b/server/edit-client.cmd @@ -1,4 +1,5 @@ cd ..\client code . cargo fmt +cargo clippy cd ..\server