code cleanup from cppcheck
This commit is contained in:
parent
c646d0371c
commit
1b3ee1503b
|
@ -423,7 +423,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
||||||
if(modelPath != "") {
|
if(modelPath != "") {
|
||||||
fileDialog->SetPath(ToUnicode(modelPath));
|
fileDialog->SetPath(ToUnicode(modelPath));
|
||||||
}
|
}
|
||||||
string userData = Config::getInstance().getString("UserData_Root","");
|
string userData = config.getString("UserData_Root","");
|
||||||
if(userData != "") {
|
if(userData != "") {
|
||||||
endPathWithSlash(userData);
|
endPathWithSlash(userData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,7 +379,7 @@ void GraphicListBox::init(int x, int y, int w, int h, Vec3f textColor){
|
||||||
}
|
}
|
||||||
|
|
||||||
const string & GraphicListBox::getTextNativeTranslation() {
|
const string & GraphicListBox::getTextNativeTranslation() {
|
||||||
if(this->translated_items.size() == 0 ||
|
if(this->translated_items.empty() == true ||
|
||||||
this->selectedItemIndex < 0 ||
|
this->selectedItemIndex < 0 ||
|
||||||
this->selectedItemIndex >= this->translated_items.size() ||
|
this->selectedItemIndex >= this->translated_items.size() ||
|
||||||
this->items.size() != this->translated_items.size()) {
|
this->items.size() != this->translated_items.size()) {
|
||||||
|
|
|
@ -2542,8 +2542,6 @@ void runTechTranslationExtractionForPath(string techPath, string techName,
|
||||||
}
|
}
|
||||||
|
|
||||||
if(factions.empty() == false) {
|
if(factions.empty() == false) {
|
||||||
bool techtree_errors = false;
|
|
||||||
|
|
||||||
std::map<string,vector<pair<string, string> > > loadedFileList;
|
std::map<string,vector<pair<string, string> > > loadedFileList;
|
||||||
//vector<string> pathList = config.getPathListForType(ptTechs,"");
|
//vector<string> pathList = config.getPathListForType(ptTechs,"");
|
||||||
vector<string> pathList;
|
vector<string> pathList;
|
||||||
|
@ -2652,12 +2650,6 @@ void runTechTranslationExtraction(int argc, char** argv) {
|
||||||
//disableBacktrace=true;
|
//disableBacktrace=true;
|
||||||
printf("====== Started Translation Extraction ======\n");
|
printf("====== Started Translation Extraction ======\n");
|
||||||
|
|
||||||
bool purgeDuplicateFiles = false;
|
|
||||||
bool showDuplicateFiles = true;
|
|
||||||
bool purgeUnusedFiles = false;
|
|
||||||
bool svnPurgeFiles = false;
|
|
||||||
|
|
||||||
double purgedMegaBytes=0;
|
|
||||||
Config &config = Config::getInstance();
|
Config &config = Config::getInstance();
|
||||||
|
|
||||||
// Did the user pass a specific list of factions to validate?
|
// Did the user pass a specific list of factions to validate?
|
||||||
|
|
|
@ -40,6 +40,12 @@ MenuStateAbout::MenuStateAbout(Program *program, MainMenu *mainMenu) :
|
||||||
|
|
||||||
adjustModelText = true;
|
adjustModelText = true;
|
||||||
|
|
||||||
|
customModTextureX = 0;
|
||||||
|
customModTextureY = 0;
|
||||||
|
customModTextureW = 0;
|
||||||
|
customModTextureH = 0;
|
||||||
|
customModTextureAlpha = 0.f;
|
||||||
|
|
||||||
string additionalCredits= loadAdditionalCredits();
|
string additionalCredits= loadAdditionalCredits();
|
||||||
|
|
||||||
//init
|
//init
|
||||||
|
|
|
@ -3191,7 +3191,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
gameSettings->setNetworkPlayerLanguages(slotIndex, lang.getLanguage());
|
gameSettings->setNetworkPlayerLanguages(slotIndex, lang.getLanguage());
|
||||||
}
|
}
|
||||||
else if(serverInterface->getSlot(i) != NULL) {
|
else if(serverInterface != NULL && serverInterface->getSlot(i) != NULL) {
|
||||||
gameSettings->setNetworkPlayerLanguages(slotIndex, serverInterface->getSlot(i)->getNetworkPlayerLanguage());
|
gameSettings->setNetworkPlayerLanguages(slotIndex, serverInterface->getSlot(i)->getNetworkPlayerLanguage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,8 @@ void NetworkInterface::init() {
|
||||||
networkGameDataSynchCheckOkTile=false;
|
networkGameDataSynchCheckOkTile=false;
|
||||||
networkGameDataSynchCheckOkTech=false;
|
networkGameDataSynchCheckOkTech=false;
|
||||||
receivedDataSynchCheck=false;
|
receivedDataSynchCheck=false;
|
||||||
|
|
||||||
|
gameSettings = GameSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkInterface::~NetworkInterface() {
|
NetworkInterface::~NetworkInterface() {
|
||||||
|
|
|
@ -275,11 +275,10 @@ bool FactionThread::isSignalPathfinderCompleted(int frameIndex) {
|
||||||
if(getRunningStatus() == false) {
|
if(getRunningStatus() == false) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool result = false;
|
|
||||||
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
||||||
MutexSafeWrapper safeMutex(triggerIdMutex,mutexOwnerId);
|
MutexSafeWrapper safeMutex(triggerIdMutex,mutexOwnerId);
|
||||||
//bool result = (event != NULL ? event->eventCompleted : true);
|
//bool result = (event != NULL ? event->eventCompleted : true);
|
||||||
result = (this->frameIndex.first == frameIndex && this->frameIndex.second == true);
|
bool result = (this->frameIndex.first == frameIndex && this->frameIndex.second == true);
|
||||||
|
|
||||||
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] worker thread this = %p, this->frameIndex.first = %d, this->frameIndex.second = %d\n",__FILE__,__FUNCTION__,__LINE__,this,this->frameIndex.first,this->frameIndex.second);
|
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] worker thread this = %p, this->frameIndex.first = %d, this->frameIndex.second = %d\n",__FILE__,__FUNCTION__,__LINE__,this,this->frameIndex.first,this->frameIndex.second);
|
||||||
|
|
||||||
|
@ -316,11 +315,10 @@ void FactionThread::execute() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int currentTriggeredFrameIndex = 0;
|
|
||||||
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
||||||
MutexSafeWrapper safeMutex(triggerIdMutex,mutexOwnerId);
|
MutexSafeWrapper safeMutex(triggerIdMutex,mutexOwnerId);
|
||||||
bool executeTask = (this->frameIndex.first >= 0);
|
bool executeTask = (this->frameIndex.first >= 0);
|
||||||
currentTriggeredFrameIndex = this->frameIndex.first;
|
int currentTriggeredFrameIndex = this->frameIndex.first;
|
||||||
|
|
||||||
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] frameIndex = %d this = %p executeTask = %d\n",__FILE__,__FUNCTION__,__LINE__,frameIndex.first, this, executeTask);
|
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] frameIndex = %d this = %p executeTask = %d\n",__FILE__,__FUNCTION__,__LINE__,frameIndex.first, this, executeTask);
|
||||||
|
|
||||||
|
@ -482,6 +480,8 @@ void Faction::init() {
|
||||||
control = ctClosed;
|
control = ctClosed;
|
||||||
|
|
||||||
overridePersonalityType = fpt_EndCount;
|
overridePersonalityType = fpt_EndCount;
|
||||||
|
|
||||||
|
upgradeManager = UpgradeManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
Faction::~Faction() {
|
Faction::~Faction() {
|
||||||
|
|
|
@ -2219,7 +2219,7 @@ void Unit::updateAttackBoostProgress(const Game* game) {
|
||||||
|
|
||||||
for(unsigned int i = 0; i < currentAttackBoostOriginatorEffect.currentAttackBoostUnits.size(); ++i) {
|
for(unsigned int i = 0; i < currentAttackBoostOriginatorEffect.currentAttackBoostUnits.size(); ++i) {
|
||||||
int unitnum = currentAttackBoostOriginatorEffect.currentAttackBoostUnits[i];
|
int unitnum = currentAttackBoostOriginatorEffect.currentAttackBoostUnits[i];
|
||||||
printf("affected unit #: %d - %d\n",i,unitnum);
|
printf("affected unit #: %u - %d\n",i,unitnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3850,10 +3850,9 @@ void Unit::logSynchDataCommon(string file,int line,string source,bool threadedMo
|
||||||
lastFile = file;
|
lastFile = file;
|
||||||
lastSource = source;
|
lastSource = source;
|
||||||
|
|
||||||
string logDataText = "";
|
|
||||||
char szBufDataText[8096]="";
|
char szBufDataText[8096]="";
|
||||||
snprintf(szBufDataText,8096,"----------------------------------- START [FRAME %d UNIT: %d - %s] ------------------------------------------------\n",getFrameCount(),this->id,this->getType()->getName(false).c_str());
|
snprintf(szBufDataText,8096,"----------------------------------- START [FRAME %d UNIT: %d - %s] ------------------------------------------------\n",getFrameCount(),this->id,this->getType()->getName(false).c_str());
|
||||||
logDataText = szBufDataText;
|
string logDataText = szBufDataText;
|
||||||
|
|
||||||
snprintf(szBufDataText,8096,"[%s::%d]\n",extractFileFromDirectoryPath(file).c_str(),line);
|
snprintf(szBufDataText,8096,"[%s::%d]\n",extractFileFromDirectoryPath(file).c_str(),line);
|
||||||
logDataText += szBufDataText;
|
logDataText += szBufDataText;
|
||||||
|
|
|
@ -551,7 +551,7 @@ void updatePathClimbingParts(string &path) {
|
||||||
if(pos != string::npos && pos != 0) {
|
if(pos != string::npos && pos != 0) {
|
||||||
string orig = path;
|
string orig = path;
|
||||||
path.erase(pos,2);
|
path.erase(pos,2);
|
||||||
pos--;
|
//pos--;
|
||||||
|
|
||||||
pos = path.find("/./");
|
pos = path.find("/./");
|
||||||
if(pos != string::npos && pos != 0) {
|
if(pos != string::npos && pos != 0) {
|
||||||
|
@ -564,7 +564,7 @@ void updatePathClimbingParts(string &path) {
|
||||||
if(pos != string::npos && pos != 0) {
|
if(pos != string::npos && pos != 0) {
|
||||||
string orig = path;
|
string orig = path;
|
||||||
path.erase(pos,2);
|
path.erase(pos,2);
|
||||||
pos--;
|
//pos--;
|
||||||
|
|
||||||
pos = path.find("\\.\\");
|
pos = path.find("\\.\\");
|
||||||
if(pos != string::npos && pos != 0) {
|
if(pos != string::npos && pos != 0) {
|
||||||
|
|
Loading…
Reference in New Issue