MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ClearTile_Trees

Function ClearTile_Trees

src/tree_cmd.cpp:718–733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

716}
717
718static CommandCost ClearTile_Trees(TileIndex tile, DoCommandFlags flags)
719{
720 uint num;
721
722 if (Company::IsValidID(_current_company)) {
723 Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
724 if (t != nullptr) ChangeTownRating(t, RATING_TREE_DOWN_STEP, RATING_TREE_MINIMUM, flags);
725 }
726
727 num = GetTreeCount(tile);
728 if (IsInsideMM(GetTreeType(tile), TREE_RAINFOREST, TREE_CACTUS)) num *= 4;
729
730 if (flags.Test(DoCommandFlag::Execute)) DoClearSquare(tile);
731
732 return CommandCost(EXPENSES_CONSTRUCTION, num * _price[PR_CLEAR_TREES]);
733}
734
735static void GetTileDesc_Trees(TileIndex tile, TileDesc &td)
736{

Callers

nothing calls this directly

Calls 8

ClosestTownFromTileFunction · 0.85
ChangeTownRatingFunction · 0.85
GetTreeCountFunction · 0.85
IsInsideMMFunction · 0.85
GetTreeTypeFunction · 0.85
DoClearSquareFunction · 0.85
CommandCostClass · 0.85
TestMethod · 0.80

Tested by

no test coverage detected