| 538 | } |
| 539 | |
| 540 | ClearFuncResult clearTreeCollision(World::TreeElement& elTree, const World::Pos2 pos, const uint8_t flags, currency32_t& cost) |
| 541 | { |
| 542 | auto* treeObj = ObjectManager::get<TreeObject>(elTree.treeObjectId()); |
| 543 | cost += Economy::getInflationAdjustedCost(treeObj->clearCostFactor, treeObj->costIndex, 12); |
| 544 | |
| 545 | if ((flags & (GameCommands::Flags::ghost | GameCommands::Flags::aiAllocated)) || !(flags & GameCommands::Flags::apply)) |
| 546 | { |
| 547 | return ClearFuncResult::noCollision; |
| 548 | } |
| 549 | |
| 550 | World::TileManager::setRemoveElementPointerChecker(reinterpret_cast<TileElement&>(elTree)); |
| 551 | World::TileManager::removeTree(elTree, GameCommands::Flags::apply, pos); |
| 552 | Scenario::getOptions().madeAnyChanges = 1; |
| 553 | if (World::TileManager::wasRemoveOnLastElement()) |
| 554 | { |
| 555 | return ClearFuncResult::allCollisionsRemoved; |
| 556 | } |
| 557 | return ClearFuncResult::collisionRemoved; |
| 558 | } |
| 559 | |
| 560 | ElementPositionFlags getPositionFlags() |
| 561 | { |
no test coverage detected