Some various tweaks and fixes

This commit is contained in:
Timothy Warren 2022-02-03 16:14:39 -05:00
parent 30de2cd7ce
commit b6e05b157a
4 changed files with 24 additions and 10 deletions

View File

@ -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),

View File

@ -148,7 +148,6 @@ impl TownBuilder {
fn buildings(
&mut self,
build_data: &mut BuilderMap,
available_building_tiles: &mut HashSet<usize>,
) -> 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<usize>,
) {
for idx in available_building_tiles.iter() {

View File

@ -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);
}
},
},

View File

@ -3,6 +3,20 @@
<head>
<meta charset="utf-8" />
<title>Roguelike-game</title>
<style>
html, body {
background: #000;
width: 100%;
height: 100%;
margin: 0;
}
body {
display: flex;
}
canvas { margin: auto; }
</style>
</head>
<body>
<canvas id="canvas" width="640" height="480"></canvas>