2004-06-03 20:38:14 +02:00
|
|
|
#include "precompiled.h"
|
|
|
|
|
2004-05-29 05:32:33 +02:00
|
|
|
#include "PathfindEngine.h"
|
|
|
|
#include "PathfindSparse.h"
|
2004-07-23 12:56:52 +02:00
|
|
|
#include "ConfigDB.h"
|
|
|
|
|
|
|
|
CPathfindEngine::CPathfindEngine()
|
|
|
|
{
|
2004-10-23 16:39:28 +02:00
|
|
|
CConfigValue* sparseDepth = g_ConfigDB.GetValue( CFG_USER, "pathfind.sparse.recursiondepth" );
|
2004-07-23 12:56:52 +02:00
|
|
|
if( sparseDepth )
|
|
|
|
sparseDepth->GetInt( SPF_RECURSION_DEPTH );
|
|
|
|
}
|
2004-05-29 05:32:33 +02:00
|
|
|
|
|
|
|
void CPathfindEngine::requestPath( HEntity entity, const CVector2D& destination )
|
|
|
|
{
|
|
|
|
pathSparse( entity, destination );
|
2004-06-02 18:11:32 +02:00
|
|
|
}
|
2004-11-11 08:09:32 +01:00
|
|
|
|
2005-04-15 06:23:33 +02:00
|
|
|
void CPathfindEngine::requestContactPath( HEntity entity, HEntity target, int transition )
|
2004-11-11 08:09:32 +01:00
|
|
|
{
|
|
|
|
pathSparse( entity, target->m_position );
|
|
|
|
// For attack orders, do some additional postprocessing (replace goto/nopathing
|
|
|
|
// with attack/nopathing, up until the attack order marker)
|
|
|
|
std::deque<CEntityOrder>::iterator it;
|
|
|
|
for( it = entity->m_orderQueue.begin(); it != entity->m_orderQueue.end(); it++ )
|
|
|
|
{
|
|
|
|
if( it->m_type == CEntityOrder::ORDER_PATH_END_MARKER )
|
|
|
|
break;
|
|
|
|
if( it->m_type == CEntityOrder::ORDER_GOTO_NOPATHING )
|
|
|
|
{
|
2005-04-15 06:23:33 +02:00
|
|
|
(int&)it->m_type = transition;
|
2004-11-11 08:09:32 +01:00
|
|
|
it->m_data[0].entity = target;
|
|
|
|
}
|
|
|
|
}
|
2004-11-24 00:56:10 +01:00
|
|
|
}
|