- fix win32 build

- cleanup a lot of win32 compiler warnings
This commit is contained in:
Mark Vejvoda 2012-04-16 20:15:57 +00:00
parent 3b8dd289ac
commit c8fdc9269f
24 changed files with 86 additions and 85 deletions

View File

@ -179,7 +179,7 @@ BuildTask * BuildTask::loadGame(const XmlNode *rootNode, Faction *faction) {
newTask->resourceType = faction->getTechTree()->getResourceType(resourceTypeName);
}
newTask->forcePos = buildTaskNode->getAttribute("forcePos")->getIntValue();
newTask->forcePos = buildTaskNode->getAttribute("forcePos")->getIntValue() != 0;
newTask->pos = Vec2i::strToVec2(buildTaskNode->getAttribute("pos")->getValue());
return newTask;
@ -1203,7 +1203,7 @@ void Ai::loadGame(const XmlNode *rootNode, Faction *faction) {
const XmlNode *aiNode = rootNode->getChild("Ai");
startLoc = aiNode->getAttribute("startLoc")->getIntValue();
randomMinWarriorsReached = aiNode->getAttribute("randomMinWarriorsReached")->getIntValue();
randomMinWarriorsReached = aiNode->getAttribute("randomMinWarriorsReached")->getIntValue() != 0;
vector<XmlNode *> taskNodeList = aiNode->getChildList("Task");
for(unsigned int i = 0; i < taskNodeList.size(); ++i) {

View File

@ -734,7 +734,7 @@ void AiInterface::loadGame(const XmlNode *rootNode, Faction *faction) {
teamIndex = aiInterfaceNode->getAttribute("teamIndex")->getIntValue();
// //config
// bool redir;
redir = aiInterfaceNode->getAttribute("redir")->getIntValue();
redir = aiInterfaceNode->getAttribute("redir")->getIntValue() != 0;
// int logLevel;
logLevel = aiInterfaceNode->getAttribute("logLevel")->getIntValue();

View File

@ -1710,7 +1710,7 @@ void PathFinder::loadGame(const XmlNode *rootNode) {
// float heuristic;
curNode->heuristic = nodePoolNode->getAttribute("heuristic")->getFloatValue();
// bool exploredCell;
curNode->exploredCell = nodePoolNode->getAttribute("exploredCell")->getIntValue();
curNode->exploredCell = nodePoolNode->getAttribute("exploredCell")->getIntValue() != 0;
}
// int nodePoolCount;

View File

@ -707,7 +707,7 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
int votingFactionIndex = networkCommand->getUnitId();
int factionIndex = networkCommand->getCommandTypeId();
bool allowSwitchTeam = networkCommand->getUnitTypeId();
bool allowSwitchTeam = networkCommand->getUnitTypeId() != 0;
Faction *faction = world->getFaction(votingFactionIndex);
@ -806,7 +806,7 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
commandWasHandled = true;
bool pauseGame = networkCommand->getUnitId();
bool pauseGame = networkCommand->getUnitId() != 0;
Game *game = this->world->getGame();
//printf("nctPauseResume pauseGame = %d\n",pauseGame);

View File

@ -3949,9 +3949,9 @@ void Game::loadGame(string name,Program *programPtr,bool isMasterserverMode) {
newGame->tickCount = gameNode->getAttribute("tickCount")->getIntValue();
//bool paused;
newGame->paused = gameNode->getAttribute("paused")->getIntValue();
newGame->paused = gameNode->getAttribute("paused")->getIntValue() != 0;
//bool gameOver;
newGame->gameOver = gameNode->getAttribute("gameOver")->getIntValue();
newGame->gameOver = gameNode->getAttribute("gameOver")->getIntValue() != 0;
//bool renderNetworkStatus;
//bool showFullConsole;
//bool mouseMoved;
@ -4004,13 +4004,13 @@ void Game::loadGame(string name,Program *programPtr,bool isMasterserverMode) {
//bool photoModeEnabled;
//gameNode->addAttribute("photoModeEnabled",intToStr(photoModeEnabled), mapTagReplacements);
newGame->photoModeEnabled = gameNode->getAttribute("photoModeEnabled")->getIntValue();
newGame->photoModeEnabled = gameNode->getAttribute("photoModeEnabled")->getIntValue() != 0;
//bool visibleHUD;
//gameNode->addAttribute("visibleHUD",intToStr(visibleHUD), mapTagReplacements);
newGame->visibleHUD = gameNode->getAttribute("visibleHUD")->getIntValue();
newGame->visibleHUD = gameNode->getAttribute("visibleHUD")->getIntValue() != 0;
//bool withRainEffect;
//gameNode->addAttribute("withRainEffect",intToStr(withRainEffect), mapTagReplacements);
newGame->withRainEffect = gameNode->getAttribute("withRainEffect")->getIntValue();
newGame->withRainEffect = gameNode->getAttribute("withRainEffect")->getIntValue() != 0;
//Program *program;
//bool gameStarted;

View File

@ -502,7 +502,7 @@ void GameCamera::loadGame(const XmlNode *rootNode) {
// float speed;
speed = gamecameraNode->getAttribute("speed")->getFloatValue();
// bool clampBounds;
clampBounds = gamecameraNode->getAttribute("clampBounds")->getIntValue();
clampBounds = gamecameraNode->getAttribute("clampBounds")->getIntValue() != 0;
// //float maxRenderDistance;
// float maxHeight;
maxHeight = gamecameraNode->getAttribute("maxHeight")->getFloatValue();

View File

@ -487,23 +487,23 @@ public:
//
//
// bool defaultUnits;
defaultUnits = gameSettingsNode->getAttribute("defaultUnits")->getIntValue();
defaultUnits = gameSettingsNode->getAttribute("defaultUnits")->getIntValue() != 0;
// bool defaultResources;
defaultResources = gameSettingsNode->getAttribute("defaultResources")->getIntValue();
defaultResources = gameSettingsNode->getAttribute("defaultResources")->getIntValue() != 0;
// bool defaultVictoryConditions;
defaultVictoryConditions = gameSettingsNode->getAttribute("defaultVictoryConditions")->getIntValue();
defaultVictoryConditions = gameSettingsNode->getAttribute("defaultVictoryConditions")->getIntValue() != 0;
// bool fogOfWar;
fogOfWar = gameSettingsNode->getAttribute("fogOfWar")->getIntValue();
fogOfWar = gameSettingsNode->getAttribute("fogOfWar")->getIntValue() != 0;
// bool allowObservers;
allowObservers = gameSettingsNode->getAttribute("allowObservers")->getIntValue();
allowObservers = gameSettingsNode->getAttribute("allowObservers")->getIntValue() != 0;
// bool enableObserverModeAtEndGame;
enableObserverModeAtEndGame = gameSettingsNode->getAttribute("enableObserverModeAtEndGame")->getIntValue();
enableObserverModeAtEndGame = gameSettingsNode->getAttribute("enableObserverModeAtEndGame")->getIntValue() != 0;
// bool enableServerControlledAI;
enableServerControlledAI = gameSettingsNode->getAttribute("enableServerControlledAI")->getIntValue();
enableServerControlledAI = gameSettingsNode->getAttribute("enableServerControlledAI")->getIntValue() != 0;
// int networkFramePeriod;
networkFramePeriod = gameSettingsNode->getAttribute("networkFramePeriod")->getIntValue();
// bool networkPauseGameForLaggedClients;
networkPauseGameForLaggedClients = gameSettingsNode->getAttribute("networkPauseGameForLaggedClients")->getIntValue();
networkPauseGameForLaggedClients = gameSettingsNode->getAttribute("networkPauseGameForLaggedClients")->getIntValue() != 0;
// PathFinderType pathFinderType;
pathFinderType = static_cast<PathFinderType>(gameSettingsNode->getAttribute("pathFinderType")->getIntValue());
// uint32 flagTypes1;

View File

@ -105,9 +105,9 @@ void PlayerModifiers::saveGame(XmlNode *rootNode) {
void PlayerModifiers::loadGame(const XmlNode *rootNode) {
const XmlNode *playerModifiersNode = rootNode;
winner = playerModifiersNode->getAttribute("winner")->getIntValue();
aiEnabled = playerModifiersNode->getAttribute("aiEnabled")->getIntValue();
consumeEnabled = playerModifiersNode->getAttribute("consumeEnabled")->getIntValue();
winner = playerModifiersNode->getAttribute("winner")->getIntValue() != 0;
aiEnabled = playerModifiersNode->getAttribute("aiEnabled")->getIntValue() != 0;
consumeEnabled = playerModifiersNode->getAttribute("consumeEnabled")->getIntValue() != 0;
}
CellTriggerEvent::CellTriggerEvent() {
@ -173,7 +173,7 @@ void TimerTriggerEvent::saveGame(XmlNode *rootNode) {
void TimerTriggerEvent::loadGame(const XmlNode *rootNode) {
const XmlNode *timerTriggerEventNode = rootNode->getChild("TimerTriggerEvent");
running = timerTriggerEventNode->getAttribute("running")->getIntValue();
running = timerTriggerEventNode->getAttribute("running")->getIntValue() != 0;
startFrame = timerTriggerEventNode->getAttribute("startFrame")->getIntValue();
endFrame = timerTriggerEventNode->getAttribute("endFrame")->getIntValue();
if(timerTriggerEventNode->hasAttribute("triggerSecondsElapsed") == true) {
@ -2099,7 +2099,7 @@ int ScriptManager::getIsGameOver(LuaHandle* luaHandle){
int ScriptManager::loadScenario(LuaHandle* luaHandle) {
LuaArguments luaArguments(luaHandle);
thisScriptManager->loadScenario(luaArguments.getString(-2),luaArguments.getInt(-1));
thisScriptManager->loadScenario(luaArguments.getString(-2),luaArguments.getInt(-1) != 0);
return luaArguments.getReturnCount();
}
@ -2251,7 +2251,7 @@ void ScriptManager::loadGame(const XmlNode *rootNode) {
}
// GraphicMessageBox messageBox;
messageBox.setEnabled(scriptManagerNode->getAttribute("messageBox_enabled")->getIntValue());
messageBox.setEnabled(scriptManagerNode->getAttribute("messageBox_enabled")->getIntValue() != 0);
messageBox.setText(wrapString(scriptManagerNode->getAttribute("messageBox_text")->getValue(),messageWrapCount));
messageBox.setHeader(scriptManagerNode->getAttribute("messageBox_header")->getValue());
@ -2292,9 +2292,9 @@ void ScriptManager::loadGame(const XmlNode *rootNode) {
//
// // end game state
// bool gameOver;
gameOver = scriptManagerNode->getAttribute("gameOver")->getIntValue();
gameOver = scriptManagerNode->getAttribute("gameOver")->getIntValue() != 0;
// bool gameWon;
gameWon = scriptManagerNode->getAttribute("gameWon")->getIntValue();
gameWon = scriptManagerNode->getAttribute("gameWon")->getIntValue() != 0;
// PlayerModifiers playerModifiers[GameConstants::maxPlayers];
vector<XmlNode *> playerModifiersNodeList = scriptManagerNode->getChildList("PlayerModifiers");
for(unsigned int i = 0; i < playerModifiersNodeList.size(); ++i) {
@ -2327,7 +2327,7 @@ void ScriptManager::loadGame(const XmlNode *rootNode) {
}
// bool inCellTriggerEvent;
inCellTriggerEvent = scriptManagerNode->getAttribute("inCellTriggerEvent")->getIntValue();
inCellTriggerEvent = scriptManagerNode->getAttribute("inCellTriggerEvent")->getIntValue() != 0;
// std::vector<int> unRegisterCellTriggerEventList;
vector<XmlNode *> unRegisterCellTriggerEventListNodeList = scriptManagerNode->getChildList("unRegisterCellTriggerEventList");
for(unsigned int i = 0; i < unRegisterCellTriggerEventListNodeList.size(); ++i) {

View File

@ -238,7 +238,7 @@ void Stats::loadGame(const XmlNode *rootNode) {
// int teamIndex;
stat.teamIndex = statsNodePlayer->getAttribute("teamIndex")->getIntValue();
// bool victory;
stat.victory = statsNodePlayer->getAttribute("victory")->getIntValue();
stat.victory = statsNodePlayer->getAttribute("victory")->getIntValue() != 0;
// int kills;
stat.kills = statsNodePlayer->getAttribute("kills")->getIntValue();
// int enemykills;

View File

@ -344,7 +344,7 @@ bool Lang::fileMatchesISO630Code(string uselanguage, string testLanguageFile) {
result = true;
}
}
catch(exception &ex) {
catch(const exception &ex) {
}
return result;
@ -388,7 +388,7 @@ string Lang::getNativeLanguageName(string uselanguage, string testLanguageFile)
try {
result = stringsTest.getString("NativeLanguageName");
}
catch(exception &ex) {
catch(const exception &ex) {
}
return result;

View File

@ -1288,7 +1288,7 @@ void Gui::loadGame(const XmlNode *rootNode, World *world) {
//guiNode->addAttribute("posObjWorld",posObjWorld.getString(), mapTagReplacements);
posObjWorld = Vec2i::strToVec2(guiNode->getAttribute("posObjWorld")->getValue());
// bool validPosObjWorld;
validPosObjWorld = guiNode->getAttribute("validPosObjWorld")->getIntValue();
validPosObjWorld = guiNode->getAttribute("validPosObjWorld")->getIntValue() != 0;
// //display
// const UnitType *choosenBuildingType;
// if(choosenBuildingType != NULL) {

View File

@ -68,8 +68,8 @@ MenuStateGraphicInfo::MenuStateGraphicInfo(Program *program, MainMenu *mainMenu)
strInternalInfo += "\nrenderText3DEnabled: " + boolToStr(Renderer::renderText3DEnabled);
strInternalInfo += "\nuseTextureCompression: " + boolToStr(Texture::useTextureCompression);
strInternalInfo += "\nfontIsRightToLeft: " + boolToStr(Font::fontIsRightToLeft);
strInternalInfo += "\nscaleFontValue: " + boolToStr(Font::scaleFontValue);
strInternalInfo += "\nscaleFontValueCenterHFactor: " + boolToStr(Font::scaleFontValueCenterHFactor);
strInternalInfo += "\nscaleFontValue: " + floatToStr(Font::scaleFontValue);
strInternalInfo += "\nscaleFontValueCenterHFactor: " + floatToStr(Font::scaleFontValueCenterHFactor);
strInternalInfo += "\nlangHeightText: " + Font::langHeightText;
strInternalInfo += "\nAllowAltEnterFullscreenToggle: " + boolToStr(Window::getAllowAltEnterFullscreenToggle());
strInternalInfo += "\nTryVSynch: " + boolToStr(Window::getTryVSynch());
@ -106,8 +106,8 @@ void MenuStateGraphicInfo::reloadUI() {
strInternalInfo += "\nrenderText3DEnabled: " + boolToStr(Renderer::renderText3DEnabled);
strInternalInfo += "\nuseTextureCompression: " + boolToStr(Texture::useTextureCompression);
strInternalInfo += "\nfontIsRightToLeft: " + boolToStr(Font::fontIsRightToLeft);
strInternalInfo += "\nscaleFontValue: " + boolToStr(Font::scaleFontValue);
strInternalInfo += "\nscaleFontValueCenterHFactor: " + boolToStr(Font::scaleFontValueCenterHFactor);
strInternalInfo += "\nscaleFontValue: " + floatToStr(Font::scaleFontValue);
strInternalInfo += "\nscaleFontValueCenterHFactor: " + floatToStr(Font::scaleFontValueCenterHFactor);
strInternalInfo += "\nlangHeightText: " + Font::langHeightText;
strInternalInfo += "\nAllowAltEnterFullscreenToggle: " + boolToStr(Window::getAllowAltEnterFullscreenToggle());
strInternalInfo += "\nTryVSynch: " + boolToStr(Window::getTryVSynch());

View File

@ -2059,7 +2059,7 @@ void Faction::loadGame(const XmlNode *rootNode, int factionIndex,GameSettings *s
// int startLocationIndex;
startLocationIndex = factionNode->getAttribute("startLocationIndex")->getIntValue();
// bool thisFaction;
thisFaction = factionNode->getAttribute("thisFaction")->getIntValue();
thisFaction = factionNode->getAttribute("thisFaction")->getIntValue() != 0;
// bool factionDisconnectHandled;
// for(std::map<Vec2i,int>::iterator iterMap = cacheResourceTargetList.begin();
@ -2089,7 +2089,7 @@ void Faction::loadGame(const XmlNode *rootNode, int factionIndex,GameSettings *s
XmlNode *cachedCloseResourceTargetLookupListNode = cachedCloseResourceTargetLookupListNodeList[i];
Vec2i vec = Vec2i::strToVec2(cachedCloseResourceTargetLookupListNode->getAttribute("key")->getValue());
cachedCloseResourceTargetLookupList[vec] = cachedCloseResourceTargetLookupListNode->getAttribute("value")->getIntValue();
cachedCloseResourceTargetLookupList[vec] = cachedCloseResourceTargetLookupListNode->getAttribute("value")->getIntValue() != 0;
}
// RandomGen random;

View File

@ -283,7 +283,7 @@ void Object::loadGame(const XmlNode *rootNode,const TechTree *techTree) {
// Vec2i mapPos;
mapPos = Vec2i::strToVec2(objectNode->getAttribute("mapPos")->getValue());
// bool visible;
visible = objectNode->getAttribute("visible")->getIntValue();
visible = objectNode->getAttribute("visible")->getIntValue() != 0;
}
}}//end namespace

View File

@ -3943,11 +3943,11 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
result->animationRandomCycleCount = unitNode->getAttribute("animationRandomCycleCount")->getIntValue();
//
// bool toBeUndertaken;
result->toBeUndertaken = unitNode->getAttribute("toBeUndertaken")->getIntValue();
result->toBeUndertaken = unitNode->getAttribute("toBeUndertaken")->getIntValue() != 0;
// bool alive;
result->alive = unitNode->getAttribute("alive")->getIntValue();
result->alive = unitNode->getAttribute("alive")->getIntValue() != 0;
// bool showUnitParticles;
result->showUnitParticles = unitNode->getAttribute("showUnitParticles")->getIntValue();
result->showUnitParticles = unitNode->getAttribute("showUnitParticles")->getIntValue() != 0;
// Faction *faction;
// ParticleSystem *fire;
// if(fire != NULL) {
@ -4153,7 +4153,7 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
// int lastRenderFrame;
result->lastRenderFrame = unitNode->getAttribute("lastRenderFrame")->getIntValue();
// bool visible;
result->visible = unitNode->getAttribute("visible")->getIntValue();
result->visible = unitNode->getAttribute("visible")->getIntValue() != 0;
// int retryCurrCommandCount;
result->retryCurrCommandCount = unitNode->getAttribute("retryCurrCommandCount")->getIntValue();
// Vec3f screenPos;
@ -4162,7 +4162,7 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
result->currentUnitTitle = unitNode->getAttribute("currentUnitTitle")->getValue();
//
// bool inBailOutAttempt;
result->inBailOutAttempt = unitNode->getAttribute("inBailOutAttempt")->getIntValue();
result->inBailOutAttempt = unitNode->getAttribute("inBailOutAttempt")->getIntValue() != 0;
// //std::vector<std::pair<Vec2i,Chrono> > badHarvestPosList;
// std::map<Vec2i,int> badHarvestPosList;
// for(std::map<Vec2i,int>::const_iterator iterMap = badHarvestPosList.begin();
@ -4187,7 +4187,7 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
// static Game *game;
//
// bool ignoreCheckCommand;
result->ignoreCheckCommand = unitNode->getAttribute("ignoreCheckCommand")->getIntValue();
result->ignoreCheckCommand = unitNode->getAttribute("ignoreCheckCommand")->getIntValue() != 0;
// uint32 lastStuckFrame;
result->lastStuckFrame = unitNode->getAttribute("lastStuckFrame")->getIntValue();
// Vec2i lastStuckPos;
@ -4197,7 +4197,7 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
// Vec2i lastPathfindFailedPos;
result->lastPathfindFailedPos = Vec2i::strToVec2(unitNode->getAttribute("lastPathfindFailedPos")->getValue());
// bool usePathfinderExtendedMaxNodes;
result->usePathfinderExtendedMaxNodes = unitNode->getAttribute("usePathfinderExtendedMaxNodes")->getIntValue();
result->usePathfinderExtendedMaxNodes = unitNode->getAttribute("usePathfinderExtendedMaxNodes")->getIntValue() != 0;
// int maxQueuedCommandDisplayCount;
result->maxQueuedCommandDisplayCount = unitNode->getAttribute("maxQueuedCommandDisplayCount")->getIntValue();
// UnitAttackBoostEffectOriginator currentAttackBoostOriginatorEffect;
@ -4214,7 +4214,7 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
// //static std::map<void *,bool> deletedUnits;
//
// bool changedActiveCommand;
result->changedActiveCommand = unitNode->getAttribute("changedActiveCommand")->getIntValue();
result->changedActiveCommand = unitNode->getAttribute("changedActiveCommand")->getIntValue() != 0;
// int lastAttackerUnitId;
result->lastAttackerUnitId = unitNode->getAttribute("lastAttackerUnitId")->getIntValue();
// int lastAttackedUnitId;

View File

@ -1093,7 +1093,7 @@ void TotalUpgrade::loadGame(const XmlNode *rootNode) {
// int maxHp;
maxHp = upgradeTypeBaseNode->getAttribute("maxHp")->getIntValue();
// bool maxHpIsMultiplier;
maxHpIsMultiplier = upgradeTypeBaseNode->getAttribute("maxHpIsMultiplier")->getIntValue();
maxHpIsMultiplier = upgradeTypeBaseNode->getAttribute("maxHpIsMultiplier")->getIntValue() != 0;
// int maxHpRegeneration;
maxHpRegeneration = upgradeTypeBaseNode->getAttribute("maxHpRegeneration")->getIntValue();
// //bool maxHpRegenerationIsMultiplier;
@ -1101,22 +1101,22 @@ void TotalUpgrade::loadGame(const XmlNode *rootNode) {
// int sight;
sight = upgradeTypeBaseNode->getAttribute("sight")->getIntValue();
// bool sightIsMultiplier;
sightIsMultiplier = upgradeTypeBaseNode->getAttribute("sightIsMultiplier")->getIntValue();
sightIsMultiplier = upgradeTypeBaseNode->getAttribute("sightIsMultiplier")->getIntValue() != 0;
// int maxEp;
maxEp = upgradeTypeBaseNode->getAttribute("maxEp")->getIntValue();
// bool maxEpIsMultiplier;
maxEpIsMultiplier = upgradeTypeBaseNode->getAttribute("maxEpIsMultiplier")->getIntValue();
maxEpIsMultiplier = upgradeTypeBaseNode->getAttribute("maxEpIsMultiplier")->getIntValue() != 0;
// int maxEpRegeneration;
maxEpRegeneration = upgradeTypeBaseNode->getAttribute("maxEpRegeneration")->getIntValue();
// //bool maxEpRegenerationIsMultiplier;
// int armor;
armor = upgradeTypeBaseNode->getAttribute("armor")->getIntValue();
// bool armorIsMultiplier;
armorIsMultiplier = upgradeTypeBaseNode->getAttribute("armorIsMultiplier")->getIntValue();
armorIsMultiplier = upgradeTypeBaseNode->getAttribute("armorIsMultiplier")->getIntValue() != 0;
// int attackStrength;
attackStrength = upgradeTypeBaseNode->getAttribute("attackStrength")->getIntValue();
// bool attackStrengthIsMultiplier;
attackStrengthIsMultiplier = upgradeTypeBaseNode->getAttribute("attackStrengthIsMultiplier")->getIntValue();
attackStrengthIsMultiplier = upgradeTypeBaseNode->getAttribute("attackStrengthIsMultiplier")->getIntValue() != 0;
// std::map<string,int> attackStrengthMultiplierValueList;
vector<XmlNode *> attackStrengthMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("attackStrengthMultiplierValueList");
for(unsigned int i = 0; i < attackStrengthMultiplierValueNodeList.size(); ++i) {
@ -1128,7 +1128,7 @@ void TotalUpgrade::loadGame(const XmlNode *rootNode) {
// int attackRange;
attackRange = upgradeTypeBaseNode->getAttribute("attackRange")->getIntValue();
// bool attackRangeIsMultiplier;
attackRangeIsMultiplier = upgradeTypeBaseNode->getAttribute("attackRangeIsMultiplier")->getIntValue();
attackRangeIsMultiplier = upgradeTypeBaseNode->getAttribute("attackRangeIsMultiplier")->getIntValue() != 0;
// std::map<string,int> attackRangeMultiplierValueList;
vector<XmlNode *> attackRangeMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("attackRangeMultiplierValueList");
for(unsigned int i = 0; i < attackRangeMultiplierValueNodeList.size(); ++i) {
@ -1141,7 +1141,7 @@ void TotalUpgrade::loadGame(const XmlNode *rootNode) {
// int moveSpeed;
moveSpeed = upgradeTypeBaseNode->getAttribute("moveSpeed")->getIntValue();
// bool moveSpeedIsMultiplier;
moveSpeedIsMultiplier = upgradeTypeBaseNode->getAttribute("moveSpeedIsMultiplier")->getIntValue();
moveSpeedIsMultiplier = upgradeTypeBaseNode->getAttribute("moveSpeedIsMultiplier")->getIntValue() != 0;
// std::map<string,int> moveSpeedIsMultiplierValueList;
vector<XmlNode *> moveSpeedIsMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("moveSpeedIsMultiplierValueList");
for(unsigned int i = 0; i < moveSpeedIsMultiplierValueNodeList.size(); ++i) {
@ -1154,7 +1154,7 @@ void TotalUpgrade::loadGame(const XmlNode *rootNode) {
// int prodSpeed;
prodSpeed = upgradeTypeBaseNode->getAttribute("prodSpeed")->getIntValue();
// bool prodSpeedIsMultiplier;
prodSpeedIsMultiplier = upgradeTypeBaseNode->getAttribute("prodSpeedIsMultiplier")->getIntValue();
prodSpeedIsMultiplier = upgradeTypeBaseNode->getAttribute("prodSpeedIsMultiplier")->getIntValue() != 0;
// std::map<string,int> prodSpeedProduceIsMultiplierValueList;
vector<XmlNode *> prodSpeedProduceIsMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("prodSpeedProduceIsMultiplierValueList");
for(unsigned int i = 0; i < prodSpeedProduceIsMultiplierValueNodeList.size(); ++i) {

View File

@ -1997,7 +1997,7 @@ void Map::loadGame(const XmlNode *rootNode, World *world) {
for(unsigned int k = 0; k < tokensExploredValue.size(); ++k) {
string value = tokensExploredValue[k];
surfaceCell.setExplored(k,strToInt(value));
surfaceCell.setExplored(k,strToInt(value) != 0);
}
surfaceCellIndexExplored++;
}
@ -2020,7 +2020,7 @@ void Map::loadGame(const XmlNode *rootNode, World *world) {
for(unsigned int k = 0; k < tokensVisibleValue.size(); ++k) {
string value = tokensVisibleValue[k];
surfaceCell.setVisible(k,strToInt(value));
surfaceCell.setVisible(k,strToInt(value) != 0);
}
surfaceCellIndexVisible++;
}

View File

@ -144,7 +144,7 @@ void TimeFlow::saveGame(XmlNode *rootNode) {
void TimeFlow::loadGame(const XmlNode *rootNode) {
const XmlNode *timeflowNode = rootNode->getChild("TimeFlow");
firstTime = timeflowNode->getAttribute("firstTime")->getFloatValue();
firstTime = timeflowNode->getAttribute("firstTime")->getFloatValue() != 0;
time = timeflowNode->getAttribute("time")->getFloatValue();
lastTime = timeflowNode->getAttribute("lastTime")->getFloatValue();
timeInc = timeflowNode->getAttribute("timeInc")->getFloatValue();

View File

@ -1480,21 +1480,21 @@ void World::initFactionTypes(GameSettings *gs) {
safeMutex.ReleaseLock();
// //config
// bool fogOfWarOverride;
fogOfWarOverride = loadWorldNode->getAttribute("fogOfWarOverride")->getIntValue();
fogOfWarOverride = loadWorldNode->getAttribute("fogOfWarOverride")->getIntValue() != 0;
// bool fogOfWar;
fogOfWar = loadWorldNode->getAttribute("fogOfWar")->getIntValue();
fogOfWar = loadWorldNode->getAttribute("fogOfWar")->getIntValue() != 0;
// int fogOfWarSmoothingFrameSkip;
fogOfWarSmoothingFrameSkip = loadWorldNode->getAttribute("fogOfWarSmoothingFrameSkip")->getIntValue();
// bool fogOfWarSmoothing;
fogOfWarSmoothing = loadWorldNode->getAttribute("fogOfWarSmoothing")->getIntValue();
fogOfWarSmoothing = loadWorldNode->getAttribute("fogOfWarSmoothing")->getIntValue() != 0;
// Game *game;
// Chrono chronoPerfTimer;
// bool perfTimerEnabled;
//
// bool unitParticlesEnabled;
unitParticlesEnabled = loadWorldNode->getAttribute("unitParticlesEnabled")->getIntValue();
unitParticlesEnabled = loadWorldNode->getAttribute("unitParticlesEnabled")->getIntValue() != 0;
// bool staggeredFactionUpdates;
staggeredFactionUpdates = loadWorldNode->getAttribute("staggeredFactionUpdates")->getIntValue();
staggeredFactionUpdates = loadWorldNode->getAttribute("staggeredFactionUpdates")->getIntValue() != 0;
// std::map<string,StaticSound *> staticSoundList;
// std::map<string,StrSound *> streamSoundList;
//
@ -1503,7 +1503,7 @@ void World::initFactionTypes(GameSettings *gs) {
// string queuedScenarioName;
queuedScenarioName = loadWorldNode->getAttribute("queuedScenarioName")->getValue();
// bool queuedScenarioKeepFactions;
queuedScenarioKeepFactions = loadWorldNode->getAttribute("queuedScenarioKeepFactions")->getIntValue();
queuedScenarioKeepFactions = loadWorldNode->getAttribute("queuedScenarioKeepFactions")->getIntValue() != 0;
}
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);

View File

@ -272,8 +272,8 @@ inline T truncateDecimal(const T &value, int precision=6) {
int iSigned = value >= 0 ? 1: -1;
#ifdef USE_STREFLOP
unsigned int uiTemp = (value * streflop::pow((streflop::Simple)10, (streflop::Simple)precision)) * iSigned; //Note I'm using unsigned int so that I can increase the precision of the truncate
T result = (((double)uiTemp) / streflop::pow((streflop::Simple)10,(streflop::Simple)precision) * iSigned);
unsigned int uiTemp = (unsigned int)(value * streflop::pow((streflop::Simple)10, (streflop::Simple)precision)) * iSigned; //Note I'm using unsigned int so that I can increase the precision of the truncate
T result = (((T)uiTemp) / streflop::pow((streflop::Simple)10,(streflop::Simple)precision) * iSigned);
#else
unsigned int uiTemp = (value * pow((T)10, precision)) * iSigned; //Note I'm using unsigned int so that I can increase the precision of the truncate
T result = (((double)uiTemp) / pow((T)10,precision) * iSigned);

View File

@ -26,7 +26,7 @@ namespace Shared{ namespace Platform{
LPWSTR Ansi2WideString(LPCSTR lpaszString);
std::string utf8_encode(const std::wstring wstr);
std::wstring utf8_decode(const std::string str);
std::wstring utf8_decode(const std::string &str);
class megaglest_runtime_error : public runtime_error {
public:

View File

@ -421,9 +421,9 @@ void ParticleSystem::loadGame(const XmlNode *rootNode) {
// State state;
state = static_cast<State>(particleSystemNode->getAttribute("state")->getIntValue());
// bool active;
active = particleSystemNode->getAttribute("active")->getIntValue();
active = particleSystemNode->getAttribute("active")->getIntValue() != 0;
// bool visible;
visible = particleSystemNode->getAttribute("visible")->getIntValue();
visible = particleSystemNode->getAttribute("visible")->getIntValue() != 0;
// int aliveParticleCount;
aliveParticleCount = particleSystemNode->getAttribute("aliveParticleCount")->getIntValue();
// int particleCount;
@ -461,9 +461,9 @@ void ParticleSystem::loadGame(const XmlNode *rootNode) {
// Vec3f factionColor;
factionColor = Vec3f::strToVec3(particleSystemNode->getAttribute("factionColor")->getValue());
// bool teamcolorNoEnergy;
teamcolorNoEnergy = particleSystemNode->getAttribute("teamcolorNoEnergy")->getIntValue();
teamcolorNoEnergy = particleSystemNode->getAttribute("teamcolorNoEnergy")->getIntValue() != 0;
// bool teamcolorEnergy;
teamcolorEnergy = particleSystemNode->getAttribute("teamcolorEnergy")->getIntValue();
teamcolorEnergy = particleSystemNode->getAttribute("teamcolorEnergy")->getIntValue() != 0;
// int alternations;
alternations = particleSystemNode->getAttribute("alternations")->getIntValue();
// int particleSystemStartDelay;
@ -1091,7 +1091,7 @@ void UnitParticleSystem::updateParticle(Particle *p){
float energyRatio;
if(alternations > 0){
int interval= (maxParticleEnergy / alternations);
float moduloValue= static_cast<int> (static_cast<float> (p->energy)) % interval;
float moduloValue= (float)((int)(static_cast<float> (p->energy)) % interval);
if(moduloValue < interval / 2){
energyRatio= (interval - moduloValue) / interval;
@ -1237,17 +1237,17 @@ void UnitParticleSystem::loadGame(const XmlNode *rootNode) {
// Vec3f oldPosition;
oldPosition = Vec3f::strToVec3(unitParticleSystemNode->getAttribute("oldPosition")->getValue());
// bool energyUp;
energyUp = unitParticleSystemNode->getAttribute("energyUp")->getIntValue();
energyUp = unitParticleSystemNode->getAttribute("energyUp")->getIntValue() != 0;
// float startTime;
startTime = unitParticleSystemNode->getAttribute("startTime")->getFloatValue();
// float endTime;
endTime = unitParticleSystemNode->getAttribute("endTime")->getFloatValue();
// bool relative;
relative = unitParticleSystemNode->getAttribute("relative")->getIntValue();
relative = unitParticleSystemNode->getAttribute("relative")->getIntValue() != 0;
// bool relativeDirection;
relativeDirection = unitParticleSystemNode->getAttribute("relativeDirection")->getIntValue();
relativeDirection = unitParticleSystemNode->getAttribute("relativeDirection")->getIntValue() != 0;
// bool fixed;
fixed = unitParticleSystemNode->getAttribute("fixed")->getIntValue();
fixed = unitParticleSystemNode->getAttribute("fixed")->getIntValue() != 0;
// Shape shape;
shape = static_cast<Shape>(unitParticleSystemNode->getAttribute("shape")->getIntValue());
// float angle;
@ -1259,13 +1259,13 @@ void UnitParticleSystem::loadGame(const XmlNode *rootNode) {
// float rotation;
rotation = unitParticleSystemNode->getAttribute("rotation")->getFloatValue();
// bool isVisibleAtNight;
isVisibleAtNight = unitParticleSystemNode->getAttribute("isVisibleAtNight")->getIntValue();
isVisibleAtNight = unitParticleSystemNode->getAttribute("isVisibleAtNight")->getIntValue() != 0;
// bool isVisibleAtDay;
isVisibleAtDay = unitParticleSystemNode->getAttribute("isVisibleAtDay")->getIntValue();
isVisibleAtDay = unitParticleSystemNode->getAttribute("isVisibleAtDay")->getIntValue() != 0;
// bool isDaylightAffected;
isDaylightAffected = unitParticleSystemNode->getAttribute("isDaylightAffected")->getIntValue();
isDaylightAffected = unitParticleSystemNode->getAttribute("isDaylightAffected")->getIntValue() != 0;
// bool radiusBasedStartenergy;
radiusBasedStartenergy = unitParticleSystemNode->getAttribute("radiusBasedStartenergy")->getIntValue();
radiusBasedStartenergy = unitParticleSystemNode->getAttribute("radiusBasedStartenergy")->getIntValue() != 0;
// int staticParticleCount;
staticParticleCount = unitParticleSystemNode->getAttribute("staticParticleCount")->getIntValue();
// int delay;

View File

@ -1002,7 +1002,7 @@ bool MapPreview::loadMapInfo(string file, MapInfo *mapInfo, string i18nMaxMapPla
// static
string MapPreview::getMapPath(const vector<string> &pathList, const string &mapName,
string scenarioDir, bool errorOnNotFound) {
for(int idx = 0; idx < pathList.size(); idx++) {
for(unsigned int idx = 0; idx < pathList.size(); idx++) {
string map_path = pathList[idx];
endPathWithSlash(map_path);
@ -1071,7 +1071,7 @@ vector<string> MapPreview::findAllValidMaps(const vector<string> &pathList,
results.clear();
MapInfo mapInfo;
for(int i= 0; i < mapFiles.size(); i++){// fetch info and put map in right list
for(unsigned int i= 0; i < mapFiles.size(); i++){// fetch info and put map in right list
//loadMapInfo(string file, MapInfo *mapInfo, string i18nMaxMapPlayersTitle,string i18nMapSizeTitle,bool errorOnInvalidMap=true);
//printf("getMapPath [%s]\nmapFiles.at(i) [%s]\nscenarioDir [%s] getUserDataOnly = %d cutExtension = %d\n",getMapPath(pathList,mapFiles.at(i), scenarioDir, false).c_str(),mapFiles.at(i).c_str(),scenarioDir.c_str(), getUserDataOnly, cutExtension);

View File

@ -70,6 +70,7 @@ getHTTPResponse(int s, int * size)
int header_buf_len = 2048;
int header_buf_used = 0;
char * content_buf;
char *content_buf_new;
int content_buf_len = 2048;
int content_buf_used = 0;
char chunksize_buf[32];
@ -234,7 +235,7 @@ getHTTPResponse(int s, int * size)
else {
content_buf_len = content_buf_used + (int)bytestocopy;
}
char *content_buf_new = (char *)realloc((void *)content_buf,
content_buf_new = (char *)realloc((void *)content_buf,
content_buf_len);
if(content_buf_new) {
content_buf = content_buf_new;
@ -261,7 +262,7 @@ getHTTPResponse(int s, int * size)
} else {
content_buf_len = content_buf_used + n;
}
char *content_buf_new = (char *)realloc((void *)content_buf,
content_buf_new = (char *)realloc((void *)content_buf,
content_buf_len);
if(content_buf_new) {
content_buf = content_buf_new;