chore: Bump Rust edition to 2024.
This commit is contained in:
parent
c47b48d627
commit
611ff98681
|
@ -7,10 +7,10 @@ keywords = ["game", "map", "map-generator"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
repository = "https://labs.lightsout.games/projects/here_be_dragons"
|
repository = "https://labs.lightsout.games/projects/here_be_dragons"
|
||||||
documentation = "https://docs.rs/here_be_dragons"
|
documentation = "https://docs.rs/here_be_dragons"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rand = "0.8"
|
rand = "0.9"
|
||||||
serde = { version = "1", optional = true, features = ["derive"]}
|
serde = { version = "1", optional = true, features = ["derive"]}
|
||||||
|
|
||||||
[package.metadata.release]
|
[package.metadata.release]
|
||||||
|
|
|
@ -127,8 +127,8 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn no_corridors_on_borders() {
|
fn no_corridors_on_borders() {
|
||||||
let mut rng = StdRng::seed_from_u64(907647352);
|
let mut rng = StdRng::seed_from_u64(907647352);
|
||||||
let gen = BspInterior::<NoData>::new();
|
let generator = BspInterior::<NoData>::new();
|
||||||
let map = gen.modify_map(&mut rng, &Map::new(80, 50));
|
let map = generator.modify_map(&mut rng, &Map::new(80, 50));
|
||||||
for i in 0..80 {
|
for i in 0..80 {
|
||||||
assert!(map.at(i, 0).unwrap().is_blocked());
|
assert!(map.at(i, 0).unwrap().is_blocked());
|
||||||
assert!(map.at(i, 49).unwrap().is_blocked());
|
assert!(map.at(i, 49).unwrap().is_blocked());
|
||||||
|
|
|
@ -175,8 +175,8 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn no_corridors_on_borders() {
|
fn no_corridors_on_borders() {
|
||||||
let mut rng = StdRng::seed_from_u64(907647352);
|
let mut rng = StdRng::seed_from_u64(907647352);
|
||||||
let gen = BspRooms::<NoData>::new();
|
let generator = BspRooms::<NoData>::new();
|
||||||
let map = gen.modify_map(&mut rng, &Map::new(80, 50));
|
let map = generator.modify_map(&mut rng, &Map::new(80, 50));
|
||||||
for i in 0..80 {
|
for i in 0..80 {
|
||||||
assert!(map.at(i, 0).unwrap().is_blocked());
|
assert!(map.at(i, 0).unwrap().is_blocked());
|
||||||
assert!(map.at(i, 49).unwrap().is_blocked());
|
assert!(map.at(i, 49).unwrap().is_blocked());
|
||||||
|
|
|
@ -160,7 +160,7 @@ impl<'a, D: Clone + Default> Grid<'a, D> {
|
||||||
if neighbors.len() == 1 {
|
if neighbors.len() == 1 {
|
||||||
return Some(neighbors[0]);
|
return Some(neighbors[0]);
|
||||||
} else {
|
} else {
|
||||||
return Some(neighbors[(self.rng.roll_dice(1, neighbors.len()) - 1)]);
|
return Some(neighbors[self.rng.roll_dice(1, neighbors.len()) - 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
|
|
|
@ -142,4 +142,14 @@ mod tests {
|
||||||
assert_eq!(rect1.width(), 40);
|
assert_eq!(rect1.width(), 40);
|
||||||
assert_eq!(rect1.height(), 30);
|
assert_eq!(rect1.height(), 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_center() {
|
||||||
|
let x = 0;
|
||||||
|
let y = 0;
|
||||||
|
let width = 12;
|
||||||
|
let height = 10;
|
||||||
|
let rect = Rect::new(x, y, width, height);
|
||||||
|
assert_eq!(rect.center(), Point::new(x + width / 2, y + height / 2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user