Fixing a stupid bug where it would crash because a fact wasn't in the world.

This commit is contained in:
Zed A. Shaw 2024-12-19 20:46:47 -05:00
parent 93f53d1714
commit 5a6494acf5
7 changed files with 11 additions and 6 deletions

View file

@ -37,8 +37,8 @@ TEST_CASE("lighting a map works", "[lighting]") {
Matrix &lighting = lr.lighting();
matrix::dump("WALLS=====", map.walls());
matrix::dump("LIGHT PATHS======", lr.$paths.$paths);
//matrix::dump("WALLS=====", map.walls());
//matrix::dump("LIGHT PATHS======", lr.$paths.$paths);
// confirm light is set at least at and around the two points
REQUIRE(lighting[light1.y][light1.x] == lighting::LEVELS[source1.strength]);

View file

@ -237,12 +237,11 @@ TEST_CASE("prototype circle algorithm", "[matrix:circle]") {
Matrix result = map.walls();
for(matrix::circle it{start, radius}; it.next();) {
println("y={}, x0={}, x1={}", it.y, it.x0, it.x1);
for(int i = it.x0; i < it.x1; i++) {
result[it.y][i] += 1;
}
}
matrix::dump("RESULT AFTER CIRCLE", result, start.x, start.y);
// matrix::dump("RESULT AFTER CIRCLE", result, start.x, start.y);
}
}

View file

@ -55,6 +55,7 @@ TEST_CASE("can render a text", "[render]") {
builder.generate();
Player player{world.entity()};
world.set_the<Debug>({});
world.set_the<Player>(player);
world.set<Tile>(player.entity, {config.PLAYER_TILE});
world.set<LightSource>(player.entity, {6,1});