diff --git a/src/bin/sol_chess/game.rs b/src/bin/sol_chess/game.rs index d56338a..e3e2313 100644 --- a/src/bin/sol_chess/game.rs +++ b/src/bin/sol_chess/game.rs @@ -1,7 +1,7 @@ use std::{ collections::HashMap, fmt::{self, Display, Formatter}, - sync::Arc, + rc::Rc, }; mod button; @@ -28,7 +28,7 @@ pub struct Game { // Constants througout the game texture_res: Texture2D, sounds: Sounds, - font: Arc, + font: Rc, num_squares: usize, heading_text: String, diff --git a/src/bin/sol_chess/game/button.rs b/src/bin/sol_chess/game/button.rs index b75d4c2..b63553a 100644 --- a/src/bin/sol_chess/game/button.rs +++ b/src/bin/sol_chess/game/button.rs @@ -1,4 +1,4 @@ -use std::sync::Arc; +use std::rc::Rc; use macroquad::{audio::Sound, prelude::*}; @@ -15,11 +15,11 @@ pub struct Button { shadow_width: f32, pub color: UiColor, sound: Sound, - font: Arc, + font: Rc, } impl Button { - pub fn new(text: &str, rect: Rect, color: UiColor, sound: Sound, font: Arc) -> Self { + pub fn new(text: &str, rect: Rect, color: UiColor, sound: Sound, font: Rc) -> Self { Self { text: text.to_string(), is_down: false, diff --git a/src/bin/sol_chess/game/logic.rs b/src/bin/sol_chess/game/logic.rs index 7ea0b0b..7da9ed8 100644 --- a/src/bin/sol_chess/game/logic.rs +++ b/src/bin/sol_chess/game/logic.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, sync::Arc}; +use std::{collections::HashMap, rc::Rc}; use super::{ constants, sound::Sounds, Board, BoardState, ButtonAction, Game, GameMode, GameSquare, @@ -6,7 +6,10 @@ use super::{ }; use macroquad::prelude::*; -use sol_chess::{board, generator::{self, RandomRange}}; +use sol_chess::{ + board, + generator::{self, RandomRange}, +}; impl Game { fn get(&mut self, i: usize, j: usize) -> &mut GameSquare { @@ -299,7 +302,7 @@ impl Game { window_height: 0., window_width: 0., square_width: 0., - font: Arc::new(font), + font: Rc::new(font), } } } diff --git a/src/util.rs b/src/util.rs index 0bf9a0a..8a4a5b9 100644 --- a/src/util.rs +++ b/src/util.rs @@ -30,15 +30,9 @@ pub(crate) fn b64_decode_48(input: &[u8; 8], output: &mut [u8; 6]) { const ALPHABET: &str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; fn lookup(idx: u8) -> char { - ALPHABET - .chars() - .nth(idx as usize) - .unwrap() + ALPHABET.chars().nth(idx as usize).unwrap() } fn reverse_lookup(c: char) -> u8 { - ALPHABET - .chars() - .position(|x| x == c) - .unwrap() as u8 + ALPHABET.chars().position(|x| x == c).unwrap() as u8 }