MCPcopy Create free account
hub / github.com/Warzone2100/warzone2100 / removeStructFromMap

Function removeStructFromMap

src/structure.cpp:4542–4560  ·  view source on GitHub ↗

remove a structure from the map

Source from the content-addressed store, hash-verified

4540
4541//remove a structure from the map
4542static void removeStructFromMap(STRUCTURE *psStruct)
4543{
4544 auxStructureNonblocking(psStruct);
4545
4546 /* set tiles drawing */
4547 StructureBounds b = getStructureBounds(psStruct);
4548 for (int j = 0; j < b.size.y; ++j)
4549 {
4550 for (int i = 0; i < b.size.x; ++i)
4551 {
4552 MAPTILE *psTile = mapTile(b.map.x + i, b.map.y + j);
4553 if (psTile->psObject == psStruct)
4554 {
4555 psTile->psObject = nullptr;
4556 auxClearBlocking(b.map.x + i, b.map.y + j, AIR_BLOCKED);
4557 }
4558 }
4559 }
4560}
4561
4562// remove a structure from a game without any visible effects
4563// bDestroy = true if the object is to be destroyed

Callers 2

buildStructureDirFunction · 0.85
removeStructFunction · 0.85

Calls 4

auxStructureNonblockingFunction · 0.85
auxClearBlockingFunction · 0.85
getStructureBoundsFunction · 0.70
mapTileFunction · 0.70

Tested by

no test coverage detected