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

Method freshenCollision

source/game/StarWorldServer.cpp:2152–2178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2150}
2151
2152void WorldServer::freshenCollision(RectI const& region) {
2153 RectI freshenRegion = RectI::null();
2154 for (int x = region.xMin(); x < region.xMax(); ++x) {
2155 for (int y = region.yMin(); y < region.yMax(); ++y) {
2156 if (auto tile = m_tileArray->modifyTile({x, y})) {
2157 if (tile->collisionCacheDirty)
2158 freshenRegion.combine(RectI(x, y, x + 1, y + 1));
2159 }
2160 }
2161 }
2162
2163 if (!freshenRegion.isNull()) {
2164 for (int x = freshenRegion.xMin(); x < freshenRegion.xMax(); ++x) {
2165 for (int y = freshenRegion.yMin(); y < freshenRegion.yMax(); ++y) {
2166 if (auto tile = m_tileArray->modifyTile({x, y})) {
2167 tile->collisionCacheDirty = false;
2168 tile->collisionCache.clear();
2169 }
2170 }
2171 }
2172
2173 for (auto collisionBlock : m_collisionGenerator.getBlocks(freshenRegion)) {
2174 if (auto tile = m_tileArray->modifyTile(collisionBlock.space))
2175 tile->collisionCache.append(std::move(collisionBlock));
2176 }
2177 }
2178}
2179
2180void WorldServer::removeEntity(EntityId entityId, bool andDie) {
2181 auto entity = m_entityMap->entity(entityId);

Callers 1

forEachCollisionBlockMethod · 0.45

Calls 10

xMinMethod · 0.80
xMaxMethod · 0.80
yMinMethod · 0.80
yMaxMethod · 0.80
getBlocksMethod · 0.80
modifyTileMethod · 0.45
combineMethod · 0.45
isNullMethod · 0.45
clearMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected