Legacy Pathfinding API improvements:

* Use the cache for source/dest currencies
* Allow a search depth and initial paths to be specified in old pathfinding
This commit is contained in:
David Schwartz
2014-02-19 14:56:09 -08:00
committed by Vinnie Falco
parent fca8fa1b1b
commit 1fe57720c4
6 changed files with 71 additions and 25 deletions

View File

@@ -166,6 +166,24 @@ public:
return true;
}
template <class D>
D& downcast()
{
D* ptr = dynamic_cast<D*> (this);
if (ptr == nullptr)
throw std::runtime_error ("type mismatch");
return *ptr;
}
template <class D>
D const& downcast() const
{
D const * ptr = dynamic_cast<D const*> (this);
if (ptr == nullptr)
throw std::runtime_error ("type mismatch");
return *ptr;
}
protected:
// VFALCO TODO make accessors for this
SField::ptr fName;