cargo fix + warning fixes

This commit is contained in:
emilis 2025-11-13 23:33:06 +00:00
parent 99a2fa31c4
commit ad7ffaac31
No known key found for this signature in database
46 changed files with 83 additions and 157 deletions

View File

@ -13,8 +13,8 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use quote::{ToTokens, quote}; use quote::{ToTokens, quote};
use syn::{parse::Parse, spanned::Spanned}; use syn::parse::Parse;
#[allow(unused)]
pub struct RefAndMut { pub struct RefAndMut {
name: syn::Ident, name: syn::Ident,
} }

View File

@ -12,7 +12,7 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::{num::NonZeroU8, ops::Not}; use core::num::NonZeroU8;
use super::Result; use super::Result;
use crate::{ use crate::{

View File

@ -24,7 +24,7 @@ use crate::{
}, },
message::night::{ActionPrompt, ActionResponse, ActionResult}, message::night::{ActionPrompt, ActionResponse, ActionResult},
player::Protection, player::Protection,
role::{Alignment, AlignmentEq, PreviousGuardianAction, RoleBlock, RoleTitle}, role::{AlignmentEq, PreviousGuardianAction, RoleBlock, RoleTitle},
}; };
type Result<T> = core::result::Result<T, GameError>; type Result<T> = core::result::Result<T, GameError>;

View File

@ -23,7 +23,7 @@ use uuid::Uuid;
use werewolves_macros::{All, ChecksAs, Titles}; use werewolves_macros::{All, ChecksAs, Titles};
use crate::{ use crate::{
aura::{Aura, AuraTitle}, aura::AuraTitle,
character::Character, character::Character,
error::GameError, error::GameError,
message::Identification, message::Identification,

View File

@ -20,7 +20,6 @@ use serde::{Deserialize, Serialize};
use super::Result; use super::Result;
use crate::{ use crate::{
aura::Aura,
character::{Character, CharacterId}, character::{Character, CharacterId},
diedto::DiedTo, diedto::DiedTo,
error::GameError, error::GameError,

View File

@ -259,7 +259,7 @@ impl ActionResultExt for ActionResult {
} }
} }
} }
#[allow(unused)]
pub trait AlignmentExt { pub trait AlignmentExt {
fn village(&self); fn village(&self);
fn wolves(&self); fn wolves(&self);
@ -275,6 +275,7 @@ impl AlignmentExt for Alignment {
} }
} }
#[allow(unused)]
pub trait ServerToHostMessageExt { pub trait ServerToHostMessageExt {
fn prompt(self) -> ActionPrompt; fn prompt(self) -> ActionPrompt;
fn result(self) -> ActionResult; fn result(self) -> ActionResult;
@ -853,7 +854,7 @@ fn big_game_test_based_on_story_test() {
settings.add_and_assign(scapegoat.0, scapegoat.1); settings.add_and_assign(scapegoat.0, scapegoat.1);
settings.add_and_assign(hunter.0, hunter.1); settings.add_and_assign(hunter.0, hunter.1);
settings.fill_remaining_slots_with_villagers(players.len()); settings.fill_remaining_slots_with_villagers(players.len());
#[allow(unused)]
let ( let (
werewolf, werewolf,
dire_wolf, dire_wolf,

View File

@ -21,8 +21,7 @@ use crate::{
diedto::DiedToTitle, diedto::DiedToTitle,
game::{Game, GameSettings, GameState, OrRandom, SetupRole}, game::{Game, GameSettings, GameState, OrRandom, SetupRole},
game_test::{ game_test::{
ActionPromptTitleExt, ActionResultExt, GameExt, ServerToHostMessageExt, SettingsExt, ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players, init_log,
gen_players, init_log,
}, },
message::{ message::{
Identification, PublicIdentity, Identification, PublicIdentity,
@ -228,7 +227,7 @@ fn previous_prompt() {
settings.add_and_assign(scapegoat.0, scapegoat.1); settings.add_and_assign(scapegoat.0, scapegoat.1);
settings.add_and_assign(hunter.0, hunter.1); settings.add_and_assign(hunter.0, hunter.1);
settings.fill_remaining_slots_with_villagers(players.len()); settings.fill_remaining_slots_with_villagers(players.len());
#[allow(unused)]
let ( let (
werewolf, werewolf,
dire_wolf, dire_wolf,

View File

@ -17,7 +17,7 @@ use crate::{
game_test::{ game_test::{
ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players, init_log, ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players, init_log,
}, },
message::{CharacterIdentity, night::ActionPrompt}, message::night::ActionPrompt,
role::{Role, RoleTitle}, role::{Role, RoleTitle},
}; };

View File

@ -12,22 +12,14 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::num::NonZeroU8;
#[allow(unused)] #[allow(unused)]
use pretty_assertions::{assert_eq, assert_ne, assert_str_eq}; use pretty_assertions::{assert_eq, assert_ne, assert_str_eq};
use crate::{ use crate::{
diedto::DiedTo, game::{Game, GameSettings, SetupRole},
game::{Game, GameSettings, OrRandom, SetupRole}, game_test::{ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players},
game_test::{ message::night::{ActionPrompt, ActionPromptTitle},
ActionPromptTitleExt, ActionResultExt, AlignmentExt, GameExt, ServerToHostMessageExt, role::RoleTitle,
SettingsExt, gen_players,
},
message::{
host::{HostDayMessage, HostGameMessage},
night::{ActionPrompt, ActionPromptTitle, ActionResult},
},
role::{Role, RoleTitle},
}; };
#[test] #[test]

View File

@ -18,16 +18,9 @@ use pretty_assertions::{assert_eq, assert_ne, assert_str_eq};
use crate::{ use crate::{
diedto::DiedTo, diedto::DiedTo,
game::{Game, GameSettings, OrRandom, SetupRole}, game::{Game, GameSettings, SetupRole},
game_test::{ game_test::{ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players},
ActionPromptTitleExt, ActionResultExt, AlignmentExt, GameExt, ServerToHostMessageExt, message::night::ActionPromptTitle,
SettingsExt, gen_players,
},
message::{
host::{HostDayMessage, HostGameMessage},
night::{ActionPrompt, ActionPromptTitle, ActionResult},
},
role::Role,
}; };
#[test] #[test]

View File

@ -18,16 +18,15 @@ use pretty_assertions::{assert_eq, assert_ne, assert_str_eq};
use crate::{ use crate::{
diedto::DiedTo, diedto::DiedTo,
game::{Game, GameSettings, OrRandom, SetupRole}, game::{Game, GameSettings, SetupRole},
game_test::{ game_test::{
ActionPromptTitleExt, ActionResultExt, AlignmentExt, GameExt, ServerToHostMessageExt, ActionPromptTitleExt, ActionResultExt, GameExt, ServerToHostMessageExt, SettingsExt,
SettingsExt, gen_players, gen_players,
}, },
message::{ message::{
host::{HostDayMessage, HostGameMessage}, host::{HostDayMessage, HostGameMessage},
night::{ActionPrompt, ActionPromptTitle, ActionResult}, night::{ActionPrompt, ActionPromptTitle},
}, },
role::Role,
}; };
#[test] #[test]

View File

@ -18,7 +18,7 @@ use crate::{
diedto::DiedTo, diedto::DiedTo,
game::{Game, GameSettings, SetupRole}, game::{Game, GameSettings, SetupRole},
game_test::{ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players}, game_test::{ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players},
message::night::{ActionPrompt, ActionPromptTitle}, message::night::ActionPromptTitle,
role::{Alignment, Role}, role::{Alignment, Role},
}; };
#[allow(unused)] #[allow(unused)]

View File

@ -12,16 +12,13 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::num::NonZeroU8;
#[allow(unused)] #[allow(unused)]
use pretty_assertions::{assert_eq, assert_ne, assert_str_eq}; use pretty_assertions::{assert_eq, assert_ne, assert_str_eq};
use crate::{ use crate::{
game::{Game, GameSettings, OrRandom, SetupRole}, game::{Game, GameSettings, OrRandom, SetupRole},
game_test::{ game_test::{ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players},
ActionPromptTitleExt, ActionResultExt, AlignmentExt, GameExt, SettingsExt, gen_players, message::night::{ActionPromptTitle, ActionResult},
},
message::night::{ActionPrompt, ActionPromptTitle, ActionResult},
role::Role, role::Role,
}; };

View File

@ -12,20 +12,13 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::num::NonZeroU8;
use crate::{ use crate::{
diedto::DiedTo,
error::GameError,
game::{Game, GameSettings, SetupRole}, game::{Game, GameSettings, SetupRole},
game_test::{ game_test::{
ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players, init_log, ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players, init_log,
}, },
message::{ message::night::ActionPromptTitle,
host::{HostGameMessage, HostNightMessage}, role::Role,
night::{ActionPromptTitle, ActionResponse},
},
role::{PreviousGuardianAction, Role},
}; };
#[test] #[test]

View File

@ -16,11 +16,8 @@
use pretty_assertions::{assert_eq, assert_ne, assert_str_eq}; use pretty_assertions::{assert_eq, assert_ne, assert_str_eq};
use crate::{ use crate::{
diedto::DiedTo, game::{Game, GameSettings, SetupRole},
game::{Game, GameSettings, OrRandom, SetupRole}, game_test::{ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players},
game_test::{
ActionPromptTitleExt, ActionResultExt, AlignmentExt, GameExt, SettingsExt, gen_players,
},
message::night::{ActionPromptTitle, Visits}, message::night::{ActionPromptTitle, Visits},
role::{Role, RoleTitle}, role::{Role, RoleTitle},
}; };

View File

@ -13,7 +13,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::num::{NonZero, NonZeroU8}; use core::num::NonZeroU8;
#[allow(unused)] #[allow(unused)]
use pretty_assertions::{assert_eq, assert_ne, assert_str_eq}; use pretty_assertions::{assert_eq, assert_ne, assert_str_eq};
@ -27,7 +27,6 @@ use crate::{
ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players, init_log, ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players, init_log,
}, },
message::night::ActionPromptTitle, message::night::ActionPromptTitle,
role::{Alignment, Killer, Powerful},
}; };
#[test] #[test]

View File

@ -12,7 +12,7 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::num::{NonZero, NonZeroU8}; use core::num::NonZeroU8;
#[allow(unused)] #[allow(unused)]
use pretty_assertions::{assert_eq, assert_ne, assert_str_eq}; use pretty_assertions::{assert_eq, assert_ne, assert_str_eq};

View File

@ -12,15 +12,13 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::num::NonZeroU8;
#[allow(unused)] #[allow(unused)]
use pretty_assertions::{assert_eq, assert_ne, assert_str_eq}; use pretty_assertions::{assert_eq, assert_ne, assert_str_eq};
use crate::{ use crate::{
diedto::DiedTo,
game::{Game, GameSettings, SetupRole}, game::{Game, GameSettings, SetupRole},
game_test::{ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players}, game_test::{ActionResultExt, GameExt, SettingsExt, gen_players},
message::night::{ActionPrompt, ActionPromptTitle}, message::night::ActionPromptTitle,
}; };
#[test] #[test]

View File

@ -12,22 +12,13 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::num::NonZeroU8;
#[allow(unused)] #[allow(unused)]
use pretty_assertions::{assert_eq, assert_ne, assert_str_eq}; use pretty_assertions::{assert_eq, assert_ne, assert_str_eq};
use crate::{ use crate::{
diedto::DiedTo, game::{Game, GameOver, GameSettings, SetupRole},
game::{Game, GameOver, GameSettings, OrRandom, SetupRole}, game_test::{ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players},
game_test::{ message::night::ActionPromptTitle,
ActionPromptTitleExt, ActionResultExt, AlignmentExt, GameExt, ServerToHostMessageExt,
SettingsExt, gen_players,
},
message::{
host::{HostDayMessage, HostGameMessage, ServerToHostMessage},
night::{ActionPrompt, ActionPromptTitle, ActionResult},
},
role::Role,
}; };
#[test] #[test]

View File

@ -18,12 +18,10 @@ use serde::{Deserialize, Serialize};
use werewolves_macros::{ChecksAs, Titles}; use werewolves_macros::{ChecksAs, Titles};
use crate::{ use crate::{
aura::Aura, character::CharacterId,
character::{Character, CharacterId},
diedto::DiedTo, diedto::DiedTo,
game::{GameTime, Village}, game::{GameTime, Village},
message::{CharacterIdentity, Identification, PublicIdentity, night::ActionType}, message::CharacterIdentity,
player::PlayerId,
}; };
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize, Default)] #[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize, Default)]

View File

@ -15,7 +15,7 @@
use core::{net::SocketAddr, time::Duration}; use core::{net::SocketAddr, time::Duration};
use crate::{ use crate::{
AppState, LogError, XForwardedFor, AppState, XForwardedFor,
connection::{ConnectionId, JoinedPlayer}, connection::{ConnectionId, JoinedPlayer},
runner::IdentifiedClientMessage, runner::IdentifiedClientMessage,
}; };
@ -26,7 +26,7 @@ use axum::{
}, },
response::IntoResponse, response::IntoResponse,
}; };
use axum_extra::{TypedHeader, headers}; use axum_extra::TypedHeader;
use chrono::Utc; use chrono::Utc;
use colored::Colorize; use colored::Colorize;
use tokio::sync::broadcast::{Receiver, Sender}; use tokio::sync::broadcast::{Receiver, Sender};
@ -34,7 +34,6 @@ use werewolves_proto::message::{ClientMessage, Identification, ServerMessage, Up
pub async fn handler( pub async fn handler(
ws: WebSocketUpgrade, ws: WebSocketUpgrade,
user_agent: Option<TypedHeader<headers::UserAgent>>,
x_forwarded_for: Option<TypedHeader<XForwardedFor>>, x_forwarded_for: Option<TypedHeader<XForwardedFor>>,
ConnectInfo(addr): ConnectInfo<SocketAddr>, ConnectInfo(addr): ConnectInfo<SocketAddr>,
State(state): State<AppState>, State(state): State<AppState>,
@ -43,12 +42,7 @@ pub async fn handler(
.map(|x| x.to_string()) .map(|x| x.to_string())
.unwrap_or_else(|| addr.to_string()) .unwrap_or_else(|| addr.to_string())
.italic(); .italic();
// log::debug!(
// "{who}{} connected.",
// user_agent
// .map(|agent| format!(" (User-Agent: {})", agent.as_str()))
// .unwrap_or_default(),
// );
let player_list = state.joined_players; let player_list = state.joined_players;
// finalize the upgrade process by returning upgrade callback. // finalize the upgrade process by returning upgrade callback.
@ -208,7 +202,7 @@ impl Client {
return Ok(()); return Ok(());
} }
Message::Close(Some(close_frame)) => { Message::Close(Some(_)) => {
// log::debug!("sent close frame: {close_frame:?}"); // log::debug!("sent close frame: {close_frame:?}");
return Ok(()); return Ok(());
} }

View File

@ -12,7 +12,7 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::sync::atomic::{AtomicBool, AtomicI64, AtomicPtr, AtomicU64, AtomicUsize, Ordering}; use core::sync::atomic::{AtomicBool, AtomicI64, Ordering};
use std::rc::Rc; use std::rc::Rc;
use chrono::{DateTime, TimeDelta, Utc}; use chrono::{DateTime, TimeDelta, Utc};

View File

@ -41,7 +41,7 @@ use yew::{html::Scope, prelude::*};
use crate::{ use crate::{
callback, callback,
components::{ components::{
Button, CoverOfDarkness, Lobby, LobbyPlayerAction, RoleReveal, Settings, Story, Victory, Button, Lobby, LobbyPlayerAction, RoleReveal, Settings, Story, Victory,
action::{ActionResultView, Prompt}, action::{ActionResultView, Prompt},
host::{DaytimePlayerList, Setup}, host::{DaytimePlayerList, Setup},
}, },
@ -224,6 +224,7 @@ pub enum HostState {
Result(Option<CharacterIdentity>, ActionResult), Result(Option<CharacterIdentity>, ActionResult),
Story { Story {
story: GameStory, story: GameStory,
#[allow(unused)]
page: usize, page: usize,
}, },
} }
@ -311,7 +312,7 @@ impl Component for Host {
fn view(&self, _ctx: &Context<Self>) -> Html { fn view(&self, _ctx: &Context<Self>) -> Html {
log::trace!("state: {:?}", self.state); log::trace!("state: {:?}", self.state);
let content = match self.state.clone() { let content = match self.state.clone() {
HostState::Story { story, page } => { HostState::Story { story, .. } => {
if let Some(outcome) = story if let Some(outcome) = story
.final_village() .final_village()
.ok() .ok()
@ -611,8 +612,7 @@ impl Component for Host {
} }
}, },
HostEvent::Error(err) => { HostEvent::Error(err) => {
self.error_callback self.error_callback.emit(Some(WerewolfError::Game(err)));
.emit(Some(WerewolfError::GameError(err)));
false false
} }
HostEvent::SetBigScreenState(state) => { HostEvent::SetBigScreenState(state) => {

View File

@ -16,8 +16,8 @@ use core::num::NonZeroU8;
use werewolves_proto::{ use werewolves_proto::{
character::{Character, CharacterId}, character::{Character, CharacterId},
diedto::{DiedTo, DiedToTitle}, diedto::DiedToTitle,
game::{self, Game, GameOver, GameSettings, OrRandom, SetupRole, Village, story::GameStory}, game::{self, Game, GameOver, GameSettings, OrRandom, SetupRole, story::GameStory},
message::{ message::{
CharacterState, Identification, PublicIdentity, CharacterState, Identification, PublicIdentity,
host::{HostDayMessage, HostGameMessage, HostNightMessage, ServerToHostMessage}, host::{HostDayMessage, HostGameMessage, HostNightMessage, ServerToHostMessage},
@ -121,7 +121,7 @@ pub fn test_story() -> GameStory {
settings.add_and_assign(hunter.0, hunter.1); settings.add_and_assign(hunter.0, hunter.1);
settings.add_and_assign(diseased.0, diseased.1); settings.add_and_assign(diseased.0, diseased.1);
settings.fill_remaining_slots_with_villagers(players.len()); settings.fill_remaining_slots_with_villagers(players.len());
#[allow(unused)]
let ( let (
werewolf, werewolf,
dire_wolf, dire_wolf,
@ -596,6 +596,7 @@ impl ActionPromptTitleExt for ActionPromptTitle {
} }
} }
#[allow(unused)]
pub trait ActionResultExt { pub trait ActionResultExt {
fn sleep(&self); fn sleep(&self);
fn r#continue(&self); fn r#continue(&self);
@ -655,7 +656,7 @@ impl ActionResultExt for ActionResult {
fn seer(&self) -> Alignment { fn seer(&self) -> Alignment {
match self { match self {
ActionResult::Seer(a) => a.clone(), ActionResult::Seer(a) => *a,
_ => panic!("expected a seer result"), _ => panic!("expected a seer result"),
} }
} }
@ -674,7 +675,7 @@ impl ActionResultExt for ActionResult {
} }
} }
} }
#[allow(unused)]
pub trait AlignmentExt { pub trait AlignmentExt {
fn village(&self); fn village(&self);
fn wolves(&self); fn wolves(&self);
@ -689,7 +690,7 @@ impl AlignmentExt for Alignment {
assert_eq!(*self, Alignment::Wolves) assert_eq!(*self, Alignment::Wolves)
} }
} }
#[allow(unused)]
pub trait ServerToHostMessageExt { pub trait ServerToHostMessageExt {
fn prompt(self) -> ActionPrompt; fn prompt(self) -> ActionPrompt;
fn result(self) -> ActionResult; fn result(self) -> ActionResult;
@ -725,6 +726,7 @@ impl ServerToHostMessageExt for ServerToHostMessage {
} }
} }
#[allow(unused)]
pub trait GameExt { pub trait GameExt {
fn villager_character_ids(&self) -> Box<[CharacterId]>; fn villager_character_ids(&self) -> Box<[CharacterId]>;
fn character_by_player_id(&self, player_id: PlayerId) -> Character; fn character_by_player_id(&self, player_id: PlayerId) -> Character;

View File

@ -22,7 +22,6 @@ use werewolves_proto::{
host::{HostGameMessage, HostMessage, HostNightMessage}, host::{HostGameMessage, HostMessage, HostNightMessage},
night::{ActionPrompt, ActionResponse}, night::{ActionPrompt, ActionResponse},
}, },
role::PreviousGuardianAction,
}; };
use yew::prelude::*; use yew::prelude::*;
@ -31,7 +30,7 @@ use crate::{
Button, CoverOfDarkness, Identity, Button, CoverOfDarkness, Identity,
action::{BinaryChoice, TargetPicker, WolvesIntro}, action::{BinaryChoice, TargetPicker, WolvesIntro},
}, },
pages::{MasonsWake, TraitorIntroPage}, pages::TraitorIntroPage,
}; };
#[derive(Debug, Clone, PartialEq, Properties)] #[derive(Debug, Clone, PartialEq, Properties)]

View File

@ -14,7 +14,6 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::ops::Not; use core::ops::Not;
use convert_case::{Case, Casing};
use werewolves_proto::message::{ use werewolves_proto::message::{
PublicIdentity, PublicIdentity,
host::{HostGameMessage, HostMessage, HostNightMessage}, host::{HostGameMessage, HostMessage, HostNightMessage},
@ -23,7 +22,7 @@ use werewolves_proto::message::{
use yew::prelude::*; use yew::prelude::*;
use crate::{ use crate::{
components::{Button, CoverOfDarkness, Icon, IconSource, Identity}, components::{Button, CoverOfDarkness, Identity},
pages::{ pages::{
AdjudicatorResult, ArcanistResult, BeholderSawEverything, BeholderSawNothing, DrunkPage, AdjudicatorResult, ArcanistResult, BeholderSawEverything, BeholderSawNothing, DrunkPage,
EmpathResult, GravediggerResultPage, InsomniacResult, MorticianResultPage, PowerSeerResult, EmpathResult, GravediggerResultPage, InsomniacResult, MorticianResultPage, PowerSeerResult,

View File

@ -13,14 +13,10 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use convert_case::{Case, Casing}; use convert_case::{Case, Casing};
use werewolves_proto::{ use werewolves_proto::{diedto::DiedToTitle, game::SetupRoleTitle};
diedto::{DiedTo, DiedToTitle},
game::{Category, SetupRoleTitle},
role,
};
use yew::prelude::*; use yew::prelude::*;
use crate::components::{AssociatedIcon, Icon, IconSource, IconType, PartialAssociatedIcon}; use crate::components::{Icon, IconSource, IconType, PartialAssociatedIcon};
#[derive(Debug, Clone, Copy, PartialEq, Properties)] #[derive(Debug, Clone, Copy, PartialEq, Properties)]
pub struct DiedToSpanProps { pub struct DiedToSpanProps {

View File

@ -12,7 +12,7 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use werewolves_proto::role::{self, Killer}; use werewolves_proto::role::Killer;
use yew::prelude::*; use yew::prelude::*;
use crate::components::{AssociatedIcon, Icon, IconType}; use crate::components::{AssociatedIcon, Icon, IconType};

View File

@ -24,7 +24,6 @@ use yew::prelude::*;
use crate::components::{ use crate::components::{
AssociatedIcon, Button, Icon, IconType, Identity, PartialAssociatedIcon, AssociatedIcon, Button, Icon, IconType, Identity, PartialAssociatedIcon,
attributes::RoleTitleSpan,
}; };
#[derive(Debug, Clone, PartialEq, Properties)] #[derive(Debug, Clone, PartialEq, Properties)]

View File

@ -16,11 +16,7 @@ use core::ops::Not;
use std::collections::HashMap; use std::collections::HashMap;
use convert_case::{Case, Casing}; use convert_case::{Case, Casing};
use rand::Rng; use werewolves_proto::game::{Category, GameSettings, SetupRole, SetupRoleTitle};
use werewolves_proto::{
game::{Category, GameSettings, SetupRole, SetupRoleTitle},
role::Alignment,
};
use yew::prelude::*; use yew::prelude::*;
use crate::components::{AssociatedIcon, Icon, IconSource, IconType}; use crate::components::{AssociatedIcon, Icon, IconSource, IconType};

View File

@ -13,7 +13,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use werewolves_proto::{ use werewolves_proto::{
aura::{Aura, AuraTitle}, aura::AuraTitle,
diedto::DiedToTitle, diedto::DiedToTitle,
role::{Alignment, Killer, Powerful, RoleTitle}, role::{Alignment, Killer, Powerful, RoleTitle},
}; };

View File

@ -17,7 +17,7 @@ use std::rc::Rc;
use convert_case::{Case, Casing}; use convert_case::{Case, Casing};
use werewolves_proto::{ use werewolves_proto::{
aura::{Aura, AuraTitle}, aura::AuraTitle,
error::GameError, error::GameError,
game::{GameSettings, OrRandom, SetupRole, SetupSlot, SlotId}, game::{GameSettings, OrRandom, SetupRole, SetupSlot, SlotId},
message::{Identification, PlayerState, PublicIdentity}, message::{Identification, PlayerState, PublicIdentity},

View File

@ -1,7 +1,7 @@
use werewolves_proto::aura::AuraTitle; use werewolves_proto::aura::AuraTitle;
use yew::prelude::*; use yew::prelude::*;
use crate::components::{Icon, IconSource, IconType, PartialAssociatedIcon}; use crate::components::{Icon, IconSource, PartialAssociatedIcon};
#[function_component] #[function_component]
pub fn DrunkPage() -> Html { pub fn DrunkPage() -> Html {

View File

@ -22,22 +22,20 @@ use crate::clients::client::connection::ConnectionError;
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum WerewolfError { pub enum WerewolfError {
#[error("{0}")] #[error("{0}")]
GameError(#[from] GameError), Game(#[from] GameError),
#[error("local storage error: {0}")] #[error("local storage error: {0}")]
LocalStorageError(String), LocalStorage(String),
#[error("invalid target")]
InvalidTarget,
#[error("send error: {0}")] #[error("send error: {0}")]
SendError(#[from] futures::channel::mpsc::SendError), Send(#[from] futures::channel::mpsc::SendError),
#[error("send error: {0}")] #[error("send error: {0}")]
ClientSendError(#[from] yew::platform::pinned::mpsc::SendError<ClientMessage>), ClientSend(#[from] yew::platform::pinned::mpsc::SendError<ClientMessage>),
#[error("connection error: {0}")] #[error("connection error: {0}")]
ConnectionError(#[from] ConnectionError), Connection(#[from] ConnectionError),
} }
impl From<StorageError> for WerewolfError { impl From<StorageError> for WerewolfError {
fn from(storage_error: StorageError) -> Self { fn from(storage_error: StorageError) -> Self {
Self::LocalStorageError(storage_error.to_string()) Self::LocalStorage(storage_error.to_string())
} }
} }

View File

@ -13,13 +13,10 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use convert_case::{Case, Casing}; use convert_case::{Case, Casing};
use werewolves_proto::{ use werewolves_proto::{game::SetupRole, role::RoleTitle};
game::SetupRole,
role::{Alignment, RoleTitle},
};
use yew::prelude::*; use yew::prelude::*;
use crate::components::{AssociatedIcon, Icon, IconSource, IconType, PartialAssociatedIcon}; use crate::components::{Icon, PartialAssociatedIcon};
#[derive(Debug, Clone, Copy, PartialEq, Properties)] #[derive(Debug, Clone, Copy, PartialEq, Properties)]
pub struct RoleChangePageProps { pub struct RoleChangePageProps {

View File

@ -15,7 +15,7 @@
use werewolves_proto::role::Killer; use werewolves_proto::role::Killer;
use yew::prelude::*; use yew::prelude::*;
use crate::components::{Icon, IconSource, IconType}; use crate::components::{Icon, IconSource};
#[function_component] #[function_component]
pub fn AdjudicatorPage1() -> Html { pub fn AdjudicatorPage1() -> Html {

View File

@ -12,11 +12,10 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::ops::Not;
use yew::prelude::*; use yew::prelude::*;
use crate::components::{Icon, IconSource, IconType}; use crate::components::{Icon, IconSource};
#[function_component] #[function_component]
pub fn EmpathPage1() -> Html { pub fn EmpathPage1() -> Html {

View File

@ -16,7 +16,7 @@ use convert_case::{Case, Casing};
use werewolves_proto::role::RoleTitle; use werewolves_proto::role::RoleTitle;
use yew::prelude::*; use yew::prelude::*;
use crate::components::{Icon, IconSource, IconType, PartialAssociatedIcon}; use crate::components::{Icon, IconSource, PartialAssociatedIcon};
#[function_component] #[function_component]
pub fn GravediggerPage1() -> Html { pub fn GravediggerPage1() -> Html {

View File

@ -15,7 +15,7 @@
use werewolves_proto::message::CharacterIdentity; use werewolves_proto::message::CharacterIdentity;
use yew::prelude::*; use yew::prelude::*;
use crate::components::{CharacterTargetCard, Icon, IconSource, IconType}; use crate::components::{CharacterTargetCard, Icon, IconSource};
#[derive(Debug, Clone, PartialEq, Properties)] #[derive(Debug, Clone, PartialEq, Properties)]
pub struct GuardianPageProps { pub struct GuardianPageProps {

View File

@ -14,7 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use yew::prelude::*; use yew::prelude::*;
use crate::components::{Icon, IconSource, IconType}; use crate::components::{Icon, IconSource};
#[function_component] #[function_component]
pub fn HunterPage1() -> Html { pub fn HunterPage1() -> Html {

View File

@ -14,7 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use yew::prelude::*; use yew::prelude::*;
use crate::components::{Icon, IconSource, IconType}; use crate::components::{Icon, IconSource};
#[function_component] #[function_component]
pub fn MilitiaPage1() -> Html { pub fn MilitiaPage1() -> Html {

View File

@ -14,7 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use yew::prelude::*; use yew::prelude::*;
use crate::components::{Icon, IconSource, IconType}; use crate::components::{Icon, IconSource};
#[function_component] #[function_component]
pub fn PyremasterPage1() -> Html { pub fn PyremasterPage1() -> Html {

View File

@ -15,9 +15,7 @@
use werewolves_proto::role::{Alignment, RoleTitle}; use werewolves_proto::role::{Alignment, RoleTitle};
use yew::prelude::*; use yew::prelude::*;
use crate::components::{ use crate::components::{AssociatedIcon, Icon, IconSource, IconType, attributes::RoleTitleSpan};
AssociatedIcon, Icon, IconSource, IconType, PartialAssociatedIcon, attributes::RoleTitleSpan,
};
#[function_component] #[function_component]
pub fn SeerPage1() -> Html { pub fn SeerPage1() -> Html {

View File

@ -14,7 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use yew::prelude::*; use yew::prelude::*;
use crate::components::{Icon, IconSource, IconType}; use crate::components::{Icon, IconSource};
#[function_component] #[function_component]
pub fn VindicatorPage1() -> Html { pub fn VindicatorPage1() -> Html {

View File

@ -12,14 +12,9 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use convert_case::{Case, Casing};
use werewolves_proto::{
game::SetupRole,
role::{Alignment, RoleTitle},
};
use yew::prelude::*; use yew::prelude::*;
use crate::components::{AssociatedIcon, Icon, IconSource, IconType, PartialAssociatedIcon}; use crate::components::{Icon, IconSource};
#[function_component] #[function_component]
pub fn ShiftFailed() -> Html { pub fn ShiftFailed() -> Html {

View File

@ -12,12 +12,10 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::ops::Not;
use werewolves_proto::role::Powerful;
use yew::prelude::*; use yew::prelude::*;
use crate::components::{AssociatedIcon, Icon, IconSource, IconType}; use crate::components::{Icon, IconSource};
#[function_component] #[function_component]
pub fn WolfpackKillPage() -> Html { pub fn WolfpackKillPage() -> Html {