this should solve the build issues; it makes using the non-crashing github build a lot easier, because it lets the explicit rltk dependency be removed.
26 lines
882 B
Rust
26 lines
882 B
Rust
use super::{ BuilderMap, MetaMapBuilder, Position };
|
|
use bracket_lib::prelude::*;
|
|
|
|
pub struct RoomBasedStartingPosition {}
|
|
|
|
impl MetaMapBuilder for RoomBasedStartingPosition {
|
|
fn build_map(&mut self, rng: &mut RandomNumberGenerator, build_data: &mut BuilderMap) {
|
|
self.build(rng, build_data);
|
|
}
|
|
}
|
|
|
|
impl RoomBasedStartingPosition {
|
|
#[allow(dead_code)]
|
|
pub fn new() -> Box<RoomBasedStartingPosition> {
|
|
Box::new(RoomBasedStartingPosition {})
|
|
}
|
|
|
|
fn build(&mut self, _rng: &mut RandomNumberGenerator, build_data: &mut BuilderMap) {
|
|
if let Some(rooms) = &build_data.rooms {
|
|
let start_pos = rooms[0].center();
|
|
build_data.starting_position = Some(Position { x: start_pos.x, y: start_pos.y });
|
|
} else {
|
|
panic!("RoomBasedStartingPosition only works after rooms have been created");
|
|
}
|
|
}
|
|
}
|