AlpacaLibary  1.63
A closed source C++ bot for OSRS
Pathfinding Namespace Reference

A class allowing easy pathfinding within the local region. More...

Classes

class  TileNode
 A subclass used to store information about tile nodes generated by the Pathfinding class. More...
 

Typedefs

typedef enum Pathfinding::PATHFINDER PATHFINDER
 

Enumerations

enum  COLLISION_FLAG {
  OPEN = 0 , CLOSED = 0xFFFFFF , UNINITIALIZED = 0x1000000 , OCCUPIED = 0x100 ,
  SOLID = 0x20000 , BLOCKED = 0x200000 , NORTH = 0x2 , EAST = 0x8 ,
  SOUTH = 0x20 , WEST = 0x80 , NORTHEAST = 0x4 , SOUTHEAST = 0x10 ,
  SOUTHWEST = 0x40 , NORTHWEST = 0x1
}
 
enum  PATHFINDER { BREADTH_FIRST_SEARCH }
 
enum  PATHFIND_OPTION {
  CHECK_COLLISION = (1 << 1) , CHECK_WHITELIST = (1 << 2) , CHECK_BLACKLIST = (1 << 3) , GOAL_IS_LOCAL = (1 << 4) ,
  RETURN_LOCAL = (1 << 5)
}
 

Functions

std::int32_t GetCurrentRegion ()
 Returns the region ID the local player is in. More...
 
void GenerateNodes ()
 Clears the internal cached nodes, and generates new ones based on the local region
More...
 
void SetWhitelist (const std::vector< Tile > &W)
 Sets the internal Whitelist tiles. More...
 
void SetBlacklist (const std::vector< Tile > &B)
 Sets the internal Blacklist tiles. More...
 
std::vector< std::vector< TileNode > > GetNodes ()
 Returns the internal TileNode cache generated by GenerateNodes() More...
 
std::vector< TileGetWhitelist ()
 Returns the internal Whitelist cache. More...
 
std::vector< TileGetBlacklist ()
 Returns the internal Blacklist cache. More...
 
Tile FindWalkableTile (const Tile &T)
 
Tile FindWalkableTile (const Tile &T, const Tile &Min, const Tile &Max)
 
std::vector< TileFindWalkableTiles (const Tile &T)
 
std::vector< TileFindWalkableTiles (const Tile &T, const Tile &Min, const Tile &Max)
 
std::vector< TileFindPathTo (const Tile &Goal, std::int32_t Options=CHECK_COLLISION|CHECK_WHITELIST|CHECK_BLACKLIST, PATHFINDER Finder=BREADTH_FIRST_SEARCH)
 
std::vector< TileFindPathTo (const std::vector< Tile > &Goals, std::int32_t Options=CHECK_COLLISION|CHECK_WHITELIST|CHECK_BLACKLIST, PATHFINDER Finder=BREADTH_FIRST_SEARCH)
 
std::vector< Pathfinding::TileNodeFindNodePathTo (const Tile &Goal, std::int32_t Options=CHECK_COLLISION|CHECK_WHITELIST|CHECK_BLACKLIST, PATHFINDER Finder=BREADTH_FIRST_SEARCH)
 
std::vector< Pathfinding::TileNodeFindNodePathTo (const std::vector< Tile > &Goals, std::int32_t Options=CHECK_COLLISION|CHECK_WHITELIST|CHECK_BLACKLIST, PATHFINDER Finder=BREADTH_FIRST_SEARCH)
 
bool IsInside (std::int32_t X, std::int32_t Y)
 
std::vector< Pathfinding::TileNode * > GetNeighborsTo (std::int32_t X, std::int32_t Y, bool CheckCollision=true)
 
std::vector< Pathfinding::TileNodeFinder_BFS (std::uint32_t StartX, std::uint32_t StartY, std::uint32_t EndX, std::uint32_t EndY, std::int32_t Options)
 
std::vector< Pathfinding::TileNodeFinder_BFS (std::uint32_t StartX, std::uint32_t StartY, const std::vector< std::pair< std::uint32_t, std::uint32_t >> &Ends, std::int32_t Options)
 

Detailed Description

A class allowing easy pathfinding within the local region.

Typedef Documentation

◆ PATHFINDER

Enumeration Type Documentation

◆ COLLISION_FLAG

Enumerator
OPEN 
CLOSED 
UNINITIALIZED 
OCCUPIED 
SOLID 
BLOCKED 
NORTH 
EAST 
SOUTH 
WEST 
NORTHEAST 
SOUTHEAST 
SOUTHWEST 
NORTHWEST 

Definition at line 13 of file Pathfinding.hpp.

◆ PATHFIND_OPTION

Enumerator
CHECK_COLLISION 

Checks collision

CHECK_WHITELIST 

Checks whitelist

CHECK_BLACKLIST 

Checks blacklist

GOAL_IS_LOCAL 

The passed goal is a local tile, the function won't normalize it

RETURN_LOCAL 

Returns a path as local tiles

Definition at line 39 of file Pathfinding.hpp.

◆ PATHFINDER

Enumerator
BREADTH_FIRST_SEARCH 

Breadth-first search algorithim

Definition at line 33 of file Pathfinding.hpp.

Function Documentation

◆ Finder_BFS() [1/2]

std::vector<Pathfinding::TileNode> Pathfinding::Finder_BFS ( std::uint32_t  StartX,
std::uint32_t  StartY,
const std::vector< std::pair< std::uint32_t, std::uint32_t >> &  Ends,
std::int32_t  Options 
)

◆ Finder_BFS() [2/2]

std::vector<Pathfinding::TileNode> Pathfinding::Finder_BFS ( std::uint32_t  StartX,
std::uint32_t  StartY,
std::uint32_t  EndX,
std::uint32_t  EndY,
std::int32_t  Options 
)

◆ FindNodePathTo() [1/2]

std::vector<Pathfinding::TileNode> Pathfinding::FindNodePathTo ( const std::vector< Tile > &  Goals,
std::int32_t  Options = CHECK_COLLISION|CHECK_WHITELIST|CHECK_BLACKLIST,
PATHFINDER  Finder = BREADTH_FIRST_SEARCH 
)

◆ FindNodePathTo() [2/2]

std::vector<Pathfinding::TileNode> Pathfinding::FindNodePathTo ( const Tile Goal,
std::int32_t  Options = CHECK_COLLISION|CHECK_WHITELIST|CHECK_BLACKLIST,
PATHFINDER  Finder = BREADTH_FIRST_SEARCH 
)

◆ FindPathTo() [1/2]

std::vector<Tile> Pathfinding::FindPathTo ( const std::vector< Tile > &  Goals,
std::int32_t  Options = CHECK_COLLISION|CHECK_WHITELIST|CHECK_BLACKLIST,
PATHFINDER  Finder = BREADTH_FIRST_SEARCH 
)

◆ FindPathTo() [2/2]

std::vector<Tile> Pathfinding::FindPathTo ( const Tile Goal,
std::int32_t  Options = CHECK_COLLISION|CHECK_WHITELIST|CHECK_BLACKLIST,
PATHFINDER  Finder = BREADTH_FIRST_SEARCH 
)

◆ FindWalkableTile() [1/2]

Tile Pathfinding::FindWalkableTile ( const Tile T)

◆ FindWalkableTile() [2/2]

Tile Pathfinding::FindWalkableTile ( const Tile T,
const Tile Min,
const Tile Max 
)

◆ FindWalkableTiles() [1/2]

std::vector<Tile> Pathfinding::FindWalkableTiles ( const Tile T)

◆ FindWalkableTiles() [2/2]

std::vector<Tile> Pathfinding::FindWalkableTiles ( const Tile T,
const Tile Min,
const Tile Max 
)

◆ GenerateNodes()

void Pathfinding::GenerateNodes ( )

Clears the internal cached nodes, and generates new ones based on the local region

◆ GetBlacklist()

std::vector<Tile> Pathfinding::GetBlacklist ( )

Returns the internal Blacklist cache.

◆ GetCurrentRegion()

std::int32_t Pathfinding::GetCurrentRegion ( )

Returns the region ID the local player is in.

◆ GetNeighborsTo()

std::vector<Pathfinding::TileNode*> Pathfinding::GetNeighborsTo ( std::int32_t  X,
std::int32_t  Y,
bool  CheckCollision = true 
)

◆ GetNodes()

std::vector<std::vector<TileNode> > Pathfinding::GetNodes ( )

Returns the internal TileNode cache generated by GenerateNodes()

◆ GetWhitelist()

std::vector<Tile> Pathfinding::GetWhitelist ( )

Returns the internal Whitelist cache.

◆ IsInside()

bool Pathfinding::IsInside ( std::int32_t  X,
std::int32_t  Y 
)

◆ SetBlacklist()

void Pathfinding::SetBlacklist ( const std::vector< Tile > &  B)

Sets the internal Blacklist tiles.

Note
This will set the internal Blacklist object to the one passed

◆ SetWhitelist()

void Pathfinding::SetWhitelist ( const std::vector< Tile > &  W)

Sets the internal Whitelist tiles.

Note
This will set the internal Whitelist object to the one passed