Exemplo n.º 1
0
/// 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;
}
Exemplo n.º 2
0
/// 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;

}
Exemplo n.º 3
0
/// 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));
}
Exemplo n.º 4
0
/// 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;
}
Exemplo n.º 5
0
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);
}
Exemplo n.º 6
0
/// 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);
}
Exemplo n.º 7
0
/// 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);
}