- more cleanup from cppcheck (using eclipse plugin now)

This commit is contained in:
Mark Vejvoda 2011-12-02 17:46:02 +00:00
parent f6dafcde3c
commit 66f44ff7c4
10 changed files with 24 additions and 16 deletions

View File

@ -149,8 +149,15 @@ private:
bool getAdjacentUnits(std::map<float, std::map<int, const Unit *> > &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();

View File

@ -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;

View File

@ -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<Vec2i> &path,int pathLength);
bool addToOpenSet(Unit *unit, Node *node,const Vec2i finalPos, Vec2i sucPos, bool &nodeLimitReached,int maxNodeCount,Node **newNodeAdded,bool bypassChecks);

View File

@ -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();

View File

@ -3159,7 +3159,7 @@ void Unit::cleanupOldBadHarvestPos() {
//printf("========================> cleanupOldBadHarvestPos() [%d] badHarvestPosList.size [%ld]\n",getFrameCount(),badHarvestPosList.size());
std::vector<Vec2i> purgeList;
for(std::map<Vec2i,int>::iterator iter = badHarvestPosList.begin(); iter != badHarvestPosList.end(); iter++) {
for(std::map<Vec2i,int>::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);

View File

@ -148,6 +148,7 @@ public:
fog = false;
fogMode = 0;
fogDensity = 0.0f;
weather= wSunny;
}
~Tileset();
Checksum loadTileset(const vector<string> pathList, const string &tilesetName,

View File

@ -90,8 +90,8 @@ void TimeFlow::update() {
lastTime= time;
}
bool TimeFlow::isAproxTime(float time) const {
return (this->time>=time) && (this->time<time+timeInc);
}
//bool TimeFlow::isAproxTime(float time) const {
// return (this->time>=time) && (this->time<time+timeInc);
//}
}}//end namespace

View File

@ -59,7 +59,7 @@ public:
void update();
private:
bool isAproxTime(float time) const;
//bool isAproxTime(float time) const;
};
}} //end namespace

View File

@ -208,9 +208,9 @@ float TextFreetypeGL::Advance(const char* str, const int len) {
FreetypeGLUnicodeStringItr<unsigned char> 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 );

View File

@ -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);