28 #include "table/strings.h" 
   77     default: 
return false;
 
  115     default: NOT_REACHED();
 
  118   MakeTree(tile, treetype, count, growth, ground, density);
 
  193       int x = 
GB(r, 0, 5) - 16;
 
  194       int y = 
GB(r, 8, 5) - 16;
 
  195       uint dist = 
abs(x) + 
abs(y);
 
  205   } 
while (--num_groups);
 
  221     int x = 
GB(r, 0, 5) - 16;
 
  222     int y = 
GB(r, 8, 5) - 16;
 
  227     if (
abs(x) + 
abs(y) > 16) 
continue;
 
  309     default: NOT_REACHED();
 
  321   for (; i != 0; i--) {
 
  339   const byte tree_to_plant = 
GB(p1, 0, 8); 
 
  346   int limit = (c == NULL ? INT32_MAX : 
GB(c->
tree_limit, 16, 16));
 
  353         if (_game_mode != GM_EDITOR && 
GetTreeCount(tile) == 4) {
 
  354           msg = STR_ERROR_TREE_ALREADY_HERE;
 
  360           msg = STR_ERROR_TREE_PLANT_LIMIT_REACHED;
 
  370         cost.
AddCost(_price[PR_BUILD_TREES] * 2);
 
  375           msg = STR_ERROR_CAN_T_BUILD_ON_WATER;
 
  381           msg = STR_ERROR_SITE_UNSUITABLE;
 
  394           msg = STR_ERROR_TREE_WRONG_TERRAIN_FOR_TREE_TYPE;
 
  400           msg = STR_ERROR_TREE_PLANT_LIMIT_REACHED;
 
  410               if (ret.
Failed()) 
return ret;
 
  421           if (t != NULL) 
ChangeTownRating(t, RATING_TREE_UP_STEP, RATING_TREE_MAXIMUM, flags);
 
  424         if (flags & DC_EXEC) {
 
  440         cost.
AddCost(_price[PR_BUILD_TREES]);
 
  445         msg = STR_ERROR_SITE_UNSUITABLE;
 
  450     if (limit < 0) 
break;
 
  464 static void DrawTile_Trees(
TileInfo *ti)
 
  486   assert(index < 
lengthof(_tree_layout_sprite));
 
  489   const TreePos *d = _tree_layout_xy[
GB(tmp, 2, 2)];
 
  499   for (uint i = 0; i < trees; i++) {
 
  514   for (; trees > 0; trees--) {
 
  515     uint 
min = te[0].x + te[0].y;
 
  518     for (uint i = 1; i < trees; i++) {
 
  519       if ((uint)(te[i].x + te[i].y) < min) {
 
  520         min = te[i].x + te[i].y;
 
  525     AddSortableSpriteToDraw(te[mi].sprite, te[mi].pal, ti->
x + te[mi].x, ti->
y + te[mi].y, 16 - te[mi].x, 16 - te[mi].y, 0x30, z, 
IsTransparencySet(
TO_TREES), -te[mi].x, -te[mi].y);
 
  528     te[mi] = te[trees - 1];
 
  535 static int GetSlopePixelZ_Trees(
TileIndex tile, uint x, uint y)
 
  554     if (t != NULL) 
ChangeTownRating(t, RATING_TREE_DOWN_STEP, RATING_TREE_MINIMUM, flags);
 
  560   if (flags & 
DC_EXEC) DoClearSquare(tile);
 
  570     td->
str = STR_LAI_TREE_NAME_RAINFOREST;
 
  572     td->
str = tt == 
TREE_CACTUS ? STR_LAI_TREE_NAME_CACTUS_PLANTS : STR_LAI_TREE_NAME_TREES;
 
  578 static void TileLoopTreesDesert(
TileIndex tile)
 
  589       static const SoundFx forest_sounds[] = {
 
  605 static void TileLoopTreesAlps(
TileIndex tile)
 
  616     uint density = min<uint>(k, 3);
 
  627           SndPlayTileFx((r & 0x80000000) ? SND_39_HEAVY_WIND : SND_34_WIND, tile);
 
  636 static void TileLoop_Trees(
TileIndex tile)
 
  642       case LT_TROPIC: TileLoopTreesDesert(tile); 
break;
 
  643       case LT_ARCTIC: TileLoopTreesAlps(tile);   
break;
 
  672         switch (
GB(Random(), 0, 3)) {
 
  790 void InitializeTrees()
 
  803   GetSlopePixelZ_Trees,     
 
  807   GetTileTrackStatus_Trees, 
 
  811   ChangeTileOwner_Trees,