From b6e05b157a77093df55c25f488c7f2399b85af96 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 3 Feb 2022 16:14:39 -0500 Subject: [PATCH] Some various tweaks and fixes --- src/map_builders.rs | 3 ++- src/map_builders/town.rs | 9 ++------- src/state.rs | 8 ++++++-- wasm/index.html | 14 ++++++++++++++ 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/map_builders.rs b/src/map_builders.rs index 8e7dda3..07508dd 100644 --- a/src/map_builders.rs +++ b/src/map_builders.rs @@ -34,6 +34,7 @@ mod voronoi; mod voronoi_spawning; mod waveform_collapse; +use ::rltk::prelude::*; use ::specs::prelude::*; use area_ending_point::{AreaEndingPosition, XEnd, YEnd}; use area_starting_points::{AreaStartingPosition, XStart, YStart}; @@ -342,7 +343,7 @@ pub fn random_builder(new_depth: i32, width: i32, height: i32) -> BuilderChain { } pub fn level_builder(new_depth: i32, width: i32, height: i32) -> BuilderChain { - rltk::console::log(format!("Depth: {}", new_depth)); + console::log(format!("Depth: {}", new_depth)); match new_depth { 1 => town_builder(new_depth, width, height), 2 => forest_builder(new_depth, width, height), diff --git a/src/map_builders/town.rs b/src/map_builders/town.rs index a67c47a..cf0a7b5 100644 --- a/src/map_builders/town.rs +++ b/src/map_builders/town.rs @@ -148,7 +148,6 @@ impl TownBuilder { fn buildings( &mut self, - build_data: &mut BuilderMap, available_building_tiles: &mut HashSet, ) -> Vec<(i32, i32, i32, i32)> { @@ -229,7 +228,6 @@ impl TownBuilder { fn add_doors( &mut self, - build_data: &mut BuilderMap, buildings: &mut Vec<(i32, i32, i32, i32)>, wall_gap_y: i32, @@ -324,13 +322,12 @@ impl TownBuilder { fn building_factory( &mut self, - build_data: &mut BuilderMap, buildings: &[(i32, i32, i32, i32)], building_index: &[(usize, i32, BuildingTag)], ) { - for (i, building) in buildings.iter().enumerate() { - let build_type = &building_index[i].2; + for (i, _size, build_type) in building_index.iter() { + let building = &buildings[*i]; match build_type { BuildingTag::Pub => self.build_pub(building, build_data), BuildingTag::Temple => self.build_temple(building, build_data), @@ -349,7 +346,6 @@ impl TownBuilder { &mut self, building: &(i32, i32, i32, i32), build_data: &mut BuilderMap, - to_place: &mut Vec<&str>, player_idx: usize, ) { @@ -481,7 +477,6 @@ impl TownBuilder { fn spawn_townsfolk( &mut self, build_data: &mut BuilderMap, - available_building_tiles: &mut HashSet, ) { for idx in available_building_tiles.iter() { diff --git a/src/state.rs b/src/state.rs index 274e855..5bc8396 100644 --- a/src/state.rs +++ b/src/state.rs @@ -338,14 +338,18 @@ impl GameState for State { } } gui::MainMenuResult::Selected { selected } => match selected { - gui::MainMenuSelection::NewGame => newrunstate = RunState::PreRun, + gui::MainMenuSelection::NewGame => { + self.game_over_cleanup(); + + newrunstate = RunState::PreRun + } gui::MainMenuSelection::LoadGame => { saveload_system::load_game(&mut self.ecs); newrunstate = RunState::AwaitingInput; saveload_system::delete_save(); } gui::MainMenuSelection::Quit => { - ::std::process::exit(0); + std::process::exit(0); } }, }, diff --git a/wasm/index.html b/wasm/index.html index 226d714..84692bc 100644 --- a/wasm/index.html +++ b/wasm/index.html @@ -3,6 +3,20 @@ Roguelike-game +