summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-17 16:59:33 +0000
committerrubidium <rubidium@openttd.org>2009-12-17 16:59:33 +0000
commit5e2b7e023875bbf7aed8223bdf7657f579e5bb85 (patch)
treed1179d8ae0cdfebaf6e21db7e62b37df3f1db41c
parentb0f1fcbead4c3aa03ab8d0544039fc2de0bc4f5d (diff)
downloadopenttd-5e2b7e023875bbf7aed8223bdf7657f579e5bb85.tar.xz
(svn r18522) -Feature: add the possibility to not make new tree tiles in-game
-rw-r--r--src/lang/english.txt5
-rw-r--r--src/saveload/saveload.cpp2
-rw-r--r--src/settings_gui.cpp1
-rw-r--r--src/settings_type.h1
-rw-r--r--src/table/settings.h1
-rw-r--r--src/tree_cmd.cpp20
6 files changed, 28 insertions, 2 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 17b0032b1..e21ff69a0 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1247,6 +1247,11 @@ STR_CONFIG_SETTING_TOWN_FOUNDING_FORBIDDEN :forbidden
STR_CONFIG_SETTING_TOWN_FOUNDING_ALLOWED :allowed
STR_CONFIG_SETTING_TOWN_FOUNDING_ALLOWED_CUSTOM_LAYOUT :allowed, custom town layout
+STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT :{LTBLUE}In game placement of trees: {ORANGE}{STRING1}
+STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_NONE :none {RED}(breaks lumber mill)
+STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_RAINFOREST :only in rain forests
+STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_ALL :everywhere
+
STR_CONFIG_SETTING_TOOLBAR_POS :{LTBLUE}Position of main toolbar: {ORANGE}{STRING1}
STR_CONFIG_SETTING_TOOLBAR_POS_LEFT :Left
STR_CONFIG_SETTING_TOOLBAR_POS_CENTER :Centre
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index d00aefda0..b5018855a 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -47,7 +47,7 @@
#include "saveload_internal.h"
-extern const uint16 SAVEGAME_VERSION = 131;
+extern const uint16 SAVEGAME_VERSION = 132;
SavegameType _savegame_type; ///< type of savegame we are loading
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 6d892f4e3..37856e305 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1268,6 +1268,7 @@ static SettingEntry _settings_construction[] = {
SettingEntry("construction.longbridges"),
SettingEntry("station.never_expire_airports"),
SettingEntry("construction.freeform_edges"),
+ SettingEntry("construction.extra_tree_placement"),
};
/** Construction sub-page */
static SettingsPage _settings_construction_page = {_settings_construction, lengthof(_settings_construction)};
diff --git a/src/settings_type.h b/src/settings_type.h
index 851e495b7..7547a87f8 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -182,6 +182,7 @@ struct ConstructionSettings {
bool road_stop_on_competitor_road; ///< allow building of drive-through road stops on roads owned by competitors
uint8 raw_industry_construction; ///< type of (raw) industry construction (none, "normal", prospecting)
bool freeform_edges; ///< allow terraforming the tiles at the map edges
+ uint8 extra_tree_placement; ///< (dis)allow building extra trees in-game
};
/** Settings related to the AI. */
diff --git a/src/table/settings.h b/src/table/settings.h
index bda619107..62213dc10 100644
--- a/src/table/settings.h
+++ b/src/table/settings.h
@@ -523,6 +523,7 @@ const SettingDesc _settings[] = {
SDT_CONDBOOL(GameSettings, construction.freeform_edges, 111, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_SETTING_ENABLE_FREEFORM_EDGES, CheckFreeformEdges),
SDT_CONDVAR(GameSettings, game_creation.water_borders, SLE_UINT8,111, SL_MAX_VERSION, 0, 0, 15, 0, 16, 0, STR_NULL, NULL),
SDT_CONDVAR(GameSettings, game_creation.custom_town_number, SLE_UINT16,115, SL_MAX_VERSION, 0, 0, 1, 1, 5000, 0, STR_NULL, NULL),
+ SDT_CONDVAR(GameSettings, construction.extra_tree_placement, SLE_UINT8,132, SL_MAX_VERSION, 0,MS, 2, 0, 2, 0, STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT, NULL),
SDT_CONDOMANY(GameSettings, locale.currency, SLE_UINT8, 97, SL_MAX_VERSION, N, 0, 0, CUSTOM_CURRENCY_ID, _locale_currencies, STR_NULL, NULL, NULL),
SDT_CONDOMANY(GameSettings, locale.units, SLE_UINT8, 97, SL_MAX_VERSION, N, 0, 1, 2, _locale_units, STR_NULL, NULL, NULL),
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index 8802acb46..2cd9c35dc 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -45,6 +45,14 @@ enum TreePlacer {
TP_IMPROVED, ///< A 'improved' algorithm
};
+/** Where to place trees while in-game? */
+enum ExtraTreePlacement {
+ ETP_NONE, ///< Place trees on no tiles
+ ETP_RAINFOREST, ///< Place trees only on rainforest tiles
+ ETP_ALL, ///< Place trees on all tiles
+};
+
+
/**
* Tests if a tile can be converted to MP_TREES
* This is true for clear ground without farms or rocks.
@@ -662,6 +670,13 @@ static void TileLoop_Trees(TileIndex tile)
/* FALL THROUGH */
case 2: { // add a neighbouring tree
+ /* Don't plant extra trees if that's not allowed. */
+ if ((_settings_game.game_creation.landscape == LT_TROPIC && GetTropicZone(tile) == TROPICZONE_RAINFOREST) ?
+ _settings_game.construction.extra_tree_placement == ETP_NONE :
+ _settings_game.construction.extra_tree_placement != ETP_ALL) {
+ break;
+ }
+
TreeType treetype = GetTreeType(tile);
tile += TileOffsByDir((Direction)(Random() & 7));
@@ -711,6 +726,9 @@ static void TileLoop_Trees(TileIndex tile)
void OnTick_Trees()
{
+ /* Don't place trees if that's not allowed */
+ if (_settings_game.construction.extra_tree_placement == ETP_NONE) return;
+
uint32 r;
TileIndex tile;
TreeType tree;
@@ -724,7 +742,7 @@ void OnTick_Trees()
}
/* byte underflow */
- if (--_trees_tick_ctr != 0) return;
+ if (--_trees_tick_ctr != 0 || _settings_game.construction.extra_tree_placement != ETP_ALL) return;
/* place a tree at a random spot */
r = Random();