MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / forEachEntityAtTile

Method forEachEntityAtTile

source/game/StarEntityMap.cpp:197–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197void EntityMap::forEachEntityAtTile(Vec2I const& pos, EntityCallbackOf<TileEntity> const& callback) const {
198 RectF rect(Vec2F(pos[0], pos[1]), Vec2F(pos[0] + 1, pos[1] + 1));
199 forEachEntity(rect, [&](EntityPtr const& entity) {
200 if (auto tileEntity = as<TileEntity>(entity)) {
201 for (Vec2I space : tileEntity->spaces()) {
202 if (m_geometry.equal(pos, space + tileEntity->tilePosition()))
203 callback(tileEntity);
204 }
205 }
206 });
207}
208
209void EntityMap::forAllEntities(EntityCallback const& callback, function<bool(EntityPtr const&, EntityPtr const&)> sortOrder) const {
210 // Even if there is no sort order, we still copy pointers to a temporary

Callers

nothing calls this directly

Calls 3

spacesMethod · 0.45
equalMethod · 0.45
tilePositionMethod · 0.45

Tested by

no test coverage detected