decouples depth from difficulty, and renames depth to ID

for future impl of branches
This commit is contained in:
Llywelwyn 2023-07-27 17:59:46 +01:00
parent 8b2acab576
commit 1239597422
20 changed files with 164 additions and 204 deletions

View file

@ -31,7 +31,8 @@ impl WaveFunctionCollapseBuilder {
let constraints = patterns_to_constraints(patterns, CHUNK_SIZE);
self.render_tile_gallery(&constraints, CHUNK_SIZE, build_data);
build_data.map = Map::new(build_data.map.depth, build_data.map.width, build_data.map.height);
build_data.map =
Map::new(build_data.map.id, build_data.map.width, build_data.map.height, build_data.map.difficulty);
loop {
let mut solver = Solver::new(constraints.clone(), CHUNK_SIZE, &build_data.map);
while !solver.iteration(&mut build_data.map, rng) {
@ -46,7 +47,7 @@ impl WaveFunctionCollapseBuilder {
}
fn render_tile_gallery(&mut self, constraints: &[MapChunk], chunk_size: i32, build_data: &mut BuilderMap) {
build_data.map = Map::new(0, build_data.width, build_data.height);
build_data.map = Map::new(0, build_data.width, build_data.height, 0);
let mut counter = 0;
let mut x = 1;
let mut y = 1;
@ -62,7 +63,7 @@ impl WaveFunctionCollapseBuilder {
if y + chunk_size > build_data.map.height {
// Move to the next page
build_data.take_snapshot();
build_data.map = Map::new(0, build_data.width, build_data.height);
build_data.map = Map::new(0, build_data.width, build_data.height, 0);
x = 1;
y = 1;