Compare commits

...

3 Commits

Author SHA1 Message Date
d99c607bf6 Release 2025-02-23 08:33:43 -06:00
c4bbfe044c Update CHANGELOG. 2025-02-23 08:33:32 -06:00
611ff98681 chore: Bump Rust edition to 2024. 2025-02-23 08:32:25 -06:00
6 changed files with 24 additions and 8 deletions

View File

@ -2,6 +2,12 @@
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
### Features

View File

@ -1,16 +1,16 @@
[package]
name = "here_be_dragons"
version = "0.3.0"
version = "0.4.0"
authors = ["Nolan Darilek <nolan@thewordnerd.info>", "Krzysztof Langner <klangner@gmail.com>"]
description = "Map generator for games"
keywords = ["game", "map", "map-generator"]
license = "MIT OR Apache-2.0"
repository = "https://labs.lightsout.games/projects/here_be_dragons"
documentation = "https://docs.rs/here_be_dragons"
edition = "2021"
edition = "2024"
[dependencies]
rand = "0.8"
rand = "0.9"
serde = { version = "1", optional = true, features = ["derive"]}
[package.metadata.release]

View File

@ -127,8 +127,8 @@ mod tests {
#[test]
fn no_corridors_on_borders() {
let mut rng = StdRng::seed_from_u64(907647352);
let gen = BspInterior::<NoData>::new();
let map = gen.modify_map(&mut rng, &Map::new(80, 50));
let generator = BspInterior::<NoData>::new();
let map = generator.modify_map(&mut rng, &Map::new(80, 50));
for i in 0..80 {
assert!(map.at(i, 0).unwrap().is_blocked());
assert!(map.at(i, 49).unwrap().is_blocked());

View File

@ -175,8 +175,8 @@ mod tests {
#[test]
fn no_corridors_on_borders() {
let mut rng = StdRng::seed_from_u64(907647352);
let gen = BspRooms::<NoData>::new();
let map = gen.modify_map(&mut rng, &Map::new(80, 50));
let generator = BspRooms::<NoData>::new();
let map = generator.modify_map(&mut rng, &Map::new(80, 50));
for i in 0..80 {
assert!(map.at(i, 0).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 {
return Some(neighbors[0]);
} else {
return Some(neighbors[(self.rng.roll_dice(1, neighbors.len()) - 1)]);
return Some(neighbors[self.rng.roll_dice(1, neighbors.len()) - 1]);
}
}
None

View File

@ -142,4 +142,14 @@ mod tests {
assert_eq!(rect1.width(), 40);
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));
}
}