clean up some warnings
This commit is contained in:
parent
5265682c53
commit
119a3d314a
|
@ -1,5 +1,6 @@
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
|
||||||
|
|
||||||
pub fn do_challenge(stat: u8) -> (bool, u8) {
|
pub fn do_challenge(stat: u8) -> (bool, u8) {
|
||||||
if stat <= 20 {
|
if stat <= 20 {
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
|
@ -19,6 +20,7 @@ pub fn do_challenge(stat: u8) -> (bool, u8) {
|
||||||
(false, 0)
|
(false, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub struct PlayerStats {
|
pub struct PlayerStats {
|
||||||
// dungeon slayer attributes
|
// dungeon slayer attributes
|
||||||
pub(crate) body: u8,
|
pub(crate) body: u8,
|
||||||
|
@ -93,6 +95,7 @@ impl PlayerStats {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub struct MonsterStats {
|
pub struct MonsterStats {
|
||||||
// dungeon slayer attributes
|
// dungeon slayer attributes
|
||||||
pub(crate) body: u8,
|
pub(crate) body: u8,
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
use std::cmp::{max, min};
|
use std::cmp::{max, min};
|
||||||
|
|
||||||
use rand::Rng;
|
|
||||||
use rand::rngs::ThreadRng;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use crate::artifacts::{Chest, Potion};
|
use crate::artifacts::{Chest, Potion};
|
||||||
use crate::artifacts::Artifact;
|
use crate::artifacts::Artifact;
|
||||||
|
@ -38,7 +35,6 @@ pub struct Level {
|
||||||
pub(crate) start: (usize, usize),
|
pub(crate) start: (usize, usize),
|
||||||
/// the position of the end in the level (either stair down or end point)
|
/// the position of the end in the level (either stair down or end point)
|
||||||
pub(crate) end: (usize, usize),
|
pub(crate) end: (usize, usize),
|
||||||
pub(crate) rng: ThreadRng,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Level {
|
impl Level {
|
||||||
|
@ -210,7 +206,6 @@ impl Level {
|
||||||
artifacts: Vec::with_capacity(10),
|
artifacts: Vec::with_capacity(10),
|
||||||
start: (0, 0),
|
start: (0, 0),
|
||||||
end: (0, 0),
|
end: (0, 0),
|
||||||
rng: rand::thread_rng(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -11,7 +11,7 @@ use rand::rngs::ThreadRng;
|
||||||
|
|
||||||
use crate::artifacts::{Artifact, Chest, Potion};
|
use crate::artifacts::{Artifact, Chest, Potion};
|
||||||
use crate::level::{Level, StructureElement};
|
use crate::level::{Level, StructureElement};
|
||||||
use crate::monster::{LowerDaemon, Monster, Orc, Rat};
|
use crate::monster::{LowerDaemon, Monster, Rat};
|
||||||
use crate::position::Position;
|
use crate::position::Position;
|
||||||
|
|
||||||
const ROOMS_VERTICAL: usize = 7;
|
const ROOMS_VERTICAL: usize = 7;
|
||||||
|
@ -344,7 +344,6 @@ impl LevelGenerator {
|
||||||
artifacts,
|
artifacts,
|
||||||
start: (start_x, start_y),
|
start: (start_x, start_y),
|
||||||
end: (end_x, end_y),
|
end: (end_x, end_y),
|
||||||
rng: rand::thread_rng(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ impl crate::monster::LowerDaemon {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn calc_move(&self, level: &Level, player_pos: &Position) -> (i16, i16) {
|
fn calc_move(&self, _level: &Level, player_pos: &Position) -> (i16, i16) {
|
||||||
let d = self.position.distance(player_pos);
|
let d = self.position.distance(player_pos);
|
||||||
if d == 1 {
|
if d == 1 {
|
||||||
return self.position.get_direction(player_pos);
|
return self.position.get_direction(player_pos);
|
||||||
|
@ -160,7 +160,7 @@ impl Rat {
|
||||||
monster_stats,
|
monster_stats,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn calc_move(&self, level: &Level, player_pos: &Position) -> (i16, i16) {
|
fn calc_move(&self, _level: &Level, _player_pos: &Position) -> (i16, i16) {
|
||||||
match rand::thread_rng().gen_range(0..5) {
|
match rand::thread_rng().gen_range(0..5) {
|
||||||
1 => { (1, 0) }
|
1 => { (1, 0) }
|
||||||
2 => { (-1, 0) }
|
2 => { (-1, 0) }
|
||||||
|
@ -218,7 +218,7 @@ impl Orc {
|
||||||
monster_stats,
|
monster_stats,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn calc_move(&self, level: &Level, player_pos: &Position) -> (i16, i16) {
|
fn calc_move(&self, _level: &Level, _player_pos: &Position) -> (i16, i16) {
|
||||||
match rand::thread_rng().gen_range(0..5) {
|
match rand::thread_rng().gen_range(0..5) {
|
||||||
1 => { (1, 0) }
|
1 => { (1, 0) }
|
||||||
2 => { (-1, 0) }
|
2 => { (-1, 0) }
|
||||||
|
|
Loading…
Reference in New Issue