The problem with picking up items under a dead body is fixed but now need to fix combat.
This commit is contained in:
parent
97fe02d99d
commit
f84b63f0e6
7 changed files with 93 additions and 43 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue