mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Merged "Improved" and "Forest" options.
parent
a2dd8ed419
commit
3a3b1c5f04
|
@ -1586,12 +1586,11 @@ STR_CONFIG_SETTING_RIVER_AMOUNT :River amount: {
|
||||||
STR_CONFIG_SETTING_RIVER_AMOUNT_HELPTEXT :Choose how many rivers to generate
|
STR_CONFIG_SETTING_RIVER_AMOUNT_HELPTEXT :Choose how many rivers to generate
|
||||||
|
|
||||||
STR_CONFIG_SETTING_TREE_PLACER :Tree placer algorithm: {STRING2}
|
STR_CONFIG_SETTING_TREE_PLACER :Tree placer algorithm: {STRING2}
|
||||||
STR_CONFIG_SETTING_TREE_PLACER_HELPTEXT :Choose the distribution of trees on the map: 'Original' plants trees uniformly scattered, 'Improved' plants them in groups, 'Forest' plants them in forests
|
STR_CONFIG_SETTING_TREE_PLACER_HELPTEXT :Choose the distribution of trees on the map: 'Original' plants trees uniformly scattered, 'Improved' plants them in groups
|
||||||
###length 3
|
###length 3
|
||||||
STR_CONFIG_SETTING_TREE_PLACER_NONE :None
|
STR_CONFIG_SETTING_TREE_PLACER_NONE :None
|
||||||
STR_CONFIG_SETTING_TREE_PLACER_ORIGINAL :Original
|
STR_CONFIG_SETTING_TREE_PLACER_ORIGINAL :Original
|
||||||
STR_CONFIG_SETTING_TREE_PLACER_IMPROVED :Improved
|
STR_CONFIG_SETTING_TREE_PLACER_IMPROVED :Improved
|
||||||
STR_CONFIG_SETTING_TREE_PLACER_FOREST :Forest
|
|
||||||
|
|
||||||
STR_CONFIG_SETTING_ROAD_SIDE :Road vehicles: {STRING2}
|
STR_CONFIG_SETTING_ROAD_SIDE :Road vehicles: {STRING2}
|
||||||
STR_CONFIG_SETTING_ROAD_SIDE_HELPTEXT :Choose the driving side
|
STR_CONFIG_SETTING_ROAD_SIDE_HELPTEXT :Choose the driving side
|
||||||
|
|
|
@ -41,7 +41,6 @@ enum TreePlacer {
|
||||||
TP_NONE, ///< No tree placer algorithm
|
TP_NONE, ///< No tree placer algorithm
|
||||||
TP_ORIGINAL, ///< The original algorithm
|
TP_ORIGINAL, ///< The original algorithm
|
||||||
TP_IMPROVED, ///< A 'improved' algorithm
|
TP_IMPROVED, ///< A 'improved' algorithm
|
||||||
TP_FOREST, ///< An algorithm trying to make only forests
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Where to place trees while in-game? */
|
/** Where to place trees while in-game? */
|
||||||
|
@ -96,7 +95,7 @@ static bool IsNearbyForest(TileIndex tile)
|
||||||
for (int y = -2; y <= 2; y++) {
|
for (int y = -2; y <= 2; y++) {
|
||||||
TileIndex vincity = TileAddWrap(tile, x, y);
|
TileIndex vincity = TileAddWrap(tile, x, y);
|
||||||
if (vincity != INVALID_TILE &&
|
if (vincity != INVALID_TILE &&
|
||||||
IsTileType(vincity, MP_TREES)) {
|
IsTileType(vincity, MP_TREES)) {
|
||||||
planted_tile_count++;
|
planted_tile_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,8 +281,7 @@ void PlaceTreesRandomly()
|
||||||
|
|
||||||
if (CanPlantTreesOnTile(tile, true)) {
|
if (CanPlantTreesOnTile(tile, true)) {
|
||||||
PlaceTree(tile, r);
|
PlaceTree(tile, r);
|
||||||
if (_settings_game.game_creation.tree_placer != TP_IMPROVED &&
|
if (_settings_game.game_creation.tree_placer != TP_IMPROVED) {
|
||||||
_settings_game.game_creation.tree_placer != TP_FOREST) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,8 +384,6 @@ void GenerateTrees()
|
||||||
|
|
||||||
switch (_settings_game.game_creation.tree_placer) {
|
switch (_settings_game.game_creation.tree_placer) {
|
||||||
case TP_ORIGINAL: i = _settings_game.game_creation.landscape == LT_ARCTIC ? 15 : 6; break;
|
case TP_ORIGINAL: i = _settings_game.game_creation.landscape == LT_ARCTIC ? 15 : 6; break;
|
||||||
case TP_FOREST:
|
|
||||||
FALLTHROUGH;
|
|
||||||
case TP_IMPROVED: i = _settings_game.game_creation.landscape == LT_ARCTIC ? 4 : 2; break;
|
case TP_IMPROVED: i = _settings_game.game_creation.landscape == LT_ARCTIC ? 4 : 2; break;
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
@ -401,8 +397,6 @@ void GenerateTrees()
|
||||||
|
|
||||||
if (num_groups != 0) PlaceTreeGroups(num_groups);
|
if (num_groups != 0) PlaceTreeGroups(num_groups);
|
||||||
|
|
||||||
if (_settings_game.game_creation.tree_placer == TP_FOREST) return;
|
|
||||||
|
|
||||||
for (; i != 0; i--) {
|
for (; i != 0; i--) {
|
||||||
PlaceTreesRandomly();
|
PlaceTreesRandomly();
|
||||||
}
|
}
|
||||||
|
@ -791,7 +785,7 @@ static void TileLoop_Trees(TileIndex tile)
|
||||||
if (IsTileType(tile, MP_CLEAR) && GetClearGround(tile) == CLEAR_GRASS && GetClearDensity(tile) != 3) return;
|
if (IsTileType(tile, MP_CLEAR) && GetClearGround(tile) == CLEAR_GRASS && GetClearDensity(tile) != 3) return;
|
||||||
|
|
||||||
/* Plants trees only near existing forests */
|
/* Plants trees only near existing forests */
|
||||||
if (_settings_game.game_creation.tree_placer == TP_FOREST && !IsNearbyForest(tile)) return;
|
if (_settings_game.game_creation.tree_placer == TP_IMPROVED && !IsNearbyForest(tile)) return;
|
||||||
|
|
||||||
PlantTreesOnTile(tile, treetype, 0, 0);
|
PlantTreesOnTile(tile, treetype, 0, 0);
|
||||||
|
|
||||||
|
@ -895,7 +889,7 @@ void OnTick_Trees()
|
||||||
tile = RandomTileSeed(r);
|
tile = RandomTileSeed(r);
|
||||||
if (CanPlantTreesOnTile(tile, false) && (tree = GetRandomTreeType(tile, GB(r, 24, 8))) != TREE_INVALID) {
|
if (CanPlantTreesOnTile(tile, false) && (tree = GetRandomTreeType(tile, GB(r, 24, 8))) != TREE_INVALID) {
|
||||||
/* Plants trees only near existing forests */
|
/* Plants trees only near existing forests */
|
||||||
if (_settings_game.game_creation.tree_placer == TP_FOREST && !IsNearbyForest(tile)) return;
|
if (_settings_game.game_creation.tree_placer == TP_IMPROVED && !IsNearbyForest(tile)) return;
|
||||||
|
|
||||||
PlantTreesOnTile(tile, tree, 0, 0);
|
PlantTreesOnTile(tile, tree, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue