![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
A vertex in the path-finding graph. More...
#include <path_finder.h>
Inheritance diagram for freeciv::detail::vertex:
Collaboration diagram for freeciv::detail::vertex:Public Member Functions | |
| vertex | child_for_action (action_id action, const unit &probe, tile *target) |
| Creates a vertex starting from this one and executing an action. More... | |
| bool | comparable (const vertex &other) const |
| Checks whether two vertices are comparable, which is the case when one of them is unambiguously "better" than the other. More... | |
| void | fill_probe (unit &probe) const |
Ensures that probe reflects the properties of this vertex. More... | |
| bool | operator== (const vertex &other) const |
| Equality comparator. More... | |
| bool | operator> (const vertex &other) const |
| Defines an ordering for the priority queue. More... | |
Static Public Member Functions | |
| static vertex | from_unit (const unit &unit) |
| Creates a vertex representing the state of a unit. More... | |
Public Attributes | |
| vertex * | parent |
| The previous vertex, if any. More... | |
Public Attributes inherited from freeciv::path::step | |
| tile * | location |
| Where we are. More... | |
| unit * | loaded |
| The unit we are loaded in. More... | |
| bool | moved |
| Whether we moved this turn (for HP recovery) More... | |
| bool | paradropped |
| Whether we paradropped this turn. More... | |
| bool | is_final |
| Whether this vertex can have children. More... | |
| int | waypoints |
| How many waypoints we have visited so far. More... | |
| int | turns |
| How many turns it takes to get there. More... | |
| int | moves_left |
| How many move fragments the unit has left. More... | |
| int | health |
| How many HP the unit has left. More... | |
| int | fuel_left |
| How much fuel the unit has left. More... | |
| unit_order | order |
| The order to come here. More... | |
A vertex in the path-finding graph.
It primarily corresponds to a tile, but sometimes a tile has several vertices (for instance, a unit may want to wait in a city to avoid ending its turn in the open).
Additional information about the path finding is also stored.
Definition at line 31 of file path_finder.h.
| vertex freeciv::detail::vertex::child_for_action | ( | action_id | action, |
| const unit & | probe, | ||
| tile * | target | ||
| ) |
Creates a vertex starting from this one and executing an action.
The vertex state is initialized as a copy of this one except that the action move cost is subtracted.
Definition at line 43 of file path_finder.cpp.
Referenced by freeciv::path_finder::path_finder_private::attempt_load(), freeciv::path_finder::path_finder_private::attempt_paradrop(), and freeciv::path_finder::path_finder_private::attempt_unload().
| bool freeciv::detail::vertex::comparable | ( | const vertex & | other | ) | const |
Checks whether two vertices are comparable, which is the case when one of them is unambiguously "better" than the other.
Vertices that are not comparable should be considered distinct: this is the case, for instance, of vertices at different locations. Comparability is not a transitive property.
Definition at line 77 of file path_finder.cpp.
| void freeciv::detail::vertex::fill_probe | ( | unit & | probe | ) | const |
Ensures that probe reflects the properties of this vertex.
Any property of probe not used in path finding is left unchanged.
Definition at line 103 of file path_finder.cpp.
Referenced by freeciv::path_finder::path_finder_private::attempt_action_move(), freeciv::path_finder::path_finder_private::attempt_load(), freeciv::path_finder::path_finder_private::attempt_move(), freeciv::path_finder::path_finder_private::attempt_paradrop(), freeciv::path_finder::path_finder_private::attempt_unload(), freeciv::path_finder::path_finder_private::maybe_insert_vertex(), and freeciv::refuel_destination::reached().
Creates a vertex representing the state of a unit.
Definition at line 27 of file path_finder.cpp.
| bool freeciv::detail::vertex::operator== | ( | const vertex & | other | ) | const |
Equality comparator.
Definition at line 119 of file path_finder.cpp.
| bool freeciv::detail::vertex::operator> | ( | const vertex & | other | ) | const |
Defines an ordering for the priority queue.
Definition at line 132 of file path_finder.cpp.
| vertex* freeciv::detail::vertex::parent |
The previous vertex, if any.
Definition at line 34 of file path_finder.h.
Referenced by child_for_action().