- a bit more code cleanup from cppcheck

- cleanup of english hints
This commit is contained in:
Mark Vejvoda 2012-10-24 06:54:10 +00:00
parent 6d2afae784
commit 2796922914
5 changed files with 25 additions and 24 deletions

View File

@ -409,15 +409,15 @@ bool MenuState::keyPressEditLabel(SDL_KeyboardEvent c, GraphicLabel **activeInpu
}
else if (newKey < 0x800) {
buf[0] = (0xC0 | newKey >> 6);
buf[1] = (0x80 | newKey & 0x3F);
buf[1] = (0x80 | (newKey & 0x3F));
//textCharLength.push_back(2);
activeInputLabel->addTextCharLengthToList(2);
//printf("2 char, textCharLength = %d\n",textCharLength.size());
}
else {
buf[0] = (0xE0 | newKey >> 12);
buf[1] = (0x80 | newKey >> 6 & 0x3F);
buf[2] = (0x80 | newKey & 0x3F);
buf[1] = (0x80 | (newKey >> 6 & 0x3F));
buf[2] = (0x80 | (newKey & 0x3F));
//textCharLength.push_back(3);
activeInputLabel->addTextCharLengthToList(3);
//printf("3 char, textCharLength = %d\n",textCharLength.size());

View File

@ -3552,8 +3552,6 @@ void MenuStateCustomGame::setupUIFromGameSettings(const GameSettings &gameSettin
//gameSettings->setDefaultResources(true);
//gameSettings->setDefaultVictoryConditions(true);
Lang &lang= Lang::getInstance();
//FogOfWar
if(checkBoxScenario.getValue() == false) {
listBoxFogOfWar.setSelectedItemIndex(0); // default is 0!

View File

@ -1120,7 +1120,6 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
setActiveInputLable(NULL);
bool gotDownloads = false;
string orig_txnURLUser = Config::getInstance().getString("TranslationGetURLUser");
//string orig_txnURLPwd = Config::getInstance().getString("TranslationGetURLPassword","");
string orig_txnURLLang = Config::getInstance().getString("TranslationGetURLLanguage");
@ -1166,10 +1165,11 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
vector<string> languageFileMappings;
Tokenize(txnURLFileListMapping,languageFileMappings,"|");
printf("URL5 file count = %lu, %lu [%s]\n",languageFiles.size(),languageFileMappings.size(),(languageFiles.size() > 0 ? languageFiles[0].c_str() : ""));
printf("URL5 file count = %lu, %lu [%s]\n",languageFiles.size(),languageFileMappings.size(),(languageFiles.empty() == false ? languageFiles[0].c_str() : ""));
if(languageFiles.size() > 0) {
if(languageFiles.empty() == false) {
bool gotDownloads = false;
bool reloadLanguage = false;
string langName = "";

View File

@ -921,6 +921,9 @@ bool Map::aproxCanMove(const Unit *unit, const Vec2i &pos1, const Vec2i &pos2, s
return false;
}
if(unit == NULL) {
throw megaglest_runtime_error("unit == NULL");
}
int size= unit->getType()->getSize();
int teamIndex= unit->getTeam();
Field field= unit->getCurrField();
@ -1038,17 +1041,15 @@ bool Map::aproxCanMove(const Unit *unit, const Vec2i &pos1, const Vec2i &pos2, s
}
bool isBadHarvestPos = false;
if(unit != NULL) {
Command *command= unit->getCurrCommand();
if(command != NULL) {
const HarvestCommandType *hct = dynamic_cast<const HarvestCommandType*>(command->getCommandType());
if(hct != NULL && unit->isBadHarvestPos(pos2) == true) {
isBadHarvestPos = true;
}
Command *command= unit->getCurrCommand();
if(command != NULL) {
const HarvestCommandType *hct = dynamic_cast<const HarvestCommandType*>(command->getCommandType());
if(hct != NULL && unit->isBadHarvestPos(pos2) == true) {
isBadHarvestPos = true;
}
}
if(unit == NULL || isBadHarvestPos == true) {
if(isBadHarvestPos == true) {
if(lookupCache != NULL) {
(*lookupCache)[pos1][pos2][teamIndex][size][field]=false;
}

View File

@ -399,6 +399,10 @@ public:
return false;
}
if(unit == NULL) {
throw megaglest_runtime_error("unit == NULL");
}
int size= unit->getType()->getSize();
int teamIndex= unit->getTeam();
Field field= unit->getCurrField();
@ -481,17 +485,15 @@ public:
}
bool isBadHarvestPos = false;
if(unit != NULL) {
Command *command= unit->getCurrCommand();
if(command != NULL) {
const HarvestCommandType *hct = dynamic_cast<const HarvestCommandType*>(command->getCommandType());
if(hct != NULL && unit->isBadHarvestPos(pos2) == true) {
isBadHarvestPos = true;
}
Command *command= unit->getCurrCommand();
if(command != NULL) {
const HarvestCommandType *hct = dynamic_cast<const HarvestCommandType*>(command->getCommandType());
if(hct != NULL && unit->isBadHarvestPos(pos2) == true) {
isBadHarvestPos = true;
}
}
if(unit == NULL || isBadHarvestPos == true) {
if(isBadHarvestPos == true) {
//printf("[%s] Line: %d returning false\n",__FUNCTION__,__LINE__);
unit->getFaction()->addAproxCanMoveSoonCached(size,field, pos1, pos2, false);