Move developer-type code options to 'debug' feature
This commit is contained in:
parent
c6cf07c8fd
commit
351b149b27
@ -7,12 +7,15 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
debug = []
|
||||||
default = ["rltk/opengl", "rltk/serde", "rltk/threaded"]
|
default = ["rltk/opengl", "rltk/serde", "rltk/threaded"]
|
||||||
curses = ["rltk/curses", "rltk/serde"]
|
curses = ["rltk/curses", "rltk/serde"]
|
||||||
js = ["getrandom/js", "rltk/opengl", "rltk/serde"]
|
|
||||||
|
# WebAssembly Build
|
||||||
|
wasm = ["getrandom/js", "rltk/opengl", "rltk/serde"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
getrandom = { version = "0.2.4" }
|
getrandom = { version = "0.2.4", optional = true }
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
regex = "1.5.4"
|
regex = "1.5.4"
|
||||||
rltk = { version = "0.8.1", default-features = false }
|
rltk = { version = "0.8.1", default-features = false }
|
||||||
|
21
Makefile
21
Makefile
@ -1,10 +1,15 @@
|
|||||||
include help-system.mk
|
include help-system.mk
|
||||||
|
|
||||||
|
FEATURES?=default
|
||||||
|
|
||||||
run: $(call print-help, run, Runs the binary in develop mode)
|
run: $(call print-help, run, Runs the binary in develop mode)
|
||||||
cargo run
|
cargo run --features $(FEATURES) --no-default-features
|
||||||
|
|
||||||
|
run-debug: $(call print-help, run-debug, Runs the binary with the 'debug' feature, which shows map generation, and other debug functionality)
|
||||||
|
cargo run --features debug
|
||||||
|
|
||||||
run-pi: $(call print-help, run-pi, Sets appropriate flags so that the game runs on a Raspberry Pi)
|
run-pi: $(call print-help, run-pi, Sets appropriate flags so that the game runs on a Raspberry Pi)
|
||||||
MESA_GL_VERSION_OVERRIDE=3.0 MESA_GLSL_VERSION_OVERRIDE=330 cargo run
|
MESA_GL_VERSION_OVERRIDE=3.0 MESA_GLSL_VERSION_OVERRIDE=330 cargo run --features $(FEATURES)
|
||||||
|
|
||||||
run-curses: $(call print-help, run-curses, Run the game in a console window via the curses library)
|
run-curses: $(call print-help, run-curses, Run the game in a console window via the curses library)
|
||||||
cargo run --features curses --no-default-features
|
cargo run --features curses --no-default-features
|
||||||
@ -13,11 +18,11 @@ build:
|
|||||||
cargo build
|
cargo build
|
||||||
|
|
||||||
build-wasm: $(call print-help, build-wasm, Build the webassembly version of the game)
|
build-wasm: $(call print-help, build-wasm, Build the webassembly version of the game)
|
||||||
cargo build --release --target wasm32-unknown-unknown --features js
|
cargo build --release --target wasm32-unknown-unknown --features wasm
|
||||||
wasm-bindgen target/wasm32-unknown-unknown/release/roguelike_tutorial.wasm --out-dir wasm --no-modules --no-typescript
|
wasm-bindgen target/wasm32-unknown-unknown/release/roguelike_tutorial.wasm --out-dir wasm --no-modules --no-typescript
|
||||||
|
|
||||||
build-wasm-dev: $(call print-help, build-wasm-dev, Build the webassembly version of the game (dev version))
|
build-wasm-dev: $(call print-help, build-wasm-dev, Build the webassembly version of the game (dev version))
|
||||||
cargo build --target wasm32-unknown-unknown --features js
|
cargo build --target wasm32-unknown-unknown --features wasm
|
||||||
wasm-bindgen target/wasm32-unknown-unknown/debug/roguelike_tutorial.wasm --out-dir wasm --no-modules --no-typescript
|
wasm-bindgen target/wasm32-unknown-unknown/debug/roguelike_tutorial.wasm --out-dir wasm --no-modules --no-typescript
|
||||||
|
|
||||||
clean: $(call print-help, clean, Removes save file and compilation artifacts)
|
clean: $(call print-help, clean, Removes save file and compilation artifacts)
|
||||||
@ -25,13 +30,13 @@ clean: $(call print-help, clean, Removes save file and compilation artifacts)
|
|||||||
cargo clean
|
cargo clean
|
||||||
|
|
||||||
check: $(call print-help, check, Check code syntax)
|
check: $(call print-help, check, Check code syntax)
|
||||||
cargo check
|
cargo check --features $(FEATURES)
|
||||||
|
|
||||||
check-wasm: $(call print-help, check-wasm, Check code syntax for webassembly build)
|
check-wasm: $(call print-help, check-wasm, Check code syntax for webassembly build)
|
||||||
cargo check --target wasm32-unknown-unknown --features js
|
cargo check --target wasm32-unknown-unknown --features wasm
|
||||||
|
|
||||||
lint: $(call print-help, lint, Check code syntax and style)
|
lint: $(call print-help, lint, Check code syntax and style)
|
||||||
cargo clippy
|
cargo clippy --features $(FEATURES)
|
||||||
|
|
||||||
fmt: $(call print-help, fmt, Runs formatter on code)
|
fmt: $(call print-help, fmt, Runs formatter on code)
|
||||||
cargo +nightly fmt
|
cargo +nightly fmt
|
||||||
@ -41,6 +46,6 @@ fix: $(call print-help, fix, Fixes some warnings, then runs the formatter)
|
|||||||
make fmt
|
make fmt
|
||||||
|
|
||||||
docs: $(call print-help, docs, Generates code docs)
|
docs: $(call print-help, docs, Generates code docs)
|
||||||
cargo doc
|
cargo doc --features $(FEATURES)
|
||||||
|
|
||||||
.phony: run-pi clean check run fmt fix lint docs build build-wasm check-wasm build-wasm-dev
|
.phony: run-pi clean check run fmt fix lint docs build build-wasm check-wasm build-wasm-dev
|
@ -7,6 +7,11 @@ use crate::map::tile_glyph;
|
|||||||
use crate::{colors, Map};
|
use crate::{colors, Map};
|
||||||
|
|
||||||
/// Whether to render an outline of the current map's boundaries
|
/// Whether to render an outline of the current map's boundaries
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
const SHOW_BOUNDARIES: bool = true;
|
||||||
|
|
||||||
|
/// Whether to render an outline of the current map's boundaries
|
||||||
|
#[cfg(not(feature = "debug"))]
|
||||||
const SHOW_BOUNDARIES: bool = false;
|
const SHOW_BOUNDARIES: bool = false;
|
||||||
|
|
||||||
/// Get the rectangle representing the current viewport
|
/// Get the rectangle representing the current viewport
|
||||||
|
@ -35,7 +35,6 @@ mod voronoi;
|
|||||||
mod voronoi_spawning;
|
mod voronoi_spawning;
|
||||||
mod waveform_collapse;
|
mod waveform_collapse;
|
||||||
|
|
||||||
use ::rltk::prelude::*;
|
|
||||||
use ::specs::prelude::*;
|
use ::specs::prelude::*;
|
||||||
use area_ending_point::{AreaEndingPosition, XEnd, YEnd};
|
use area_ending_point::{AreaEndingPosition, XEnd, YEnd};
|
||||||
use area_starting_points::{AreaStartingPosition, XStart, YStart};
|
use area_starting_points::{AreaStartingPosition, XStart, YStart};
|
||||||
@ -345,7 +344,9 @@ pub fn random_builder(new_depth: i32, width: i32, height: i32) -> BuilderChain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn level_builder(new_depth: i32, width: i32, height: i32) -> BuilderChain {
|
pub fn level_builder(new_depth: i32, width: i32, height: i32) -> BuilderChain {
|
||||||
console::log(format!("Depth: {}", new_depth));
|
#[cfg(feature = "debug")]
|
||||||
|
::rltk::console::log(format!("Depth: {}", new_depth));
|
||||||
|
|
||||||
match new_depth {
|
match new_depth {
|
||||||
1 => town_builder(new_depth, width, height),
|
1 => town_builder(new_depth, width, height),
|
||||||
2 => forest_builder(new_depth, width, height),
|
2 => forest_builder(new_depth, width, height),
|
||||||
|
@ -136,7 +136,8 @@ impl PrefabBuilder {
|
|||||||
build_data.spawn_list.push((idx, "Watch Fire".to_string()));
|
build_data.spawn_list.push((idx, "Watch Fire".to_string()));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
rltk::console::log(format!("Unknown glyph loading map: {}", (ch as u8) as char));
|
#[cfg(feature = "debug")]
|
||||||
|
::rltk::console::log(format!("Unknown glyph loading map: {}", (ch as u8) as char));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,8 @@ pub fn build_patterns(
|
|||||||
|
|
||||||
// Dedupe
|
// Dedupe
|
||||||
if dedupe {
|
if dedupe {
|
||||||
rltk::console::log(format!(
|
#[cfg(feature = "debug")]
|
||||||
|
::rltk::console::log(format!(
|
||||||
"Pre de-duplication, there are {} patterns",
|
"Pre de-duplication, there are {} patterns",
|
||||||
patterns.len()
|
patterns.len()
|
||||||
));
|
));
|
||||||
@ -75,7 +76,8 @@ pub fn build_patterns(
|
|||||||
let set: HashSet<Vec<TileType>> = patterns.drain(..).collect();
|
let set: HashSet<Vec<TileType>> = patterns.drain(..).collect();
|
||||||
patterns.extend(set.into_iter());
|
patterns.extend(set.into_iter());
|
||||||
|
|
||||||
rltk::console::log(format!("There are {} patterns", patterns.len()));
|
#[cfg(feature = "debug")]
|
||||||
|
::rltk::console::log(format!("There are {} patterns", patterns.len()));
|
||||||
}
|
}
|
||||||
|
|
||||||
patterns
|
patterns
|
||||||
|
@ -194,7 +194,9 @@ impl Solver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if possible_options.is_empty() {
|
if possible_options.is_empty() {
|
||||||
rltk::console::log("Oh no! It's not possible!");
|
#[cfg(feature = "debug")]
|
||||||
|
::rltk::console::log("Oh no! It's not possible!");
|
||||||
|
|
||||||
self.possible = false;
|
self.possible = false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -196,6 +196,7 @@ impl RawMaster {
|
|||||||
|
|
||||||
for (i, item) in self.raws.items.iter().enumerate() {
|
for (i, item) in self.raws.items.iter().enumerate() {
|
||||||
if used_names.contains(&item.name) {
|
if used_names.contains(&item.name) {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
console::log(format!(
|
console::log(format!(
|
||||||
"WARNING - duplicate item name in raws [{}]",
|
"WARNING - duplicate item name in raws [{}]",
|
||||||
item.name
|
item.name
|
||||||
@ -208,6 +209,7 @@ impl RawMaster {
|
|||||||
}
|
}
|
||||||
for (i, mob) in self.raws.mobs.iter().enumerate() {
|
for (i, mob) in self.raws.mobs.iter().enumerate() {
|
||||||
if used_names.contains(&mob.name) {
|
if used_names.contains(&mob.name) {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
console::log(format!(
|
console::log(format!(
|
||||||
"WARNING - duplicate mob name in raws [{}]",
|
"WARNING - duplicate mob name in raws [{}]",
|
||||||
mob.name
|
mob.name
|
||||||
@ -218,6 +220,7 @@ impl RawMaster {
|
|||||||
}
|
}
|
||||||
for (i, prop) in self.raws.props.iter().enumerate() {
|
for (i, prop) in self.raws.props.iter().enumerate() {
|
||||||
if used_names.contains(&prop.name) {
|
if used_names.contains(&prop.name) {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
console::log(format!(
|
console::log(format!(
|
||||||
"WARNING - duplicate prop name in raws [{}]",
|
"WARNING - duplicate prop name in raws [{}]",
|
||||||
prop.name
|
prop.name
|
||||||
@ -229,6 +232,7 @@ impl RawMaster {
|
|||||||
|
|
||||||
for spawn in self.raws.spawn_table.iter() {
|
for spawn in self.raws.spawn_table.iter() {
|
||||||
if !used_names.contains(&spawn.name) {
|
if !used_names.contains(&spawn.name) {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
console::log(format!(
|
console::log(format!(
|
||||||
"WARNING - Spawn tables references unspecified entity [{}]",
|
"WARNING - Spawn tables references unspecified entity [{}]",
|
||||||
spawn.name
|
spawn.name
|
||||||
@ -392,6 +396,7 @@ pub fn string_to_slot(slot: &str) -> EquipmentSlot {
|
|||||||
"Hands" => EquipmentSlot::Hands,
|
"Hands" => EquipmentSlot::Hands,
|
||||||
"Melee" => EquipmentSlot::Melee,
|
"Melee" => EquipmentSlot::Melee,
|
||||||
_ => {
|
_ => {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
console::log(format!("Warning: unknown equipment slot type [{}]", slot));
|
console::log(format!("Warning: unknown equipment slot type [{}]", slot));
|
||||||
|
|
||||||
EquipmentSlot::Melee
|
EquipmentSlot::Melee
|
||||||
@ -738,6 +743,7 @@ pub fn spawn_named_mob(
|
|||||||
skills.skills.insert(Skill::Magic, *sk.1);
|
skills.skills.insert(Skill::Magic, *sk.1);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
console::log(format!("Unknown skill referenced [{}]", sk.0));
|
console::log(format!("Unknown skill referenced [{}]", sk.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,6 +163,7 @@ pub fn spawn_entity(ecs: &mut World, spawn: &(&usize, &String)) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if item_result.is_none() {
|
if item_result.is_none() {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
console::log(format!("WARNING: We don't know how to spawn [{}]!", name));
|
console::log(format!("WARNING: We don't know how to spawn [{}]!", name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,12 @@ use crate::systems::{self, particle_system};
|
|||||||
use crate::{camera, colors, damage_system, gamelog, player, saveload_system, spawner};
|
use crate::{camera, colors, damage_system, gamelog, player, saveload_system, spawner};
|
||||||
|
|
||||||
/// Whether to show a visual representation of map generation
|
/// Whether to show a visual representation of map generation
|
||||||
|
#[cfg(not(feature = "debug"))]
|
||||||
pub const SHOW_MAPGEN_VISUALIZER: bool = false;
|
pub const SHOW_MAPGEN_VISUALIZER: bool = false;
|
||||||
|
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
pub const SHOW_MAPGEN_VISUALIZER: bool = true;
|
||||||
|
|
||||||
/// Whether to show an FPS counter
|
/// Whether to show an FPS counter
|
||||||
pub const SHOW_FPS: bool = true;
|
pub const SHOW_FPS: bool = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user