diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 790b20ab..05d36c90 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -5303,7 +5303,7 @@ void Renderer::renderSelectionEffects() { const UnitPathInterface *path= unit->getPath(); if(path != NULL && dynamic_cast(path)) { - vector pathList = dynamic_cast(path)->getLastPathCacheQueue(); + vector pathList = dynamic_cast(path)->getQueue(); Vec2i lastPosValue; for(int i = 0; i < pathList.size(); ++i) { @@ -5314,11 +5314,6 @@ void Renderer::renderSelectionEffects() { Vec3f currVec2 = unit->getVectorFlat(lastPosValue,curPosValue); currVec2.y+= 0.3f; renderSelectionCircle(currVec2, 1, selectionCircleRadius); - //renderSelectionCircle(currVec2, unit->getType()->getSize(), selectionCircleRadius); - - //SurfaceCell *cell= map->getSurfaceCell(currVec2.x, currVec2.y); - //currVec2.z = cell->getHeight() + 2.0; - //renderSelectionCircle(currVec2, unit->getType()->getSize(), selectionCircleRadius); } } } diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index ea59ff64..b8b42a21 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -55,14 +55,12 @@ UnitPathBasic::UnitPathBasic() : UnitPathInterface() { this->blockCount = 0; this->pathQueue.clear(); - this->lastPathCacheQueue.clear(); this->map = NULL; } UnitPathBasic::~UnitPathBasic() { this->blockCount = 0; this->pathQueue.clear(); - this->lastPathCacheQueue.clear(); this->map = NULL; #ifdef LEAK_CHECK_UNITS @@ -87,7 +85,6 @@ void UnitPathBasic::dumpMemoryList() { void UnitPathBasic::clearCaches() { this->blockCount = 0; this->pathQueue.clear(); - this->lastPathCacheQueue.clear(); } bool UnitPathBasic::isEmpty() const { @@ -104,13 +101,11 @@ bool UnitPathBasic::isStuck() const { void UnitPathBasic::clear() { pathQueue.clear(); - lastPathCacheQueue.clear(); blockCount= 0; } void UnitPathBasic::incBlockCount() { pathQueue.clear(); - lastPathCacheQueue.clear(); blockCount++; } @@ -136,12 +131,6 @@ void UnitPathBasic::addToLastPathCache(const Vec2i &path) { throw megaglest_runtime_error("Invalid map surface path position = " + path.getString() + " map surface w x h = " + intToStr(map->getSurfaceW()) + " " + intToStr(map->getSurfaceH())); } } - - //const bool tryLastPathCache = Config::getInstance().getBool("EnablePathfinderCache","false"); - const bool tryLastPathCache = false; - if(tryLastPathCache == true) { - lastPathCacheQueue.push_back(path); - } } Vec2i UnitPathBasic::pop(bool removeFrontPos) { @@ -159,10 +148,6 @@ std::string UnitPathBasic::toString() const { for(int idx = 0; idx < pathQueue.size(); ++idx) { result += " index = " + intToStr(idx) + " value = " + pathQueue[idx].getString(); } - result += "\nlastPathCacheQueue size = " + intToStr(lastPathCacheQueue.size()); - for(int idx = 0; idx < lastPathCacheQueue.size(); ++idx) { - result += " index = " + intToStr(idx) + " value = " + lastPathCacheQueue[idx].getString(); - } return result; } @@ -180,13 +165,6 @@ void UnitPathBasic::saveGame(XmlNode *rootNode) { XmlNode *pathQueueNode = unitPathBasicNode->addChild("pathQueue"); pathQueueNode->addAttribute("vec",vec.getString(), mapTagReplacements); } -// vector lastPathCacheQueue; - for(unsigned int i = 0; i < lastPathCacheQueue.size(); ++i) { - Vec2i &vec = lastPathCacheQueue[i]; - - XmlNode *lastPathCacheQueueNode = unitPathBasicNode->addChild("lastPathCacheQueue"); - lastPathCacheQueueNode->addAttribute("vec",vec.getString(), mapTagReplacements); - } } void UnitPathBasic::loadGame(const XmlNode *rootNode) { @@ -202,15 +180,6 @@ void UnitPathBasic::loadGame(const XmlNode *rootNode) { Vec2i vec = Vec2i::strToVec2(node->getAttribute("vec")->getValue()); pathQueue.push_back(vec); } - - lastPathCacheQueue.clear(); - vector lastpathqueueNodeList = unitPathBasicNode->getChildList("lastPathCacheQueue"); - for(unsigned int i = 0; i < lastpathqueueNodeList.size(); ++i) { - XmlNode *node = lastpathqueueNodeList[i]; - - Vec2i vec = Vec2i::strToVec2(node->getAttribute("vec")->getValue()); - lastPathCacheQueue.push_back(vec); - } } Checksum UnitPathBasic::getCRC() { @@ -218,7 +187,6 @@ Checksum UnitPathBasic::getCRC() { crcForPath.addInt(blockCount); crcForPath.addInt((int)pathQueue.size()); - crcForPath.addInt((int)lastPathCacheQueue.size()); return crcForPath; } diff --git a/source/glest_game/type_instances/unit.h b/source/glest_game/type_instances/unit.h index 3cb192df..f782c38f 100644 --- a/source/glest_game/type_instances/unit.h +++ b/source/glest_game/type_instances/unit.h @@ -180,7 +180,6 @@ private: private: int blockCount; vector pathQueue; - vector lastPathCacheQueue; public: UnitPathBasic(); @@ -203,9 +202,6 @@ public: virtual int getBlockCount() const { return blockCount; } virtual int getQueueCount() const { return (int)pathQueue.size(); } - int getLastPathCacheQueueCount() const { return (int)lastPathCacheQueue.size(); } - vector getLastPathCacheQueue() const { return lastPathCacheQueue; } - virtual vector getQueue() const { return pathQueue; } virtual void setMap(Map *value) { map = value; }