MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / removeTree

Function removeTree

src/OpenLoco/src/Map/TileManager.cpp:1088–1109  ·  view source on GitHub ↗

0x004BB432 bl = flags; esi = X86Pointer(&element); ax = pos.x; cx = pos.y;

Source from the content-addressed store, hash-verified

1086 // ax = pos.x;
1087 // cx = pos.y;
1088 void removeTree(World::TreeElement& element, const uint8_t flags, const World::Pos2& pos)
1089 {
1090 if ((!element.isGhost() && !element.isAiAllocated())
1091 && GameCommands::getUpdatingCompanyId() != CompanyId::neutral)
1092 {
1093 auto loc = World::Pos3(pos.x, pos.y, element.baseHeight());
1094 playDemolishTreeSound(loc);
1095 }
1096
1097 if ((flags & GameCommands::Flags::ghost) == 0)
1098 {
1099 auto treeObj = ObjectManager::get<TreeObject>(element.treeObjectId());
1100 auto ratingReduction = treeObj->demolishRatingReduction;
1101 TownManager::updateTownInfo(pos, 0, 0, ratingReduction, 0);
1102 }
1103
1104 auto zMin = element.baseHeight();
1105 auto zMax = element.clearHeight();
1106 Ui::ViewportManager::invalidate(pos, zMin, zMax, ZoomLevel::eighth, 56);
1107
1108 World::TileManager::removeElement(*reinterpret_cast<World::TileElement*>(&element));
1109 }
1110
1111 // 0x0048B0C7
1112 void createDestructExplosion(const World::Pos3& pos)

Callers 1

clearTreeCollisionFunction · 0.70

Calls 10

getUpdatingCompanyIdFunction · 0.85
playDemolishTreeSoundFunction · 0.85
updateTownInfoFunction · 0.85
isAiAllocatedMethod · 0.80
baseHeightMethod · 0.80
treeObjectIdMethod · 0.80
clearHeightMethod · 0.80
removeElementFunction · 0.70
invalidateFunction · 0.50
isGhostMethod · 0.45

Tested by

no test coverage detected