/// Find a route for trade caravanes unsigned char GameWorldGame::FindTradePath(const MapPoint start, const MapPoint dest, unsigned char player, unsigned max_route, bool random_route, std::vector<unsigned char>* route, unsigned* length) const { unsigned char owner = GetNode(dest).owner; if(owner != 0 && !GetPlayer(player).IsAlly(owner -1)) return INVALID_DIR; RTTR_Assert(GetNO(dest)->GetType() == NOP_FLAG); // Goal should be the flag of a wh if(!IsNodeForFigures(dest)) return INVALID_DIR; unsigned char first_dir = INVALID_DIR; GetFreePathFinder().FindPath(start, dest, random_route, max_route, route, length, &first_dir, PathConditionTrade(*this, player)); return first_dir; }
/// Findet einen Weg für Figuren unsigned char GameWorldBase::FindHumanPath(const MapPoint start, const MapPoint dest, const unsigned max_route, const bool random_route, unsigned* length, const bool record) const { // Aus Replay lesen? if(GAMECLIENT.ArePathfindingResultsAvailable() && !random_route) { unsigned char dir; if(GAMECLIENT.ReadPathfindingResult(&dir, length, NULL)) return dir; } unsigned char first_dir = INVALID_DIR; GetFreePathFinder().FindPath(start, dest, random_route, max_route, NULL, length, &first_dir, PathConditionHuman(*this), record); if(!random_route) GAMECLIENT.AddPathfindingResult(first_dir, length, NULL); return first_dir; }
/// Wegfindung für Schiffe auf dem Wasser bool GameWorldBase::FindShipPath(const MapPoint start, const MapPoint dest, std::vector<unsigned char>* route, unsigned* length) { return GetFreePathFinder().FindPath(start, dest, true, 400, route, length, NULL, PathConditionShip(*this)); }
/// Findet einen Weg für Figuren unsigned char GameWorldBase::FindHumanPath(const MapPoint start, const MapPoint dest, const unsigned max_route, const bool random_route, unsigned* length) const { unsigned char first_dir = INVALID_DIR; GetFreePathFinder().FindPath(start, dest, random_route, max_route, NULL, length, &first_dir, PathConditionHuman(*this)); return first_dir; }
bool GameWorldGame::CheckTradeRoute(const MapPoint start, const std::vector<unsigned char>& route, unsigned pos, unsigned char player, MapPoint* dest) const { return GetFreePathFinder().CheckRoute(start, route, pos, PathConditionTrade(*this, player), dest); }
/// Prüft, ob eine Schiffsroute noch Gültigkeit hat bool GameWorldGame::CheckShipRoute(const MapPoint start, const std::vector<unsigned char>& route, const unsigned pos, MapPoint* dest) { return GetFreePathFinder().CheckRoute(start, route, pos, PathConditionShip(*this), dest); }
/// Straßenbau-Pathfinding bool GameWorldViewer::FindRoadPath(const MapPoint start, const MapPoint dest, std::vector<unsigned char>& route, const bool boat_road) { return GetFreePathFinder().FindPath(start, dest, false, 100, &route, NULL, NULL, PathConditionRoad(*this, boat_road), false); }