MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / updateActiveSpots

Method updateActiveSpots

source/traps/Trap.cpp:192–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192void Trap::updateActiveSpots()
193{
194 // For a trap, by default, every tile is an active spot
195 for(std::pair<Tile* const, TileData*>& p : mTileData)
196 {
197 TrapTileData* trapTileData = static_cast<TrapTileData*>(p.second);
198 if(trapTileData->getTrapEntity() == nullptr)
199 {
200 BuildingObject* obj = notifyActiveSpotCreated(p.first);
201 if(obj == nullptr)
202 continue;
203
204 addBuildingObject(p.first, obj);
205 continue;
206 }
207
208 if(trapTileData->getRemoveTrap())
209 {
210 trapTileData->setRemoveTrap(false);
211 auto it = mBuildingObjects.find(p.first);
212 if(it == mBuildingObjects.end())
213 continue;
214
215 BuildingObject* trapEntity = it->second;
216 if(trapEntity->notifyRemoveAsked())
217 removeBuildingObject(p.first);
218 else
219 mTrapEntitiesWaitingRemove.push_back(trapEntity);
220
221 continue;
222 }
223 }
224}
225
226BuildingObject* Trap::notifyActiveSpotCreated(Tile* tile)
227{

Callers 7

buildTrapDefaultMethod · 0.45
sellTrapTilesMethod · 0.45
sellTrapTilesEditorMethod · 0.45
createAllEntitiesMethod · 0.45
claimTileMethod · 0.45
unclaimTileMethod · 0.45
digOutMethod · 0.45

Calls 4

getRemoveTrapMethod · 0.80
setRemoveTrapMethod · 0.80
getTrapEntityMethod · 0.45
notifyRemoveAskedMethod · 0.45

Tested by

no test coverage detected