mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
extended clippy from quality.sh
This commit is contained in:
parent
540f0d10f2
commit
df03c92741
@ -22,7 +22,7 @@ pub struct Tui {
|
||||
|
||||
impl Tui {
|
||||
pub fn new() -> (Self, async_channel::Receiver<Cmd>) {
|
||||
let (mut commands_s, commands_r) = async_channel::unbounded();
|
||||
let (commands_s, commands_r) = async_channel::unbounded();
|
||||
|
||||
let handle = thread::spawn(move || {
|
||||
thread::sleep(Duration::from_millis(20));
|
||||
@ -36,7 +36,7 @@ impl Tui {
|
||||
)
|
||||
.unwrap();
|
||||
while let Ok(cmd) = readline.readline("\n\nbotclient> ") {
|
||||
let keep_going = Self::process_command(&cmd, &mut commands_s);
|
||||
let keep_going = Self::process_command(&cmd, &commands_s);
|
||||
readline.add_history_entry(cmd).unwrap();
|
||||
if !keep_going {
|
||||
break;
|
||||
@ -47,7 +47,7 @@ impl Tui {
|
||||
(Self { _handle: handle }, commands_r)
|
||||
}
|
||||
|
||||
pub fn process_command(cmd: &str, command_s: &mut async_channel::Sender<Cmd>) -> bool {
|
||||
pub fn process_command(cmd: &str, command_s: &async_channel::Sender<Cmd>) -> bool {
|
||||
let matches = Command::new("veloren-botclient")
|
||||
.version(common::util::DISPLAY_VERSION_LONG.as_str())
|
||||
.author("The veloren devs <https://gitlab.com/veloren/veloren>")
|
||||
|
@ -749,12 +749,12 @@ pub mod asset_tweak {
|
||||
|
||||
run_with_file(tweak_path, |file| {
|
||||
file.write_all(
|
||||
br#"
|
||||
br"
|
||||
((
|
||||
such: 5,
|
||||
field: 35.752346,
|
||||
))
|
||||
"#,
|
||||
",
|
||||
)
|
||||
.expect("failed to write to the file");
|
||||
|
||||
|
@ -100,11 +100,11 @@ fn input_validated_string(prompt: &str, check: &dyn Fn(&str) -> bool) -> String
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let prompt = r#"
|
||||
let prompt = r"
|
||||
Stub implementation.
|
||||
If you want to migrate new assets, edit `v1` and `v2` modules.
|
||||
If you want to migrate old assets, check commit history.
|
||||
"#;
|
||||
";
|
||||
println!("{prompt}");
|
||||
|
||||
let old_dir = input_validated_string(
|
||||
|
@ -1185,7 +1185,7 @@ mod tests {
|
||||
init();
|
||||
info!("init");
|
||||
|
||||
let mut stock: hashbrown::HashMap<Good, f32> = vec![
|
||||
let mut stock: hashbrown::HashMap<Good, f32> = [
|
||||
(Good::Ingredients, 50.0),
|
||||
(Good::Tools, 10.0),
|
||||
(Good::Armor, 10.0),
|
||||
|
@ -16,7 +16,7 @@ impl<T> Id<T> {
|
||||
|
||||
impl<T> Copy for Id<T> {}
|
||||
impl<T> Clone for Id<T> {
|
||||
fn clone(&self) -> Self { Self(self.0, PhantomData) }
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl<T> Eq for Id<T> {}
|
||||
impl<T> PartialEq for Id<T> {
|
||||
|
@ -141,6 +141,7 @@ pub fn create_player(state: &mut State) -> Entity {
|
||||
.build()
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_ref_mut)]
|
||||
pub fn generate_chunk(state: &mut State, chunk_pos: Vec2<i32>) {
|
||||
let (x, y) = chunk_pos.map(|e| e.to_le_bytes()).into_tuple();
|
||||
let mut rng = SmallRng::from_seed([
|
||||
|
@ -864,7 +864,7 @@ mod tests {
|
||||
async fn mock_mpsc(
|
||||
cid: Cid,
|
||||
_runtime: &Arc<Runtime>,
|
||||
create_channel: &mut mpsc::UnboundedSender<S2bCreateChannel>,
|
||||
create_channel: &mpsc::UnboundedSender<S2bCreateChannel>,
|
||||
) -> Protocols {
|
||||
let (s1, r1) = mpsc::channel(100);
|
||||
let (s2, r2) = mpsc::channel(100);
|
||||
@ -887,14 +887,14 @@ mod tests {
|
||||
a2b_open_stream_s,
|
||||
b2a_stream_opened_r,
|
||||
mut b2a_event_r,
|
||||
mut s2b_create_channel_s,
|
||||
s2b_create_channel_s,
|
||||
s2b_shutdown_bparticipant_s,
|
||||
b2s_prio_statistic_r,
|
||||
_b2a_bandwidth_stats_r,
|
||||
handle,
|
||||
) = mock_bparticipant();
|
||||
|
||||
let _remote = runtime.block_on(mock_mpsc(0, &runtime, &mut s2b_create_channel_s));
|
||||
let _remote = runtime.block_on(mock_mpsc(0, &runtime, &s2b_create_channel_s));
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
|
||||
let (s, r) = oneshot::channel();
|
||||
@ -933,14 +933,14 @@ mod tests {
|
||||
a2b_open_stream_s,
|
||||
b2a_stream_opened_r,
|
||||
mut b2a_event_r,
|
||||
mut s2b_create_channel_s,
|
||||
s2b_create_channel_s,
|
||||
s2b_shutdown_bparticipant_s,
|
||||
b2s_prio_statistic_r,
|
||||
_b2a_bandwidth_stats_r,
|
||||
handle,
|
||||
) = mock_bparticipant();
|
||||
|
||||
let remote = runtime.block_on(mock_mpsc(0, &runtime, &mut s2b_create_channel_s));
|
||||
let remote = runtime.block_on(mock_mpsc(0, &runtime, &s2b_create_channel_s));
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
|
||||
let (s, r) = oneshot::channel();
|
||||
@ -980,14 +980,14 @@ mod tests {
|
||||
a2b_open_stream_s,
|
||||
b2a_stream_opened_r,
|
||||
_b2a_event_r,
|
||||
mut s2b_create_channel_s,
|
||||
s2b_create_channel_s,
|
||||
s2b_shutdown_bparticipant_s,
|
||||
b2s_prio_statistic_r,
|
||||
_b2a_bandwidth_stats_r,
|
||||
handle,
|
||||
) = mock_bparticipant();
|
||||
|
||||
let remote = runtime.block_on(mock_mpsc(0, &runtime, &mut s2b_create_channel_s));
|
||||
let remote = runtime.block_on(mock_mpsc(0, &runtime, &s2b_create_channel_s));
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
|
||||
// created stream
|
||||
@ -1036,14 +1036,14 @@ mod tests {
|
||||
a2b_open_stream_s,
|
||||
mut b2a_stream_opened_r,
|
||||
_b2a_event_r,
|
||||
mut s2b_create_channel_s,
|
||||
s2b_create_channel_s,
|
||||
s2b_shutdown_bparticipant_s,
|
||||
b2s_prio_statistic_r,
|
||||
_b2a_bandwidth_stats_r,
|
||||
handle,
|
||||
) = mock_bparticipant();
|
||||
|
||||
let remote = runtime.block_on(mock_mpsc(0, &runtime, &mut s2b_create_channel_s));
|
||||
let remote = runtime.block_on(mock_mpsc(0, &runtime, &s2b_create_channel_s));
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
|
||||
// create stream
|
||||
|
@ -129,7 +129,7 @@ pub struct ArgvApp {
|
||||
pub command: Option<ArgvCommand>,
|
||||
}
|
||||
|
||||
pub fn parse_command(input: &str, msg_s: &mut Sender<Message>) {
|
||||
pub fn parse_command(input: &str, msg_s: &Sender<Message>) {
|
||||
match TuiApp::try_parse_from(shell_words::split(input).unwrap_or_default()) {
|
||||
Ok(message) => {
|
||||
msg_s
|
||||
|
@ -29,7 +29,7 @@ pub struct Tui {
|
||||
}
|
||||
|
||||
impl Tui {
|
||||
fn handle_events(input: &mut String, msg_s: &mut mpsc::Sender<Message>) {
|
||||
fn handle_events(input: &mut String, msg_s: &mpsc::Sender<Message>) {
|
||||
use crossterm::event::*;
|
||||
if let Event::Key(event) = read().unwrap() {
|
||||
match event.code {
|
||||
@ -81,7 +81,7 @@ impl Tui {
|
||||
}
|
||||
|
||||
/// In a seperate Thread
|
||||
fn work_b(running: Arc<AtomicBool>, mut msg_s: mpsc::Sender<Message>) {
|
||||
fn work_b(running: Arc<AtomicBool>, msg_s: mpsc::Sender<Message>) {
|
||||
while running.load(Ordering::Relaxed) {
|
||||
let mut line = String::new();
|
||||
|
||||
@ -100,14 +100,14 @@ impl Tui {
|
||||
},
|
||||
Ok(_) => {
|
||||
debug!(?line, "basic mode: command entered");
|
||||
cli::parse_command(line.trim(), &mut msg_s);
|
||||
cli::parse_command(line.trim(), &msg_s);
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// In a seperate Thread
|
||||
fn work_e(running: Arc<AtomicBool>, mut msg_s: mpsc::Sender<Message>) {
|
||||
fn work_e(running: Arc<AtomicBool>, msg_s: mpsc::Sender<Message>) {
|
||||
// Start the tui
|
||||
let mut stdout = io::stdout();
|
||||
execute!(stdout, EnterAlternateScreen, EnableMouseCapture).unwrap();
|
||||
@ -169,7 +169,7 @@ impl Tui {
|
||||
warn!(?e, "couldn't draw frame");
|
||||
};
|
||||
if crossterm::event::poll(Duration::from_millis(100)).unwrap() {
|
||||
Self::handle_events(&mut input, &mut msg_s);
|
||||
Self::handle_events(&mut input, &msg_s);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1939,7 +1939,7 @@ impl<'a> AgentData<'a> {
|
||||
|
||||
pub fn menacing(
|
||||
&self,
|
||||
agent: &mut Agent,
|
||||
agent: &Agent,
|
||||
controller: &mut Controller,
|
||||
target: EcsEntity,
|
||||
read_data: &ReadData,
|
||||
|
@ -2924,11 +2924,7 @@ impl<'a> AgentData<'a> {
|
||||
{
|
||||
agent.action_state.counters[FCounters::SummonThreshold as usize] -=
|
||||
SUMMON_THRESHOLD;
|
||||
if !agent.action_state.conditions[Conditions::AttackToggle as usize] {
|
||||
agent.action_state.conditions[Conditions::AttackToggle as usize] = true;
|
||||
} else {
|
||||
agent.action_state.conditions[Conditions::AttackToggle as usize] = false;
|
||||
}
|
||||
agent.action_state.conditions[Conditions::AttackToggle as usize] = !agent.action_state.conditions[Conditions::AttackToggle as usize];
|
||||
}
|
||||
} else {
|
||||
// If target is in melee range use flamecrush
|
||||
|
@ -316,7 +316,7 @@ fn no_sudo(client: EcsEntity, target: EcsEntity) -> CmdResult<()> {
|
||||
/// with a higher role than their permanent role allowing it, and only permanent
|
||||
/// roles should be recorded in the settings files.
|
||||
fn verify_above_role(
|
||||
server: &mut Server,
|
||||
server: &Server,
|
||||
(client, client_uuid): (EcsEntity, Uuid),
|
||||
(player, player_uuid): (EcsEntity, Uuid),
|
||||
reason: &str,
|
||||
@ -379,7 +379,7 @@ fn find_username(server: &mut Server, username: &str) -> CmdResult<Uuid> {
|
||||
|
||||
/// NOTE: Intended to be run only on logged-in clients.
|
||||
fn uuid_to_username(
|
||||
server: &mut Server,
|
||||
server: &Server,
|
||||
fallback_entity: EcsEntity,
|
||||
uuid: Uuid,
|
||||
) -> CmdResult<String> {
|
||||
@ -405,7 +405,7 @@ fn uuid_to_username(
|
||||
}
|
||||
|
||||
fn edit_setting_feedback<S: EditableSetting>(
|
||||
server: &mut Server,
|
||||
server: &Server,
|
||||
client: EcsEntity,
|
||||
result: Option<(String, Result<(), SettingError<S>>)>,
|
||||
failure: impl FnOnce() -> String,
|
||||
@ -2426,7 +2426,7 @@ fn handle_kit(
|
||||
}
|
||||
}
|
||||
|
||||
fn push_kit<I>(kit: I, count: usize, server: &mut Server, target: EcsEntity) -> CmdResult<()>
|
||||
fn push_kit<I>(kit: I, count: usize, server: &Server, target: EcsEntity) -> CmdResult<()>
|
||||
where
|
||||
I: Iterator<Item = (KitSpec, u32)>,
|
||||
{
|
||||
@ -4040,7 +4040,7 @@ fn handle_buff(
|
||||
}
|
||||
}
|
||||
|
||||
fn cast_buff(kind: &str, data: BuffData, server: &mut Server, target: EcsEntity) -> CmdResult<()> {
|
||||
fn cast_buff(kind: &str, data: BuffData, server: &Server, target: EcsEntity) -> CmdResult<()> {
|
||||
if let Some(buffkind) = parse_buffkind(kind) {
|
||||
let ecs = &server.state.ecs();
|
||||
let mut buffs_all = ecs.write_storage::<comp::Buffs>();
|
||||
|
@ -300,7 +300,7 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, last_change: Healt
|
||||
|
||||
let alignments = state.ecs().read_storage::<Alignment>();
|
||||
let uids = state.ecs().read_storage::<Uid>();
|
||||
let mut outcomes = state.ecs().write_resource::<EventBus<Outcome>>();
|
||||
let outcomes = state.ecs().write_resource::<EventBus<Outcome>>();
|
||||
let inventories = state.ecs().read_storage::<Inventory>();
|
||||
|
||||
let destroyed_group = groups.get(entity);
|
||||
@ -384,7 +384,7 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, last_change: Healt
|
||||
attacker_inventory,
|
||||
&mut attacker_skill_set,
|
||||
attacker_uid,
|
||||
&mut outcomes,
|
||||
&outcomes,
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -1186,8 +1186,8 @@ pub fn handle_bonk(server: &mut Server, pos: Vec3<f32>, owner: Option<Uid>, targ
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_aura(server: &mut Server, entity: EcsEntity, aura_change: aura::AuraChange) {
|
||||
let ecs = &server.state.ecs();
|
||||
pub fn handle_aura(server: &Server, entity: EcsEntity, aura_change: aura::AuraChange) {
|
||||
let ecs = server.state.ecs();
|
||||
let mut auras_all = ecs.write_storage::<Auras>();
|
||||
if let Some(mut auras) = auras_all.get_mut(entity) {
|
||||
use aura::AuraChange;
|
||||
@ -1204,7 +1204,7 @@ pub fn handle_aura(server: &mut Server, entity: EcsEntity, aura_change: aura::Au
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_buff(server: &mut Server, entity: EcsEntity, buff_change: buff::BuffChange) {
|
||||
pub fn handle_buff(server: &Server, entity: EcsEntity, buff_change: buff::BuffChange) {
|
||||
let ecs = &server.state.ecs();
|
||||
let mut buffs_all = ecs.write_storage::<comp::Buffs>();
|
||||
let bodies = ecs.read_storage::<Body>();
|
||||
@ -1301,7 +1301,7 @@ fn handle_exp_gain(
|
||||
inventory: &Inventory,
|
||||
skill_set: &mut SkillSet,
|
||||
uid: &Uid,
|
||||
outcomes: &mut EventBus<Outcome>,
|
||||
outcomes: &EventBus<Outcome>,
|
||||
) {
|
||||
use comp::inventory::{item::ItemKind, slot::EquipSlot};
|
||||
|
||||
@ -1671,7 +1671,7 @@ pub fn handle_teleport_to_position(server: &mut Server, entity: EcsEntity, posit
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_start_teleporting(server: &mut Server, entity: EcsEntity, portal: EcsEntity) {
|
||||
pub fn handle_start_teleporting(server: &Server, entity: EcsEntity, portal: EcsEntity) {
|
||||
let ecs = server.state.ecs();
|
||||
let positions = ecs.read_storage::<comp::Pos>();
|
||||
let mut teleportings = ecs.write_storage::<comp::Teleporting>();
|
||||
|
@ -18,7 +18,7 @@ use specs::{
|
||||
pub fn can_invite(
|
||||
state: &State,
|
||||
clients: &ReadStorage<'_, Client>,
|
||||
pending_invites: &mut WriteStorage<'_, PendingInvites>,
|
||||
pending_invites: &WriteStorage<'_, PendingInvites>,
|
||||
max_group_size: u32,
|
||||
inviter: Entity,
|
||||
invitee: Entity,
|
||||
|
@ -391,8 +391,8 @@ pub fn handle_mine_block(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_sound(server: &mut Server, sound: &Sound) {
|
||||
let ecs = &server.state.ecs();
|
||||
pub fn handle_sound(server: &Server, sound: &Sound) {
|
||||
let ecs = server.state.ecs();
|
||||
let positions = &ecs.read_storage::<Pos>();
|
||||
let agents = &mut ecs.write_storage::<comp::Agent>();
|
||||
|
||||
@ -459,7 +459,7 @@ pub fn handle_create_sprite(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_tame_pet(server: &mut Server, pet_entity: EcsEntity, owner_entity: EcsEntity) {
|
||||
pub fn handle_tame_pet(server: &Server, pet_entity: EcsEntity, owner_entity: EcsEntity) {
|
||||
// TODO: Raise outcome to send to clients to play sound/render an indicator
|
||||
// showing taming success?
|
||||
tame_pet(server.state.ecs(), pet_entity, owner_entity);
|
||||
|
@ -71,7 +71,7 @@ pub fn handle_invite(server: &mut Server, inviter: Entity, invitee_uid: Uid, kin
|
||||
if !group_manip::can_invite(
|
||||
state,
|
||||
&clients,
|
||||
&mut pending_invites,
|
||||
&pending_invites,
|
||||
max_group_size,
|
||||
inviter,
|
||||
invitee,
|
||||
@ -275,7 +275,7 @@ pub fn handle_invite_accept(server: &mut Server, entity: Entity) {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_inviter_and_kind(entity: Entity, state: &mut State) -> Option<(Entity, InviteKind)> {
|
||||
fn get_inviter_and_kind(entity: Entity, state: &State) -> Option<(Entity, InviteKind)> {
|
||||
let mut invites = state.ecs().write_storage::<Invite>();
|
||||
invites.remove(entity).and_then(|invite| {
|
||||
let Invite { inviter, kind } = invite;
|
||||
@ -294,7 +294,7 @@ fn get_inviter_and_kind(entity: Entity, state: &mut State) -> Option<(Entity, In
|
||||
}
|
||||
|
||||
fn handle_invite_answer(
|
||||
state: &mut State,
|
||||
state: &State,
|
||||
inviter: Entity,
|
||||
entity: Entity,
|
||||
invite_answer: InviteAnswer,
|
||||
|
@ -253,7 +253,7 @@ pub fn handle_client_disconnect(
|
||||
// temporarily unable to log in during this period to avoid
|
||||
// the race condition of their login fetching their old data
|
||||
// and overwriting the data saved here.
|
||||
fn persist_entity(state: &mut State, entity: EcsEntity) -> EcsEntity {
|
||||
fn persist_entity(state: &State, entity: EcsEntity) -> EcsEntity {
|
||||
if let (
|
||||
Some(presence),
|
||||
Some(skill_set),
|
||||
|
@ -54,7 +54,7 @@ fn notify_agent_prices(
|
||||
|
||||
/// Invoked when the trade UI is up, handling item changes, accepts, etc
|
||||
pub(super) fn handle_process_trade_action(
|
||||
server: &mut Server,
|
||||
server: &Server,
|
||||
entity: EcsEntity,
|
||||
trade_id: TradeId,
|
||||
action: TradeAction,
|
||||
@ -169,7 +169,7 @@ pub(super) fn handle_process_trade_action(
|
||||
/// longer exists or is awareof this cancellation through other means (e.g.
|
||||
/// client getting ExitInGameSuccess message knows that it should clear any
|
||||
/// trades).
|
||||
pub(crate) fn cancel_trades_for(state: &mut common_state::State, entity: EcsEntity) {
|
||||
pub(crate) fn cancel_trades_for(state: &common_state::State, entity: EcsEntity) {
|
||||
let ecs = state.ecs();
|
||||
if let Some(uid) = ecs.uid_from_entity(entity) {
|
||||
let mut trades = ecs.write_resource::<Trades>();
|
||||
|
@ -1173,9 +1173,9 @@ impl Server {
|
||||
/// due to a persistence transaction failure and returns the processed
|
||||
/// DisconnectionType
|
||||
fn disconnect_all_clients_if_requested(&mut self) -> Option<DisconnectType> {
|
||||
let mut character_updater = self.state.ecs().fetch_mut::<CharacterUpdater>();
|
||||
let character_updater = self.state.ecs().fetch_mut::<CharacterUpdater>();
|
||||
|
||||
let disconnect_type = self.get_disconnect_all_clients_requested(&mut character_updater);
|
||||
let disconnect_type = self.get_disconnect_all_clients_requested(&character_updater);
|
||||
if let Some(disconnect_type) = disconnect_type {
|
||||
let with_persistence = disconnect_type == DisconnectType::WithPersistence;
|
||||
let clients = self.state.ecs().read_storage::<Client>();
|
||||
@ -1206,7 +1206,7 @@ impl Server {
|
||||
|
||||
fn get_disconnect_all_clients_requested(
|
||||
&self,
|
||||
character_updater: &mut CharacterUpdater,
|
||||
character_updater: &CharacterUpdater,
|
||||
) -> Option<DisconnectType> {
|
||||
let without_persistence_requested = character_updater.disconnect_all_clients_requested();
|
||||
let with_persistence_requested = self.disconnect_all_clients_requested;
|
||||
|
@ -1062,7 +1062,7 @@ pub fn update(
|
||||
// The `defer_foreign_keys` pragma treats the foreign key
|
||||
// constraints as deferred for the next transaction (it turns itself
|
||||
// off at the commit boundary). https://sqlite.org/foreignkeys.html#fk_deferred
|
||||
transaction.pragma_update(None, "defer_foreign_keys", &"ON".to_string())?;
|
||||
transaction.pragma_update(None, "defer_foreign_keys", "ON".to_string())?;
|
||||
|
||||
let mut stmt = transaction.prepare_cached(
|
||||
"
|
||||
|
@ -44,7 +44,7 @@ pub fn add_server_systems(dispatch_builder: &mut DispatcherBuilder) {
|
||||
dispatch::<chunk_send::Sys>(dispatch_builder, &[]);
|
||||
}
|
||||
|
||||
pub fn run_sync_systems(ecs: &mut specs::World) {
|
||||
pub fn run_sync_systems(ecs: &specs::World) {
|
||||
// Setup for entity sync
|
||||
// If I'm not mistaken, these two could be ran in parallel
|
||||
run_now::<sentinel::Sys>(ecs);
|
||||
|
@ -517,7 +517,7 @@ pub fn maintain_egui_inner(
|
||||
}
|
||||
|
||||
fn selected_entity_window(
|
||||
platform: &mut Platform,
|
||||
platform: &Platform,
|
||||
ecs: &World,
|
||||
selected_entity_info: &mut SelectedEntityInfo,
|
||||
egui_actions: &mut EguiActions,
|
||||
|
@ -196,7 +196,7 @@ fn invalid_command_message(client: &Client, user_entered_invalid_command: String
|
||||
}
|
||||
|
||||
fn run_client_command(
|
||||
client: &mut Client,
|
||||
client: &Client,
|
||||
global_state: &mut GlobalState,
|
||||
command: ClientChatCommand,
|
||||
args: Vec<String>,
|
||||
@ -407,7 +407,7 @@ impl TabComplete for ArgumentSpec {
|
||||
.filter(|string| string.starts_with(part))
|
||||
.map(|c| c.to_string())
|
||||
.collect(),
|
||||
ArgumentSpec::Boolean(_, part, _) => vec!["true", "false"]
|
||||
ArgumentSpec::Boolean(_, part, _) => ["true", "false"]
|
||||
.iter()
|
||||
.filter(|string| string.starts_with(part))
|
||||
.map(|c| c.to_string())
|
||||
|
@ -196,7 +196,7 @@ impl<'a> InventoryScroller<'a> {
|
||||
.set(self.bg_ids.bg_frame, ui);
|
||||
}
|
||||
|
||||
fn title(&mut self, state: &mut ConrodState<'_, InventoryScrollerState>, ui: &mut UiCell<'_>) {
|
||||
fn title(&mut self, state: &ConrodState<'_, InventoryScrollerState>, ui: &mut UiCell<'_>) {
|
||||
Text::new(
|
||||
&self
|
||||
.localized_strings
|
||||
@ -371,7 +371,7 @@ impl<'a> InventoryScroller<'a> {
|
||||
});
|
||||
}
|
||||
for (pos, item) in items.into_iter() {
|
||||
if self.details_mode && !self.is_us && matches!(item, None) {
|
||||
if self.details_mode && !self.is_us && item.is_none() {
|
||||
continue;
|
||||
}
|
||||
let (x, y) = if self.details_mode {
|
||||
@ -488,7 +488,7 @@ impl<'a> InventoryScroller<'a> {
|
||||
|
||||
fn footer_metrics(
|
||||
&mut self,
|
||||
state: &mut ConrodState<'_, InventoryScrollerState>,
|
||||
state: &ConrodState<'_, InventoryScrollerState>,
|
||||
ui: &mut UiCell<'_>,
|
||||
) {
|
||||
let space_used = self.inventory.populated_slots();
|
||||
|
@ -874,13 +874,13 @@ mod tests {
|
||||
#[test]
|
||||
fn parse_cmds() {
|
||||
let expected: Result<(String, Vec<String>), String> = Ok(("help".to_string(), vec![]));
|
||||
assert_eq!(parse_cmd(r#"help"#), expected);
|
||||
assert_eq!(parse_cmd(r"help"), expected);
|
||||
|
||||
let expected: Result<(String, Vec<String>), String> = Ok(("say".to_string(), vec![
|
||||
"foo".to_string(),
|
||||
"bar".to_string(),
|
||||
]));
|
||||
assert_eq!(parse_cmd(r#"say foo bar"#), expected);
|
||||
assert_eq!(parse_cmd(r"say foo bar"), expected);
|
||||
assert_eq!(parse_cmd(r#"say "foo" "bar""#), expected);
|
||||
|
||||
let expected: Result<(String, Vec<String>), String> =
|
||||
|
@ -1479,7 +1479,7 @@ impl<'a> Widget for Crafting<'a> {
|
||||
});
|
||||
self.inventory
|
||||
.slots_with_id()
|
||||
.filter(|(_, item)| item.as_ref().map_or(false, |i| can_repair(i)))
|
||||
.filter(|(_, item)| item.as_ref().map_or(false, can_repair))
|
||||
.for_each(|(slot, _)| {
|
||||
events.push(Event::RepairItem {
|
||||
slot: Slot::Inventory(slot),
|
||||
@ -1489,7 +1489,7 @@ impl<'a> Widget for Crafting<'a> {
|
||||
|
||||
let can_perform = repair_slot
|
||||
.item(self.inventory)
|
||||
.map_or(false, |item| can_repair(item));
|
||||
.map_or(false, can_repair);
|
||||
|
||||
(repair_slot.slot, None, can_perform)
|
||||
},
|
||||
|
@ -2572,7 +2572,7 @@ impl<'a> Diary<'a> {
|
||||
ui: &mut UiCell,
|
||||
events: &mut Vec<Event>,
|
||||
diary_tooltip: &Tooltip,
|
||||
state: &mut State<DiaryState>,
|
||||
state: &State<DiaryState>,
|
||||
) {
|
||||
for (i, icon) in icons.iter().enumerate() {
|
||||
match icon {
|
||||
@ -2824,7 +2824,7 @@ impl<'a> Diary<'a> {
|
||||
ui: &mut UiCell,
|
||||
events: &mut Vec<Event>,
|
||||
diary_tooltip: &Tooltip,
|
||||
state: &mut State<DiaryState>,
|
||||
state: &State<DiaryState>,
|
||||
) {
|
||||
let locked = !self.skill_set.prerequisites_met(skill);
|
||||
let owned = self.skill_set.has_skill(skill);
|
||||
|
@ -516,19 +516,7 @@ impl BuffIconKind {
|
||||
|
||||
impl PartialOrd for BuffIconKind {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
match (self, other) {
|
||||
(
|
||||
BuffIconKind::Buff { kind, .. },
|
||||
BuffIconKind::Buff {
|
||||
kind: other_kind, ..
|
||||
},
|
||||
) => Some(kind.cmp(other_kind)),
|
||||
(BuffIconKind::Buff { .. }, BuffIconKind::Stance(_)) => Some(Ordering::Greater),
|
||||
(BuffIconKind::Stance(_), BuffIconKind::Buff { .. }) => Some(Ordering::Less),
|
||||
(BuffIconKind::Stance(stance), BuffIconKind::Stance(stance_other)) => {
|
||||
Some(stance.cmp(stance_other))
|
||||
},
|
||||
}
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
@ -586,7 +574,7 @@ impl BuffIcon {
|
||||
buffs
|
||||
.iter_active()
|
||||
.filter_map(BuffIcon::from_buffs)
|
||||
.chain(stance.and_then(BuffIcon::from_stance).into_iter())
|
||||
.chain(stance.and_then(BuffIcon::from_stance))
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
@ -1089,7 +1077,7 @@ impl Show {
|
||||
|| !matches!(self.open_windows, Windows::None)
|
||||
}
|
||||
|
||||
fn toggle_windows(&mut self, global_state: &mut GlobalState) {
|
||||
fn toggle_windows(&mut self, global_state: &GlobalState) {
|
||||
if self.any_window_requires_cursor() {
|
||||
self.bag = false;
|
||||
self.trade = false;
|
||||
@ -1146,7 +1134,7 @@ impl Show {
|
||||
|
||||
/// If all of the menus are closed, adjusts coordinates of cursor to center
|
||||
/// of screen
|
||||
fn toggle_cursor_on_menu_close(&self, global_state: &mut GlobalState, ui: &mut Ui) {
|
||||
fn toggle_cursor_on_menu_close(&self, global_state: &GlobalState, ui: &mut Ui) {
|
||||
if !self.bag
|
||||
&& !self.trade
|
||||
&& !self.esc_menu
|
||||
|
@ -223,7 +223,7 @@ impl<'a> Widget for Quest<'a> {
|
||||
// [amount, item_desc]
|
||||
|
||||
//("common.items.weapons.sword.caladbolg");
|
||||
let rewards = vec![
|
||||
let rewards = [
|
||||
(1, "common.items.weapons.dagger.starter_dagger", "Dagger"),
|
||||
(4, "common.items.crafting_ing.seashells", "Seashell"),
|
||||
(
|
||||
|
@ -143,7 +143,7 @@ impl<'a> Trade<'a> {
|
||||
const MAX_TRADE_SLOTS: usize = 16;
|
||||
|
||||
impl<'a> Trade<'a> {
|
||||
fn background(&mut self, state: &mut ConrodState<'_, State>, ui: &mut UiCell<'_>) {
|
||||
fn background(&mut self, state: &ConrodState<'_, State>, ui: &mut UiCell<'_>) {
|
||||
Image::new(self.imgs.inv_middle_bg_bag)
|
||||
.w_h(424.0, 482.0)
|
||||
.color(Some(UI_MAIN))
|
||||
@ -156,7 +156,7 @@ impl<'a> Trade<'a> {
|
||||
.set(state.ids.bg_frame, ui);
|
||||
}
|
||||
|
||||
fn title(&mut self, state: &mut ConrodState<'_, State>, ui: &mut UiCell<'_>) {
|
||||
fn title(&mut self, state: &ConrodState<'_, State>, ui: &mut UiCell<'_>) {
|
||||
Text::new(&self.localized_strings.get_msg("hud-trade-trade_window"))
|
||||
.mid_top_with_margin_on(state.ids.bg_frame, 9.0)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
@ -173,7 +173,7 @@ impl<'a> Trade<'a> {
|
||||
|
||||
fn phase_indicator(
|
||||
&mut self,
|
||||
state: &mut ConrodState<'_, State>,
|
||||
state: &ConrodState<'_, State>,
|
||||
ui: &mut UiCell<'_>,
|
||||
trade: &'a PendingTrade,
|
||||
) {
|
||||
@ -566,7 +566,7 @@ impl<'a> Trade<'a> {
|
||||
|
||||
fn accept_decline_buttons(
|
||||
&mut self,
|
||||
state: &mut ConrodState<'_, State>,
|
||||
state: &ConrodState<'_, State>,
|
||||
ui: &mut UiCell<'_>,
|
||||
trade: &'a PendingTrade,
|
||||
) -> Option<TradeEvent> {
|
||||
@ -632,7 +632,7 @@ impl<'a> Trade<'a> {
|
||||
|
||||
fn input_item_amount(
|
||||
&mut self,
|
||||
state: &mut ConrodState<'_, State>,
|
||||
state: &ConrodState<'_, State>,
|
||||
ui: &mut UiCell<'_>,
|
||||
trade: &'a PendingTrade,
|
||||
) -> Option<TradeEvent> {
|
||||
@ -760,7 +760,7 @@ impl<'a> Trade<'a> {
|
||||
|
||||
fn close_button(
|
||||
&mut self,
|
||||
state: &mut ConrodState<'_, State>,
|
||||
state: &ConrodState<'_, State>,
|
||||
ui: &mut UiCell<'_>,
|
||||
) -> Option<TradeEvent> {
|
||||
if Button::image(self.imgs.close_btn)
|
||||
|
@ -529,8 +529,8 @@ pub fn generate_mesh<'a>(
|
||||
(
|
||||
opaque_deep
|
||||
.into_iter()
|
||||
.chain(opaque_shallow.into_iter())
|
||||
.chain(opaque_surface.into_iter())
|
||||
.chain(opaque_shallow)
|
||||
.chain(opaque_surface)
|
||||
.collect(),
|
||||
fluid_mesh,
|
||||
Mesh::new(),
|
||||
|
@ -275,7 +275,7 @@ impl ShaderModules {
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
let mut compiler = Compiler::new().ok_or(RenderError::ErrorInitializingCompiler)?;
|
||||
let compiler = Compiler::new().ok_or(RenderError::ErrorInitializingCompiler)?;
|
||||
let mut options = CompileOptions::new().ok_or(RenderError::ErrorInitializingCompiler)?;
|
||||
options.set_optimization_level(OptimizationLevel::Performance);
|
||||
options.set_forced_version_profile(430, shaderc::GlslProfile::Core);
|
||||
@ -306,13 +306,13 @@ impl ShaderModules {
|
||||
})
|
||||
});
|
||||
|
||||
let mut create_shader = |name, kind| {
|
||||
let create_shader = |name, kind| {
|
||||
let glsl = &shaders
|
||||
.get(name)
|
||||
.unwrap_or_else(|| panic!("Can't retrieve shader: {}", name))
|
||||
.0;
|
||||
let file_name = format!("{}.glsl", name);
|
||||
create_shader_module(device, &mut compiler, glsl, kind, &file_name, &options)
|
||||
create_shader_module(device, &compiler, glsl, kind, &file_name, &options)
|
||||
};
|
||||
|
||||
let selected_fluid_shader = ["fluid-frag.", match pipeline_modes.fluid {
|
||||
@ -388,7 +388,7 @@ impl ShaderModules {
|
||||
|
||||
fn create_shader_module(
|
||||
device: &wgpu::Device,
|
||||
compiler: &mut shaderc::Compiler,
|
||||
compiler: &shaderc::Compiler,
|
||||
source: &str,
|
||||
kind: shaderc::ShaderKind,
|
||||
file_name: &str,
|
||||
|
@ -1069,7 +1069,7 @@ fn mesh_hold() -> BoneMeshes {
|
||||
)
|
||||
}
|
||||
|
||||
/////////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct QuadrupedSmallCentralSpec(HashMap<(QSSpecies, QSBodyType), SidedQSCentralVoxSpec>);
|
||||
|
||||
@ -1660,7 +1660,7 @@ impl QuadrupedMediumLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct BirdMediumCentralSpec(HashMap<(BMSpecies, BMBodyType), SidedBMCentralVoxSpec>);
|
||||
|
||||
@ -1914,7 +1914,7 @@ impl BirdMediumLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct TheropodCentralSpec(HashMap<(TSpecies, TBodyType), SidedTCentralVoxSpec>);
|
||||
|
||||
@ -2244,7 +2244,7 @@ impl TheropodLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct ArthropodCentralSpec(HashMap<(ASpecies, ABodyType), SidedACentralVoxSpec>);
|
||||
|
||||
@ -2644,7 +2644,7 @@ impl ArthropodLateralSpec {
|
||||
(lateral, Vec3::from(spec.leg_br.offset))
|
||||
}
|
||||
}
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct FishMediumCentralSpec(HashMap<(FMSpecies, FMBodyType), SidedFMCentralVoxSpec>);
|
||||
|
||||
@ -2850,7 +2850,7 @@ impl FishMediumLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct FishSmallCentralSpec(HashMap<(FSSpecies, FSBodyType), SidedFSCentralVoxSpec>);
|
||||
|
||||
@ -2994,7 +2994,7 @@ impl FishSmallLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct BipedSmallWeaponSpec(HashMap<ToolKey, ArmorVoxSpec>);
|
||||
@ -3269,8 +3269,8 @@ impl BipedSmallWeaponSpec {
|
||||
(tool_kind_segment, offset)
|
||||
}
|
||||
}
|
||||
////
|
||||
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct DragonCentralSpec(HashMap<(DSpecies, DBodyType), SidedDCentralVoxSpec>);
|
||||
|
||||
@ -3641,7 +3641,7 @@ impl DragonLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct BirdLargeCentralSpec(HashMap<(BLASpecies, BLABodyType), SidedBLACentralVoxSpec>);
|
||||
|
||||
@ -4044,7 +4044,7 @@ impl BirdLargeLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct BipedLargeCentralSpec(HashMap<(BLSpecies, BLBodyType), SidedBLCentralVoxSpec>);
|
||||
|
||||
@ -4462,7 +4462,8 @@ impl BipedLargeSecondSpec {
|
||||
(tool_kind_segment, offset)
|
||||
}
|
||||
}
|
||||
////
|
||||
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct GolemCentralSpec(HashMap<(GSpecies, GBodyType), SidedGCentralVoxSpec>);
|
||||
|
||||
@ -4772,8 +4773,7 @@ impl GolemLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
/////
|
||||
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct QuadrupedLowCentralSpec(HashMap<(QLSpecies, QLBodyType), SidedQLCentralVoxSpec>);
|
||||
|
||||
@ -5050,8 +5050,7 @@ impl QuadrupedLowLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct ObjectCentralSpec(HashMap<object::Body, SidedObjectCentralVoxSpec>);
|
||||
|
||||
|
@ -527,7 +527,7 @@ pub struct FigureMgr {
|
||||
}
|
||||
|
||||
impl FigureMgr {
|
||||
pub fn new(renderer: &mut Renderer) -> Self {
|
||||
pub fn new(renderer: &Renderer) -> Self {
|
||||
Self {
|
||||
atlas: FigureAtlas::new(renderer),
|
||||
model_cache: FigureModelCache::new(),
|
||||
@ -1101,8 +1101,8 @@ impl FigureMgr {
|
||||
let holding_lantern = inventory
|
||||
.map_or(false, |i| i.equipped(EquipSlot::Lantern).is_some())
|
||||
&& light_emitter.is_some()
|
||||
&& !((matches!(second_tool_hand, Some(_))
|
||||
|| matches!(active_tool_hand, Some(Hands::Two)))
|
||||
&& !(second_tool_hand.is_some()
|
||||
|| matches!(active_tool_hand, Some(Hands::Two))
|
||||
&& character.map_or(false, |c| c.is_wield()))
|
||||
&& !character.map_or(false, |c| c.is_using_hands())
|
||||
&& physics.in_liquid().is_none();
|
||||
@ -7373,7 +7373,7 @@ pub struct FigureAtlas {
|
||||
}
|
||||
|
||||
impl FigureAtlas {
|
||||
pub fn new(renderer: &mut Renderer) -> Self {
|
||||
pub fn new(renderer: &Renderer) -> Self {
|
||||
let allocator =
|
||||
Self::make_allocator(renderer).expect("Failed to create texture atlas for figures");
|
||||
Self {
|
||||
@ -7499,7 +7499,7 @@ impl FigureAtlas {
|
||||
}
|
||||
}
|
||||
|
||||
fn make_allocator(renderer: &mut Renderer) -> Result<AtlasAllocator, RenderError> {
|
||||
fn make_allocator(renderer: &Renderer) -> Result<AtlasAllocator, RenderError> {
|
||||
let max_texture_size = renderer.max_texture_size();
|
||||
let atlas_size = guillotiere::Size::new(max_texture_size as i32, max_texture_size as i32);
|
||||
let allocator = AtlasAllocator::with_options(atlas_size, &guillotiere::AllocatorOptions {
|
||||
|
@ -137,7 +137,7 @@ impl Scene {
|
||||
figure_state: None,
|
||||
|
||||
backdrop: backdrop.map(|specifier| {
|
||||
let mut state = FigureState::new(renderer, FixtureSkeleton::default(), ());
|
||||
let mut state = FigureState::new(renderer, FixtureSkeleton, ());
|
||||
let mut greedy = FigureModel::make_greedy();
|
||||
let mut opaque_mesh = Mesh::new();
|
||||
let (segment, offset) = load_mesh(specifier, Vec3::new(-55.0, -49.5, -2.0));
|
||||
|
@ -437,8 +437,8 @@ fn mesh_worker(
|
||||
(
|
||||
deep_level
|
||||
.into_iter()
|
||||
.chain(shallow_level.into_iter())
|
||||
.chain(surface_level.into_iter())
|
||||
.chain(shallow_level)
|
||||
.chain(surface_level)
|
||||
.collect(),
|
||||
alt_indices,
|
||||
)
|
||||
@ -535,7 +535,7 @@ pub struct SpriteRenderContext {
|
||||
pub type SpriteRenderContextLazy = Box<dyn FnMut(&mut Renderer) -> SpriteRenderContext>;
|
||||
|
||||
impl SpriteRenderContext {
|
||||
pub fn new(renderer: &mut Renderer) -> SpriteRenderContextLazy {
|
||||
pub fn new(renderer: &Renderer) -> SpriteRenderContextLazy {
|
||||
let max_texture_size = renderer.max_texture_size();
|
||||
|
||||
struct SpriteWorkerResponse {
|
||||
|
@ -59,7 +59,7 @@ impl Interactable {
|
||||
volume_pos: VolumePos,
|
||||
interaction: Interaction,
|
||||
) -> Option<Self> {
|
||||
let Some(block) = volume_pos.get_block(terrain, id_maps, colliders) else { return None };
|
||||
let block= volume_pos.get_block(terrain, id_maps, colliders)?;
|
||||
let block_interaction = match interaction {
|
||||
Interaction::Collect => {
|
||||
// Check if this is an unlockable sprite
|
||||
|
@ -793,7 +793,7 @@ pub fn change_render_mode(
|
||||
fn adjust_terrain_view_distance(
|
||||
terrain_vd: u32,
|
||||
settings: &mut Settings,
|
||||
session_state: &mut SessionState,
|
||||
session_state: &SessionState,
|
||||
) {
|
||||
settings.graphics.terrain_view_distance = terrain_vd;
|
||||
client_set_view_distance(settings, session_state);
|
||||
@ -802,13 +802,13 @@ fn adjust_terrain_view_distance(
|
||||
fn adjust_entity_view_distance(
|
||||
entity_vd: u32,
|
||||
settings: &mut Settings,
|
||||
session_state: &mut SessionState,
|
||||
session_state: &SessionState,
|
||||
) {
|
||||
settings.graphics.entity_view_distance = entity_vd;
|
||||
client_set_view_distance(settings, session_state);
|
||||
}
|
||||
|
||||
fn client_set_view_distance(settings: &Settings, session_state: &mut SessionState) {
|
||||
fn client_set_view_distance(settings: &Settings, session_state: &SessionState) {
|
||||
let view_distances = common::ViewDistances {
|
||||
terrain: settings.graphics.terrain_view_distance,
|
||||
entity: settings.graphics.entity_view_distance,
|
||||
|
@ -5,7 +5,7 @@ mod widget;
|
||||
|
||||
pub use defaults::Defaults;
|
||||
|
||||
pub(self) use primitive::Primitive;
|
||||
use primitive::Primitive;
|
||||
|
||||
use super::{
|
||||
super::graphic::{self, Graphic, TexId},
|
||||
|
@ -675,6 +675,7 @@ impl Window {
|
||||
.game_analog_button_map
|
||||
.get(&AnalogButton::from((button, code)))
|
||||
{
|
||||
#[allow(clippy::never_loop)]
|
||||
for action in actions {
|
||||
match *action {}
|
||||
}
|
||||
@ -684,6 +685,7 @@ impl Window {
|
||||
.menu_analog_button_map
|
||||
.get(&AnalogButton::from((button, code)))
|
||||
{
|
||||
#[allow(clippy::never_loop)]
|
||||
for action in actions {
|
||||
match *action {}
|
||||
}
|
||||
|
@ -691,7 +691,7 @@ fn main() {
|
||||
let k = 32;
|
||||
let sz = world.sim().get_size();
|
||||
|
||||
let sites = vec![
|
||||
let sites = [
|
||||
("center", sz / 2),
|
||||
(
|
||||
"dungeon",
|
||||
|
@ -11,7 +11,7 @@ fn main() {
|
||||
]);
|
||||
let mut middle = cons.clone();
|
||||
middle.extend(vec!["tt"]);
|
||||
let vowel = vec!["o", "e", "a", "i", "u", "au", "ee", "ow", "ay", "ey", "oe"];
|
||||
let vowel = ["o", "e", "a", "i", "u", "au", "ee", "ow", "ay", "ey", "oe"];
|
||||
let end = vec![
|
||||
"et", "ige", "age", "ist", "en", "on", "og", "end", "ind", "ock", "een", "edge", "ist",
|
||||
"ed", "est", "eed", "ast", "olt", "ey", "ean", "ead", "onk", "ink", "eon", "er", "ow",
|
||||
|
@ -198,7 +198,7 @@ fn palette(conn: Connection) -> Result<(), Box<dyn Error>> {
|
||||
let count: i64 = row.get(4)?;
|
||||
block_colors
|
||||
.entry(kind)
|
||||
.or_insert_with(Vec::new)
|
||||
.or_default()
|
||||
.push((rgb, count));
|
||||
}
|
||||
for (_, v) in block_colors.iter_mut() {
|
||||
@ -207,7 +207,7 @@ fn palette(conn: Connection) -> Result<(), Box<dyn Error>> {
|
||||
|
||||
let mut palettes: HashMap<BlockKind, Vec<Rgb<u8>>> = HashMap::new();
|
||||
for (kind, colors) in block_colors.iter() {
|
||||
let palette = palettes.entry(*kind).or_insert_with(Vec::new);
|
||||
let palette = palettes.entry(*kind).or_default();
|
||||
if colors.len() <= 256 {
|
||||
for (color, _) in colors {
|
||||
palette.push(*color);
|
||||
|
@ -1514,7 +1514,7 @@ impl Civs {
|
||||
|
||||
/// Attempt to find a path between two locations
|
||||
fn find_path(
|
||||
ctx: &mut GenCtx<impl Rng>,
|
||||
ctx: &GenCtx<impl Rng>,
|
||||
get_bridge: impl Fn(Vec2<i32>) -> Option<Vec2<i32>>,
|
||||
a: Vec2<i32>,
|
||||
b: Vec2<i32>,
|
||||
|
@ -1036,7 +1036,6 @@ pub fn apply_caverns_to<R: Rng>(canvas: &mut Canvas, dynamic_rng: &mut R) {
|
||||
}
|
||||
};
|
||||
|
||||
let cavern_top = cavern_top;
|
||||
let mut last_kind = BlockKind::Rock;
|
||||
for z in cavern_bottom - 1..cavern_top {
|
||||
use SpriteKind::*;
|
||||
|
@ -31,7 +31,7 @@ impl<'a, R: Rng> NameGen<'a, R> {
|
||||
]);
|
||||
let mut middle = cons.clone();
|
||||
middle.extend(vec!["tt"]);
|
||||
let vowel = vec!["o", "e", "a", "i", "u", "au", "ee", "ow", "ay", "ey", "oe"];
|
||||
let vowel = ["o", "e", "a", "i", "u", "au", "ee", "ow", "ay", "ey", "oe"];
|
||||
let end = vec![
|
||||
"et", "ige", "age", "ist", "en", "on", "og", "end", "ind", "ock", "een", "edge", "ist",
|
||||
"ed", "est", "eed", "ast", "olt", "ey", "ean", "ead", "onk", "ink", "eon", "er", "ow",
|
||||
|
@ -641,7 +641,7 @@ impl Archetype for House {
|
||||
% 6
|
||||
{
|
||||
0 => SpriteKind::HangingSign,
|
||||
1 | 2 | 3 => SpriteKind::HangingBasket,
|
||||
1..=3 => SpriteKind::HangingBasket,
|
||||
4 => SpriteKind::WallSconce,
|
||||
5 => SpriteKind::WallLampSmall,
|
||||
_ => SpriteKind::DungeonWallDecor,
|
||||
|
@ -1414,7 +1414,7 @@ impl Land {
|
||||
}
|
||||
}
|
||||
|
||||
closed.into_iter().chain(open.into_iter()).collect()
|
||||
closed.into_iter().chain(open).collect()
|
||||
}
|
||||
|
||||
fn write_path(
|
||||
|
@ -298,7 +298,7 @@ impl GnarlingFortification {
|
||||
wall_connections
|
||||
.iter()
|
||||
.copied()
|
||||
.zip(inner_tower_locs.into_iter()),
|
||||
.zip(inner_tower_locs),
|
||||
)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@ -454,7 +454,6 @@ impl Structure for GnarlingFortification {
|
||||
})
|
||||
.for_each(|(point, next_point)| {
|
||||
// 2d world positions of each point in wall segment
|
||||
let point = point;
|
||||
let start_wpos = point + self.origin;
|
||||
let end_wpos = next_point + self.origin;
|
||||
|
||||
@ -1829,7 +1828,7 @@ impl Structure for GnarlingFortification {
|
||||
}
|
||||
tunnels
|
||||
.into_iter()
|
||||
.chain(rooms.into_iter())
|
||||
.chain(rooms)
|
||||
.chain(core::iter::once(boss_room))
|
||||
.chain(core::iter::once(stump))
|
||||
.for_each(|prim| prim.fill(wood.clone()));
|
||||
@ -1839,7 +1838,7 @@ impl Structure for GnarlingFortification {
|
||||
let mut sprite_clear = Vec::new();
|
||||
tunnels_clear
|
||||
.into_iter()
|
||||
.chain(rooms_clear.into_iter())
|
||||
.chain(rooms_clear)
|
||||
.chain(core::iter::once(boss_room_clear))
|
||||
.for_each(|prim| {
|
||||
sprite_clear.push(prim.translate(Vec3::new(0, 0, 1)).intersect(prim));
|
||||
|
Loading…
Reference in New Issue
Block a user