Compare commits

..

No commits in common. "d99c607bf6e00a08f8bc2ec241ff0ae82d349da2" and "c47b48d6271262b4984ea05ae0d1297a26926197" have entirely different histories.

6 changed files with 8 additions and 24 deletions

View File

@ -2,12 +2,6 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## Version 0.4.0 - 2025-02-23
### Miscellaneous Tasks
- Bump Rust edition to 2024.
## Version 0.3.0 - 2023-02-22 ## Version 0.3.0 - 2023-02-22
### Features ### Features

View File

@ -1,16 +1,16 @@
[package] [package]
name = "here_be_dragons" name = "here_be_dragons"
version = "0.4.0" version = "0.3.0"
authors = ["Nolan Darilek <nolan@thewordnerd.info>", "Krzysztof Langner <klangner@gmail.com>"] authors = ["Nolan Darilek <nolan@thewordnerd.info>", "Krzysztof Langner <klangner@gmail.com>"]
description = "Map generator for games" description = "Map generator for games"
keywords = ["game", "map", "map-generator"] 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 = "2024" edition = "2021"
[dependencies] [dependencies]
rand = "0.9" rand = "0.8"
serde = { version = "1", optional = true, features = ["derive"]} serde = { version = "1", optional = true, features = ["derive"]}
[package.metadata.release] [package.metadata.release]

View File

@ -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 generator = BspInterior::<NoData>::new(); let gen = BspInterior::<NoData>::new();
let map = generator.modify_map(&mut rng, &Map::new(80, 50)); let map = gen.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());

View File

@ -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 generator = BspRooms::<NoData>::new(); let gen = BspRooms::<NoData>::new();
let map = generator.modify_map(&mut rng, &Map::new(80, 50)); let map = gen.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());

View File

@ -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

View File

@ -142,14 +142,4 @@ 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));
}
} }