mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r22773) -Add: Some grass around rivers in desert areas.
This commit is contained in:
parent
d7baf7a4a9
commit
4261e8fdfd
|
@ -1038,7 +1038,12 @@ static void River_GetNeighbours(AyStar *aystar, OpenListNode *current)
|
||||||
static void River_FoundEndNode(AyStar *aystar, OpenListNode *current)
|
static void River_FoundEndNode(AyStar *aystar, OpenListNode *current)
|
||||||
{
|
{
|
||||||
for (PathNode *path = ¤t->path; path != NULL; path = path->parent) {
|
for (PathNode *path = ¤t->path; path != NULL; path = path->parent) {
|
||||||
if (!IsWaterTile(path->node.tile)) MakeRiver(path->node.tile, Random());
|
TileIndex tile = path->node.tile;
|
||||||
|
if (!IsWaterTile(tile)) {
|
||||||
|
MakeRiver(tile, Random());
|
||||||
|
/* Remove desert directly around the river tile. */
|
||||||
|
CircularTileSearch(&tile, 5, RiverModifyDesertZone, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1168,7 +1173,7 @@ static void CreateRivers()
|
||||||
if (amount == 0) return;
|
if (amount == 0) return;
|
||||||
|
|
||||||
uint wells = ScaleByMapSize(4 << _settings_game.game_creation.amount_of_rivers);
|
uint wells = ScaleByMapSize(4 << _settings_game.game_creation.amount_of_rivers);
|
||||||
SetGeneratingWorldProgress(GWP_RIVER, wells);
|
SetGeneratingWorldProgress(GWP_RIVER, wells + 256 / 64); // Include the tile loop calls below.
|
||||||
bool *marks = CallocT<bool>(MapSize());
|
bool *marks = CallocT<bool>(MapSize());
|
||||||
|
|
||||||
for (; wells != 0; wells--) {
|
for (; wells != 0; wells--) {
|
||||||
|
@ -1181,6 +1186,12 @@ static void CreateRivers()
|
||||||
}
|
}
|
||||||
|
|
||||||
free(marks);
|
free(marks);
|
||||||
|
|
||||||
|
/* Run tile loop to update the ground density. */
|
||||||
|
for (uint i = 0; i != 256; i++) {
|
||||||
|
if (i % 64 == 0) IncreaseGeneratingWorldProgress(GWP_RIVER);
|
||||||
|
RunTileLoop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateLandscape(byte mode)
|
void GenerateLandscape(byte mode)
|
||||||
|
|
|
@ -41,4 +41,6 @@ void DrawShoreTile(Slope tileh);
|
||||||
|
|
||||||
void MakeWaterKeepingClass(TileIndex tile, Owner o);
|
void MakeWaterKeepingClass(TileIndex tile, Owner o);
|
||||||
|
|
||||||
|
bool RiverModifyDesertZone(TileIndex tile, void *data);
|
||||||
|
|
||||||
#endif /* WATER_H */
|
#endif /* WATER_H */
|
||||||
|
|
|
@ -308,6 +308,13 @@ CommandCost CmdBuildLock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
return DoBuildLock(tile, dir, flags);
|
return DoBuildLock(tile, dir, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Callback to create non-desert around a river tile. */
|
||||||
|
bool RiverModifyDesertZone(TileIndex tile, void *)
|
||||||
|
{
|
||||||
|
if (GetTropicZone(tile) == TROPICZONE_DESERT) SetTropicZone(tile, TROPICZONE_NORMAL);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a piece of canal.
|
* Build a piece of canal.
|
||||||
* @param tile end tile of stretch-dragging
|
* @param tile end tile of stretch-dragging
|
||||||
|
@ -350,6 +357,10 @@ CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
switch (wc) {
|
switch (wc) {
|
||||||
case WATER_CLASS_RIVER:
|
case WATER_CLASS_RIVER:
|
||||||
MakeRiver(tile, Random());
|
MakeRiver(tile, Random());
|
||||||
|
if (_game_mode == GM_EDITOR) {
|
||||||
|
TileIndex tile2 = tile;
|
||||||
|
CircularTileSearch(&tile2, 5, RiverModifyDesertZone, NULL);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WATER_CLASS_SEA:
|
case WATER_CLASS_SEA:
|
||||||
|
|
Loading…
Reference in New Issue