From 66f44ff7c4e324081d51cab3a400e81910f6666c Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Fri, 2 Dec 2011 17:46:02 +0000 Subject: [PATCH] - more cleanup from cppcheck (using eclipse plugin now) --- source/glest_game/ai/ai.h | 9 ++++++++- source/glest_game/ai/path_finder.cpp | 4 ++-- source/glest_game/ai/path_finder.h | 4 ++-- source/glest_game/main/intro.cpp | 4 ++-- source/glest_game/type_instances/unit.cpp | 2 +- source/glest_game/world/tileset.h | 1 + source/glest_game/world/time_flow.cpp | 6 +++--- source/glest_game/world/time_flow.h | 2 +- .../sources/graphics/gl/font_text_freetypegl.cpp | 4 ++-- source/shared_lib/sources/platform/posix/socket.cpp | 4 ++-- 10 files changed, 24 insertions(+), 16 deletions(-) diff --git a/source/glest_game/ai/ai.h b/source/glest_game/ai/ai.h index d44703be..7fb2851e 100644 --- a/source/glest_game/ai/ai.h +++ b/source/glest_game/ai/ai.h @@ -149,8 +149,15 @@ private: bool getAdjacentUnits(std::map > &signalAdjacentUnits, const Unit *unit); public: - int minWarriors; + Ai() { + aiInterface = NULL; + startLoc = -1; + randomMinWarriorsReached = false; + } ~Ai(); + + int minWarriors; + void init(AiInterface *aiInterface,int useStartLocation=-1); void update(); diff --git a/source/glest_game/ai/path_finder.cpp b/source/glest_game/ai/path_finder.cpp index d36ed0e6..9a27b817 100644 --- a/source/glest_game/ai/path_finder.cpp +++ b/source/glest_game/ai/path_finder.cpp @@ -504,7 +504,7 @@ direction PathFinder::directionOfMove(Vec2i to, Vec2i from) const { } -direction PathFinder::directionWeCameFrom(Vec2i node, Vec2i nodeFrom) { +direction PathFinder::directionWeCameFrom(Vec2i node, Vec2i nodeFrom) const { direction result = NO_DIRECTION; if(nodeFrom.x >= 0 && nodeFrom.y >= 0) { result = directionOfMove(node, nodeFrom); @@ -580,7 +580,7 @@ directionset PathFinder::forcedNeighbours(Vec2i coord,direction dir) { return dirs; } -directionset PathFinder::naturalNeighbours(direction dir) { +directionset PathFinder::naturalNeighbours(direction dir) const { if (dir == NO_DIRECTION) return 255; diff --git a/source/glest_game/ai/path_finder.h b/source/glest_game/ai/path_finder.h index b4aa6fa5..0220a6d9 100644 --- a/source/glest_game/ai/path_finder.h +++ b/source/glest_game/ai/path_finder.h @@ -134,14 +134,14 @@ private: bool contained(Vec2i c); direction directionOfMove(Vec2i to, Vec2i from) const; - direction directionWeCameFrom(Vec2i node, Vec2i nodeFrom); + direction directionWeCameFrom(Vec2i node, Vec2i nodeFrom) const; bool isEnterable(Vec2i coord); Vec2i adjustInDirection(Vec2i c, int dir); bool directionIsDiagonal(direction dir) const; directionset forcedNeighbours(Vec2i coord,direction dir); bool implies(bool a, bool b) const; directionset addDirectionToSet(directionset dirs, direction dir) const; - directionset naturalNeighbours(direction dir); + directionset naturalNeighbours(direction dir) const; direction nextDirectionInSet(directionset *dirs) const; Vec2i jump(Vec2i dest, direction dir, Vec2i start,std::vector &path,int pathLength); bool addToOpenSet(Unit *unit, Node *node,const Vec2i finalPos, Vec2i sucPos, bool &nodeLimitReached,int maxNodeCount,Node **newNodeAdded,bool bypassChecks); diff --git a/source/glest_game/main/intro.cpp b/source/glest_game/main/intro.cpp index 0fe3b064..1abe6386 100644 --- a/source/glest_game/main/intro.cpp +++ b/source/glest_game/main/intro.cpp @@ -755,7 +755,7 @@ void Intro::render() { string timingText = intToStr(difTime) + " / " + intToStr(Intro::introTime); if(Renderer::renderText3DEnabled) { - const Metrics &metrics= Metrics::getInstance(); + //const Metrics &metrics= Metrics::getInstance(); //int w= metrics.getVirtualW(); //int h= metrics.getVirtualH(); @@ -764,7 +764,7 @@ void Intro::render() { 10, 20, false); } else { - const Metrics &metrics= Metrics::getInstance(); + //const Metrics &metrics= Metrics::getInstance(); //int w= metrics.getVirtualW(); //int h= metrics.getVirtualH(); diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 891265d3..8f76b780 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -3159,7 +3159,7 @@ void Unit::cleanupOldBadHarvestPos() { //printf("========================> cleanupOldBadHarvestPos() [%d] badHarvestPosList.size [%ld]\n",getFrameCount(),badHarvestPosList.size()); std::vector purgeList; - for(std::map::iterator iter = badHarvestPosList.begin(); iter != badHarvestPosList.end(); iter++) { + for(std::map::iterator iter = badHarvestPosList.begin(); iter != badHarvestPosList.end(); ++iter) { if(getFrameCount() - iter->second >= cleanupInterval) { //printf("cleanupOldBadHarvestPos() [%d][%d]\n",getFrameCount(),iter->second); purgeList.push_back(iter->first); diff --git a/source/glest_game/world/tileset.h b/source/glest_game/world/tileset.h index 869bb02a..06b993f4 100644 --- a/source/glest_game/world/tileset.h +++ b/source/glest_game/world/tileset.h @@ -148,6 +148,7 @@ public: fog = false; fogMode = 0; fogDensity = 0.0f; + weather= wSunny; } ~Tileset(); Checksum loadTileset(const vector pathList, const string &tilesetName, diff --git a/source/glest_game/world/time_flow.cpp b/source/glest_game/world/time_flow.cpp index 05085168..23c4fe65 100644 --- a/source/glest_game/world/time_flow.cpp +++ b/source/glest_game/world/time_flow.cpp @@ -90,8 +90,8 @@ void TimeFlow::update() { lastTime= time; } -bool TimeFlow::isAproxTime(float time) const { - return (this->time>=time) && (this->timetime>=time) && (this->time ustr((const unsigned char *)str); for(int i = 0; (len < 0 && *ustr) || (len >= 0 && i < len); i++) { - unsigned int prevChar = (i > 0 ? *ustr-1 : 0); + //unsigned int prevChar = (i > 0 ? *ustr-1 : 0); unsigned int thisChar = *ustr++; - unsigned int nextChar = *ustr; + //unsigned int nextChar = *ustr; // Get glyph (build it if needed TextureGlyph *glyph = texture_font_get_glyph( this->font, thisChar ); diff --git a/source/shared_lib/sources/platform/posix/socket.cpp b/source/shared_lib/sources/platform/posix/socket.cpp index 6a5a02da..64c64998 100644 --- a/source/shared_lib/sources/platform/posix/socket.cpp +++ b/source/shared_lib/sources/platform/posix/socket.cpp @@ -616,11 +616,11 @@ string getNetworkInterfaceBroadcastAddress(string ipAddress) next = next->Next; } } - char buf[128]=""; + //char buf[128]=""; if (name == NULL) { //sprintf(buf, "unnamed-%i", i); - name = buf; + name = ""; } uint32 ipAddr = ntohl(row.dwAddr);