From 8462eab0bdf636203791c6f4824d7aab9a69d83f Mon Sep 17 00:00:00 2001 From: Llywelwyn Date: Mon, 10 Jul 2023 06:55:52 +0100 Subject: [PATCH] fixed room gen bug (disconnected rooms) --- src/map.rs | 4 ++-- src/spawner.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/map.rs b/src/map.rs index 1ef2404..d9f5b19 100644 --- a/src/map.rs +++ b/src/map.rs @@ -148,10 +148,10 @@ impl Map { let (prev_x, prev_y) = map.rooms[map.rooms.len() - 1].centre(); if rng.range(0, 2) == 1 { map.apply_horizontal_tunnel(prev_x, new_x, prev_y); - map.apply_vertical_tunnel(prev_y, new_y, prev_x); + map.apply_vertical_tunnel(prev_y, new_y, new_x); } else { map.apply_vertical_tunnel(prev_y, new_y, prev_x); - map.apply_horizontal_tunnel(prev_x, new_x, prev_y); + map.apply_horizontal_tunnel(prev_x, new_x, new_y); } } diff --git a/src/spawner.rs b/src/spawner.rs index 25e5642..bd18e10 100644 --- a/src/spawner.rs +++ b/src/spawner.rs @@ -137,8 +137,8 @@ fn room_table(map_depth: i32) -> RandomTable { .add("fireball scroll", 1 + map_depth) .add("confusion scroll", 1) .add("magic missile scroll", 4) - .add("magic map scroll", 400) - .add("cursed magic map scroll", 400); + .add("magic map scroll", 1) + .add("cursed magic map scroll", 1); } fn health_potion(ecs: &mut World, x: i32, y: i32) {