

Std::priority_queue>, NodeCostCompare> m_open_nodes īool operator=(const Iterator& iterator) const Static const uint16 DEFAULT_NODE_COUNT_PER_FIND = 20 Check this many nodes per call of find() Returns true if a road can be built from one node to the nextīool nodes_can_connect_road(const Node* const node_from, const Node* const node_to) const Get the cheapest open node, returns nullptr if there are no open nodes

Std::unique_ptr get_node(const TileIndex tile_index) Return the corresponding node or create a new one if none is found Void parse_adjacent_tile(Node* const current_node, const int8 x, const int8 y) new values are lower than the previous ones.īool update_costs(Node* const adjacent_node) īool operator()(const std::unique_ptr& node1, const std::unique_ptr& node2)
#Openttd review update
Update the Node's g and h values, as well as its previous node. Node(TileIndex in_tile_index, int32 in_h) Status find(const uint16_t max_node_count = DEFAULT_NODE_COUNT_PER_FIND)
#Openttd review full
Find a partial path from start to end, returning true if the full path has been found Path(const TileIndex start, const TileIndex end) I should also add that I'm working with C++11.
#Openttd review code
The code also now checks to make sure that roads can be actually built based on the slope of the current tile, so there are no longer any broken connections in roads built along the discovered path.Īs in the previous review, any comments on good C++ programming practices are welcome as well. With a raw pointer, this isn't necessary unless the node is going to be re-opened. Something that stands out to me is that when using std::unique_ptr, any node in m_closed_nodes must be moved out, checked, and then moved back in.

Since I'm new to unique_ptr, I would appreciate any comments on whether its being used appropriately, and whether performance can be improved. However, using std::unique_ptr compared to raw pointers is slowing the code down by about a factor of 2. In particular, using std::priority_queue and std::unordered map have dramatically improved performance. If you'd like to run the code yourself: (use_smart_pointers branch)Ĭhanges have been made based on the previous review. The program runs on every version of Windows since Windows 95, many versions of Linux and BSD, MacOS X (although not very well, still seeking a developer to fix some major issues unique to the platform) and has been independently ported by fans to Apple iOS, Android, WiiBrew, and online.Original review here: AI for OpenTTD - A* Path Finder A new freely-available base graphics set (zBase) is in development, and several NewGRF add-on graphical building & vehicle sets are adding more 32bpp graphics. Since version 1.2.0, users now have the options of using stunning 32bpp graphics.
#Openttd review install
If you have your original TTD installation CD, you can still install those either during OpenTTD's set-up, or by following directions in the manual. Since version 0.7.0, the game will now prompt you to download freely-available graphics (OpenGFX), sound (OpenSFX) and music files (OpenMSX, among others), or install them from another area. OpenTTD has not required the original Transport Tycoon Deluxe files for nearly two years.
