Changeset - r15019:89cf9eac8dac
[Not reviewed]
master
0 2 0
rubidium - 14 years ago 2010-04-16 21:46:06
rubidium@openttd.org
(svn r19644) -Fix [FS#3728]: don't allow building cacti outside of the desert or rain forest trees outside of the rain forest area. This to prevent people from thinking planting rain forest trees makes the rain forest bigger and thus adds more place to build a lumber mill.
2 files changed with 18 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -3526,12 +3526,13 @@ STR_ERROR_MUST_BE_BUILT_ON_WATER        
 
STR_ERROR_CAN_T_BUILD_ON_WATER                                  :{WHITE}... can't build on water
 
STR_ERROR_MUST_DEMOLISH_CANAL_FIRST                             :{WHITE}Must demolish canal first
 
STR_ERROR_CAN_T_BUILD_AQUEDUCT_HERE                             :{WHITE}Can't build aqueduct here...
 

	
 
# Tree related errors
 
STR_ERROR_TREE_ALREADY_HERE                                     :{WHITE}... tree already here
 
STR_ERROR_TREE_WRONG_TERRAIN_FOR_TREE_TYPE                      :{WHITE}... wrong terrain for tree type
 
STR_ERROR_CAN_T_PLANT_TREE_HERE                                 :{WHITE}Can't plant tree here...
 

	
 
# Bridge related errors
 
STR_ERROR_CAN_T_BUILD_BRIDGE_HERE                               :{WHITE}Can't build bridge here...
 
STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST                            :{WHITE}Must demolish bridge first
 
STR_ERROR_CAN_T_START_AND_END_ON                                :{WHITE}Can't start and end in the same spot
src/tree_cmd.cpp
Show inline comments
 
@@ -372,18 +372,31 @@ CommandCost CmdPlantTree(TileIndex tile,
 
			case MP_WATER:
 
				if (!IsCoast(tile) || IsSlopeWithOneCornerRaised(GetTileSlope(tile, NULL))) {
 
					msg = STR_ERROR_CAN_T_BUILD_ON_WATER;
 
					continue;
 
				}
 
			/* FALL THROUGH */
 
			case MP_CLEAR:
 
			case MP_CLEAR: {
 
				if (IsBridgeAbove(tile)) {
 
					msg = STR_ERROR_SITE_UNSUITABLE;
 
					continue;
 
				}
 

	
 
				TreeType treetype = (TreeType)tree_to_plant;
 
				/* Be a bit picky about which trees go where. */
 
				if (_settings_game.game_creation.landscape == LT_TROPIC && treetype != TREE_INVALID && (
 
						/* No cacti outside the desert */
 
						(treetype == TREE_CACTUS && GetTropicZone(tile) != TROPICZONE_DESERT) ||
 
						/* No rain forest trees outside the rain forest, except in the editor mode where it makes those tiles rain forest tile */
 
						(IsInsideMM(treetype, TREE_RAINFOREST, TREE_CACTUS) && GetTropicZone(tile) != TROPICZONE_RAINFOREST && _game_mode != GM_EDITOR) ||
 
						/* And no subtropical trees in the desert/rain forest */
 
						(IsInsideMM(treetype, TREE_SUB_TROPICAL, TREE_TOYLAND) && GetTropicZone(tile) != TROPICZONE_NORMAL))) {
 
					msg = STR_ERROR_TREE_WRONG_TERRAIN_FOR_TREE_TYPE;
 
					continue;
 
				}
 

	
 
				if (IsTileType(tile, MP_CLEAR)) {
 
					/* Remove fields or rocks. Note that the ground will get barrened */
 
					switch (GetRawClearGround(tile)) {
 
						case CLEAR_FIELDS:
 
						case CLEAR_ROCKS: {
 
							CommandCost ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 
@@ -399,28 +412,28 @@ CommandCost CmdPlantTree(TileIndex tile,
 
				if (_game_mode != GM_EDITOR && Company::IsValidID(_current_company)) {
 
					Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
 
					if (t != NULL) ChangeTownRating(t, RATING_TREE_UP_STEP, RATING_TREE_MAXIMUM, flags);
 
				}
 

	
 
				if (flags & DC_EXEC) {
 
					TreeType treetype = (TreeType)tree_to_plant;
 
					if (treetype == TREE_INVALID) {
 
						treetype = GetRandomTreeType(tile, GB(Random(), 24, 8));
 
						if (treetype == TREE_INVALID) treetype = TREE_CACTUS;
 
					}
 

	
 
					/* Plant full grown trees in scenario editor */
 
					PlantTreesOnTile(tile, treetype, 0, _game_mode == GM_EDITOR ? 3 : 0);
 
					MarkTileDirtyByTile(tile);
 

	
 
					/* When planting rainforest-trees, set tropiczone to rainforest in editor. */
 
					if (_game_mode == GM_EDITOR && IsInsideMM(treetype, TREE_RAINFOREST, TREE_CACTUS))
 
					if (_game_mode == GM_EDITOR && IsInsideMM(treetype, TREE_RAINFOREST, TREE_CACTUS)) {
 
						SetTropicZone(tile, TROPICZONE_RAINFOREST);
 
					}
 
				}
 
				cost.AddCost(_price[PR_BUILD_TREES]);
 
				break;
 
			} break;
 

	
 
			default:
 
				msg = STR_ERROR_SITE_UNSUITABLE;
 
				break;
 
		}
 
	}
0 comments (0 inline, 0 general)