- more fixes from cppcheck

This commit is contained in:
SoftCoder 2014-11-28 18:19:40 -08:00
parent a656a64830
commit ceca2fc5aa
8 changed files with 23 additions and 10 deletions

@ -1 +1 @@
Subproject commit 929c6bac3c2654aa549aaecd589cdc15a0abdd61
Subproject commit f674bb7461ea1ada93c96a7c3167daa4d2dc1ef3

View File

@ -5476,7 +5476,10 @@ void Renderer::renderSelectionEffects(int healthbarMode) {
if(healthbarsVisible) {
hpRatio=unit->getHpRatio();
selectionCircleThickness=0.05f;
hpRatio=1.0f;
//hpRatio=1.0f;
}
else {
hpRatio=0.0f;
}
if(world->getThisFactionIndex() == unit->getFactionIndex()) {

View File

@ -62,7 +62,7 @@ bool AttackBoost::isAffected(const Unit *source, const Unit *dest) const {
else {
// All units are affected (including enemies)
if(targetType == abtAll) {
destUnitMightApply = (boostUnitList.empty() && tags.empty());
//destUnitMightApply = (boostUnitList.empty() && tags.empty());
destUnitMightApply = isInUnitListOrTags(dest->getType());
}
// Only same faction units are affected
@ -70,7 +70,7 @@ bool AttackBoost::isAffected(const Unit *source, const Unit *dest) const {
//if(boostUnitList.empty() == true) {
if(source->getFactionIndex() == dest->getFactionIndex()) {
//destUnitMightApply = true;
destUnitMightApply = (boostUnitList.empty() && tags.empty());
//destUnitMightApply = (boostUnitList.empty() && tags.empty());
destUnitMightApply = isInUnitListOrTags(dest->getType());
}
//}
@ -80,7 +80,7 @@ bool AttackBoost::isAffected(const Unit *source, const Unit *dest) const {
//if(boostUnitList.empty() == true) {
if(source->isAlly(dest) == true) {
//destUnitMightApply = true;
destUnitMightApply = (boostUnitList.empty() && tags.empty());
//destUnitMightApply = (boostUnitList.empty() && tags.empty());
destUnitMightApply = isInUnitListOrTags(dest->getType());
}
//}
@ -90,7 +90,7 @@ bool AttackBoost::isAffected(const Unit *source, const Unit *dest) const {
//if(boostUnitList.empty() == true) {
if(source->isAlly(dest) == false) {
//destUnitMightApply = true;
destUnitMightApply = (boostUnitList.empty() && tags.empty());
//destUnitMightApply = (boostUnitList.empty() && tags.empty());
destUnitMightApply = isInUnitListOrTags(dest->getType());
}
//}

View File

@ -646,7 +646,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
}
}
sortedItems.clear();
hasDup = false;
//hasDup = false;
// Lootable resources (resources given/lost on death)
if(parametersNode->hasChild("resources-death")) {

View File

@ -79,6 +79,15 @@ private:
bool negativeAllowed;
public:
LootableResource() {
type=NULL;
amountValue=0;
amountFactionPercent=0;
lossValue=0;
lossFactionPercent=0;
negativeAllowed=false;
}
const ResourceType* getResourceType() const {return type;}
void setResourceType(const ResourceType *type) {this->type=type;}

View File

@ -781,7 +781,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
}
sortedItems.clear();
hasDup = false;
//hasDup = false;
//effects -- get list of affected units
const XmlNode *effectsNode= upgradeNode->getChild("effects");

View File

@ -619,7 +619,7 @@ void updatePathClimbingParts(string &path,bool processPreviousDirTokenCheck) {
//printf("x [%d][%c] pos [%ld][%c] [%s]\n",x,path[x],(long int)pos,path[pos],path.substr(0,x+1).c_str());
if((path[x] == '/' || path[x] == '\\') && x != (int)pos) {
string origLoop = path;
//string origLoop = path;
path.erase(x,(int)pos-x);
//printf("#5 [%d] [%d] [%d] CHANGE relative path from [%s] to [%s]\n",(int)pos,(int)x,(int)origLoop.length(),origLoop.c_str(),path.c_str());
@ -2455,7 +2455,7 @@ void ValueCheckerVault::checkItemInVault(const void *ptr,int value) const {
}
string getUserHome() {
string home_folder = "";
string home_folder;
home_folder = safeCharPtrCopy(getenv("HOME"),8095);
if(home_folder == "") {
#if _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED

View File

@ -136,6 +136,7 @@ static int getFileAndLine(char *function, void *address, char *file, size_t flen
#if __APPLE_CC__
//### TODO Will: still working this out
int len = fread(buf,1,maxbufSize,f);
pclose(f);
buf[len] = 0;
fprintf(stderr,"< %s",buf);
return -1;