The problem with picking up items under a dead body is fixed but now need to fix combat.

This commit is contained in:
Zed A. Shaw 2025-08-07 12:13:39 -04:00
parent 97fe02d99d
commit f84b63f0e6
7 changed files with 93 additions and 43 deletions

View file

@ -66,6 +66,7 @@ inline void find_neighbor(const PointEntityMap &table, EntityList &result, Point
Point cell = {at.x + dx, at.y + dy};
// Bug #81, should actually for-loop through these and only add ones with collision
auto it = table.find(cell);
if (it != table.end()) {
result.insert(result.end(), it->second.entity);
@ -117,6 +118,16 @@ inline void update_sorted(SortedEntities& sprite_distance, PointEntityMap& table
}
}
Entity SpatialMap::find(Point at, std::function<bool(CollisionData)> cb) const {
auto [begin, end] = $collision.equal_range(at);
for(auto it = begin; it != end; ++it) {
if(cb(it->second)) return it->second.entity;
}
return DinkyECS::NONE;
}
void SpatialMap::distance_sorted(SortedEntities& sprite_distance, Point from, int max_dist) {
sprite_distance.clear();