Now the spatialmap determines the 'wiggle factor' when there's multiple entities in a cell, which staggers them visually. Closes #78.

This commit is contained in:
Zed A. Shaw 2025-08-03 01:56:34 -04:00
parent 694ee210d6
commit 9c02fb846b
4 changed files with 35 additions and 21 deletions

View file

@ -203,13 +203,13 @@ TEST_CASE("SpatialMap::distance_sorted", "[spatialmap]") {
auto result = map.distance_sorted({1, 1}, 100);
REQUIRE(result.size() == 3);
REQUIRE(result[0].second == enemy1);
REQUIRE(result[1].second == item);
REQUIRE(result[2].second == player);
REQUIRE(result[0].entity == enemy1);
REQUIRE(result[1].entity == item);
REQUIRE(result[2].entity == player);
int prev_dist = std::numeric_limits<int>::max();
for(auto [dist, entity] : result) {
REQUIRE(dist < prev_dist);
prev_dist = dist;
for(auto rec : result) {
REQUIRE(rec.dist_square < prev_dist);
prev_dist = rec.dist_square;
}
}