mirror of
https://github.com/glest/glest-source.git
synced 2025-02-25 12:12:25 +01:00
- more pathfinder in progress changes, nothing to test yet
This commit is contained in:
parent
3ff0796bec
commit
f79222defa
@ -627,11 +627,11 @@ public: // methods
|
|||||||
// heap now unsorted
|
// heap now unsorted
|
||||||
m_OpenList.push_back( (*successor) );
|
m_OpenList.push_back( (*successor) );
|
||||||
|
|
||||||
if (m_OpenList[0]->f == m_OpenList[m_OpenList.size()-1]->f) {
|
// if (m_OpenList[0]->f == m_OpenList[m_OpenList.size()-1]->f) {
|
||||||
Node *aux = m_OpenList[0];
|
// Node *aux = m_OpenList[0];
|
||||||
m_OpenList[0] = m_OpenList[m_OpenList.size()-1];
|
// m_OpenList[0] = m_OpenList[m_OpenList.size()-1];
|
||||||
m_OpenList[m_OpenList.size()-1] = aux;
|
// m_OpenList[m_OpenList.size()-1] = aux;
|
||||||
}
|
// }
|
||||||
// sort back element into heap
|
// sort back element into heap
|
||||||
push_heap( m_OpenList.begin(), m_OpenList.end(), HeapCompare_f() );
|
push_heap( m_OpenList.begin(), m_OpenList.end(), HeapCompare_f() );
|
||||||
|
|
||||||
|
@ -860,15 +860,15 @@ TravelState PathFinder::aStarFast(Unit *unit, Vec2i finalPos, bool inBailout, in
|
|||||||
factions[unitFactionIndex].precachedPath[unit->getId()].push_back(nodePos);
|
factions[unitFactionIndex].precachedPath[unit->getId()].push_back(nodePos);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(i < pathFindRefresh) {
|
//if(i < pathFindRefresh) {
|
||||||
//if(i < pathFindRefresh ||
|
if(i < pathFindRefresh ||
|
||||||
// (whileLoopCount >= pathFindExtendRefreshForNodeCount &&
|
(nodeSearchCount >= pathFindExtendRefreshForNodeCount &&
|
||||||
// i < getPathFindExtendRefreshNodeCount(unitFactionIndex))) {
|
i < getPathFindExtendRefreshNodeCount(unitFactionIndex))) {
|
||||||
path->add(nodePos);
|
path->add(nodePos);
|
||||||
}
|
}
|
||||||
//else if(tryLastPathCache == false) {
|
else if(tryLastPathCache == false) {
|
||||||
// break;
|
break;
|
||||||
//}
|
}
|
||||||
|
|
||||||
//if(tryLastPathCache == true && basicPathFinder) {
|
//if(tryLastPathCache == true && basicPathFinder) {
|
||||||
if(basicPathFinder) {
|
if(basicPathFinder) {
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
#include "fast_path_finder.h"
|
#include "fast_path_finder.h"
|
||||||
|
//#include <tr1/unordered_map>
|
||||||
|
//using namespace std::tr1;
|
||||||
|
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
@ -341,6 +341,12 @@ float FastAINode::getDistance(const AI_Node *node,void *userData) {
|
|||||||
}
|
}
|
||||||
float FastAINode::getCost(void *userData) {
|
float FastAINode::getCost(void *userData) {
|
||||||
float result = 1.0f;
|
float result = 1.0f;
|
||||||
|
|
||||||
|
// FastAINodeCache *nodeCache = (FastAINodeCache *)userData;
|
||||||
|
// if(map->aproxCanMoveSoon(nodeCache->unit, pos, pos) == false) {
|
||||||
|
// result = 100000;
|
||||||
|
// }
|
||||||
|
|
||||||
// bool checkCellObjects = true;
|
// bool checkCellObjects = true;
|
||||||
// if(checkCellObjects == true) {
|
// if(checkCellObjects == true) {
|
||||||
// FastAINode *resultNode = map->getCellNode(pos,false);
|
// FastAINode *resultNode = map->getCellNode(pos,false);
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
//#include <tr1/unordered_map>
|
||||||
|
//using namespace std::tr1;
|
||||||
|
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{
|
namespace Shared{ namespace Graphics{
|
||||||
@ -102,6 +105,15 @@ public:
|
|||||||
this->y= y;
|
this->y= y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//template<typename S>
|
||||||
|
//size_t operator()(const Vec2<S> &v) const {
|
||||||
|
// return hash<T>()(v.x) ^ hash<T>()(v.y);
|
||||||
|
//}
|
||||||
|
//template<typename S>
|
||||||
|
//bool operator()(const Vec2<S> &a, const Vec2<S> &b) const {
|
||||||
|
// return a == b;
|
||||||
|
//}
|
||||||
|
|
||||||
T *ptr(){
|
T *ptr(){
|
||||||
return reinterpret_cast<T*>(this);
|
return reinterpret_cast<T*>(this);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user