OpenTTD Source 20250428-master-ga5578166bb
|
Search path and build river. More...
Static Public Member Functions | |
static void | Exec (TileIndex begin, TileIndex end, TileIndex spring, bool main_river) |
Actually build the river between the begin and end tiles using AyStar. | |
Protected Member Functions | |
AyStarStatus | EndNodeCheck (const PathNode ¤t) const override |
Check whether the end-tile is found. | |
int32_t | CalculateG (const AyStarNode &, const PathNode &) const override |
Calculate the G-value for the AyStar algorithm. | |
int32_t | CalculateH (const AyStarNode ¤t, const PathNode &) const override |
Calculate the H-value for the AyStar algorithm. | |
void | GetNeighbours (const PathNode ¤t, std::vector< AyStarNode > &neighbours) const override |
This function requests the tiles around the current tile. | |
void | FoundEndNode (const PathNode ¤t) override |
If the End Node is found, this function is called. | |
RiverBuilder (TileIndex end, TileIndex spring, bool main_river) | |
![]() | |
void | AddStartNode (AyStarNode *start_node, int g) |
Adds a node from where to start an algorithm. | |
AyStarStatus | Main () |
This is the function you call to run AyStar. | |
Private Attributes | |
TileIndex | end |
Destination for the river. | |
TileIndex | spring |
The current spring during river generation. | |
bool | main_river |
Whether the current river is a big river that others flow into. | |
Search path and build river.
Definition at line 1202 of file landscape.cpp.
Definition at line 1265 of file landscape.cpp.
|
inlineoverrideprotectedvirtual |
Calculate the G-value for the AyStar algorithm.
Implements AyStar.
Definition at line 1209 of file landscape.cpp.
References _settings_game, GameSettings::game_creation, RandomRange(), and GameCreationSettings::river_route_random.
|
inlineoverrideprotectedvirtual |
Calculate the H-value for the AyStar algorithm.
Mostly, this must return the distance (Manhattan way) between the current point and the end point.
Implements AyStar.
Definition at line 1214 of file landscape.cpp.
References DistanceManhattan(), and end.
|
inlineoverrideprotectedvirtual |
Check whether the end-tile is found.
current | Node to exam. |
Implements AyStar.
Definition at line 1204 of file landscape.cpp.
References Done, end, and FoundEndNode.
|
inlinestatic |
Actually build the river between the begin and end tiles using AyStar.
begin | The begin of the river. |
end | The end of the river. |
spring | The springing point of the river. |
main_river | Whether the current river is a big river that others flow into. |
Definition at line 1280 of file landscape.cpp.
References AyStar::AddStartNode(), end, INVALID_TRACKDIR, AyStar::Main(), main_river, and spring.
Referenced by FlowRiver().
|
inlineoverrideprotectedvirtual |
If the End Node is found, this function is called.
It can do, for example, calculate the route and put that in an array.
Implements AyStar.
Definition at line 1234 of file landscape.cpp.
References _settings_game, DistanceManhattan(), GameSettings::game_creation, IsWaterTile(), GameCreationSettings::land_generator, LG_ORIGINAL, MakeRiverAndModifyDesertZoneAround(), GameCreationSettings::min_river_length, RiverMakeWider(), and spring.
|
inlineoverrideprotectedvirtual |
This function requests the tiles around the current tile.
neighbours is never reset, so if you are not using directions, just leave it alone.
Implements AyStar.
Definition at line 1219 of file landscape.cpp.
References DIAGDIR_BEGIN, DIAGDIR_END, FlowsDown(), INVALID_TRACKDIR, IsValidTile(), and TileOffsByDiagDir().
|
private |
Destination for the river.
Definition at line 1268 of file landscape.cpp.
Referenced by CalculateH(), EndNodeCheck(), and Exec().
|
private |
Whether the current river is a big river that others flow into.
Definition at line 1270 of file landscape.cpp.
Referenced by Exec().
|
private |
The current spring during river generation.
Definition at line 1269 of file landscape.cpp.
Referenced by Exec(), and FoundEndNode().