truelight@9652: /* $Id$ */ truelight@9652: truelight@9652: /** @file ai_pathfinder_stupid.hpp A really stupid pathfinder */ truelight@9652: truelight@9652: #ifndef AI_PATHFINDER_STUPID_HPP truelight@9652: #define AI_PATHFINDER_STUPID_HPP truelight@9652: truelight@9652: #include "ai_pathfinder.hpp" truelight@9652: truelight@9652: /** truelight@9652: * A stupid pathfinder. It first makes a straight line on the X-axis, than truelight@9652: * it does the same on the Y-axis. The result is rarely optimal, or connected. truelight@9652: */ truelight@9652: class AIPathFinderStupid : public AIPathFinder { truelight@9652: public: truelight@9652: /** truelight@9652: * The name of the class, needed by several sub-processes. truelight@9652: */ truelight@9652: static const char *GetClassName() { return "AIPathFinderStupid"; } truelight@9652: truelight@9652: /** truelight@9652: * Custom constructor, to see for which type we are going to be a pathfinder. truelight@9652: */ truelight@9652: AIPathFinderStupid(AIPathFinder::PathFinderType type) { this->type = type; } truelight@9652: truelight@9652: void *FindRoute(AITileList *start, AITileList *end); truelight@9652: bool BuildRoute(void *result); truelight@9652: void FreeRoute(void *result); truelight@9652: rubidium@9653: /** Keep the compilers happy */ rubidium@9653: virtual ~AIPathFinderStupid() {} truelight@9652: private: truelight@9652: AIPathFinder::PathFinderType type; truelight@9652: truelight@9652: /** truelight@9652: * Internal storage of the pointer returned by FindRoute which can be given to BuildRoute. truelight@9652: */ truelight@9652: struct Path { truelight@9652: TileIndex start; truelight@9652: TileIndex end; truelight@9652: }; truelight@9652: truelight@9652: /** truelight@9652: * Build the real route based on begin and end tile. truelight@9652: */ truelight@9652: bool BuildRealRoute(TileIndex start, TileIndex end, bool continue_on_error); truelight@9652: }; truelight@9652: truelight@9652: #endif /* AI_PATHFINDER_HPP */