mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-09-02 11:29:10 +00:00
(svn r5070) Merged the bridge branch
-Feature: Bridges can now be placed above: Any railway track combination (excluding depots and waypoints) Any road combination (excluding depots) Clear tiles (duh), including fields Tunnel entrances Bridge heads Thanks to Tron for idea and implementation, KUDr for the yapf synchronization and many others for hours of testing There are still a number of visual problems remaining, especially when electric railways are on or under the bridge. DO NOT REPORT THOSE BUGS FOR THE TIME BEING please.
This commit is contained in:
15
tree_cmd.c
15
tree_cmd.c
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "bridge_map.h"
|
||||
#include "clear_map.h"
|
||||
#include "table/strings.h"
|
||||
#include "table/sprites.h"
|
||||
@@ -68,6 +69,7 @@ static void DoPlaceMoreTrees(TileIndex tile)
|
||||
|
||||
if (dist <= 13 &&
|
||||
IsTileType(cur_tile, MP_CLEAR) &&
|
||||
!IsBridgeAbove(cur_tile) &&
|
||||
!IsClearGround(cur_tile, CLEAR_FIELDS) &&
|
||||
!IsClearGround(cur_tile, CLEAR_ROCKS)) {
|
||||
PlaceTree(cur_tile, r);
|
||||
@@ -92,6 +94,7 @@ void PlaceTreesRandomly(void)
|
||||
uint32 r = Random();
|
||||
TileIndex tile = RandomTileSeed(r);
|
||||
if (IsTileType(tile, MP_CLEAR) &&
|
||||
!IsBridgeAbove(tile) &&
|
||||
!IsClearGround(tile, CLEAR_FIELDS) &&
|
||||
!IsClearGround(tile, CLEAR_ROCKS)) {
|
||||
PlaceTree(tile, r);
|
||||
@@ -105,7 +108,9 @@ void PlaceTreesRandomly(void)
|
||||
do {
|
||||
uint32 r = Random();
|
||||
TileIndex tile = RandomTileSeed(r);
|
||||
if (IsTileType(tile, MP_CLEAR) && GetTropicZone(tile) == TROPICZONE_RAINFOREST) {
|
||||
if (IsTileType(tile, MP_CLEAR) &&
|
||||
!IsBridgeAbove(tile) &&
|
||||
GetTropicZone(tile) == TROPICZONE_RAINFOREST) {
|
||||
PlaceTree(tile, r);
|
||||
}
|
||||
} while (--i);
|
||||
@@ -175,7 +180,8 @@ int32 CmdPlantTree(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
break;
|
||||
|
||||
case MP_CLEAR:
|
||||
if (!IsTileOwner(tile, OWNER_NONE)) {
|
||||
if (!IsTileOwner(tile, OWNER_NONE) ||
|
||||
IsBridgeAbove(tile)) {
|
||||
msg = STR_2804_SITE_UNSUITABLE;
|
||||
continue;
|
||||
}
|
||||
@@ -480,7 +486,7 @@ static void TileLoop_Trees(TileIndex tile)
|
||||
|
||||
tile += ToTileIndexDiff(_tileloop_trees_dir[Random() & 7]);
|
||||
|
||||
if (!IsTileType(tile, MP_CLEAR)) return;
|
||||
if (!IsTileType(tile, MP_CLEAR) || IsBridgeAbove(tile)) return;
|
||||
|
||||
switch (GetClearGround(tile)) {
|
||||
case CLEAR_GRASS:
|
||||
@@ -513,6 +519,7 @@ static void TileLoop_Trees(TileIndex tile)
|
||||
case TREE_GROUND_ROUGH: MakeClear(tile, CLEAR_ROUGH, 3); break;
|
||||
default: MakeClear(tile, CLEAR_SNOW, GetTreeDensity(tile)); break;
|
||||
}
|
||||
ClearBridgeMiddle(tile);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -535,6 +542,7 @@ void OnTick_Trees(void)
|
||||
if (_opt.landscape == LT_DESERT &&
|
||||
(r = Random(), tile = RandomTileSeed(r), GetTropicZone(tile) == TROPICZONE_RAINFOREST) &&
|
||||
IsTileType(tile, MP_CLEAR) &&
|
||||
!IsBridgeAbove(tile) &&
|
||||
(ct = GetClearGround(tile), ct == CLEAR_GRASS || ct == CLEAR_ROUGH) &&
|
||||
(tree = GetRandomTreeType(tile, GB(r, 24, 8))) != TREE_INVALID) {
|
||||
MakeTree(tile, tree, 0, 0, ct == CLEAR_ROUGH ? TREE_GROUND_ROUGH : TREE_GROUND_GRASS, 0);
|
||||
@@ -547,6 +555,7 @@ void OnTick_Trees(void)
|
||||
r = Random();
|
||||
tile = TILE_MASK(r);
|
||||
if (IsTileType(tile, MP_CLEAR) &&
|
||||
!IsBridgeAbove(tile) &&
|
||||
(ct = GetClearGround(tile), ct == CLEAR_GRASS || ct == CLEAR_ROUGH || ct == CLEAR_SNOW) &&
|
||||
(tree = GetRandomTreeType(tile, GB(r, 24, 8))) != TREE_INVALID) {
|
||||
switch (ct) {
|
||||
|
Reference in New Issue
Block a user