Example #1
0
// -----------------------------------------------------------------
// Name : getHighestMoveCost
// -----------------------------------------------------------------
int Pathfinder::getHighestMoveCost(ObjectList * pList, int x, int y)
{
    int highest = -1;
    MapObject * mapObj = (MapObject*) pList->getFirst(0);
    while (mapObj != NULL)
    {
        int cost = mapObj->getMoveCost(m_pMap[x][y]->m_uTerrainType);
        if (cost == -1)
            return -1;
        else if (cost > highest)
            highest = cost;
        mapObj = (MapObject*) pList->getNext(0);
    }
    return highest;
}