Merge branch 'desert-tweaks' of https://github.com/reldred/OpenTTD-patches into desert-tweaks
This commit is contained in:
@@ -1001,48 +1001,39 @@ static void GenerateTerrain(int type, uint flag)
|
|||||||
|
|
||||||
#include "table/genland.h"
|
#include "table/genland.h"
|
||||||
|
|
||||||
|
static std::pair<const TileIndexDiffC *, const TileIndexDiffC *> GetDesertOrRainforestData()
|
||||||
|
{
|
||||||
|
switch (_settings_game.game_creation.coast_tropics_width) {
|
||||||
|
case 0:
|
||||||
|
return { _make_desert_or_rainforest_data, endof(_make_desert_or_rainforest_data) };
|
||||||
|
case 1:
|
||||||
|
return { _make_desert_or_rainforest_data_medium, endof(_make_desert_or_rainforest_data_medium) };
|
||||||
|
case 2:
|
||||||
|
return { _make_desert_or_rainforest_data_large, endof(_make_desert_or_rainforest_data_large) };
|
||||||
|
default:
|
||||||
|
NOT_REACHED();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void CreateDesertOrRainForest(uint desert_tropic_line)
|
static void CreateDesertOrRainForest(uint desert_tropic_line)
|
||||||
{
|
{
|
||||||
TileIndex update_freq = MapSize() / 4;
|
TileIndex update_freq = MapSize() / 4;
|
||||||
const TileIndexDiffC *data;
|
const TileIndexDiffC *data;
|
||||||
|
|
||||||
|
const std::pair<const TileIndexDiffC *, const TileIndexDiffC *> desert_rainforest_data = GetDesertOrRainforestData();
|
||||||
|
|
||||||
for (TileIndex tile = 0; tile != MapSize(); ++tile) {
|
for (TileIndex tile = 0; tile != MapSize(); ++tile) {
|
||||||
if ((tile % update_freq) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
|
if ((tile % update_freq) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
|
||||||
|
|
||||||
if (!IsValidTile(tile)) continue;
|
if (!IsValidTile(tile)) continue;
|
||||||
|
|
||||||
if (_settings_game.game_creation.coast_tropics_width == 0) {
|
for (data = desert_rainforest_data.first; data != desert_rainforest_data.second; ++data) {
|
||||||
for (data = _make_desert_or_rainforest_data;
|
|
||||||
data != endof(_make_desert_or_rainforest_data); ++data) {
|
|
||||||
TileIndex t = AddTileIndexDiffCWrap(tile, *data);
|
TileIndex t = AddTileIndexDiffCWrap(tile, *data);
|
||||||
if (t != INVALID_TILE && (TileHeight(t) >= desert_tropic_line || IsTileType(t, MP_WATER))) break;
|
if (t != INVALID_TILE && (TileHeight(t) >= desert_tropic_line || IsTileType(t, MP_WATER))) break;
|
||||||
}
|
}
|
||||||
if (data == endof(_make_desert_or_rainforest_data)) {
|
if (data == desert_rainforest_data.second) {
|
||||||
SetTropicZone(tile, TROPICZONE_DESERT);
|
SetTropicZone(tile, TROPICZONE_DESERT);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (_settings_game.game_creation.coast_tropics_width == 1) {
|
|
||||||
for (data = _make_desert_or_rainforest_data_medium;
|
|
||||||
data != endof(_make_desert_or_rainforest_data_medium); ++data) {
|
|
||||||
TileIndex t = AddTileIndexDiffCWrap(tile, *data);
|
|
||||||
if (t != INVALID_TILE && (TileHeight(t) >= desert_tropic_line || IsTileType(t, MP_WATER))) break;
|
|
||||||
}
|
|
||||||
if (data == endof(_make_desert_or_rainforest_data_medium)) {
|
|
||||||
SetTropicZone(tile, TROPICZONE_DESERT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_settings_game.game_creation.coast_tropics_width == 2) {
|
|
||||||
for (data = _make_desert_or_rainforest_data_large;
|
|
||||||
data != endof(_make_desert_or_rainforest_data_large); ++data) {
|
|
||||||
TileIndex t = AddTileIndexDiffCWrap(tile, *data);
|
|
||||||
if (t != INVALID_TILE && (TileHeight(t) >= desert_tropic_line || IsTileType(t, MP_WATER))) break;
|
|
||||||
}
|
|
||||||
if (data == endof(_make_desert_or_rainforest_data_large)) {
|
|
||||||
SetTropicZone(tile, TROPICZONE_DESERT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_settings_game.game_creation.coast_tropics_width == 3) {
|
if (_settings_game.game_creation.coast_tropics_width == 3) {
|
||||||
for (data = _make_desert_or_rainforest_data_extralarge;
|
for (data = _make_desert_or_rainforest_data_extralarge;
|
||||||
@@ -1067,38 +1058,13 @@ static void CreateDesertOrRainForest(uint desert_tropic_line)
|
|||||||
|
|
||||||
if (!IsValidTile(tile)) continue;
|
if (!IsValidTile(tile)) continue;
|
||||||
|
|
||||||
if (_settings_game.game_creation.coast_tropics_width == 0) {
|
for (data = desert_rainforest_data.first; data != desert_rainforest_data.second; ++data) {
|
||||||
for (data = _make_desert_or_rainforest_data;
|
|
||||||
data != endof(_make_desert_or_rainforest_data); ++data) {
|
|
||||||
TileIndex t = AddTileIndexDiffCWrap(tile, *data);
|
TileIndex t = AddTileIndexDiffCWrap(tile, *data);
|
||||||
if (t != INVALID_TILE && IsTileType(t, MP_CLEAR) && IsClearGround(t, CLEAR_DESERT)) break;
|
if (t != INVALID_TILE && IsTileType(t, MP_CLEAR) && IsClearGround(t, CLEAR_DESERT)) break;
|
||||||
}
|
}
|
||||||
if (data == endof(_make_desert_or_rainforest_data)) {
|
if (data == desert_rainforest_data.second) {
|
||||||
SetTropicZone(tile, TROPICZONE_RAINFOREST);
|
SetTropicZone(tile, TROPICZONE_RAINFOREST);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (_settings_game.game_creation.coast_tropics_width == 1) {
|
|
||||||
for (data = _make_desert_or_rainforest_data_medium;
|
|
||||||
data != endof(_make_desert_or_rainforest_data_medium); ++data) {
|
|
||||||
TileIndex t = AddTileIndexDiffCWrap(tile, *data);
|
|
||||||
if (t != INVALID_TILE && IsTileType(t, MP_CLEAR) && IsClearGround(t, CLEAR_DESERT)) break;
|
|
||||||
}
|
|
||||||
if (data == endof(_make_desert_or_rainforest_data_medium)) {
|
|
||||||
SetTropicZone(tile, TROPICZONE_RAINFOREST);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_settings_game.game_creation.coast_tropics_width == 2) {
|
|
||||||
for (data = _make_desert_or_rainforest_data_large;
|
|
||||||
data != endof(_make_desert_or_rainforest_data_large); ++data) {
|
|
||||||
TileIndex t = AddTileIndexDiffCWrap(tile, *data);
|
|
||||||
if (t != INVALID_TILE && IsTileType(t, MP_CLEAR) && IsClearGround(t, CLEAR_DESERT)) break;
|
|
||||||
}
|
|
||||||
if (data == endof(_make_desert_or_rainforest_data_large)) {
|
|
||||||
SetTropicZone(tile, TROPICZONE_RAINFOREST);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_settings_game.game_creation.coast_tropics_width == 3) {
|
if (_settings_game.game_creation.coast_tropics_width == 3) {
|
||||||
for (data = _make_desert_or_rainforest_data_extralarge;
|
for (data = _make_desert_or_rainforest_data_extralarge;
|
||||||
|
Reference in New Issue
Block a user