#include <hex.h>
Inheritance diagram for hex::Path:

Definition at line 315 of file hex.h.
Public Member Functions | |
| Area | to_area (void) const |
| const std::list< Hex * > & | hexes (void) const |
| int | length (void) const |
| in units of I | |
| std::string | steps (void) const |
| std::string | str (void) const |
| Path (void) | |
| Required for list<Path>. | |
| Path (const std::list< Hex * > &hexes) | |
| Path (Hex *start, const std::string &steps) throw (hex::out_of_range,hex::invalid_argument) | |
| A Path starting at start, and proceeding in directions from steps. | |
| Path (Hex *from, const Hex *to) throw () | |
| Calculates a minimum-length path between two hexes. | |
| hex::Path::Path | ( | const std::list< Hex * > & | hexes | ) | [inline] |
| hex::Path::Path | ( | Hex * | start, | |
| const std::string & | steps | |||
| ) | throw (hex::out_of_range,hex::invalid_argument) |
Calculates a minimum-length path between two hexes.
The result is one of many possible solutions.
Definition at line 107 of file path.cc.
00108 : _hexes( path(from,hex::steps(from,to)) ) 00109 {}
| Area hex::Path::to_area | ( | void | ) | const |
| const std::list<Hex*>& hex::Path::hexes | ( | void | ) | const [inline] |
| int hex::Path::length | ( | void | ) | const |
| std::string hex::Path::steps | ( | void | ) | const |
Definition at line 48 of file path.cc.
References hex::steps().
Referenced by str().
00049 { 00050 std::string result =""; 00051 const Hex* curr =NULL; 00052 for(std::list<Hex*>::const_iterator h=_hexes.begin(); h!=_hexes.end(); ++h) 00053 { 00054 if(curr) 00055 result += hex::steps(curr,*h); 00056 curr = *h; 00057 } 00058 return result; 00059 }
| std::string hex::Path::str | ( | void | ) | const |
1.5.1