Dragonfly 4.20
A text-based game engine
Public Member Functions | Private Attributes | List of all members
df::Path Class Reference

Public Member Functions

Vector nextNode () const
 
Vector previousNode () const
 
void setPath (std::vector< Vector > new_path)
 
std::vector< VectorgetPath () const
 
bool endOfPath () const
 
Vector getEnd () const
 
int setIndex (int new_index)
 
int getIndex () const
 
int draw (Color color) const
 
Path operator++ (int)
 
int serialize (std::stringstream *p_ss) const
 
int deserialize (std::stringstream *p_ss)
 
bool operator== (const Path &p)
 
bool operator!= (const Path &p)
 
std::string toString () const
 

Private Attributes

std::vector< Vectorm_path
 
int m_index
 

Member Function Documentation

◆ draw()

int df::Path::draw ( Color  color) const

Draw remaining path in indicated color.

Return 0 if ok, negative if not.

◆ endOfPath()

bool df::Path::endOfPath ( ) const

Return true when at end of path.

◆ getEnd()

Vector df::Path::getEnd ( ) const

Return last node of path.

◆ getIndex()

int df::Path::getIndex ( ) const

Return index of path.

◆ getPath()

std::vector< Vector > df::Path::getPath ( ) const

Return path.

◆ nextNode()

Vector df::Path::nextNode ( ) const

Return next node in path.

Return (-1,-1) if none.

◆ operator++()

Path df::Path::operator++ ( int  )

Increment path target node.

If at last node, index stays at end.

◆ operator==()

bool df::Path::operator== ( const Path p)

Compare two Paths.

◆ previousNode()

Vector df::Path::previousNode ( ) const

Return previous node in path.

Return (-1,-1) if none.

◆ setIndex()

int df::Path::setIndex ( int  new_index)

Set index of path.

Return 0 if ok, else -1;

◆ setPath()

void df::Path::setPath ( std::vector< Vector new_path)

Set path.

◆ toString()

std::string df::Path::toString ( ) const

Return attributes as string.

Member Data Documentation

◆ m_index

int df::Path::m_index
private

Index of next target node.

◆ m_path

std::vector<Vector> df::Path::m_path
private

Nodes in path.