36 using NodeList = RiverBuilderNodeList;
46 using Node = RiverBuilderTypes::NodeList::Item;
47 using Key = Node::Key;
52 inline YapfRiverBuilder &
Yapf()
54 return *
static_cast<YapfRiverBuilder *
>(
this);
67 inline bool PfDetectDestination(Node &n)
const
69 return n.GetTile() == this->
end_tile;
72 inline bool PfCalcCost(Node &n,
const RiverBuilderFollower *)
78 inline bool PfCalcEstimate(Node &n)
81 assert(n.estimate >= n.parent->estimate);
85 inline void PfFollowNode(Node &old_node)
97 inline char TransportTypeChar()
const
104 YapfRiverBuilder pf(start_tile,
end_tile);
105 if (pf.FindPath(
nullptr) ==
false)
return;
108 for (Node *node = pf.GetBestNode(); node !=
nullptr; node = node->parent) {
121 for (Node *node = pf.GetBestNode(); node !=
nullptr; node = node->parent) {
122 const TileIndex center_tile = node->GetTile();
126 uint diameter = std::min(3u, (current_river_length / (long_river_length / 3u)) + 1u);
127 if (diameter <= 1)
continue;
129 for (
auto tile : SpiralTileSequence(center_tile, diameter)) {
146 YapfRiverBuilder::BuildRiver(start_tile, end_tile, spring_tile, main_river);
void AddNewNode(Node &n, const TrackFollower &follower)
AddNewNode() - called by Tderived::PfFollowNode() for each child node.
Node & CreateNewNode()
Calls NodeList::CreateNewNode() - allocates new node that can be filled and used as argument for AddS...
void AddStartupNode(Node &n)
Add new node (created by CreateNewNode and filled with data) into open list.
CYapfSegmentCostCacheNoneT - the formal only yapf cost cache provider that implements PfNodeCacheFetc...
Hash table based node list multi-container class.
TileIndex end_tile
End tile of the river.
DiagDirection
Enumeration for diagonal directions.
@ DIAGDIR_END
Used for iterations.
@ DIAGDIR_BEGIN
Used for iterations.
Functions related to world/map generation.
@ LG_ORIGINAL
The original landscape generator.
bool RiverFlowsDown(TileIndex begin, TileIndex end)
Check whether a river at begin could (logically) flow down to end.
void RiverMakeWider(TileIndex tile, TileIndex origin_tile)
Widen a river by expanding into adjacent tiles via circular tile search.
uint DistanceManhattan(TileIndex t0, TileIndex t1)
Gets the Manhattan distance between the two given tiles.
TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
uint32_t RandomRange(uint32_t limit, const std::source_location location=std::source_location::current())
Pick a random number between 0 and limit - 1, inclusive.
A number of safeguards to prevent using unsafe methods.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition of base types and functions in a cross-platform compatible way.
uint8_t min_river_length
the minimum river length
uint8_t land_generator
the landscape generator
uint8_t river_route_random
the amount of randomicity for the route finding
GameCreationSettings game_creation
settings used during the creation of a game (map)
Vehicle(VehicleID index, VehicleType type=VEH_INVALID)
Vehicle constructor.
bool IsValidTile(Tile tile)
Checks if a tile is valid.
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.
@ INVALID_TRACKDIR
Flag for an invalid trackdir.
Functions related to water management.
void MakeRiverAndModifyDesertZoneAround(TileIndex tile)
Make a river tile and remove desert directly around it.
bool IsWaterTile(Tile t)
Is it a water tile with plain water?
Base includes/functions for YAPF.
void YapfBuildRiver(TileIndex start_tile, TileIndex end_tile, TileIndex spring_tile, bool main_river)
Builds a river from the start tile to the end tile.