From 9268aaf279288342a5262e53fc38586578b660bb Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 19 Nov 2013 06:14:06 +0000 Subject: [PATCH] - a few minor bug fixes related to code warnings - code cleanup based on additional gcc warnings - enabled additional gcc compiler warnings --- CMakeLists.txt | 4 +- source/g3d_viewer/main.cpp | 36 +++++-- source/glest_game/ai/ai.cpp | 2 +- source/glest_game/ai/ai_rule.cpp | 8 +- source/glest_game/ai/path_finder.cpp | 15 +-- source/glest_game/ai/path_finder.h | 2 +- source/glest_game/facilities/components.cpp | 29 +++--- source/glest_game/facilities/game_util.cpp | 2 +- source/glest_game/game/chat_manager.cpp | 24 ++--- source/glest_game/game/commander.cpp | 4 +- source/glest_game/game/console.cpp | 16 ++-- source/glest_game/game/game.cpp | 30 +++--- source/glest_game/game/game_camera.cpp | 8 +- source/glest_game/game/game_settings.h | 2 +- source/glest_game/game/script_manager.cpp | 12 +-- source/glest_game/game/stats.cpp | 4 +- source/glest_game/global/core_data.cpp | 32 +++---- source/glest_game/global/lang.cpp | 6 +- source/glest_game/graphics/renderer.cpp | 78 +++++++-------- source/glest_game/gui/gui.cpp | 2 +- source/glest_game/gui/selection.cpp | 18 ++-- source/glest_game/main/intro.cpp | 14 +-- source/glest_game/main/main.cpp | 96 +++++++++---------- source/glest_game/menu/main_menu.cpp | 6 +- source/glest_game/menu/menu_state_about.cpp | 6 +- .../menu/menu_state_connected_game.cpp | 38 ++++---- .../menu/menu_state_custom_game.cpp | 22 ++--- .../glest_game/menu/menu_state_join_game.cpp | 6 +- .../glest_game/menu/menu_state_keysetup.cpp | 6 +- .../glest_game/menu/menu_state_load_game.cpp | 4 +- .../menu/menu_state_masterserver.cpp | 12 +-- source/glest_game/menu/menu_state_mods.cpp | 22 ++--- .../menu/menu_state_options_network.cpp | 2 +- source/glest_game/menu/menu_state_root.cpp | 4 +- .../glest_game/menu/menu_state_scenario.cpp | 12 +-- .../glest_game/network/client_interface.cpp | 16 ++-- source/glest_game/network/connection_slot.cpp | 8 +- .../glest_game/network/network_interface.cpp | 4 +- source/glest_game/network/network_message.cpp | 31 +++--- source/glest_game/network/network_message.h | 12 ++- source/glest_game/network/network_types.cpp | 2 +- .../glest_game/network/server_interface.cpp | 32 +++---- source/glest_game/type_instances/faction.cpp | 48 +++++----- source/glest_game/type_instances/resource.cpp | 2 +- source/glest_game/type_instances/unit.cpp | 18 ++-- source/glest_game/type_instances/upgrade.cpp | 6 +- source/glest_game/types/command_type.cpp | 18 ++-- source/glest_game/types/damage_multiplier.cpp | 2 +- source/glest_game/types/element_type.cpp | 2 +- source/glest_game/types/faction_type.cpp | 88 ++++++++--------- source/glest_game/types/object_type.cpp | 2 +- source/glest_game/types/resource_type.cpp | 2 +- source/glest_game/types/skill_type.cpp | 22 ++--- source/glest_game/types/tech_tree.cpp | 22 ++--- source/glest_game/types/unit_type.cpp | 58 +++++------ source/glest_game/types/upgrade_type.cpp | 24 ++--- source/glest_game/world/map.cpp | 12 +-- source/glest_game/world/scenario.cpp | 10 +- source/glest_game/world/tileset.cpp | 24 +++-- source/glest_game/world/unit_updater.cpp | 8 +- source/glest_game/world/water_effects.cpp | 4 +- source/glest_game/world/world.cpp | 36 +++---- source/glest_map_editor/main.cpp | 16 ++-- .../shared_lib/include/platform/sdl/gl_wrap.h | 19 ++-- source/shared_lib/include/util/gen_uuid.h | 1 + .../shared_lib/sources/feathery_ftp/ftpCmds.c | 16 ++-- source/shared_lib/sources/graphics/font.cpp | 4 +- .../sources/graphics/gl/texture_gl.cpp | 8 +- source/shared_lib/sources/graphics/model.cpp | 2 +- .../shared_lib/sources/graphics/particle.cpp | 4 +- source/shared_lib/sources/graphics/pixmap.cpp | 31 +++--- .../sources/graphics/video_player.cpp | 50 +++++----- .../platform/common/platform_common.cpp | 16 ++-- .../platform/common/simple_threads.cpp | 8 +- .../sources/platform/posix/socket.cpp | 4 +- .../sources/platform/sdl/thread.cpp | 4 +- .../sources/platform/sdl/window.cpp | 2 +- .../sources/platform/unix/gl_wrap.cpp | 9 ++ .../sources/platform/win32/gl_wrap_billy.cpp | 4 +- source/shared_lib/sources/util/checksum.cpp | 2 +- source/shared_lib/sources/xml/xml_parser.cpp | 4 +- 81 files changed, 675 insertions(+), 626 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7369e479..392cc626 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,10 +119,10 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW) IF(NOT MINGW) # For tons of verbose warnings add: -Wall # ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -rdynamic") - ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -rdynamic") + ADD_DEFINITIONS("-Wuninitialized -Wsign-compare -Wunused-function -Wunused-variable -Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -rdynamic") ELSE() # ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -DUNICODE") - ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -DUNICODE") + ADD_DEFINITIONS("-Wuninitialized -Wsign-compare -Wunused-function -Wunused-variable -Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -DUNICODE") ENDIF() #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") diff --git a/source/g3d_viewer/main.cpp b/source/g3d_viewer/main.cpp index 7ba59452..1693be82 100644 --- a/source/g3d_viewer/main.cpp +++ b/source/g3d_viewer/main.cpp @@ -285,10 +285,16 @@ MainWindow::MainWindow( std::pair > unitToLoad, : wxFrame(NULL, -1, ToUnicode(winHeader), wxPoint(Renderer::windowX, Renderer::windowY), wxSize(Renderer::windowW, Renderer::windowH)), - model(NULL), glCanvas(NULL), renderer(NULL), - initTextureManager(true), timer(NULL), - startupSettingsInited(false), - fileDialog(NULL),colorPicker(NULL) + glCanvas(NULL), + renderer(NULL), + timer(NULL), + menu(NULL), + fileDialog(NULL), + colorPicker(NULL), + model(NULL), + initTextureManager(true), + startupSettingsInited(false) + { this->appPath = appPath; Properties::setApplicationPath(executable_path(appPath)); @@ -599,6 +605,10 @@ void MainWindow::onPaint(wxPaintEvent &event) { // dc.DestroyClippingRegion(); // } + static float autoScreenshotRender = -1; + if(autoScreenShotAndExit == true && autoScreenshotRender >= 0) { + anim = autoScreenshotRender; + } // notice that we use GetSize() here and not GetClientSize() because // the latter doesn't return correct results for the minimized windows // (at least not under Windows) @@ -613,6 +623,11 @@ void MainWindow::onPaint(wxPaintEvent &event) { viewportW = GetSize().x; viewportH = GetSize().y; + if(viewportH > 0) { + //viewportH -= menu->GetSize().y; + viewportH -= 22; + } + printf("#2 %d x %d\n",viewportW,viewportH); } @@ -622,8 +637,6 @@ void MainWindow::onPaint(wxPaintEvent &event) { renderer->reset(viewportW, viewportH, playerColor); #endif - - renderer->transform(rotX, rotY, zoom); renderer->renderGrid(); @@ -654,6 +667,7 @@ void MainWindow::onPaint(wxPaintEvent &event) { fflush(stdout); autoScreenShotAndExit = false; + saveScreenshot(); Close(); return; @@ -662,6 +676,8 @@ void MainWindow::onPaint(wxPaintEvent &event) { glCanvas->SwapBuffers(); if(autoScreenShotAndExit == true && viewportW == 0 && viewportH == 0) { + autoScreenshotRender = anim; + printf("Auto exiting desired but waiting for w x h > 0...\n"); return; @@ -1161,7 +1177,7 @@ void MainWindow::loadUnit(string path, string skillName) { const XmlNode *skillsNode= unitNode->getChild("skills"); for(unsigned int i = 0; foundSkillName == false && i < skillsNode->getChildCount(); ++i) { const XmlNode *sn= skillsNode->getChild("skill", i); - const XmlNode *typeNode= sn->getChild("type"); + //const XmlNode *typeNode= sn->getChild("type"); const XmlNode *nameNode= sn->getChild("name"); string skillXmlName = nameNode->getAttribute("value")->getRestrictedValue(); if(skillXmlName == lookipForSkillName) { @@ -1545,7 +1561,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp std::string unitXML = dir + folderDelimiter + extractFileFromDirectoryPath(dir) + ".xml"; int size = 1; - int height = 1; + //int height = 1; if(fileExists(unitXML) == true) { XmlTree xmlTree; @@ -1555,7 +1571,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp //size size= parametersNode->getChild("size")->getAttribute("value")->getIntValue(); //height - height= parametersNode->getChild("height")->getAttribute("value")->getIntValue(); + //height= parametersNode->getChild("height")->getAttribute("value")->getIntValue(); } // std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl; @@ -1582,7 +1598,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp SplashParticleSystem *ps = (*it)->create(NULL); if(size > 0) { - Vec3f vec = Vec3f(0.f, height / 2.f, 0.f); + //Vec3f vec = Vec3f(0.f, height / 2.f, 0.f); //ps->setPos(vec); //Vec3f vec2 = Vec3f(size * 2.f, height * 2.f, height * 2.f); // <------- removed relative projectile diff --git a/source/glest_game/ai/ai.cpp b/source/glest_game/ai/ai.cpp index f562509f..18796a5c 100644 --- a/source/glest_game/ai/ai.cpp +++ b/source/glest_game/ai/ai.cpp @@ -717,7 +717,7 @@ void Ai::addExpansion(const Vec2i &pos) { expansionPositions.push_front(pos); //remove expansion if queue is list is full - if(expansionPositions.size() > maxExpansions){ + if((int)expansionPositions.size() > maxExpansions){ expansionPositions.pop_back(); } } diff --git a/source/glest_game/ai/ai_rule.cpp b/source/glest_game/ai/ai_rule.cpp index d68b4195..0095086f 100644 --- a/source/glest_game/ai/ai_rule.cpp +++ b/source/glest_game/ai/ai_rule.cpp @@ -1276,7 +1276,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){ snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %u, i = %u,producers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,producers.size()); throw megaglest_runtime_error(szBuf); } - if(prIndex >= producers.size()) { + if(prIndex >= (int)producers.size()) { char szBuf[8096]=""; printf("In [%s::%s Line: %d] prIndex >= producers.size(), currentProducerIndex = %d, i = %u,producers.size() = " MG_SIZE_T_SPECIFIER " \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,producers.size()); snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= producers.size(), currentProducerIndex = %d, i = %u,producers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,producers.size()); @@ -1341,7 +1341,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){ snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,backupProducers.size()); throw megaglest_runtime_error(szBuf); } - if(prIndex >= backupProducers.size()) { + if(prIndex >= (int)backupProducers.size()) { char szBuf[8096]=""; printf("In [%s::%s Line: %d] prIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER " \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,backupProducers.size()); snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,backupProducers.size()); @@ -1613,7 +1613,7 @@ void AiRuleBuild::buildGeneric(const BuildTask *bt) { } if(aiInterface->isLogLevelEnabled(4) == true) { - for(int i = 0; i < buildings.size(); ++i) { + for(int i = 0; i < (int)buildings.size(); ++i) { char szBuf[8096]=""; snprintf(szBuf,8096,"In buildGeneric i = %d unit type: [%s]\n",i,buildings[i]->getName().c_str()); aiInterface->printLog(4, szBuf); @@ -1642,7 +1642,7 @@ void AiRuleBuild::buildBestBuilding(const vector &buildings){ if(i>0){ //Defensive buildings have priority - for(int j=0; jgetCountOfType(building)<=i+1 && isDefensive(building)) { diff --git a/source/glest_game/ai/path_finder.cpp b/source/glest_game/ai/path_finder.cpp index 1146b231..97393bab 100644 --- a/source/glest_game/ai/path_finder.cpp +++ b/source/glest_game/ai/path_finder.cpp @@ -457,6 +457,9 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu } } break; + + default: + break; } if(minorDebugPathfinderPerformance && chrono.getMillis() >= 1) printf("Unit [%d - %s] astar took [%lld] msecs, ts = %d searched_node_count = %d.\n",unit->getId(),unit->getType()->getName(false).c_str(),(long long int)chrono.getMillis(),ts,searched_node_count); @@ -570,7 +573,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout if(canMoveToCells == true) { path->clear(); - UnitPathBasic *basicPathFinder = dynamic_cast(path); + //UnitPathBasic *basicPathFinder = dynamic_cast(path); int unitPrecachePathSize = (int)faction.precachedPath[unit->getId()].size(); @@ -873,7 +876,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout path->clear(); } - UnitPathBasic *basicPathFinder = dynamic_cast(path); + //UnitPathBasic *basicPathFinder = dynamic_cast(path); currNode= firstNode; @@ -1133,11 +1136,11 @@ void PathFinder::saveGame(XmlNode *rootNode) { pathfinderNode->addAttribute("pathFindNodesMax",intToStr(pathFindNodesMax), mapTagReplacements); pathfinderNode->addAttribute("pathFindNodesAbsoluteMax",intToStr(pathFindNodesAbsoluteMax), mapTagReplacements); - for(unsigned int i = 0; i < factions.size(); ++i) { + for(unsigned int i = 0; i < (unsigned int)factions.size(); ++i) { FactionState &factionState = factions.getFactionState(i); XmlNode *factionsNode = pathfinderNode->addChild("factions"); - for(unsigned int j = 0; j < factionState.nodePool.size(); ++j) { + for(unsigned int j = 0; j < (unsigned int)factionState.nodePool.size(); ++j) { Node *curNode = &factionState.nodePool[j]; XmlNode *nodePoolNode = factionsNode->addChild("nodePool"); @@ -1160,12 +1163,12 @@ void PathFinder::loadGame(const XmlNode *rootNode) { const XmlNode *pathfinderNode = rootNode->getChild("PathFinder"); vector factionsNodeList = pathfinderNode->getChildList("factions"); - for(unsigned int i = 0; i < factionsNodeList.size(); ++i) { + for(unsigned int i = 0; i < (unsigned int)factionsNodeList.size(); ++i) { XmlNode *factionsNode = factionsNodeList[i]; FactionState &factionState = factions.getFactionState(i); vector nodePoolListNode = factionsNode->getChildList("nodePool"); - for(unsigned int j = 0; j < nodePoolListNode.size() && j < pathFindNodesAbsoluteMax; ++j) { + for(unsigned int j = 0; j < (unsigned int)nodePoolListNode.size() && j < (unsigned int)pathFindNodesAbsoluteMax; ++j) { XmlNode *nodePoolNode = nodePoolListNode[j]; Node *curNode = &factionState.nodePool[j]; diff --git a/source/glest_game/ai/path_finder.h b/source/glest_game/ai/path_finder.h index f48f72de..9d1662e4 100644 --- a/source/glest_game/ai/path_finder.h +++ b/source/glest_game/ai/path_finder.h @@ -213,7 +213,7 @@ private: TravelState aStar(Unit *unit, const Vec2i &finalPos, bool inBailout, int frameIndex, int maxNodeCount=-1,uint32 *searched_node_count=NULL); inline static Node *newNode(FactionState &faction, int maxNodeCount) { - if( faction.nodePoolCount < faction.nodePool.size() && + if( faction.nodePoolCount < (int)faction.nodePool.size() && faction.nodePoolCount < maxNodeCount) { Node *node= &(faction.nodePool[faction.nodePoolCount]); node->clear(); diff --git a/source/glest_game/facilities/components.cpp b/source/glest_game/facilities/components.cpp index 5aadf2dc..b94e3794 100644 --- a/source/glest_game/facilities/components.cpp +++ b/source/glest_game/facilities/components.cpp @@ -74,7 +74,7 @@ void GraphicComponent::clearRegisterGraphicComponent(std::string containerName, } void GraphicComponent::clearRegisterGraphicComponent(std::string containerName, std::vector objNameList) { - for(int idx = 0; idx < objNameList.size(); ++idx) { + for(int idx = 0; idx < (int)objNameList.size(); ++idx) { GraphicComponent::clearRegisterGraphicComponent(containerName, objNameList[idx]); } } @@ -387,7 +387,7 @@ void GraphicListBox::init(int x, int y, int w, int h, Vec3f textColor){ const string & GraphicListBox::getTextNativeTranslation() { if(this->translated_items.empty() == true || this->selectedItemIndex < 0 || - this->selectedItemIndex >= this->translated_items.size() || + this->selectedItemIndex >= (int)this->translated_items.size() || this->items.size() != this->translated_items.size()) { return this->text; } @@ -416,7 +416,7 @@ void GraphicListBox::setItems(const vector &items, const vector } void GraphicListBox::setSelectedItemIndex(int index, bool errorOnMissing){ - if(errorOnMissing == true && (index < 0 || index >= items.size())) { + if(errorOnMissing == true && (index < 0 || index >= (int)items.size())) { char szBuf[8096]=""; snprintf(szBuf,8096,"Index not found in listbox name: [%s] value index: %d size: %lu",this->instanceName.c_str(),index,(unsigned long)items.size()); throw megaglest_runtime_error(szBuf); @@ -505,7 +505,7 @@ void GraphicListBox::setSelectedItem(string item, bool errorOnMissing){ if(iter==items.end()) { if(errorOnMissing == true) { - for(int idx = 0; idx < items.size(); idx++) { + for(int idx = 0; idx < (int)items.size(); idx++) { SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\ninstanceName [%s] idx = %d items[idx] = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,instanceName.c_str(),idx,items[idx].c_str()); } @@ -544,7 +544,7 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) { if(advanceToItemStartingWith != "") { for(int i = selectedItemIndex - 1; i >= 0; --i) { string item = items[i]; - if(translated_items.size()>i) item=translated_items[i]; + if((int)translated_items.size() > i) item = translated_items[i]; if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) { bFound = true; selectedItemIndex = i; @@ -554,7 +554,7 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) { if(bFound == false) { for(int i = (int)items.size() - 1; i >= selectedItemIndex; --i) { string item = items[i]; - if(translated_items.size()>i) item=translated_items[i]; + if((int)translated_items.size() > i) item = translated_items[i]; //printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str()); if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) { bFound = true; @@ -574,9 +574,9 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) { else if(b2) { bool bFound = false; if(advanceToItemStartingWith != "") { - for(int i = selectedItemIndex + 1; i < items.size(); ++i) { + for(int i = selectedItemIndex + 1; i < (int)items.size(); ++i) { string item = items[i]; - if(translated_items.size()>i) item=translated_items[i]; + if((int)translated_items.size() > i) item = translated_items[i]; //printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str()); if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) { bFound = true; @@ -587,7 +587,7 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) { if(bFound == false) { for(int i = 0; i <= selectedItemIndex; ++i) { string item = items[i]; - if(translated_items.size()>i) item=translated_items[i]; + if((int)translated_items.size() > i) item = translated_items[i]; //printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str()); if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) { bFound = true; @@ -600,7 +600,7 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) { if(bFound == false) { selectedItemIndex++; } - if(selectedItemIndex>=items.size()){ + if(selectedItemIndex >= (int)items.size()) { selectedItemIndex=0; } } @@ -789,11 +789,14 @@ bool GraphicCheckBox::mouseMove(int x, int y){ bool GraphicCheckBox::mouseClick(int x, int y){ bool result=GraphicComponent::mouseClick( x, y); - if(result) - if(value) + if(result == true) { + if(value) { value=false; - else + } + else { value=true; + } + } return result; } diff --git a/source/glest_game/facilities/game_util.cpp b/source/glest_game/facilities/game_util.cpp index 4096266f..eb1167e5 100644 --- a/source/glest_game/facilities/game_util.cpp +++ b/source/glest_game/facilities/game_util.cpp @@ -245,7 +245,7 @@ string formatString(string str) { } bool afterSeparator= false; - for(int i= 0; igetGameSettings(); - for(unsigned int factionIndex = 0; factionIndex < settings->getFactionCount(); ++factionIndex) { + for(unsigned int factionIndex = 0; factionIndex < (unsigned int)settings->getFactionCount(); ++factionIndex) { string playerName = settings->getNetworkPlayerName(factionIndex); if(playerName.length() > autoCompleteName.length() && StartsWith(toLower(playerName), toLower(autoCompleteName)) == true) { @@ -217,7 +217,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) { } if(matchedIndexes.empty() == false) { int newMatchedIndex = -1; - for(unsigned int index = 0; index < matchedIndexes.size(); ++index) { + for(unsigned int index = 0; index < (unsigned int)matchedIndexes.size(); ++index) { int possibleMatchIndex = matchedIndexes[index]; if(replaceCurrentAutoCompleteName < 0 || (replaceCurrentAutoCompleteName >= 0 && possibleMatchIndex > replaceCurrentAutoCompleteName)) { @@ -226,7 +226,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) { } } if(newMatchedIndex < 0) { - for(unsigned int index = 0; index < matchedIndexes.size(); ++index) { + for(unsigned int index = 0; index < (unsigned int)matchedIndexes.size(); ++index) { int possibleMatchIndex = matchedIndexes[index]; if(replaceCurrentAutoCompleteName < 0 || (replaceCurrentAutoCompleteName >= 0 && possibleMatchIndex < replaceCurrentAutoCompleteName)) { @@ -244,7 +244,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) { if(autoCompleteResult == "") { replaceCurrentAutoCompleteName = -1; matchedIndexes.clear(); - for(unsigned int index = 0; index < autoCompleteTextList.size(); ++index) { + for(unsigned int index = 0; index < (unsigned int)autoCompleteTextList.size(); ++index) { string autoText = autoCompleteTextList[index]; //printf("CHECKING #2 autoText.length() = %d [%s] autoCompleteName.length() = %d [%s]\n",autoText.length(),autoText.c_str(),autoCompleteName.length(),currentAutoCompleteName.c_str()); @@ -265,7 +265,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) { } if(matchedIndexes.empty() == false) { int newMatchedIndex = -1; - for(unsigned int index = 0; index < matchedIndexes.size(); ++index) { + for(unsigned int index = 0; index < (unsigned int)matchedIndexes.size(); ++index) { int possibleMatchIndex = matchedIndexes[index]; if(replaceCurrentAutoCompleteName < 0 || (replaceCurrentAutoCompleteName >= 0 && possibleMatchIndex > replaceCurrentAutoCompleteName)) { @@ -274,7 +274,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) { } } if(newMatchedIndex < 0) { - for(unsigned int index = 0; index < matchedIndexes.size(); ++index) { + for(unsigned int index = 0; index < (unsigned int)matchedIndexes.size(); ++index) { int possibleMatchIndex = matchedIndexes[index]; if(replaceCurrentAutoCompleteName < 0 || (replaceCurrentAutoCompleteName >= 0 && possibleMatchIndex < replaceCurrentAutoCompleteName)) { @@ -327,7 +327,7 @@ void ChatManager::keyPress(SDL_KeyboardEvent c) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,c.keysym.sym,c.keysym.sym); int maxTextLenAllowed = (customCB != NULL ? this->maxCustomTextLength : maxTextLenght); - if(editEnabled && text.size() < maxTextLenAllowed) { + if(editEnabled && (int)text.size() < maxTextLenAllowed) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,c.keysym.sym,c.keysym.sym); //space is the first meaningful code wchar_t key = extractKeyPressedUnicode(c); @@ -350,15 +350,15 @@ void ChatManager::switchOnEdit(CustomInputCallbackInterface *customCB,int maxCus } void ChatManager::deleteText(int deleteCount,bool addToAutoCompleteBuffer) { - if(text.empty() == false) { - for(unsigned int i = 0; i < deleteCount; ++i) { + if(text.empty() == false && deleteCount >= 0) { + for(unsigned int i = 0; i < (unsigned int)deleteCount; ++i) { if(textCharLength.empty() == false) { //printf("BEFORE DEL textCharLength.size() = %d textCharLength[textCharLength.size()-1] = %d text.length() = %d\n",textCharLength.size(),textCharLength[textCharLength.size()-1],text.length()); if(textCharLength[textCharLength.size()-1] > (int)text.length()) { textCharLength[(int)textCharLength.size()-1] = (int)text.length(); } - for(unsigned int i = 0; i < textCharLength[textCharLength.size()-1]; ++i) { + for(unsigned int i = 0; i < (unsigned int)textCharLength[textCharLength.size()-1]; ++i) { text.erase(text.end() -1); } //printf("AFTER DEL textCharLength.size() = %d textCharLength[textCharLength.size()-1] = %d text.length() = %d\n",textCharLength.size(),textCharLength[textCharLength.size()-1],text.length()); @@ -428,7 +428,7 @@ void ChatManager::updateAutoCompleteBuffer() { void ChatManager::addText(string text) { int maxTextLenAllowed = (customCB != NULL ? this->maxCustomTextLength : maxTextLenght); - if(editEnabled && text.size() + this->text.size() < maxTextLenAllowed) { + if(editEnabled && (int)text.size() + (int)this->text.size() < maxTextLenAllowed) { this->text += text; } } @@ -447,7 +447,7 @@ void ChatManager::updateNetwork() { Lang &lang= Lang::getInstance(); std::vector chatList = gameNetworkInterface->getChatTextList(true); - for(int idx = 0; idx < chatList.size(); idx++) { + for(int idx = 0; idx < (int)chatList.size(); idx++) { const ChatMsgInfo msg = chatList[idx]; int teamIndex= msg.chatTeamIndex; diff --git a/source/glest_game/game/commander.cpp b/source/glest_game/game/commander.cpp index f7a4ade0..1d6ddbea 100644 --- a/source/glest_game/game/commander.cpp +++ b/source/glest_game/game/commander.cpp @@ -433,7 +433,7 @@ std::pair Commander::computeResult(const CommandResultCont case 1: return results.front(); default: - for(int i = 0; i < results.size(); ++i) { + for(int i = 0; i < (int)results.size(); ++i) { if(results[i].first != crSuccess) { return std::pair(crSomeFailed,results[i].second); } @@ -502,7 +502,7 @@ bool Commander::getReplayCommandListForFrame(int worldFrameCount) { replayCommandList.erase(replayCommandList.begin(),replayCommandList.begin() + replayList.size()); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("worldFrameCount = %d GIVING COMMANDS replayList.size() = " MG_SIZE_T_SPECIFIER "\n",worldFrameCount,replayList.size()); - for(int i= 0; i < replayList.size(); ++i){ + for(int i= 0; i < (int)replayList.size(); ++i){ giveNetworkCommand(&replayList[i]); } GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface(); diff --git a/source/glest_game/game/console.cpp b/source/glest_game/game/console.cpp index d6ca0224..c3b86a45 100644 --- a/source/glest_game/game/console.cpp +++ b/source/glest_game/game/console.cpp @@ -108,12 +108,12 @@ void Console::addLine(string line, bool playSound, int playerIndex, Vec3f textCo storedLines.clear(); } lines.insert(lines.begin(), info); - if(lines.size() > maxLines) { + if((int)lines.size() > maxLines) { lines.pop_back(); } if(onlyChatMessagesInStoredLines==false || info.PlayerIndex!=-1) { storedLines.insert(storedLines.begin(), info); - if(storedLines.size() > maxStoredLines) { + if((int)storedLines.size() > maxStoredLines) { storedLines.pop_back(); } } @@ -144,11 +144,11 @@ void Console::addLine(string line, bool playSound, string playerName, Vec3f text //printf("info.PlayerIndex = %d, line [%s]\n",info.PlayerIndex,info.originalPlayerName.c_str()); lines.insert(lines.begin(), info); - if(lines.size() > maxLines) { + if((int)lines.size() > maxLines) { lines.pop_back(); } storedLines.insert(storedLines.begin(), info); - if(storedLines.size() > maxStoredLines) { + if((int)storedLines.size() > maxStoredLines) { storedLines.pop_back(); } } @@ -181,25 +181,25 @@ bool Console::isEmpty() { } string Console::getLine(int i) const { - if(i < 0 || i >= lines.size()) + if(i < 0 || i >= (int)lines.size()) throw megaglest_runtime_error("i >= Lines.size()"); return lines[i].text; } string Console::getStoredLine(int i) const { - if(i < 0 || i >= storedLines.size()) + if(i < 0 || i >= (int)storedLines.size()) throw megaglest_runtime_error("i >= storedLines.size()"); return storedLines[i].text; } ConsoleLineInfo Console::getLineItem(int i) const { - if(i < 0 || i >= lines.size()) + if(i < 0 || i >= (int)lines.size()) throw megaglest_runtime_error("i >= Lines.size()"); return lines[i]; } ConsoleLineInfo Console::getStoredLineItem(int i) const { - if(i < 0 || i >= storedLines.size()) + if(i < 0 || i >= (int)storedLines.size()) throw megaglest_runtime_error("i >= storedLines.size()"); return storedLines[i]; } diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index 5b0696d5..e65970e3 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -618,8 +618,8 @@ string Game::extractFactionLogoFile(bool &loadingImageUsed, string factionName, } else { Config &config = Config::getInstance(); - vector pathList=config.getPathListForType(ptTechs,scenarioDir); - for(int idx = 0; idx < pathList.size(); idx++) { + vector pathList = config.getPathListForType(ptTechs,scenarioDir); + for(int idx = 0; idx < (int)pathList.size(); idx++) { string currentPath = pathList[idx]; endPathWithSlash(currentPath); //string path = currentPath + techName + "/" + "factions" + "/" + settings->getFactionTypeName(i); @@ -642,7 +642,7 @@ string Game::extractFactionLogoFile(bool &loadingImageUsed, string factionName, int bestMinHeightDiff = INT_MAX; // Now find the best texture for our screen // Texture2D *result = preloadTexture(logoFilename); - for(unsigned int logoIndex = 0; logoIndex < loadScreenList.size(); ++logoIndex) { + for(unsigned int logoIndex = 0; logoIndex < (unsigned int)loadScreenList.size(); ++logoIndex) { string factionLogo = path + loadScreenList[logoIndex]; if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] looking for loading screen '%s'\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,factionLogo.c_str()); @@ -786,7 +786,7 @@ string Game::extractTechLogoFile(string scenarioDir, string techName, if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Searching for tech loading screen\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); Config &config = Config::getInstance(); vector pathList = config.getPathListForType(ptTechs, scenarioDir); - for(int idx = 0; idx < pathList.size(); idx++) { + for(int idx = 0; idx < (int)pathList.size(); idx++) { string currentPath = pathList[idx]; endPathWithSlash(currentPath); string path = currentPath + techName; @@ -838,7 +838,7 @@ void Game::loadHudTexture(const GameSettings *settings) bool hudFound = false; Config &config= Config::getInstance(); vector pathList= config.getPathListForType(ptTechs, scenarioDir); - for(int idx= 0; hudFound == false && idx < pathList.size(); idx++){ + for(int idx= 0; hudFound == false && idx < (int)pathList.size(); idx++){ string currentPath= pathList[idx]; endPathWithSlash(currentPath); @@ -847,7 +847,7 @@ void Game::loadHudTexture(const GameSettings *settings) endPathWithSlash(path); findAll(path + GameConstants::HUD_SCREEN_FILE_FILTER, hudList, false, false); if(hudList.empty() == false){ - for(unsigned int hudIdx = 0; hudFound == false && hudIdx < hudList.size(); ++hudIdx) { + for(unsigned int hudIdx = 0; hudFound == false && hudIdx < (unsigned int)hudList.size(); ++hudIdx) { string hudImageFileName= path + hudList[hudIdx]; if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] looking for a HUD [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,hudImageFileName.c_str()); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) @@ -934,13 +934,13 @@ vector Game::processTech(string techName) { vector factions; vector techPaths = Config::getInstance().getPathListForType(ptTechs); - for(int idx = 0; idx < techPaths.size(); idx++) { + for(int idx = 0; idx < (int)techPaths.size(); idx++) { string &techPath = techPaths[idx]; endPathWithSlash(techPath); findAll(techPath + techName + "/factions/*.", factions, false, false); if(factions.empty() == false) { - for(unsigned int factionIdx = 0; factionIdx < factions.size(); ++factionIdx) { + for(unsigned int factionIdx = 0; factionIdx < (unsigned int)factions.size(); ++factionIdx) { bool loadingImageUsed = false; string currentFactionName_factionPreview = factions[factionIdx]; @@ -1877,7 +1877,7 @@ void Game::update() { if(receivedTooEarlyInFrames[index]==-1){ // we need to check if we already received something for next frame - if(lastNetworkFrameFromServer > 0 && lastNetworkFrameFromServer > world.getFrameCount()) { + if(lastNetworkFrameFromServer > 0 && lastNetworkFrameFromServer > (uint64)world.getFrameCount()) { receivedTooEarlyInFrames[index]= lastNetworkFrameFromServer-world.getFrameCount(); } } @@ -3426,7 +3426,7 @@ void Game::tick() { int Game::getFirstUnusedTeamNumber() { std::map uniqueTeamNumbersUsed; - for(unsigned int i = 0; i < world.getFactionCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)world.getFactionCount(); ++i) { Faction *faction = world.getFaction(i); uniqueTeamNumbersUsed[faction->getTeam()]=true; } @@ -3669,7 +3669,7 @@ void Game::mouseDownLeft(int x, int y) { switchTeamIndexMap.clear(); std::map uniqueTeamNumbersUsed; std::vector menuItems; - for(unsigned int i = 0; i < world.getFactionCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)world.getFactionCount(); ++i) { Faction *faction = world.getFaction(i); if(faction->getPersonalityType() != fpt_Observer && @@ -3718,7 +3718,7 @@ void Game::mouseDownLeft(int x, int y) { } disconnectPlayerIndexMap.clear(); std::vector menuItems; - for(unsigned int i = 0; i < world.getFactionCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)world.getFactionCount(); ++i) { Faction *faction = world.getFaction(i); //printf("faction->getPersonalityType() = %d index [%d,%d] control [%d] networkstatus [%d]\n",faction->getPersonalityType(),world.getThisFaction()->getIndex(),faction->getIndex(),faction->getControlType(),this->gameSettings.getNetworkPlayerStatuses(i)); @@ -4058,7 +4058,7 @@ void Game::mouseDownLeft(int x, int y) { Vec2i screenPos(x,y-60); Renderer &renderer= Renderer::getInstance(); renderer.computePosition(screenPos, targetPos); - Vec2i surfaceCellPos = map->toSurfCoords(targetPos); + //Vec2i surfaceCellPos = map->toSurfCoords(targetPos); MarkedCell mc(targetPos,world.getThisFaction(),"none",world.getThisFaction()->getStartLocationIndex()); @@ -5285,7 +5285,7 @@ string Game::getDebugStats(std::map &factionDebugInfo) { if(this->masterserverMode == false) { Renderer &renderer= Renderer::getInstance(); Quad2i visibleQuad= renderer.getVisibleQuad(); - Quad2i visibleQuadCamera= renderer.getVisibleQuadFromCamera(); + //Quad2i visibleQuadCamera= renderer.getVisibleQuadFromCamera(); str+= "Visible quad: "; for(int i= 0; i<4; ++i){ @@ -6577,7 +6577,7 @@ void Game::loadGame(string name,Program *programPtr,bool isMasterserverMode,cons minimapNode->clearChild("fowPixmap1"); NetworkManager &networkManager= NetworkManager::getInstance(); - NetworkRole role = networkManager.getNetworkRole(); + //NetworkRole role = networkManager.getNetworkRole(); ClientInterface *clientInterface = dynamic_cast(networkManager.getClientInterface()); for(int i= 0; iwrapCount && str[i]==' '){ - returnString+= '\n'; + for(int i= 0; i < (int)str.size(); ++i){ + if(letterCount>wrapCount && str[i]==' ') { + returnString += '\n'; letterCount= 0; } else { - returnString+= str[i]; + returnString += str[i]; } ++letterCount; } @@ -1296,7 +1296,7 @@ void ScriptManager::unregisterCellTriggerEvent(int eventId) { if(inCellTriggerEvent == false) { if(unRegisterCellTriggerEventList.empty() == false) { - for(int i = 0; i < unRegisterCellTriggerEventList.size(); ++i) { + for(int i = 0; i < (int)unRegisterCellTriggerEventList.size(); ++i) { int delayedEventId = unRegisterCellTriggerEventList[i]; if(CellTriggerEventList.find(delayedEventId) != CellTriggerEventList.end()) { CellTriggerEventList.erase(delayedEventId); diff --git a/source/glest_game/game/stats.cpp b/source/glest_game/game/stats.cpp index 1fd9292b..635ef6ba 100644 --- a/source/glest_game/game/stats.cpp +++ b/source/glest_game/game/stats.cpp @@ -157,10 +157,10 @@ string Stats::getStats() const { result += "Max Concurrent Units: " + intToStr(maxConcurrentUnitCount) + "\n"; result += "Total EndGame Concurrent Unit Count: " + intToStr(totalEndGameConcurrentUnitCount) + "\n"; - for(unsigned int i = 0; i < factionCount; ++i) { + for(unsigned int i = 0; i < (unsigned int)factionCount; ++i) { const PlayerStats &player = playerStats[i]; - result += "player #" + intToStr(i) + " " + player.getStats() + "\n"; + result += "player #" + uIntToStr(i) + " " + player.getStats() + "\n"; } return result; diff --git a/source/glest_game/global/core_data.cpp b/source/glest_game/global/core_data.cpp index 45594530..2da9f5a3 100644 --- a/source/glest_game/global/core_data.cpp +++ b/source/glest_game/global/core_data.cpp @@ -395,7 +395,7 @@ void CoreData::loadTextures(string data_path) { + CORE_MENU_TEXTURES_PATH + "logo*.*"; vector logoFilenames; findAll(logosPath, logoFilenames, false, false); - for (int i = 0; i < logoFilenames.size(); ++i) { + for (int i = 0; i < (int)logoFilenames.size(); ++i) { string logo = logoFilenames[i]; if (strcmp("logo.tga", logo.c_str()) != 0) { Texture2D* logoTextureExtra = renderer.newTexture2D(rsGlobal); @@ -419,7 +419,7 @@ void CoreData::loadTextures(string data_path) { logosPath = data_path + CORE_MENU_TEXTURES_PATH + "logo*.*"; vector logoFilenames; findAll(logosPath, logoFilenames, false, false); - for (int i = 0; i < logoFilenames.size(); ++i) { + for (int i = 0; i < (int)logoFilenames.size(); ++i) { string logo = logoFilenames[i]; if (strcmp("logo.tga", logo.c_str()) != 0) { Texture2D* logoTextureExtra = renderer.newTexture2D(rsGlobal); @@ -444,7 +444,7 @@ void CoreData::loadTextures(string data_path) { + CORE_MENU_TEXTURES_PATH + "intro*.*"; vector introFilenames; findAll(introPath, introFilenames, false, false); - for (int i = 0; i < introFilenames.size(); ++i) { + for (int i = 0; i < (int)introFilenames.size(); ++i) { string logo = introFilenames[i]; //if(strcmp("logo.tga",logo.c_str()) != 0) { Texture2D* logoTextureExtra = renderer.newTexture2D(rsGlobal); @@ -468,7 +468,7 @@ void CoreData::loadTextures(string data_path) { introPath = data_path + CORE_MENU_TEXTURES_PATH + "intro*.*"; vector introFilenames; findAll(introPath, introFilenames, false, false); - for (int i = 0; i < introFilenames.size(); ++i) { + for (int i = 0; i < (int)introFilenames.size(); ++i) { string logo = introFilenames[i]; //if(strcmp("logo.tga",logo.c_str()) != 0) { Texture2D* logoTextureExtra = renderer.newTexture2D(rsGlobal); @@ -708,7 +708,7 @@ void CoreData::loadIntroMedia(string data_path) { + CORE_MENU_VIDEOS_PATH + "intro.*"; vector introVideos; findAll(introVideoPath, introVideos, false, false); - for (int i = 0; i < introVideos.size(); ++i) { + for (int i = 0; i < (int)introVideos.size(); ++i) { string video = getGameCustomCoreDataPath(data_path, "") + CORE_MENU_VIDEOS_PATH + introVideos[i]; if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -727,7 +727,7 @@ void CoreData::loadIntroMedia(string data_path) { introVideoPath = data_path + CORE_MENU_VIDEOS_PATH + "intro.*"; introVideos.clear(); findAll(introVideoPath, introVideos, false, false); - for (int i = 0; i < introVideos.size(); ++i) { + for (int i = 0; i < (int)introVideos.size(); ++i) { string video = data_path + CORE_MENU_VIDEOS_PATH + introVideos[i]; if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -758,7 +758,7 @@ void CoreData::loadMainMenuMedia(string data_path) { + CORE_MENU_VIDEOS_PATH + "main.*"; vector mainVideos; findAll(mainVideoPath, mainVideos, false, false); - for (int i = 0; i < mainVideos.size(); ++i) { + for (int i = 0; i < (int)mainVideos.size(); ++i) { string video = getGameCustomCoreDataPath(data_path, "") + CORE_MENU_VIDEOS_PATH + mainVideos[i]; if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -778,7 +778,7 @@ void CoreData::loadMainMenuMedia(string data_path) { mainVideoPath = data_path + CORE_MENU_VIDEOS_PATH + "main.*"; mainVideos.clear(); findAll(mainVideoPath, mainVideos, false, false); - for (int i = 0; i < mainVideos.size(); ++i) { + for (int i = 0; i < (int)mainVideos.size(); ++i) { string video = data_path + CORE_MENU_VIDEOS_PATH + mainVideos[i]; if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -809,7 +809,7 @@ void CoreData::loadBattleEndMedia(string data_path) { + CORE_MENU_VIDEOS_PATH + "battle_end_win.*"; vector battleEndWinVideos; findAll(battleEndWinVideoPath, battleEndWinVideos, false, false); - for (int i = 0; i < battleEndWinVideos.size(); ++i) { + for (int i = 0; i < (int)battleEndWinVideos.size(); ++i) { string video = getGameCustomCoreDataPath(data_path, "") + CORE_MENU_VIDEOS_PATH + battleEndWinVideos[i]; if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -831,7 +831,7 @@ void CoreData::loadBattleEndMedia(string data_path) { + "battle_end_win.*"; battleEndWinVideos.clear(); findAll(battleEndWinVideoPath, battleEndWinVideos, false, false); - for (int i = 0; i < battleEndWinVideos.size(); ++i) { + for (int i = 0; i < (int)battleEndWinVideos.size(); ++i) { string video = data_path + CORE_MENU_VIDEOS_PATH + battleEndWinVideos[i]; if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -857,7 +857,7 @@ void CoreData::loadBattleEndMedia(string data_path) { + CORE_MENU_MUSIC_PATH + "battle_end_win.*"; vector battleEndWinMusic; findAll(battleEndWinPath, battleEndWinMusic, false, false); - for (int i = 0; i < battleEndWinMusic.size(); ++i) { + for (int i = 0; i < (int)battleEndWinMusic.size(); ++i) { string music = getGameCustomCoreDataPath(data_path, "") + CORE_MENU_MUSIC_PATH + battleEndWinMusic[i]; if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -879,7 +879,7 @@ void CoreData::loadBattleEndMedia(string data_path) { + "battle_end_win.*"; battleEndWinMusic.clear(); findAll(battleEndWinPath, battleEndWinMusic, false, false); - for (int i = 0; i < battleEndWinMusic.size(); ++i) { + for (int i = 0; i < (int)battleEndWinMusic.size(); ++i) { string music = data_path + CORE_MENU_MUSIC_PATH + battleEndWinMusic[i]; if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -906,7 +906,7 @@ void CoreData::loadBattleEndMedia(string data_path) { + CORE_MENU_VIDEOS_PATH + "battle_end_lose.*"; vector battleEndLoseVideos; findAll(battleEndLoseVideoPath, battleEndLoseVideos, false, false); - for (int i = 0; i < battleEndLoseVideos.size(); ++i) { + for (int i = 0; i < (int)battleEndLoseVideos.size(); ++i) { string video = getGameCustomCoreDataPath(data_path, "") + CORE_MENU_VIDEOS_PATH + battleEndLoseVideos[i]; if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -928,7 +928,7 @@ void CoreData::loadBattleEndMedia(string data_path) { + "battle_end_lose.*"; battleEndLoseVideos.clear(); findAll(battleEndLoseVideoPath, battleEndLoseVideos, false, false); - for (int i = 0; i < battleEndLoseVideos.size(); ++i) { + for (int i = 0; i < (int)battleEndLoseVideos.size(); ++i) { string video = data_path + CORE_MENU_VIDEOS_PATH + battleEndLoseVideos[i]; if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -954,7 +954,7 @@ void CoreData::loadBattleEndMedia(string data_path) { + CORE_MENU_MUSIC_PATH + "battle_end_lose.*"; vector battleEndLoseMusic; findAll(battleEndLosePath, battleEndLoseMusic, false, false); - for (int i = 0; i < battleEndLoseMusic.size(); ++i) { + for (int i = 0; i < (int)battleEndLoseMusic.size(); ++i) { string music = getGameCustomCoreDataPath(data_path, "") + CORE_MENU_MUSIC_PATH + battleEndLoseMusic[i]; if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -976,7 +976,7 @@ void CoreData::loadBattleEndMedia(string data_path) { + "battle_end_lose.*"; battleEndLoseMusic.clear(); findAll(battleEndLosePath, battleEndLoseMusic, false, false); - for (int i = 0; i < battleEndLoseMusic.size(); ++i) { + for (int i = 0; i < (int)battleEndLoseMusic.size(); ++i) { string music = data_path + CORE_MENU_MUSIC_PATH + battleEndLoseMusic[i]; if (SystemFlags::VERBOSE_MODE_ENABLED) diff --git a/source/glest_game/global/lang.cpp b/source/glest_game/global/lang.cpp index 4f95b5cb..a46f5c72 100644 --- a/source/glest_game/global/lang.cpp +++ b/source/glest_game/global/lang.cpp @@ -91,7 +91,7 @@ void Lang::loadGameStrings(string uselanguage, bool loadFonts, // Example values: // DEFAULT_CHARSET (English) = 1 // GB2312_CHARSET (Chinese) = 134 - Shared::Platform::charSet = strToInt(lang.getString("FONT_CHARSET")); + Shared::Platform::PlatformContextGl::charSet = strToInt(lang.getString("FONT_CHARSET")); } if( lang.hasString("FONT_MULTIBYTE")) { Font::fontIsMultibyte = strToBool(lang.getString("FONT_MULTIBYTE")); @@ -291,7 +291,7 @@ bool Lang::loadTechTreeStrings(string techTree,bool forceLoad) { string currentPath = ""; Config &config = Config::getInstance(); vector techPaths = config.getPathListForType(ptTechs); - for(int idx = 0; idx < techPaths.size(); idx++) { + for(int idx = 0; idx < (int)techPaths.size(); idx++) { string &techPath = techPaths[idx]; endPathWithSlash(techPath); @@ -382,7 +382,7 @@ void Lang::loadTilesetStrings(string tileset) { string currentPath = ""; Config &config = Config::getInstance(); vector tilesetPaths = config.getPathListForType(ptTilesets); - for(int idx = 0; idx < tilesetPaths.size(); idx++) { + for(int idx = 0; idx < (int)tilesetPaths.size(); idx++) { string &tilesetPath = tilesetPaths[idx]; endPathWithSlash(tilesetPath); diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index bed0d41f..b5d956ea 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -1049,7 +1049,7 @@ void Renderer::setupLighting() { if(qCache.visibleQuadUnitList.empty() == false) { //bool modelRenderStarted = false; for(int visibleUnitIndex = 0; - visibleUnitIndex < qCache.visibleQuadUnitList.size() && lightCount < maxLights; + visibleUnitIndex < (int)qCache.visibleQuadUnitList.size() && lightCount < maxLights; ++visibleUnitIndex) { Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex]; @@ -1405,7 +1405,7 @@ bool Renderer::PointInFrustum(vector > &frustum, float x, float y, bool Renderer::SphereInFrustum(vector > &frustum, float x, float y, float z, float radius) { // Go through all the sides of the frustum - for(int i = 0; i < frustum.size(); i++ ) { + for(int i = 0; i < (int)frustum.size(); i++ ) { // If the center of the sphere is farther away from the plane than the radius if(frustum[i][0] * x + frustum[i][1] * y + frustum[i][2] * z + frustum[i][3] <= -radius ) { // The distance was greater than the radius so the sphere is outside of the frustum @@ -3216,7 +3216,7 @@ void Renderer::renderCheckBox(const GraphicCheckBox *box) { int h= box->getH(); int w= box->getW(); - const Vec3f disabledTextColor= Vec3f(0.25f,0.25f,0.25f); + //const Vec3f disabledTextColor= Vec3f(0.25f,0.25f,0.25f); glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT); @@ -3316,7 +3316,7 @@ void Renderer::renderLine(const GraphicLine *line) { int h= line->getH(); int w= line->getW(); - const Vec3f disabledTextColor= Vec3f(0.25f,0.25f,0.25f); + //const Vec3f disabledTextColor= Vec3f(0.25f,0.25f,0.25f); glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT); @@ -3362,7 +3362,7 @@ void Renderer::renderScrollBar(const GraphicScrollBar *sb) { int h= sb->getH(); int w= sb->getW(); - const Vec3f disabledTextColor= Vec3f(0.25f,0.25f,0.25f); + //const Vec3f disabledTextColor= Vec3f(0.25f,0.25f,0.25f); glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT); ///////////////////// @@ -3840,7 +3840,7 @@ void Renderer::MapRenderer::loadVisibleLayers(float coordStep,VisibleQuadContain int totalCellCount = 0; // we create a layer for each visible texture in the map for(int visibleIndex = 0; - visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) { + visibleIndex < (int)qCache.visibleScaledCellList.size(); ++visibleIndex) { Vec2i &pos = qCache.visibleScaledCellList[visibleIndex]; totalCellCount++; @@ -4064,7 +4064,7 @@ void Renderer::MapRenderer::Layer::render(VisibleQuadContainerCache &qCache) { int lastValidIndex = -1; for(int visibleIndex = 0; - visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) { + visibleIndex < (int)qCache.visibleScaledCellList.size(); ++visibleIndex) { Vec2i &pos = qCache.visibleScaledCellList[visibleIndex]; if(cellToIndicesMap.find(pos) != cellToIndicesMap.end()) { @@ -4293,7 +4293,7 @@ void Renderer::renderSurface(const int renderFps) { std::map uniqueVisibleTextures; for(int visibleIndex = 0; - visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) { + visibleIndex < (int)qCache.visibleScaledCellList.size(); ++visibleIndex) { Vec2i &pos = qCache.visibleScaledCellList[visibleIndex]; SurfaceCell *tc00= map->getSurfaceCell(pos.x, pos.y); int cellTex= static_cast(tc00->getSurfaceTexture())->getHandle(); @@ -4304,7 +4304,7 @@ void Renderer::renderSurface(const int renderFps) { //printf("Current renders = %d possible = %d\n",qCache.visibleScaledCellList.size(),uniqueVisibleTextures.size()); for(int visibleIndex = 0; - visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) { + visibleIndex < (int)qCache.visibleScaledCellList.size(); ++visibleIndex) { Vec2i &pos = qCache.visibleScaledCellList[visibleIndex]; SurfaceCell *tc00= map->getSurfaceCell(pos.x, pos.y); @@ -4452,7 +4452,7 @@ void Renderer::renderSurface(const int renderFps) { int lastSurfaceDataIndex = -1; for(int visibleIndex = 0; - visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) { + visibleIndex < (int)qCache.visibleScaledCellList.size(); ++visibleIndex) { Vec2i &pos = qCache.visibleScaledCellList[visibleIndex]; SurfaceCell *tc00= map->getSurfaceCell(pos.x, pos.y); @@ -4542,7 +4542,7 @@ void Renderer::renderSurface(const int renderFps) { glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); - for(int i = 0; i < surface->size(); ++i) { + for(int i = 0; i < (int)surface->size(); ++i) { SurfaceData &data = (*surface)[i]; if(useVBOs == true) { @@ -4636,7 +4636,7 @@ void Renderer::renderObjects(const int renderFps) { } const World *world= game->getWorld(); - const Map *map= world->getMap(); + //const Map *map= world->getMap(); Config &config= Config::getInstance(); int tilesetObjectsToAnimate=config.getInt("AnimatedTilesetObjects","-1"); @@ -4901,7 +4901,7 @@ void Renderer::renderTeamColorCircle(){ glLineWidth(2.f); for(int visibleUnitIndex = 0; - visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) { + visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) { Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex]; Vec3f currVec= unit->getCurrVectorFlat(); Vec3f color=unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0); @@ -4930,7 +4930,7 @@ void Renderer::renderSpecialHighlightUnits(std::map::iterator iterFindSpecialUnit = unitHighlightList.find(unit->getId()); @@ -4980,7 +4980,7 @@ void Renderer::renderTeamColorPlane(){ glEnable(GL_COLOR_MATERIAL); const Texture2D *texture=CoreData::getInstance().getTeamColorTexture(); for(int visibleUnitIndex = 0; - visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex){ + visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex){ Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex]; Vec3f currVec= unit->getCurrVectorFlat(); renderTeamColorEffect(currVec,visibleUnitIndex,unit->getType()->getSize(), @@ -5068,7 +5068,7 @@ void Renderer::renderUnits(const int renderFps) { if(qCache.visibleQuadUnitList.empty() == false) { bool modelRenderStarted = false; for(int visibleUnitIndex = 0; - visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) { + visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) { Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex]; meshCallbackTeamColor.setTeamTexture(unit->getFaction()->getTexture()); @@ -5187,7 +5187,7 @@ void Renderer::renderUnitsToBuild(const int renderFps) { modelRenderer->begin(true, true, false, false); for(int visibleUnitIndex = 0; - visibleUnitIndex < qCache.visibleQuadUnitBuildList.size(); ++visibleUnitIndex) { + visibleUnitIndex < (int)qCache.visibleQuadUnitBuildList.size(); ++visibleUnitIndex) { const UnitBuildInfo &buildUnit = qCache.visibleQuadUnitBuildList[visibleUnitIndex]; //Vec4f modelColor= Vec4f(0.f, 1.f, 0.f, 0.5f); const Vec3f teamColor = buildUnit.unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0); @@ -5245,7 +5245,7 @@ void Renderer::renderMorphEffects(){ bool initialized=false; int frameCycle=0; for(int visibleUnitIndex = 0; - visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) { + visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) { Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex]; if(unit->getCurrSkill() != NULL && unit->getCurrSkill()->getClass() == scMorph) { Command *command= unit->getCurrCommand(); @@ -5355,7 +5355,7 @@ void Renderer::renderSelectionEffects() { vector pathList = dynamic_cast(path)->getQueue(); Vec2i lastPosValue; - for(int i = 0; i < pathList.size(); ++i) { + for(int i = 0; i < (int)pathList.size(); ++i) { Vec2i curPosValue = pathList[i]; if(i == 0) { lastPosValue = curPosValue; @@ -5857,9 +5857,9 @@ void Renderer::renderMinimap(){ visibleUnitList.clear(); const World *world= game->getWorld(); - for(unsigned int i = 0; i < world->getFactionCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)world->getFactionCount(); ++i) { const Faction *faction = world->getFaction(i); - for(unsigned int j = 0; j < faction->getUnitCount(); ++j) { + for(unsigned int j = 0; j < (unsigned int)faction->getUnitCount(); ++j) { Unit *unit = faction->getUnit(j); visibleUnitList.push_back(unit); } @@ -5874,7 +5874,7 @@ void Renderer::renderMinimap(){ unit_colors.resize(visibleUnitList.size()*4); for(int visibleIndex = 0; - visibleIndex < visibleUnitList.size(); ++visibleIndex) { + visibleIndex < (int)visibleUnitList.size(); ++visibleIndex) { Unit *unit = visibleUnitList[visibleIndex]; if (unit->isAlive() == false) { continue; @@ -5981,7 +5981,7 @@ void Renderer::renderHighlightedCellsOnMinimap() { static_cast(mw)/ pixmap->getW()/2, static_cast(mh)/ pixmap->getH()/2); - for(int i = 0;i < highlightedCells->size(); i++) { + for(int i = 0;i < (int)highlightedCells->size(); i++) { const MarkedCell *mc=&highlightedCells->at(i); if(mc->getFaction() == NULL || (mc->getFaction()->getTeam() == game->getWorld()->getThisFaction()->getTeam())) { const Texture2D *texture= game->getHighlightCellTexture(); @@ -6717,7 +6717,7 @@ void Renderer::selectUsingFrustumSelection(Selection::UnitContainer &units, VisibleQuadContainerCache &qCache = getQuadCache(); if(qCache.visibleQuadUnitList.empty() == false) { for(int visibleUnitIndex = 0; - visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) { + visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) { Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex]; if(unit != NULL && unit->isAlive()) { Vec3f unitPos = unit->getCurrVector(); @@ -6733,7 +6733,7 @@ void Renderer::selectUsingFrustumSelection(Selection::UnitContainer &units, if(withObjectSelection == true) { if(qCache.visibleObjectList.empty() == false) { for(int visibleIndex = 0; - visibleIndex < qCache.visibleObjectList.size(); ++visibleIndex) { + visibleIndex < (int)qCache.visibleObjectList.size(); ++visibleIndex) { Object *object = qCache.visibleObjectList[visibleIndex]; if(object != NULL) { bool insideQuad = CubeInFrustum(quadSelectionCacheItem.frustumData, @@ -6913,7 +6913,7 @@ void Renderer::selectUsingColorPicking(Selection::UnitContainer &units, int index = pickedList[i]; //printf("In [%s::%s] Line: %d searching for selected object i = %d index = %d units = %d objects = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,i,index,rendererUnits.size(),rendererObjects.size()); - if(rendererUnits.empty() == false && index < rendererUnits.size()) { + if(rendererUnits.empty() == false && index < (int)rendererUnits.size()) { Unit *unit = rendererUnits[index]; if(unit != NULL && unit->isAlive()) { unitFound=true; @@ -6941,7 +6941,7 @@ void Renderer::selectUsingColorPicking(Selection::UnitContainer &units, int index = pickedList[i]; //printf("In [%s::%s] Line: %d searching for selected object i = %d index = %d units = %d objects = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,i,index,rendererUnits.size(),rendererObjects.size()); - if(rendererObjects.empty() == false && index < rendererObjects.size()) { + if(rendererObjects.empty() == false && index < (int)rendererObjects.size()) { Object *object = rendererObjects[index]; //printf("In [%s::%s] Line: %d searching for selected object i = %d index = %d [%p]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,i,index,object); @@ -7182,7 +7182,7 @@ string Renderer::getGlMoreInfo(){ string extensions= getGlExtensions(); int charCount= 0; - for(int i=0; i120 && extensions[i]==' '){ infoStr+= "\n "; @@ -7197,7 +7197,7 @@ string Renderer::getGlMoreInfo(){ charCount= 0; string platformExtensions= getGlPlatformExtensions(); - for(int i=0; i120 && platformExtensions[i]==' '){ infoStr+= "\n "; @@ -7402,7 +7402,7 @@ vector Renderer::renderUnitsFast(bool renderingShadows, bool colorPickin } assert(game != NULL); - const World *world= game->getWorld(); + //const World *world= game->getWorld(); assert(world != NULL); VisibleQuadContainerCache &qCache = getQuadCache(); @@ -7424,7 +7424,7 @@ vector Renderer::renderUnitsFast(bool renderingShadows, bool colorPickin renderOnlyBuildings=false; } for(int visibleUnitIndex = 0; - visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) { + visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) { Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex]; if(renderOnlyBuildings==true && unit->getType()->hasSkillClass(scMove)){ @@ -7539,7 +7539,7 @@ vector Renderer::renderObjectsFast(bool renderingShadows, bool resour bool modelRenderStarted = false; for(int visibleIndex = 0; - visibleIndex < qCache.visibleObjectList.size(); ++visibleIndex) { + visibleIndex < (int)qCache.visibleObjectList.size(); ++visibleIndex) { Object *o = qCache.visibleObjectList[visibleIndex]; if(modelRenderStarted == false) { @@ -8440,7 +8440,7 @@ void Renderer::renderUnitTitles3D(Font3D *font, Vec3f color) { if(visibleFrameUnitList.empty() == false) { //printf("Render Unit titles ON\n"); - for(int idx = 0; idx < visibleFrameUnitList.size(); idx++) { + for(int idx = 0; idx < (int)visibleFrameUnitList.size(); idx++) { const Unit *unit = visibleFrameUnitList[idx]; if(unit != NULL) { if(unit->getVisible() == true) { @@ -8494,7 +8494,7 @@ void Renderer::renderUnitTitles(Font2D *font, Vec3f color) { if(visibleFrameUnitList.empty() == false) { //printf("Render Unit titles ON\n"); - for(int idx = 0; idx < visibleFrameUnitList.size(); idx++) { + for(int idx = 0; idx < (int)visibleFrameUnitList.size(); idx++) { const Unit *unit = visibleFrameUnitList[idx]; if(unit != NULL) { if(unit->getCurrentUnitTitle() != "") { @@ -8539,7 +8539,7 @@ void Renderer::renderUnitTitles(Font2D *font, Vec3f color) { void Renderer::removeObjectFromQuadCache(const Object *o) { VisibleQuadContainerCache &qCache = getQuadCache(); for(int visibleIndex = 0; - visibleIndex < qCache.visibleObjectList.size(); ++visibleIndex) { + visibleIndex < (int)qCache.visibleObjectList.size(); ++visibleIndex) { Object *currentObj = qCache.visibleObjectList[visibleIndex]; if(currentObj == o) { qCache.visibleObjectList.erase(qCache.visibleObjectList.begin() + visibleIndex); @@ -8551,7 +8551,7 @@ void Renderer::removeObjectFromQuadCache(const Object *o) { void Renderer::removeUnitFromQuadCache(const Unit *unit) { VisibleQuadContainerCache &qCache = getQuadCache(); for(int visibleIndex = 0; - visibleIndex < qCache.visibleQuadUnitList.size(); ++visibleIndex) { + visibleIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleIndex) { Unit *currentUnit = qCache.visibleQuadUnitList[visibleIndex]; if(currentUnit == unit) { qCache.visibleQuadUnitList.erase(qCache.visibleQuadUnitList.begin() + visibleIndex); @@ -8559,7 +8559,7 @@ void Renderer::removeUnitFromQuadCache(const Unit *unit) { } } for(int visibleIndex = 0; - visibleIndex < qCache.visibleUnitList.size(); ++visibleIndex) { + visibleIndex < (int)qCache.visibleUnitList.size(); ++visibleIndex) { Unit *currentUnit = qCache.visibleUnitList[visibleIndex]; if(currentUnit == unit) { qCache.visibleUnitList.erase(qCache.visibleUnitList.begin() + visibleIndex); @@ -8678,7 +8678,7 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame, const Map *map= world->getMap(); // clear visibility of old objects for(int visibleIndex = 0; - visibleIndex < quadCache.visibleObjectList.size(); ++visibleIndex){ + visibleIndex < (int)quadCache.visibleObjectList.size(); ++visibleIndex){ quadCache.visibleObjectList[visibleIndex]->setVisible(false); } quadCache.clearNonVolatileCacheData(); @@ -9260,7 +9260,7 @@ uint64 Renderer::getCurrentPixelByteCount(ResourceScope rs) const { for(int i = (rs == rsCount ? 0 : rs); i < rsCount; ++i) { if(textureManager[i] != NULL) { const Shared::Graphics::TextureContainer &textures = textureManager[i]->getTextures(); - for(int j = 0; j < textures.size(); ++j) { + for(int j = 0; j < (int)textures.size(); ++j) { const Texture *texture = textures[j]; result += texture->getPixelByteCount(); } diff --git a/source/glest_game/gui/gui.cpp b/source/glest_game/gui/gui.cpp index dcef8b1c..8c77e7cc 100644 --- a/source/glest_game/gui/gui.cpp +++ b/source/glest_game/gui/gui.cpp @@ -1236,7 +1236,7 @@ bool Gui::computeTarget(const Vec2i &screenPos, Vec2i &targetPos, const Unit *&t Unit* Gui::getRelevantObjectFromSelection(Selection::UnitContainer *uc){ Unit *resultUnit=NULL; - for(int i= 0; i < uc->size(); ++i){ + for(int i= 0; i < (int)uc->size(); ++i) { resultUnit= uc->at(i); if(resultUnit->getType()->hasSkillClass(scMove)){// moving units are more relevant than non moving ones break; diff --git a/source/glest_game/gui/selection.cpp b/source/glest_game/gui/selection.cpp index 9286e148..bc7ca28b 100644 --- a/source/glest_game/gui/selection.cpp +++ b/source/glest_game/gui/selection.cpp @@ -41,14 +41,14 @@ bool Selection::select(Unit *unit) { bool result = false; //check size //if(selectedUnits.size() >= maxUnits){ - if(selectedUnits.size() >= Config::getInstance().getInt("MaxUnitSelectCount",intToStr(maxUnits).c_str())) { + if((int)selectedUnits.size() >= Config::getInstance().getInt("MaxUnitSelectCount",intToStr(maxUnits).c_str())) { return result; } // Fix Bug reported on sourceforge.net: Glest::Game::Selection::select crash with NULL pointer - ID: 3608835 if(unit != NULL) { //check if already selected - for(int i=0; i < selectedUnits.size(); ++i) { + for(int i=0; i < (int)selectedUnits.size(); ++i) { if(selectedUnits[i ]== unit) { return true; } @@ -85,7 +85,7 @@ bool Selection::select(Unit *unit) { int unitTypeId=unit->getType()->getId(); bool inserted=false; - for(int i=0; i < selectedUnits.size(); ++i) { + for(int i=0; i < (int)selectedUnits.size(); ++i) { int currentTypeId=selectedUnits[i]->getType()->getId(); if(unitTypeId<=currentTypeId) { @@ -120,8 +120,8 @@ void Selection::unSelect(const UnitContainer &units){ //add units to gui for(UnitIterator it= units.begin(); it!=units.end(); ++it){ - for(int i=0; igetType(); - for(int i=0; igetType()!=ut){ return false; } @@ -249,7 +249,7 @@ void Selection::recallGroup(int groupIndex){ } clear(); - for(int i=0; i introModels; findAll(introPath, introModels, false, false); - for(int i = 0; i < introModels.size(); ++i) { + for(int i = 0; i < (int)introModels.size(); ++i) { string logo = introModels[i]; Model *model= renderer.newModel(rsMenu); if(model) { @@ -220,7 +220,7 @@ Intro::Intro(Program *program): introPath = data_path + "data/core/menu/main_model/intro*.g3d"; //vector introModels; findAll(introPath, introModels, false, false); - for(int i = 0; i < introModels.size(); ++i) { + for(int i = 0; i < (int)introModels.size(); ++i) { string logo = introModels[i]; Model *model= renderer.newModel(rsMenu); if(model) { @@ -429,7 +429,7 @@ Intro::Intro(Program *program): srand((unsigned int)seed.getCurTicks()); int failedLookups=0; std::map usedIndex; - for(;intoTexList.size() < showIntroPics;) { + for(;(int)intoTexList.size() < showIntroPics;) { int picIndex = rand() % coreData.getMiscTextureList().size(); if(usedIndex.find(picIndex) != usedIndex.end()) { failedLookups++; @@ -456,8 +456,8 @@ Intro::Intro(Program *program): } else { for(unsigned int i = 0; - i < coreData.getMiscTextureList().size() && - i < showIntroPics; ++i) { + i < (unsigned int)coreData.getMiscTextureList().size() && + i < (unsigned int)showIntroPics; ++i) { Texture2D *tex = coreData.getMiscTextureList()[i]; intoTexList.push_back(tex); } @@ -628,7 +628,7 @@ void Intro::renderModelBackground() { if(difTime > 0) { if(difTime > ((modelIndex+1) * individualModelShowTime)) { //int oldmodelIndex = modelIndex; - if(modelIndex+1 < models.size()) { + if(modelIndex + 1 < (int)models.size()) { modelIndex++; //position @@ -681,7 +681,7 @@ void Intro::render() { renderer.reset2d(); - for(int i = 0; i < texts.size(); ++i) { + for(int i = 0; i < (int)texts.size(); ++i) { Text *text= texts[i]; int difTime= 1000 * timer / GameConstants::updateFps - text->getTime(); diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index de5c5d91..304f4e4b 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -239,7 +239,7 @@ static void cleanupProcessObjects() { printf("Waiting for the following threads to exit [" MG_SIZE_T_SPECIFIER "]:\n",Thread::getThreadList().size()); - for(int i = 0; i < Thread::getThreadList().size(); ++i) { + for(int i = 0; i < (int)Thread::getThreadList().size(); ++i) { BaseThread *baseThread = dynamic_cast(Thread::getThreadList()[i]); printf("Thread index: %d ptr [%p] isBaseThread: %d, Name: [%s]\n",i,baseThread,(baseThread != NULL ? 1 : 0),(baseThread != NULL ? baseThread->getUniqueID().c_str() : "")); } @@ -1870,7 +1870,7 @@ void runTilesetValidationForPath(string tilesetPath, string tilesetName, string duplicateFile = fileList[idx]; string fileExt = extractExtension(duplicateFile); if(fileExt == "wav" || fileExt == "ogg") { - off_t fileSize = getFileSize(duplicateFile); + //off_t fileSize = getFileSize(duplicateFile); if(idx == 0) { newCommonFileName = "$COMMONDATAPATH/sounds/" + extractFileFromDirectoryPath(duplicateFile); break; @@ -1932,7 +1932,7 @@ void runTechValidationForPath(string techPath, string techName, if(factionsList.empty() == false) { Checksum checksum; set factions; - for(int j = 0; j < factionsList.size(); ++j) { + for(int j = 0; j < (int)factionsList.size(); ++j) { if( filteredFactionList.empty() == true || std::find(filteredFactionList.begin(),filteredFactionList.end(),factionsList[j]) != filteredFactionList.end()) { factions.insert(factionsList[j]); @@ -1941,7 +1941,7 @@ void runTechValidationForPath(string techPath, string techName, printf("\n----------------------------------------------------------------"); printf("\nChecking techPath [%s] techName [%s] total faction count = %d\n",techPath.c_str(), techName.c_str(),(int)factionsList.size()); - for(int j = 0; j < factionsList.size(); ++j) { + for(int j = 0; j < (int)factionsList.size(); ++j) { if( filteredFactionList.empty() == true || std::find(filteredFactionList.begin(),filteredFactionList.end(),factionsList[j]) != filteredFactionList.end()) { printf("Using faction [%s]\n",factionsList[j].c_str()); @@ -2008,7 +2008,7 @@ void runTechValidationForPath(string techPath, string techName, techtree_errors = true; // Display the validation errors string errorText = "\nErrors were detected:\n=====================\n"; - for(int i = 0; i < resultErrors.size(); ++i) { + for(int i = 0; i < (int)resultErrors.size(); ++i) { if(i > 0) { errorText += "\n"; } @@ -2030,7 +2030,7 @@ void runTechValidationForPath(string techPath, string techName, techtree_errors = true; // Display the validation errors string errorText = "\nErrors were detected:\n=====================\n"; - for(int i = 0; i < resultErrors.size(); ++i) { + for(int i = 0; i < (int)resultErrors.size(); ++i) { if(i > 0) { errorText += "\n"; } @@ -2352,7 +2352,7 @@ void runTechValidationForPath(string techPath, string techName, string duplicateFile = fileList[idx]; string fileExt = extractExtension(duplicateFile); if(fileExt == "wav" || fileExt == "ogg") { - off_t fileSize = getFileSize(duplicateFile); + //off_t fileSize = getFileSize(duplicateFile); if(idx == 0) { newCommonFileName = "$COMMONDATAPATH/sounds/" + extractFileFromDirectoryPath(duplicateFile); break; @@ -2440,7 +2440,7 @@ void runTechTranslationExtractionForPath(string techPath, string techName, if(factionsList.empty() == false) { Checksum checksum; set factions; - for(int j = 0; j < factionsList.size(); ++j) { + for(int j = 0; j < (int)factionsList.size(); ++j) { if( filteredFactionList.empty() == true || std::find(filteredFactionList.begin(),filteredFactionList.end(),factionsList[j]) != filteredFactionList.end()) { factions.insert(factionsList[j]); @@ -2449,7 +2449,7 @@ void runTechTranslationExtractionForPath(string techPath, string techName, printf("\n----------------------------------------------------------------"); printf("\nChecking techPath [%s] techName [%s] total faction count = %d\n",techPath.c_str(), techName.c_str(),(int)factionsList.size()); - for(int j = 0; j < factionsList.size(); ++j) { + for(int j = 0; j < (int)factionsList.size(); ++j) { if( filteredFactionList.empty() == true || std::find(filteredFactionList.begin(),filteredFactionList.end(),factionsList[j]) != filteredFactionList.end()) { printf("Using faction [%s]\n",factionsList[j].c_str()); @@ -2488,21 +2488,21 @@ void runTechTranslationExtractionForPath(string techPath, string techName, txFile << "; --------------" << std::endl; txFile << "; Types of Armor" << std::endl; - for(unsigned int index = 0; index < techtree->getArmorTypeCount(); ++index) { + for(int index = 0; index < techtree->getArmorTypeCount(); ++index) { const ArmorType *at = techtree->getArmorTypeByIndex(index); txFile << "ArmorTypeName_" << at->getName(false) << "=" << at->getName(false) << std::endl; } txFile << "; -------------- " << std::endl; txFile << "; Types of Attack" << std::endl; - for(unsigned int index = 0; index < techtree->getAttackTypeCount(); ++index) { + for(int index = 0; index < techtree->getAttackTypeCount(); ++index) { const AttackType *at = techtree->getAttackTypeByIndex(index); txFile << "AttackTypeName_" << at->getName(false) << "=" << at->getName(false) << std::endl; } txFile << "; ------------------" << std::endl; txFile << "; Types of Resources" << std::endl; - for(unsigned int index = 0; index < techtree->getResourceTypeCount(); ++index) { + for(int index = 0; index < techtree->getResourceTypeCount(); ++index) { const ResourceType *rt = techtree->getResourceType(index); txFile << "ResourceTypeName_" << rt->getName(false) << "=" << rt->getName(false) << std::endl; } @@ -2512,33 +2512,33 @@ void runTechTranslationExtractionForPath(string techPath, string techName, txFile << "FactionName_" << GameConstants::OBSERVER_SLOTNAME << "=" << GameConstants::OBSERVER_SLOTNAME << std::endl; txFile << "FactionName_" << GameConstants::RANDOMFACTION_SLOTNAME << "=" << GameConstants::RANDOMFACTION_SLOTNAME << std::endl; - for(unsigned int index = 0; index < techtree->getTypeCount(); ++index) { + for(int index = 0; index < techtree->getTypeCount(); ++index) { const FactionType *ft = techtree->getType(index); txFile << "FactionName_" << ft->getName(false) << "=" << ft->getName(false) << std::endl; txFile << "; ----------------------------------" << std::endl; txFile << "; Types of Upgrades for this Faction" << std::endl; - for(unsigned int upgradeIndex = 0; upgradeIndex < ft->getUpgradeTypeCount(); ++upgradeIndex) { + for(int upgradeIndex = 0; upgradeIndex < ft->getUpgradeTypeCount(); ++upgradeIndex) { const UpgradeType *upt = ft->getUpgradeType(upgradeIndex); txFile << "UpgradeTypeName_" << upt->getName(false) << "=" << upt->getName(false) << std::endl; } txFile << "; -------------------------------" << std::endl; txFile << "; Types of Units for this Faction" << std::endl; - for(unsigned int unitIndex = 0; unitIndex < ft->getUnitTypeCount(); ++unitIndex) { + for(int unitIndex = 0; unitIndex < ft->getUnitTypeCount(); ++unitIndex) { const UnitType *ut = ft->getUnitType(unitIndex); txFile << "UnitTypeName_" << ut->getName(false) << "=" << ut->getName(false) << std::endl; txFile << "; --------------------" << std::endl; txFile << "; Levels for this Unit" << std::endl; - for(unsigned int levelIndex = 0; levelIndex < ut->getLevelCount(); ++levelIndex) { + for(int levelIndex = 0; levelIndex < ut->getLevelCount(); ++levelIndex) { const Level *level = ut->getLevel(levelIndex); txFile << "LevelName_" << level->getName(false) << "=" << level->getName(false) << std::endl; } txFile << "; -------------------------------" << std::endl; txFile << "; Types of Commands for this Unit" << std::endl; - for(unsigned int commandIndex = 0; commandIndex < ut->getCommandTypeCount(); ++commandIndex) { + for(int commandIndex = 0; commandIndex < ut->getCommandTypeCount(); ++commandIndex) { const CommandType *ct = ut->getCommandType(commandIndex); txFile << "CommandName_" << ct->getName(false) << "=" << ct->getName(false) << std::endl; } @@ -2592,7 +2592,7 @@ void runTechTranslationExtraction(int argc, char** argv) { if(filteredTechTreeList.empty() == false) { printf("Filtering techtrees and only looking for the following:\n"); - for(int idx = 0; idx < filteredTechTreeList.size(); ++idx) { + for(int idx = 0; idx < (int)filteredTechTreeList.size(); ++idx) { filteredTechTreeList[idx] = trim(filteredTechTreeList[idx]); printf("%s\n",filteredTechTreeList[idx].c_str()); } @@ -2605,11 +2605,11 @@ void runTechTranslationExtraction(int argc, char** argv) { World world; vector techPaths = config.getPathListForType(ptTechs); - for(int idx = 0; idx < techPaths.size(); idx++) { + for(int idx = 0; idx < (int)techPaths.size(); idx++) { string &techPath = techPaths[idx]; endPathWithSlash(techPath); - for(int idx2 = 0; idx2 < techTreeFiles.size(); idx2++) { + for(int idx2 = 0; idx2 < (int)techTreeFiles.size(); idx2++) { string &techName = techTreeFiles[idx2]; if( filteredTechTreeList.empty() == true || @@ -2668,13 +2668,13 @@ void runTechValidationReport(int argc, char** argv) { std::vector filteredFactionList; vector scenarioPaths = config.getPathListForType(ptScenarios); - for(int idx = 0; idx < scenarioPaths.size(); idx++) { + for(int idx = 0; idx < (int)scenarioPaths.size(); idx++) { string &scenarioPath = scenarioPaths[idx]; endPathWithSlash(scenarioPath); vector scenarioList; findDirs(scenarioPath, scenarioList, false, false); - for(int idx2 = 0; idx2 < scenarioList.size(); idx2++) { + for(int idx2 = 0; idx2 < (int)scenarioList.size(); idx2++) { string &scenarioName = scenarioList[idx2]; if(scenarioName == validateScenarioName) { @@ -2701,7 +2701,7 @@ void runTechValidationReport(int argc, char** argv) { } else { vector techPaths = config.getPathListForType(ptTechs); - for(int idx = 0; idx < techPaths.size(); idx++) { + for(int idx = 0; idx < (int)techPaths.size(); idx++) { string &techPath = techPaths[idx]; endPathWithSlash(techPath); scenarioTechtree = techPath + "/" + techName + "/" + techName + ".xml"; @@ -2747,7 +2747,7 @@ void runTechValidationReport(int argc, char** argv) { if(filteredFactionList.empty() == false) { printf("Filtering factions and only looking for the following:\n"); - for(int idx = 0; idx < filteredFactionList.size(); ++idx) { + for(int idx = 0; idx < (int)filteredFactionList.size(); ++idx) { filteredFactionList[idx] = trim(filteredFactionList[idx]); printf("%s\n",filteredFactionList[idx].c_str()); } @@ -2778,7 +2778,7 @@ void runTechValidationReport(int argc, char** argv) { if(filteredTechTreeList.empty() == false) { printf("Filtering techtrees and only looking for the following:\n"); - for(int idx = 0; idx < filteredTechTreeList.size(); ++idx) { + for(int idx = 0; idx < (int)filteredTechTreeList.size(); ++idx) { filteredTechTreeList[idx] = trim(filteredTechTreeList[idx]); printf("%s\n",filteredTechTreeList[idx].c_str()); } @@ -2846,11 +2846,11 @@ void runTechValidationReport(int argc, char** argv) { World world; vector techPaths = config.getPathListForType(ptTechs); - for(int idx = 0; idx < techPaths.size(); idx++) { + for(int idx = 0; idx < (int)techPaths.size(); idx++) { string &techPath = techPaths[idx]; endPathWithSlash(techPath); - for(int idx2 = 0; idx2 < techTreeFiles.size(); idx2++) { + for(int idx2 = 0; idx2 < (int)techTreeFiles.size(); idx2++) { string &techName = techTreeFiles[idx2]; if( filteredTechTreeList.empty() == true || @@ -2905,13 +2905,13 @@ void runTilesetValidationReport(int argc, char** argv) { bool tilesetFound = false; vector tilesetPaths = config.getPathListForType(ptTilesets); - for(int idx = 0; idx < tilesetPaths.size(); idx++) { + for(int idx = 0; idx < (int)tilesetPaths.size(); idx++) { string &tilesetPath = tilesetPaths[idx]; endPathWithSlash(tilesetPath); vector tilesetList; findDirs(tilesetPath, tilesetList, false, false); - for(int idx2 = 0; idx2 < tilesetList.size(); idx2++) { + for(int idx2 = 0; idx2 < (int)tilesetList.size(); idx2++) { string &tilesetName = tilesetList[idx2]; if(tilesetName == validateTilesetName) { tilesetFound = true; @@ -2955,7 +2955,7 @@ void ShowINISettings(int argc, char **argv,Config &config,Config &configKeys) { if(filteredPropertyList.empty() == false) { printf("Filtering properties and only looking for the following:\n"); - for(int idx = 0; idx < filteredPropertyList.size(); ++idx) { + for(int idx = 0; idx < (int)filteredPropertyList.size(); ++idx) { filteredPropertyList[idx] = trim(filteredPropertyList[idx]); printf("%s\n",filteredPropertyList[idx].c_str()); } @@ -2970,7 +2970,7 @@ void ShowINISettings(int argc, char **argv,Config &config,Config &configKeys) { // Figure out the max # of tabs we need to format display nicely int tabCount = 1; - for(int i = 0; i < mergedMainSettings.size(); ++i) { + for(int i = 0; i < (int)mergedMainSettings.size(); ++i) { const pair &nameValue = mergedMainSettings[i]; bool displayProperty = false; @@ -2993,7 +2993,7 @@ void ShowINISettings(int argc, char **argv,Config &config,Config &configKeys) { } } } - for(int i = 0; i < mergedKeySettings.size(); ++i) { + for(int i = 0; i < (int)mergedKeySettings.size(); ++i) { const pair &nameValue = mergedKeySettings[i]; bool displayProperty = false; @@ -3018,7 +3018,7 @@ void ShowINISettings(int argc, char **argv,Config &config,Config &configKeys) { } // Output the properties - for(int i = 0; i < mergedMainSettings.size(); ++i) { + for(int i = 0; i < (int)mergedMainSettings.size(); ++i) { const pair &nameValue = mergedMainSettings[i]; bool displayProperty = false; @@ -3051,7 +3051,7 @@ void ShowINISettings(int argc, char **argv,Config &config,Config &configKeys) { printf("\n\nMain key binding settings report\n"); printf("====================================\n"); - for(int i = 0; i < mergedKeySettings.size(); ++i) { + for(int i = 0; i < (int)mergedKeySettings.size(); ++i) { const pair &nameValue = mergedKeySettings[i]; bool displayProperty = false; @@ -3099,7 +3099,7 @@ void CheckForDuplicateData() { } else if(invalidMapList.empty() == false) { string errorMsg = "Warning invalid maps were detected (will be ignored):\n"; - for(int i = 0; i < invalidMapList.size(); ++i) { + for(int i = 0; i < (int)invalidMapList.size(); ++i) { char szBuf[8096]=""; snprintf(szBuf,8096,"map [%s]\n",invalidMapList[i].c_str()); @@ -3109,9 +3109,9 @@ void CheckForDuplicateData() { } vector duplicateMapsToRename; - for(int i = 0; i < maps.size(); ++i) { + for(int i = 0; i < (int)maps.size(); ++i) { string map1 = maps[i]; - for(int j = 0; j < maps.size(); ++j) { + for(int j = 0; j < (int)maps.size(); ++j) { if(i != j) { string map2 = maps[j]; @@ -3125,7 +3125,7 @@ void CheckForDuplicateData() { } if(duplicateMapsToRename.empty() == false) { string errorMsg = "Warning duplicate maps were detected and renamed:\n"; - for(int i = 0; i < duplicateMapsToRename.size(); ++i) { + for(int i = 0; i < (int)duplicateMapsToRename.size(); ++i) { string currentPath = pathList[1]; endPathWithSlash(currentPath); @@ -3162,9 +3162,9 @@ void CheckForDuplicateData() { } vector duplicateTilesetsToRename; - for(int i = 0; i < tileSets.size(); ++i) { + for(int i = 0; i < (int)tileSets.size(); ++i) { string tileSet1 = tileSets[i]; - for(int j = 0; j < tileSets.size(); ++j) { + for(int j = 0; j < (int)tileSets.size(); ++j) { if(i != j) { string tileSet2= tileSets[j]; if(tileSet1 == tileSet2) { @@ -3178,7 +3178,7 @@ void CheckForDuplicateData() { if(duplicateTilesetsToRename.empty() == false) { string errorMsg = "Warning duplicate tilesets were detected and renamed:\n"; - for(int i = 0; i < duplicateTilesetsToRename.size(); ++i) { + for(int i = 0; i < (int)duplicateTilesetsToRename.size(); ++i) { string currentPath = tilesetPaths[1]; endPathWithSlash(currentPath); @@ -3217,9 +3217,9 @@ void CheckForDuplicateData() { } vector duplicateTechtreesToRename; - for(int i = 0; i < techTrees.size(); ++i) { + for(int i = 0; i < (int)techTrees.size(); ++i) { string techtree1 = techTrees[i]; - for(int j = 0; j < techTrees.size(); ++j) { + for(int j = 0; j < (int)techTrees.size(); ++j) { if(i != j) { string techtree2 = techTrees[j]; if(techtree1 == techtree2) { @@ -3233,7 +3233,7 @@ void CheckForDuplicateData() { if(duplicateTechtreesToRename.empty() == false) { string errorMsg = "Warning duplicate techtrees were detected and renamed:\n"; - for(int i = 0; i < duplicateTechtreesToRename.size(); ++i) { + for(int i = 0; i < (int)duplicateTechtreesToRename.size(); ++i) { string currentPath = techPaths[1]; endPathWithSlash(currentPath); @@ -4587,7 +4587,7 @@ int glestMain(int argc, char** argv) { // Example values: // DEFAULT_CHARSET (English) = 1 // GB2312_CHARSET (Chinese) = 134 - Shared::Platform::charSet = config.getInt("FONT_CHARSET",intToStr(Shared::Platform::charSet).c_str()); + Shared::Platform::PlatformContextGl::charSet = config.getInt("FONT_CHARSET",intToStr(Shared::Platform::PlatformContextGl::charSet).c_str()); if(config.getBool("No2DMouseRendering","false") == false) { showCursor(false); } @@ -4605,7 +4605,7 @@ int glestMain(int argc, char** argv) { // Setup debug logging etc setupLogging(config, haveSpecialOutputCommandLineOption); - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d, Font::fontIsMultibyte = %d, fontIsRightToLeft = %d\n",__FILE__,__FUNCTION__,__LINE__,Shared::Graphics::Font::charCount,Shared::Graphics::Font::fontTypeName.c_str(),Shared::Platform::charSet,Shared::Graphics::Font::fontIsMultibyte, Shared::Graphics::Font::fontIsRightToLeft); + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d, Font::fontIsMultibyte = %d, fontIsRightToLeft = %d\n",__FILE__,__FUNCTION__,__LINE__,Shared::Graphics::Font::charCount,Shared::Graphics::Font::fontTypeName.c_str(),Shared::Platform::PlatformContextGl::charSet,Shared::Graphics::Font::fontIsMultibyte, Shared::Graphics::Font::fontIsRightToLeft); NetworkInterface::setDisplayMessageFunction(ExceptionHandler::DisplayMessage); MenuStateMasterserver::setDisplayMessageFunction(ExceptionHandler::DisplayMessage); @@ -4774,8 +4774,8 @@ int glestMain(int argc, char** argv) { } } - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d, Font::fontIsMultibyte = %d, Font::fontIsRightToLeft = %d\n",__FILE__,__FUNCTION__,__LINE__,Shared::Graphics::Font::charCount,Shared::Graphics::Font::fontTypeName.c_str(),Shared::Platform::charSet,Shared::Graphics::Font::fontIsMultibyte,Shared::Graphics::Font::fontIsRightToLeft); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Using Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d, Font::fontIsMultibyte = %d, Font::fontIsRightToLeft = %d\n",Shared::Graphics::Font::charCount,Shared::Graphics::Font::fontTypeName.c_str(),Shared::Platform::charSet,Shared::Graphics::Font::fontIsMultibyte,Shared::Graphics::Font::fontIsRightToLeft); + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::PlatformContextGl::charSet = %d, Font::fontIsMultibyte = %d, Font::fontIsRightToLeft = %d\n",__FILE__,__FUNCTION__,__LINE__,Shared::Graphics::Font::charCount,Shared::Graphics::Font::fontTypeName.c_str(),Shared::Platform::PlatformContextGl::charSet,Shared::Graphics::Font::fontIsMultibyte,Shared::Graphics::Font::fontIsRightToLeft); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Using Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::PlatformContextGl::charSet = %d, Font::fontIsMultibyte = %d, Font::fontIsRightToLeft = %d\n",Shared::Graphics::Font::charCount,Shared::Graphics::Font::fontTypeName.c_str(),Shared::Platform::PlatformContextGl::charSet,Shared::Graphics::Font::fontIsMultibyte,Shared::Graphics::Font::fontIsRightToLeft); if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_USE_FONT]) == true) { int foundParamIndIndex = -1; diff --git a/source/glest_game/menu/main_menu.cpp b/source/glest_game/menu/main_menu.cpp index 1f01e471..9b12a092 100644 --- a/source/glest_game/menu/main_menu.cpp +++ b/source/glest_game/menu/main_menu.cpp @@ -416,7 +416,7 @@ bool MenuState::keyPressEditLabel(SDL_KeyboardEvent c, GraphicLabel **activeInpu //if((c>='0' && c<='9') || (c>='a' && c<='z') || (c>='A' && c<='Z') || // (c=='-') || (c=='(') || (c==')')) { if(isAllowedInputTextKey(key)) { - if(activeInputLabel->getText().size() < maxTextSize) { + if((int)activeInputLabel->getText().size() < maxTextSize) { string text= activeInputLabel->getText(); wchar_t keyW = extractKeyPressedUnicode(c); @@ -540,7 +540,7 @@ bool MenuState::keyDownEditLabel(SDL_KeyboardEvent c, GraphicLabel **activeInput //} //for(unsigned int i = 0; i < textCharLength[textCharLength.size()-2]; ++i) { - for(unsigned int i = 0; i < activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-2]; ++i) { + for(unsigned int i = 0; i < (unsigned int)activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-2]; ++i) { //printf("erase A1 i = %d [%s]\n",i,text.c_str()); text.erase(text.end() -2); //printf("erase A2 i = %d [%s]\n",i,text.c_str()); @@ -556,7 +556,7 @@ bool MenuState::keyDownEditLabel(SDL_KeyboardEvent c, GraphicLabel **activeInput } else { //for(unsigned int i = 0; i < textCharLength[textCharLength.size()-1]; ++i) { - for(unsigned int i = 0; i < activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-1]; ++i) { + for(unsigned int i = 0; i < (unsigned int)activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-1]; ++i) { //printf("erase B1 i = %d [%s]\n",i,text.c_str()); text.erase(text.end() -1); //printf("erase B2 i = %d [%s]\n",i,text.c_str()); diff --git a/source/glest_game/menu/menu_state_about.cpp b/source/glest_game/menu/menu_state_about.cpp index 1063dcc6..bc19a36c 100644 --- a/source/glest_game/menu/menu_state_about.cpp +++ b/source/glest_game/menu/menu_state_about.cpp @@ -252,14 +252,14 @@ void MenuStateAbout::render() { for(int i= 0; i < teammateCount; ++i) { int characterPos = (i % teammateTopLineCount); - if(characterPos < characterMenuScreenPositionListCache.size()) { + if(characterPos < (int)characterMenuScreenPositionListCache.size()) { adjustModelText = false; int xPos = characterMenuScreenPositionListCache[characterPos].x; - if(i == 7 && characterPos+1 < characterMenuScreenPositionListCache.size()) { + if(i == 7 && characterPos+1 < (int)characterMenuScreenPositionListCache.size()) { xPos += ((characterMenuScreenPositionListCache[characterPos+1].x - characterMenuScreenPositionListCache[characterPos].x) / 2); } - else if(i == 8 && characterPos+1 < characterMenuScreenPositionListCache.size()) { + else if(i == 8 && characterPos+1 < (int)characterMenuScreenPositionListCache.size()) { xPos = characterMenuScreenPositionListCache[characterPos+1].x; } diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index 4413ba5b..af3856b7 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -461,7 +461,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM vector resultsScenarios; findDirs(dirList, resultsScenarios); // Filter out only scenarios with no network slots - for(int i= 0; i < resultsScenarios.size(); ++i) { + for(int i= 0; i < (int)resultsScenarios.size(); ++i) { string scenario = resultsScenarios[i]; string file = Scenario::getScenarioPath(dirList, scenario); @@ -492,7 +492,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM } } resultsScenarios.clear(); - for(int i = 0; i < scenarioFiles.size(); ++i) { + for(int i = 0; i < (int)scenarioFiles.size(); ++i) { resultsScenarios.push_back(formatString(scenarioFiles[i])); } listBoxScenario.setItems(resultsScenarios); @@ -1879,11 +1879,11 @@ void MenuStateConnectedGame::reloadFactions(bool keepExistingSelectedItem, strin string scenarioDir = Scenario::getScenarioDir(dirList, scenario); vector techPaths = config.getPathListForType(ptTechs,scenarioDir); - for(int idx = 0; idx < techPaths.size(); idx++) { + for(int idx = 0; idx < (int)techPaths.size(); idx++) { string &techPath = techPaths[idx]; endPathWithSlash(techPath); - if(listBoxTechTree.getSelectedItemIndex() >= 0 && listBoxTechTree.getSelectedItemIndex() < techTreeFiles.size()) { + if(listBoxTechTree.getSelectedItemIndex() >= 0 && listBoxTechTree.getSelectedItemIndex() < (int)techTreeFiles.size()) { findDirs(techPath + techTreeFiles[listBoxTechTree.getSelectedItemIndex()] + "/factions/", results, false, false); } if(results.empty() == false) { @@ -1899,7 +1899,7 @@ void MenuStateConnectedGame::reloadFactions(bool keepExistingSelectedItem, strin vector translatedFactionNames; factionFiles= results; - for(int i = 0; i < results.size(); ++i) { + for(int i = 0; i < (int)results.size(); ++i) { results[i]= formatString(results[i]); string translatedString=techTree->getTranslatedFactionName(techTreeFiles[listBoxTechTree.getSelectedItemIndex()],factionFiles[i]); if(toLower(translatedString)==toLower(results[i])){ @@ -1941,7 +1941,7 @@ void MenuStateConnectedGame::reloadFactions(bool keepExistingSelectedItem, strin } } } - else if(originalIndex < results.size()) { + else if(originalIndex < (int)results.size()) { listBoxFactions[i].setSelectedItemIndex(originalIndex); } } @@ -1975,7 +1975,7 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) { if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d] listBoxMap.getSelectedItemIndex() = %d, mapFiles.size() = " MG_SIZE_T_SPECIFIER ", getCurrentMapFile() [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,listBoxMap.getSelectedItemIndex(),mapFiles.size(),getCurrentMapFile().c_str()); - if(listBoxMap.getSelectedItemIndex() >= 0 && listBoxMap.getSelectedItemIndex() < mapFiles.size()) { + if(listBoxMap.getSelectedItemIndex() >= 0 && listBoxMap.getSelectedItemIndex() < (int)mapFiles.size()) { gameSettings->setDescription(formatString(getCurrentMapFile())); gameSettings->setMap(getCurrentMapFile()); } @@ -1997,7 +1997,7 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) { } } - if(listBoxTileset.getSelectedItemIndex() >= 0 && listBoxTileset.getSelectedItemIndex() < tilesetFiles.size()) { + if(listBoxTileset.getSelectedItemIndex() >= 0 && listBoxTileset.getSelectedItemIndex() < (int)tilesetFiles.size()) { gameSettings->setTileset(tilesetFiles[listBoxTileset.getSelectedItemIndex()]); } else { @@ -2019,7 +2019,7 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) { clientInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]); } } - if(listBoxTechTree.getSelectedItemIndex() >= 0 && listBoxTechTree.getSelectedItemIndex() < techTreeFiles.size()) { + if(listBoxTechTree.getSelectedItemIndex() >= 0 && listBoxTechTree.getSelectedItemIndex() < (int)techTreeFiles.size()) { gameSettings->setTech(techTreeFiles[listBoxTechTree.getSelectedItemIndex()]); } else { @@ -2787,7 +2787,7 @@ void MenuStateConnectedGame::update() { listBoxTechTree.getSelectedItemIndex() >= 0 && listBoxTechTree.getSelectedItem() != Lang::getInstance().getString("DataMissing","",true)) { - time_t now = time(NULL); + //time_t now = time(NULL); time_t lastUpdateDate = getFolderTreeContentsCheckSumRecursivelyLastGenerated(config.getPathListForType(ptTechs,""), string("/") + gameSettings->getTech() + string("/*"), ".xml"); const time_t REFRESH_CRC_DAY_SECONDS = 60 * 60 * 1; @@ -2812,7 +2812,7 @@ void MenuStateConnectedGame::update() { factionName != Lang::getInstance().getString("DataMissing","",true)) { uint32 factionCRC = 0; - time_t now = time(NULL); + //time_t now = time(NULL); time_t lastUpdateDate = getFolderTreeContentsCheckSumRecursivelyLastGenerated(config.getPathListForType(ptTechs,""), "/" + gameSettings->getTech() + "/factions/" + factionName + "/*", ".xml"); const time_t REFRESH_CRC_DAY_SECONDS = 60 * 60 * 24; @@ -3100,7 +3100,7 @@ void MenuStateConnectedGame::update() { clientInterface->sendTextMessage("techtree CRC mismatch",-1,true,""); vector reportLineTokens; Tokenize(report,reportLineTokens,"\n"); - for(int reportLine = 0; reportLine < reportLineTokens.size(); ++reportLine) { + for(int reportLine = 0; reportLine < (int)reportLineTokens.size(); ++reportLine) { clientInterface->sendTextMessage(reportLineTokens[reportLine],-1,true,""); } } @@ -3378,7 +3378,7 @@ bool MenuStateConnectedGame::loadFactions(const GameSettings *gameSettings, bool Config &config = Config::getInstance(); vector techPaths = config.getPathListForType(ptTechs,scenarioDir); - for(int idx = 0; idx < techPaths.size(); idx++) { + for(int idx = 0; idx < (int)techPaths.size(); idx++) { string &techPath = techPaths[idx]; endPathWithSlash(techPath); //findAll(techPath + gameSettings->getTech() + "/factions/*.", results, false, false); @@ -3402,7 +3402,7 @@ bool MenuStateConnectedGame::loadFactions(const GameSettings *gameSettings, bool results.push_back(Lang::getInstance().getString("DataMissing","",true)); factionFiles = results; vector translatedFactionNames; - for(int i= 0; i < factionFiles.size(); ++i) { + for(int i= 0; i < (int)factionFiles.size(); ++i) { results[i]= formatString(results[i]); string translatedString=techTree->getTranslatedFactionName(gameSettings->getTech(),factionFiles[i]); if(toLower(translatedString)==toLower(results[i])){ @@ -3445,7 +3445,7 @@ bool MenuStateConnectedGame::loadFactions(const GameSettings *gameSettings, bool factionFiles= results; vector translatedFactionNames; - for(int i= 0; i < factionFiles.size(); ++i) { + for(int i= 0; i < (int)factionFiles.size(); ++i) { results[i]= formatString(results[i]); string translatedString=techTree->getTranslatedFactionName(gameSettings->getTech(),factionFiles[i]); if(toLower(translatedString)==toLower(results[i])){ @@ -4098,7 +4098,7 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, vector translatedTechs; std::vector techsFormatted = techTreeFiles; - for(int i= 0; i < techsFormatted.size(); i++){ + for(int i= 0; i < (int)techsFormatted.size(); i++){ techsFormatted.at(i)= formatString(techsFormatted.at(i)); string txTech = techTree->getTranslatedName(techTreeFiles.at(i), true); @@ -4111,7 +4111,7 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, Lang &lang= Lang::getInstance(); const vector languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages(); - for(unsigned int i = 0; i < languageList.size(); ++i) { + for(unsigned int i = 0; i < (unsigned int)languageList.size(); ++i) { char szMsg[8096]=""; if(lang.hasString("DataMissingTechtreeFailDownload",languageList[i]) == true) { snprintf(szMsg,8096,lang.getString("DataMissingTechtreeFailDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),(itemName+"(.7z)").c_str(),curlVersion->version); @@ -4157,7 +4157,7 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, NetworkManager &networkManager= NetworkManager::getInstance(); ClientInterface* clientInterface= networkManager.getClientInterface(); - const GameSettings *gameSettings = clientInterface->getGameSettings(); + //const GameSettings *gameSettings = clientInterface->getGameSettings(); if(result.first == ftp_crt_SUCCESS) { Lang &lang= Lang::getInstance(); @@ -4806,7 +4806,7 @@ int MenuStateConnectedGame::setupMapList(string scenario) { std::for_each(formattedPlayerSortedMaps[0].begin(), formattedPlayerSortedMaps[0].end(), FormatString()); formattedMapFiles.clear(); - for(int i= 0; i < mapFiles.size(); i++){// fetch info and put map in right list + for(int i= 0; i < (int)mapFiles.size(); i++){// fetch info and put map in right list loadMapInfo(Map::getMapPath(mapFiles.at(i), scenarioDir, false), &mapInfo, false); if(GameConstants::maxPlayers+1 <= mapInfo.players) { diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index 35aad38e..66fc5b4f 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -205,7 +205,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, std::vector ipList = Socket::getLocalIPAddressList(); if(ipList.empty() == false) { ipText = ""; - for(int idx = 0; idx < ipList.size(); idx++) { + for(int idx = 0; idx < (int)ipList.size(); idx++) { string ip = ipList[idx]; if(ipText != "") { ipText += ", "; @@ -376,7 +376,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, vector resultsScenarios; findDirs(dirList, resultsScenarios); // Filter out only scenarios with no network slots - for(int i= 0; i < resultsScenarios.size(); ++i) { + for(int i= 0; i < (int)resultsScenarios.size(); ++i) { string scenario = resultsScenarios[i]; string file = Scenario::getScenarioPath(dirList, scenario); @@ -408,7 +408,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, } } resultsScenarios.clear(); - for(int i = 0; i < scenarioFiles.size(); ++i) { + for(int i = 0; i < (int)scenarioFiles.size(); ++i) { resultsScenarios.push_back(formatString(scenarioFiles[i])); } listBoxScenario.setItems(resultsScenarios); @@ -716,7 +716,7 @@ void MenuStateCustomGame::reloadUI() { std::vector ipList = Socket::getLocalIPAddressList(); if(ipList.empty() == false) { ipText = ""; - for(int idx = 0; idx < ipList.size(); idx++) { + for(int idx = 0; idx < (int)ipList.size(); idx++) { string ip = ipList[idx]; if(ipText != "") { ipText += ", "; @@ -2578,7 +2578,7 @@ void MenuStateCustomGame::update() { serverInterface->sendTextMessage("techtree CRC mismatch",-1,true,""); vector reportLineTokens; Tokenize(report,reportLineTokens,"\n"); - for(int reportLine = 0; reportLine < reportLineTokens.size(); ++reportLine) { + for(int reportLine = 0; reportLine < (int)reportLineTokens.size(); ++reportLine) { serverInterface->sendTextMessage(reportLineTokens[reportLine],-1,true,""); } } @@ -3102,7 +3102,7 @@ void MenuStateCustomGame::simpleTaskForMasterServer(BaseThread *callingThread) { request += SystemFlags::escapeURL(iterMap->second,handle); paramIndex++; - if(paramIndex < newPublishToServerInfo.size()) { + if(paramIndex < (int)newPublishToServerInfo.size()) { request += "&"; } } @@ -3703,7 +3703,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force if(masterserver_admin_found == false ) { for(int i=mapInfo.players; i < GameConstants::maxPlayers; ++i) { ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface(); - ConnectionSlot *slot = serverInterface->getSlot(i); + //ConnectionSlot *slot = serverInterface->getSlot(i); if( serverInterface->getSlot(i) != NULL && serverInterface->getSlot(i)->isConnected()) { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); @@ -4734,7 +4734,7 @@ int MenuStateCustomGame::setupMapList(string scenario) { std::for_each(formattedPlayerSortedMaps[0].begin(), formattedPlayerSortedMaps[0].end(), FormatString()); //printf("#5\n"); - for(int i= 0; i < mapFiles.size(); i++){// fetch info and put map in right list + for(int i= 0; i < (int)mapFiles.size(); i++){// fetch info and put map in right list loadMapInfo(Map::getMapPath(mapFiles.at(i), scenarioDir, false), &mapInfo, false); if(GameConstants::maxPlayers+1 <= mapInfo.players) { @@ -4836,7 +4836,7 @@ void MenuStateCustomGame::reloadFactions(bool keepExistingSelectedItem, string s //printf("#1 techPaths.size() = %d scenarioDir [%s] [%s]\n",techPaths.size(),scenario.c_str(),scenarioDir.c_str()); if(listBoxTechTree.getItemCount() > 0) { - for(int idx = 0; idx < techPaths.size(); idx++) { + for(int idx = 0; idx < (int)techPaths.size(); idx++) { string &techPath = techPaths[idx]; endPathWithSlash(techPath); string factionPath = techPath + techTreeFiles[listBoxTechTree.getSelectedItemIndex()] + "/factions/"; @@ -4870,7 +4870,7 @@ void MenuStateCustomGame::reloadFactions(bool keepExistingSelectedItem, string s vector translatedFactionNames; factionFiles= results; - for(int i = 0; i < results.size(); ++i) { + for(int i = 0; i < (int)results.size(); ++i) { results[i]= formatString(results[i]); string translatedString = ""; @@ -4917,7 +4917,7 @@ void MenuStateCustomGame::reloadFactions(bool keepExistingSelectedItem, string s } } } - else if(originalIndex < results.size()) { + else if(originalIndex < (int)results.size()) { listBoxFactions[i].setSelectedItemIndex(originalIndex); } } diff --git a/source/glest_game/menu/menu_state_join_game.cpp b/source/glest_game/menu/menu_state_join_game.cpp index b2ee77e0..ec163d51 100644 --- a/source/glest_game/menu/menu_state_join_game.cpp +++ b/source/glest_game/menu/menu_state_join_game.cpp @@ -280,7 +280,7 @@ void MenuStateJoinGame::DiscoveredServers(std::vector serverList) { if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - for(int idx = 0; idx < serverList.size(); idx++) { + for(int idx = 0; idx < (int)serverList.size(); idx++) { vector paramPartPortsTokens; Tokenize(serverList[idx],paramPartPortsTokens,":"); @@ -687,7 +687,7 @@ void MenuStateJoinGame::keyPress(SDL_KeyboardEvent c) { //if(c>='0' && c<='9') { if( (key >= SDLK_0 && key <= SDLK_9) || (key >= SDLK_KP0 && key <= SDLK_KP9)) { - if(labelServerIp.getText().size() < maxTextSize) { + if((int)labelServerIp.getText().size() < maxTextSize) { string text= labelServerIp.getText(); //text.insert(text.end()-1, key); char szCharText[20]=""; @@ -707,7 +707,7 @@ void MenuStateJoinGame::keyPress(SDL_KeyboardEvent c) { } //else if (c=='.') { else if (key == SDLK_PERIOD) { - if(labelServerIp.getText().size() < maxTextSize) { + if((int)labelServerIp.getText().size() < maxTextSize) { string text= labelServerIp.getText(); if(text.size() > 0) { text.insert(text.end() -1, '.'); diff --git a/source/glest_game/menu/menu_state_keysetup.cpp b/source/glest_game/menu/menu_state_keysetup.cpp index 2d43eea5..e420fdd4 100644 --- a/source/glest_game/menu/menu_state_keysetup.cpp +++ b/source/glest_game/menu/menu_state_keysetup.cpp @@ -150,7 +150,7 @@ MenuStateKeysetup::MenuStateKeysetup(Program *program, MainMenu *mainMenu, //throw megaglest_runtime_error("Test!"); - for(int i = 0; i < mergedProperties.size(); ++i) { + for(int i = 0; i < (int)mergedProperties.size(); ++i) { string keyName = mergedProperties[i].second; if(keyName.length() > 0) { @@ -544,7 +544,7 @@ void MenuStateKeysetup::keyUp(SDL_KeyboardEvent key) { if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] keyName [%s] char [%d][%d]\n",__FILE__,__FUNCTION__,__LINE__,keyName.c_str(),hotkeyChar,key.keysym.sym); - SDLKey keysym = SDLK_UNKNOWN; + //SDLKey keysym = SDLK_UNKNOWN; if(keyName == "unknown key" || keyName == "") { // Config &configKeys = Config::getInstance(std::pair(cfgMainKeys,cfgUserKeys)); // keysym = configKeys.translateSpecialStringToSDLKey(hotkeyChar); @@ -569,7 +569,7 @@ void MenuStateKeysetup::keyUp(SDL_KeyboardEvent key) { pair &nameValuePair = mergedProperties[hotkeyIndex]; bool isNewUserKeyEntry = true; - for(int i = 0; i < userProperties.size(); ++i) { + for(int i = 0; i < (int)userProperties.size(); ++i) { string hotKeyName = userProperties[i].first; if(nameValuePair.first == hotKeyName) { // if(keysym <= SDLK_ESCAPE || keysym > 255) { diff --git a/source/glest_game/menu/menu_state_load_game.cpp b/source/glest_game/menu/menu_state_load_game.cpp index ca4de702..f2b52e39 100644 --- a/source/glest_game/menu/menu_state_load_game.cpp +++ b/source/glest_game/menu/menu_state_load_game.cpp @@ -218,7 +218,7 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){ snprintf(szBuf,8096,lang.getString("LoadGameDeletingFile","",true).c_str(),filename.c_str()); console.addLineOnly(szBuf); - for(int i = 0; i < slots.size(); i++) { + for(int i = 0; i < (int)slots.size(); i++) { if(slots[i] == selectedButton) { if(removeFile(filename) == true) { removeFile(jpgfilename); @@ -401,7 +401,7 @@ void MenuStateLoadGame::render() { renderer.renderButton(&deleteButton); renderer.renderButton(&loadButton); - for(int i=0; iinit(userButtonsXBase,userButtonsYBase,userButtonsWidth,userButtonsHeight); //button->init(userButtonsXBase,userButtonsYBase-userButtonsLineHeight*i,userButtonsWidth,userButtonsHeight); @@ -1035,7 +1035,7 @@ void MenuStateMasterserver::rebuildServerLines(const string &serverInfo) { std::vector serverList; Tokenize(serverInfo,serverList,"\n"); - for(int i=0; i < serverList.size(); i++) { + for(int i = 0; i < (int)serverList.size(); i++) { string &server = serverList[i]; if(trim(server) == "") { continue; @@ -1112,8 +1112,8 @@ void MenuStateMasterserver::rebuildServerLines(const string &serverInfo) { SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line %d] error during Internet game status update: [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what()); } - if(serverLines.size()>numberOfOldServerLines) { - playServerFoundSound=true; + if((int)serverLines.size() > numberOfOldServerLines) { + playServerFoundSound = true; } } diff --git a/source/glest_game/menu/menu_state_mods.cpp b/source/glest_game/menu/menu_state_mods.cpp index 68232423..6a6a0a52 100644 --- a/source/glest_game/menu/menu_state_mods.cpp +++ b/source/glest_game/menu/menu_state_mods.cpp @@ -885,7 +885,7 @@ string MenuStateMods::refreshTechModInfo(string techInfo) { void MenuStateMods::refreshTechs() { getTechsLocalList(); - for(int i=0; i < techListRemote.size(); i++) { + for(int i=0; i < (int)techListRemote.size(); i++) { refreshTechModInfo(techListRemote[i]); } } @@ -947,7 +947,7 @@ string MenuStateMods::refreshTilesetModInfo(string tilesetInfo) { void MenuStateMods::refreshTilesets() { getTilesetsLocalList(); - for(int i=0; i < tilesetListRemote.size(); i++) { + for(int i=0; i < (int)tilesetListRemote.size(); i++) { refreshTilesetModInfo(tilesetListRemote[i]); } } @@ -1058,7 +1058,7 @@ string MenuStateMods::getMapCRC(string mapName) { void MenuStateMods::refreshMaps() { getMapsLocalList(); - for(int i=0; i < mapListRemote.size(); i++) { + for(int i=0; i < (int)mapListRemote.size(); i++) { refreshMapModInfo(mapListRemote[i]); } } @@ -1115,7 +1115,7 @@ string MenuStateMods::refreshScenarioModInfo(string scenarioInfo) { void MenuStateMods::refreshScenarios() { getScenariosLocalList(); - for(int i=0; i < scenarioListRemote.size(); i++) { + for(int i=0; i < (int)scenarioListRemote.size(); i++) { refreshScenarioModInfo(scenarioListRemote[i]); } } @@ -2302,7 +2302,7 @@ void MenuStateMods::render() { if(keyScenarioScrollBar.getElementCount() != 0) { for(int i = keyScenarioScrollBar.getVisibleStart(); i <= keyScenarioScrollBar.getVisibleEnd(); ++i) { - if(i >= keyScenarioButtons.size()) { + if(i >= (int)keyScenarioButtons.size()) { char szBuf[8096]=""; snprintf(szBuf,8096,"i >= keyScenarioButtons.size(), i = %d keyScenarioButtons.size() = %d",i,(int)keyScenarioButtons.size()); throw megaglest_runtime_error(szBuf); @@ -2443,7 +2443,7 @@ void MenuStateMods::update() { if (keyTechScrollBar.getElementCount() != 0) { for (int i = keyTechScrollBar.getVisibleStart(); i <= keyTechScrollBar.getVisibleEnd(); ++i) { - if(i >= keyTechButtons.size()) { + if(i >= (int)keyTechButtons.size()) { char szBuf[8096]=""; snprintf(szBuf,8096,"i >= keyTechButtons.size(), i = %d, keyTechButtons.size() = %d",i,(int)keyTechButtons.size()); throw megaglest_runtime_error(szBuf); @@ -2460,7 +2460,7 @@ void MenuStateMods::update() { if (keyTilesetScrollBar.getElementCount() != 0) { for (int i = keyTilesetScrollBar.getVisibleStart(); i <= keyTilesetScrollBar.getVisibleEnd(); ++i) { - if(i >= keyTilesetButtons.size()) { + if(i >= (int)keyTilesetButtons.size()) { char szBuf[8096]=""; snprintf(szBuf,8096,"i >= keyTilesetButtons.size(), i = %d, keyTilesetButtons.size() = %d",i,(int)keyTilesetButtons.size()); throw megaglest_runtime_error(szBuf); @@ -2476,7 +2476,7 @@ void MenuStateMods::update() { if (keyMapScrollBar.getElementCount() != 0) { for (int i = keyMapScrollBar.getVisibleStart(); i <= keyMapScrollBar.getVisibleEnd(); ++i) { - if(i >= keyMapButtons.size()) { + if(i >= (int)keyMapButtons.size()) { char szBuf[8096]=""; snprintf(szBuf,8096,"i >= keyMapButtons.size(), i = %d, keyMapButtons.size() = %d",i,(int)keyMapButtons.size()); throw megaglest_runtime_error(szBuf); @@ -2493,7 +2493,7 @@ void MenuStateMods::update() { if (keyScenarioScrollBar.getElementCount() != 0) { for (int i = keyScenarioScrollBar.getVisibleStart(); i <= keyScenarioScrollBar.getVisibleEnd(); ++i) { - if(i >= keyScenarioButtons.size()) { + if(i >= (int)keyScenarioButtons.size()) { char szBuf[8096]=""; snprintf(szBuf,8096,"i >= keyScenarioButtons.size(), i = %d, keyScenarioButtons.size() = %d",i,(int)keyScenarioButtons.size()); throw megaglest_runtime_error(szBuf); @@ -2680,7 +2680,7 @@ void MenuStateMods::FTPClient_CallbackEvent(string itemName, // Refresh CRC Config &config = Config::getInstance(); - uint32 CRCTechtreeValue = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), string("/") + itemName + string("/*"), ".xml", NULL, true); + getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), string("/") + itemName + string("/*"), ".xml", NULL, true); safeMutexFTPProgress.ReleaseLock(); refreshTechs(); @@ -2726,7 +2726,7 @@ void MenuStateMods::FTPClient_CallbackEvent(string itemName, // Refresh CRC Config &config = Config::getInstance(); - uint32 CRCScenarioValue = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptScenarios,""), string("/") + itemName + string("/*"), ".xml", NULL, true); + getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptScenarios,""), string("/") + itemName + string("/*"), ".xml", NULL, true); safeMutexFTPProgress.ReleaseLock(); refreshScenarios(); diff --git a/source/glest_game/menu/menu_state_options_network.cpp b/source/glest_game/menu/menu_state_options_network.cpp index 0d2badf6..cb995611 100644 --- a/source/glest_game/menu/menu_state_options_network.cpp +++ b/source/glest_game/menu/menu_state_options_network.cpp @@ -131,7 +131,7 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai string currentPort=config.getString("PortServer", intToStr(GameConstants::serverPort).c_str()); int portSelectionIndex=0; - for(int idx = 0; idx < portList.size(); idx++) { + for(int idx = 0; idx < (int)portList.size(); idx++) { if(portList[idx] != "" && IsNumeric(portList[idx].c_str(),false)) { listBoxServerPort.pushBackItem(portList[idx]); if(currentPort==portList[idx]) diff --git a/source/glest_game/menu/menu_state_root.cpp b/source/glest_game/menu/menu_state_root.cpp index f8f426da..0c27d8a6 100644 --- a/source/glest_game/menu/menu_state_root.cpp +++ b/source/glest_game/menu/menu_state_root.cpp @@ -242,14 +242,14 @@ void MenuStateRoot::render() { coreData.getLogoTexture(), GraphicComponent::getFade()); int maxLogoWidth=0; - for(int idx = 0; idx < coreData.getLogoTextureExtraCount(); ++idx) { + for(int idx = 0; idx < (int)coreData.getLogoTextureExtraCount(); ++idx) { Texture2D *extraLogo = coreData.getLogoTextureExtra(idx); maxLogoWidth += extraLogo->getPixmap()->getW(); } int currentX = (metrics.getVirtualW()-maxLogoWidth)/2; int currentY = 50; - for(int idx = 0; idx < coreData.getLogoTextureExtraCount(); ++idx) { + for(int idx = 0; idx < (int)coreData.getLogoTextureExtraCount(); ++idx) { Texture2D *extraLogo = coreData.getLogoTextureExtra(idx); logoMainX = currentX; diff --git a/source/glest_game/menu/menu_state_scenario.cpp b/source/glest_game/menu/menu_state_scenario.cpp index 9af71616..9bf22a80 100644 --- a/source/glest_game/menu/menu_state_scenario.cpp +++ b/source/glest_game/menu/menu_state_scenario.cpp @@ -122,7 +122,7 @@ MenuStateScenario::MenuStateScenario(Program *program, MainMenu *mainMenu, } std::map scenarioErrors; - for(int i= 0; i 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < scenarioFiles.size()) { + if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < (int)scenarioFiles.size()) { string scenarioPath = Scenario::getScenarioPath(dirList, scenarioFiles[listBoxScenario.getSelectedItemIndex()]); //printf("scenarioPath [%s]\n",scenarioPath.c_str()); @@ -244,7 +244,7 @@ void MenuStateScenario::mouseClick(int x, int y, MouseButton mouseButton) { try { if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] listBoxScenario.getSelectedItemIndex() = %d scenarioFiles.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,listBoxScenario.getSelectedItemIndex(),(int)scenarioFiles.size()); - if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < scenarioFiles.size()) { + if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < (int)scenarioFiles.size()) { loadScenarioInfo(Scenario::getScenarioPath(dirList, scenarioFiles[listBoxScenario.getSelectedItemIndex()]), &scenarioInfo); labelInfo.setText(scenarioInfo.desc); if(scenarioInfo.namei18n != "") { @@ -333,7 +333,7 @@ void MenuStateScenario::update() { else { try { this->autoloadScenarioName = ""; - if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < scenarioFiles.size()) { + if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < (int)scenarioFiles.size()) { loadScenarioInfo(Scenario::getScenarioPath(dirList, scenarioFiles[listBoxScenario.getSelectedItemIndex()]), &scenarioInfo); labelInfo.setText(scenarioInfo.desc); if(scenarioInfo.namei18n != "") { @@ -402,7 +402,7 @@ void MenuStateScenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo void MenuStateScenario::loadScenarioPreviewTexture(){ if(enableScenarioTexturePreview == true) { //if(listBoxScenario.getSelectedItemIndex() >= 0) { - if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < scenarioFiles.size()) { + if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < (int)scenarioFiles.size()) { GameSettings gameSettings; loadGameSettings(&scenarioInfo, &gameSettings); @@ -431,7 +431,7 @@ void MenuStateScenario::loadGameSettings(const ScenarioInfo *scenarioInfo, GameS snprintf(szBuf,8096,"listBoxScenario.getSelectedItemIndex() < 0, = %d",listBoxScenario.getSelectedItemIndex()); throw megaglest_runtime_error(szBuf); } - else if(listBoxScenario.getSelectedItemIndex() >= scenarioFiles.size()) { + else if(listBoxScenario.getSelectedItemIndex() >= (int)scenarioFiles.size()) { char szBuf[8096]=""; snprintf(szBuf,8096,"listBoxScenario.getSelectedItemIndex() >= scenarioFiles.size(), = [%d][%d]",listBoxScenario.getSelectedItemIndex(),(int)scenarioFiles.size()); throw megaglest_runtime_error(szBuf); diff --git a/source/glest_game/network/client_interface.cpp b/source/glest_game/network/client_interface.cpp index 4edac22d..86ee684c 100644 --- a/source/glest_game/network/client_interface.cpp +++ b/source/glest_game/network/client_interface.cpp @@ -959,7 +959,7 @@ void ClientInterface::updateLobby() { { //make sure we read the message - time_t receiveTimeElapsed = time(NULL); + //time_t receiveTimeElapsed = time(NULL); NetworkMessageCommandList networkMessageCommandList; bool gotCmd = receiveMessage(&networkMessageCommandList); if(gotCmd == false) { @@ -971,7 +971,7 @@ void ClientInterface::updateLobby() { case nmtQuit: { - time_t receiveTimeElapsed = time(NULL); + //time_t receiveTimeElapsed = time(NULL); NetworkMessageQuit networkMessageQuit; bool gotCmd = receiveMessage(&networkMessageQuit); if(gotCmd == false) { @@ -1064,7 +1064,7 @@ void ClientInterface::updateFrame(int *checkFrame) { { //make sure we read the message - time_t receiveTimeElapsed = time(NULL); + //time_t receiveTimeElapsed = time(NULL); NetworkMessageCommandList networkMessageCommandList; bool gotCmd = receiveMessage(&networkMessageCommandList); if(gotCmd == false) { @@ -1157,7 +1157,7 @@ void ClientInterface::updateFrame(int *checkFrame) { case nmtQuit: { - time_t receiveTimeElapsed = time(NULL); + //time_t receiveTimeElapsed = time(NULL); NetworkMessageQuit networkMessageQuit; // while(receiveMessage(&networkMessageQuit) == false && // isConnected() == true && @@ -1410,7 +1410,7 @@ bool ClientInterface::getNetworkCommand(int frameCount, int currentCachedPending if(cachedPendingCommands.find(frameCount) != cachedPendingCommands.end()) { Commands &frameCmdList = cachedPendingCommands[frameCount]; if(frameCmdList.size() > 0) { - for(int i= 0; i < frameCmdList.size(); ++i) { + for(int i= 0; i < (int)frameCmdList.size(); ++i) { pendingCommands.push_back(frameCmdList[i]); } //cachedPendingCommands.erase(frameCount); @@ -1460,7 +1460,7 @@ bool ClientInterface::getNetworkCommand(int frameCount, int currentCachedPending if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Client waiting for packet for frame: %d, copyCachedLastPendingFrameCount = %lld\n",frameCount,(long long int)copyCachedLastPendingFrameCount); chrono.start(); } - if(copyCachedLastPendingFrameCount > frameCount) { + if(copyCachedLastPendingFrameCount > (uint64)frameCount) { break; } @@ -1495,7 +1495,7 @@ void ClientInterface::updateKeyframe(int frameCount) { if(testThreaded == false) { updateFrame(&frameCount); Commands &frameCmdList = cachedPendingCommands[frameCount]; - for(int i= 0; i < frameCmdList.size(); ++i) { + for(int i= 0; i < (int)frameCmdList.size(); ++i) { pendingCommands.push_back(frameCmdList[i]); } cachedPendingCommands.erase(frameCount); @@ -1619,7 +1619,7 @@ void ClientInterface::waitUntilReady(Checksum* checksum) { else if(networkMessageType == nmtCommandList) { //int waitCount = 0; //make sure we read the message - time_t receiveTimeElapsed = time(NULL); + //time_t receiveTimeElapsed = time(NULL); NetworkMessageCommandList networkMessageCommandList; bool gotCmd = receiveMessage(&networkMessageCommandList); if(gotCmd == false) { diff --git a/source/glest_game/network/connection_slot.cpp b/source/glest_game/network/connection_slot.cpp index fff75bb6..f36f941f 100644 --- a/source/glest_game/network/connection_slot.cpp +++ b/source/glest_game/network/connection_slot.cpp @@ -94,7 +94,7 @@ void ConnectionSlotThread::setTaskCompleted(int eventId) { if(eventId > 0) { MutexSafeWrapper safeMutex(triggerIdMutex,CODE_AT_LINE); //event->eventCompleted = true; - for(int i = 0; i < eventList.size(); ++i) { + for(int i = 0; i < (int)eventList.size(); ++i) { ConnectionSlotEvent &slotEvent = eventList[i]; if(slotEvent.eventId == eventId) { //eventList.erase(eventList.begin() + i); @@ -114,7 +114,7 @@ void ConnectionSlotThread::purgeAllEvents() { void ConnectionSlotThread::setAllEventsCompleted() { MutexSafeWrapper safeMutex(triggerIdMutex,CODE_AT_LINE); - for(int i = 0; i < eventList.size(); ++i) { + for(int i = 0; i < (int)eventList.size(); ++i) { ConnectionSlotEvent &slotEvent = eventList[i]; if(slotEvent.eventCompleted == false) { slotEvent.eventCompleted = true; @@ -150,7 +150,7 @@ bool ConnectionSlotThread::isSignalCompleted(ConnectionSlotEvent *event) { MutexSafeWrapper safeMutex(triggerIdMutex,CODE_AT_LINE); bool result = false; if(event != NULL) { - for(int i = 0; i < eventList.size(); ++i) { + for(int i = 0; i < (int)eventList.size(); ++i) { ConnectionSlotEvent &slotEvent = eventList[i]; if(slotEvent.eventId == event->eventId) { result = slotEvent.eventCompleted; @@ -350,7 +350,7 @@ void ConnectionSlotThread::execute() { ConnectionSlotEvent eventCopy; eventCopy.eventId = -1; - for(int i = 0; i < eventList.size(); ++i) { + for(int i = 0; i < (int)eventList.size(); ++i) { ConnectionSlotEvent &slotEvent = eventList[i]; if(slotEvent.eventCompleted == false) { eventCopy = slotEvent; diff --git a/source/glest_game/network/network_interface.cpp b/source/glest_game/network/network_interface.cpp index 9f54e4ed..b1ce2c4f 100644 --- a/source/glest_game/network/network_interface.cpp +++ b/source/glest_game/network/network_interface.cpp @@ -127,7 +127,7 @@ NetworkMessageType NetworkInterface::getNextMessageType(int waitMilliseconds) (waitMilliseconds > 0 && socket->hasDataToReadWithWait(waitMilliseconds) == true))) { //peek message type int dataSize = socket->getDataToRead(); - if(dataSize >= sizeof(messageType)) { + if(dataSize >= (int)sizeof(messageType)) { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] socket->getDataToRead() dataSize = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,dataSize); int iPeek = socket->peek(&messageType, sizeof(messageType)); @@ -317,7 +317,7 @@ void NetworkInterface::setHighlightedCell(const MarkedCell &msg){ static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__); MutexSafeWrapper safeMutex(networkAccessMutex,mutexOwnerId); - for(int idx = 0; idx < highlightedCellList.size(); idx++) { + for(int idx = 0; idx < (int)highlightedCellList.size(); idx++) { MarkedCell mc = highlightedCellList[idx]; if(mc.getFactionIndex()==msg.getFactionIndex()){ highlightedCellList.erase(highlightedCellList.begin()+ idx); diff --git a/source/glest_game/network/network_message.cpp b/source/glest_game/network/network_message.cpp index 28080120..4f0b25f9 100644 --- a/source/glest_game/network/network_message.cpp +++ b/source/glest_game/network/network_message.cpp @@ -90,7 +90,7 @@ void NetworkMessage::dump_packet(string label, const void* data, int dataSize) { printf("%s",label.c_str()); const char *buf = static_cast(data); - for(unsigned int i = 0; i < dataSize; ++i) { + for(unsigned int i = 0; i < (unsigned int)dataSize; ++i) { printf("%u[%X][%d] ",i,buf[i],buf[i]); if(i % 10 == 0) { printf("\n"); @@ -1277,6 +1277,7 @@ unsigned int NetworkMessageCommandList::getPackedSizeHeader() { static unsigned int result = 0; if(result == 0) { Data packedData; + init(packedData); unsigned char *buf = new unsigned char[sizeof(packedData)*3]; result = pack(buf, getPackedMessageFormatHeader(), packedData.header.messageType, @@ -1333,7 +1334,7 @@ const char * NetworkMessageCommandList::getPackedMessageFormatDetail() const { unsigned int NetworkMessageCommandList::getPackedSizeDetail(int count) { unsigned int result = 0; if(result == 0) { - for(unsigned int i = 0; i < count; ++i) { + for(unsigned int i = 0; i < (unsigned int)count; ++i) { NetworkCommand packedData; unsigned char *buf = new unsigned char[sizeof(NetworkCommand)*3]; result += pack(buf, getPackedMessageFormatDetail(), @@ -1361,7 +1362,7 @@ void NetworkMessageCommandList::unpackMessageDetail(unsigned char *buf,int count data.commands.resize(count); //unsigned int bytes_processed_total = 0; unsigned char *bufMove = buf; - for(unsigned int i = 0; i < count; ++i) { + for(unsigned int i = 0; i < (unsigned int)count; ++i) { unsigned int bytes_processed = unpack(bufMove, getPackedMessageFormatDetail(), &data.commands[i].networkCommandType, &data.commands[i].unitId, @@ -1831,7 +1832,7 @@ NetworkMessageSynchNetworkGameData::NetworkMessageSynchNetworkGameData(const Gam if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] vctFileList.size() = %d, maxFileCRCCount = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__, vctFileList.size(),maxFileCRCCount); - for(int idx =0; idx < data.header.techCRCFileCount; ++idx) { + for(int idx =0; idx < (int)data.header.techCRCFileCount; ++idx) { const std::pair &fileInfo = vctFileList[idx]; data.detail.techCRCFileList[idx] = fileInfo.first; data.detail.techCRCFileCRCList[idx] = fileInfo.second; @@ -1855,11 +1856,11 @@ string NetworkMessageSynchNetworkGameData::getTechCRCFileMismatchReport(vector &fileInfo = vctFileList[idx]; bool fileFound = false; uint32 remoteCRC = 0; - for(int j = 0; j < data.header.techCRCFileCount; ++j) { + for(int j = 0; j < (int)data.header.techCRCFileCount; ++j) { string networkFile = data.detail.techCRCFileList[j].getString(); uint32 &networkFileCRC = data.detail.techCRCFileCRCList[j]; if(fileInfo.first == networkFile) { @@ -1877,12 +1878,12 @@ string NetworkMessageSynchNetworkGameData::getTechCRCFileMismatchReport(vector &fileInfo = vctFileList[idx]; if(networkFile == fileInfo.first) { fileFound = true; @@ -2042,7 +2043,7 @@ bool NetworkMessageSynchNetworkGameData::receive(Socket* socket) { // Wait a max of x seconds for this message result = NetworkMessage::receive(socket, &data.detail.techCRCFileList[packetIndex], packetDetail1DataSize, true); if(result == true) { - for(int i = 0; i < data.header.techCRCFileCount; ++i) { + for(unsigned int i = 0; i < data.header.techCRCFileCount; ++i) { data.detail.techCRCFileList[i].nullTerminate(); } @@ -2138,7 +2139,7 @@ NetworkMessageSynchNetworkGameDataStatus::NetworkMessageSynchNetworkGameDataStat data.header.mapCRC = mapCRC; data.header.techCRCFileCount = min((int)vctFileList.size(),(int)maxFileCRCCount); - for(int idx =0; idx < data.header.techCRCFileCount; ++idx) { + for(unsigned int idx =0; idx < data.header.techCRCFileCount; ++idx) { const std::pair &fileInfo = vctFileList[idx]; data.detail.techCRCFileList[idx] = fileInfo.first; data.detail.techCRCFileCRCList[idx] = fileInfo.second; @@ -2154,11 +2155,11 @@ string NetworkMessageSynchNetworkGameDataStatus::getTechCRCFileMismatchReport(st result = result + "Remote player has no files.\n"; } else { - for(int idx = 0; idx < vctFileList.size(); ++idx) { + for(int idx = 0; idx < (int)vctFileList.size(); ++idx) { std::pair &fileInfo = vctFileList[idx]; bool fileFound = false; uint32 remoteCRC = 0; - for(int j = 0; j < data.header.techCRCFileCount; ++j) { + for(int j = 0; j < (int)data.header.techCRCFileCount; ++j) { string networkFile = data.detail.techCRCFileList[j].getString(); uint32 &networkFileCRC = data.detail.techCRCFileCRCList[j]; if(fileInfo.first == networkFile) { @@ -2176,12 +2177,12 @@ string NetworkMessageSynchNetworkGameDataStatus::getTechCRCFileMismatchReport(st } } - for(int i = 0; i < data.header.techCRCFileCount; ++i) { + for(int i = 0; i < (int)data.header.techCRCFileCount; ++i) { string networkFile = data.detail.techCRCFileList[i].getString(); uint32 &networkFileCRC = data.detail.techCRCFileCRCList[i]; bool fileFound = false; uint32 localCRC = 0; - for(int idx = 0; idx < vctFileList.size(); ++idx) { + for(int idx = 0; idx < (int)vctFileList.size(); ++idx) { std::pair &fileInfo = vctFileList[idx]; if(networkFile == fileInfo.first) { @@ -2231,7 +2232,7 @@ bool NetworkMessageSynchNetworkGameDataStatus::receive(Socket* socket) { result = NetworkMessage::receive(socket, &data.detail.techCRCFileList[packetIndex], (DetailSize1 * packetFileCount),true); if(result == true) { - for(int i = 0; i < data.header.techCRCFileCount; ++i) { + for(int i = 0; i < (int)data.header.techCRCFileCount; ++i) { data.detail.techCRCFileList[i].nullTerminate(); } diff --git a/source/glest_game/network/network_message.h b/source/glest_game/network/network_message.h index 5b5e831d..85feeeb4 100644 --- a/source/glest_game/network/network_message.h +++ b/source/glest_game/network/network_message.h @@ -345,9 +345,6 @@ public: #pragma pack(push, 1) class NetworkMessageCommandList: public NetworkMessage { -private: - //static const int maxCommandCount = 2496; // can be as large as 65535 - private: struct DataHeader { int8 messageType; @@ -360,9 +357,16 @@ private: struct Data { DataHeader header; - //NetworkCommand commands[maxCommandCount]; std::vector commands; }; + void init(Data &data_ref) { + data_ref.header.messageType = 0; + data_ref.header.commandCount = 0; + data_ref.header.frameCount = 0; + for(unsigned int index = 0; index < GameConstants::maxPlayers; ++index) { + data_ref.header.networkPlayerFactionCRC[index] = 0; + } + } void toEndianHeader(); void fromEndianHeader(); void toEndianDetail(uint16 totalCommand); diff --git a/source/glest_game/network/network_types.cpp b/source/glest_game/network/network_types.cpp index 94c31b6e..45d44365 100644 --- a/source/glest_game/network/network_types.cpp +++ b/source/glest_game/network/network_types.cpp @@ -33,10 +33,10 @@ NetworkCommand::NetworkCommand(World *world, int networkCommandType, int unitId, int commandStateValue, int unitCommandGroupId) : networkCommandType(networkCommandType) , unitId(unitId) + , unitTypeId(unitTypeId) , commandTypeId(commandTypeId) , positionX(pos.x) , positionY(pos.y) - , unitTypeId(unitTypeId) , wantQueue(wantQueue) , commandStateType(commandStateType) , commandStateValue(commandStateValue) diff --git a/source/glest_game/network/server_interface.cpp b/source/glest_game/network/server_interface.cpp index 6493a72c..f7de5b70 100644 --- a/source/glest_game/network/server_interface.cpp +++ b/source/glest_game/network/server_interface.cpp @@ -301,7 +301,7 @@ ServerInterface::~ServerInterface() { delete serverSocketAdmin; serverSocketAdmin = NULL; - for(int i = 0; i < broadcastMessageQueue.size(); ++i) { + for(int i = 0; i < (int)broadcastMessageQueue.size(); ++i) { pair &item = broadcastMessageQueue[i]; if(item.first != NULL) { delete item.first; @@ -942,7 +942,7 @@ void ServerInterface::checkForCompletedClients(std::map & mapSlotSigna std::vector errorList = connectionSlot->getThreadErrorList(); // Collect any collected errors from threads if(errorList.empty() == false) { - for(int iErrIdx = 0; iErrIdx < errorList.size(); ++iErrIdx) { + for(int iErrIdx = 0; iErrIdx < (int)errorList.size(); ++iErrIdx) { string &sErr = errorList[iErrIdx]; if(sErr != "") { errorMsgList.push_back(sErr); @@ -990,7 +990,7 @@ void ServerInterface::checkForCompletedClients(std::map & mapSlotSigna std::vector errorList = connectionSlot->getThreadErrorList(); // Collect any collected errors from threads if(errorList.empty() == false) { - for(int iErrIdx = 0; iErrIdx < errorList.size(); ++iErrIdx) { + for(int iErrIdx = 0; iErrIdx < (int)errorList.size(); ++iErrIdx) { string &sErr = errorList[iErrIdx]; if(sErr != "") { errorMsgList.push_back(sErr); @@ -1055,7 +1055,7 @@ void ServerInterface::checkForLaggingClients(std::map &mapSlotSignalle std::vector errorList = connectionSlot->getThreadErrorList(); // Show any collected errors from threads if(errorList.empty() == false) { - for(int iErrIdx = 0; iErrIdx < errorList.size(); ++iErrIdx) { + for(int iErrIdx = 0; iErrIdx < (int)errorList.size(); ++iErrIdx) { string &sErr = errorList[iErrIdx]; if(sErr != "") { errorMsgList.push_back(sErr); @@ -1189,7 +1189,7 @@ void ServerInterface::executeNetworkCommandsFromClients() { if(connectionSlot != NULL && connectionSlot->isConnected() == true) { vector pendingList = connectionSlot->getPendingNetworkCommandList(true); if(pendingList.empty() == false) { - for(int idx = 0; exitServer == false && idx < pendingList.size(); ++idx) { + for(int idx = 0; exitServer == false && idx < (int)pendingList.size(); ++idx) { NetworkCommand &cmd = pendingList[idx]; this->requestCommand(&cmd); } @@ -1211,7 +1211,7 @@ void ServerInterface::dispatchPendingChatMessages(std::vector &errorMsg std::vector chatText = connectionSlot->getChatTextList(true); for(int chatIdx = 0; exitServer == false && slots[i] != NULL && - chatIdx < chatText.size(); chatIdx++) { + chatIdx < (int)chatText.size(); chatIdx++) { connectionSlot= slots[i]; if(connectionSlot != NULL) { ChatMsgInfo msg(chatText[chatIdx]); @@ -1259,7 +1259,7 @@ void ServerInterface::dispatchPendingMarkCellMessages(std::vector &erro std::vector chatText = connectionSlot->getMarkedCellList(true); for(int chatIdx = 0; exitServer == false && slots[i] != NULL && - chatIdx < chatText.size(); chatIdx++) { + chatIdx < (int)chatText.size(); chatIdx++) { connectionSlot= slots[i]; if(connectionSlot != NULL) { MarkedCell msg(chatText[chatIdx]); @@ -1297,7 +1297,7 @@ void ServerInterface::dispatchPendingHighlightCellMessages(std::vector std::vector highlightedCells = connectionSlot->getHighlightedCellList(true); for(int chatIdx = 0; exitServer == false && slots[i] != NULL && - chatIdx < highlightedCells.size(); chatIdx++) { + chatIdx < (int)highlightedCells.size(); chatIdx++) { connectionSlot= slots[i]; if(connectionSlot != NULL) { MarkedCell msg(highlightedCells[chatIdx]); @@ -1334,7 +1334,7 @@ void ServerInterface::dispatchPendingUnMarkCellMessages(std::vector &er std::vector chatText = connectionSlot->getUnMarkedCellList(true); for(int chatIdx = 0; exitServer == false && slots[i] != NULL && - chatIdx < chatText.size(); chatIdx++) { + chatIdx < (int)chatText.size(); chatIdx++) { connectionSlot= slots[i]; if(connectionSlot != NULL) { UnMarkedCell msg(chatText[chatIdx]); @@ -1600,7 +1600,7 @@ void ServerInterface::update() { errorMsgList.push_back(ex.what()); } if(errorMsgList.empty() == false){ - for(int iErrIdx = 0;iErrIdx < errorMsgList.size();++iErrIdx){ + for(int iErrIdx = 0;iErrIdx < (int)errorMsgList.size();++iErrIdx){ string & sErr = errorMsgList[iErrIdx]; if(sErr != ""){ DisplayErrorMessage(sErr); @@ -1914,7 +1914,7 @@ void ServerInterface::waitUntilReady(Checksum *checksum) { lastStatusUpdate = chrono.getMillis(); string waitForHosts = ""; - for(int i = 0; i < waitingForHosts.size(); i++) { + for(int i = 0; i < (int)waitingForHosts.size(); i++) { if(waitForHosts != "") { waitForHosts += ", "; } @@ -2060,7 +2060,7 @@ void ServerInterface::processBroadCastMessageQueue() { MutexSafeWrapper safeMutexSlot(broadcastMessageQueueThreadAccessor,CODE_AT_LINE); if(broadcastMessageQueue.empty() == false) { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] broadcastMessageQueue.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,broadcastMessageQueue.size()); - for(int i = 0; i < broadcastMessageQueue.size(); ++i) { + for(int i = 0; i < (int)broadcastMessageQueue.size(); ++i) { pair &item = broadcastMessageQueue[i]; if(item.first != NULL) { this->broadcastMessage(item.first,item.second); @@ -2084,7 +2084,7 @@ void ServerInterface::processTextMessageQueue() { MutexSafeWrapper safeMutexSlot(textMessageQueueThreadAccessor,CODE_AT_LINE); if(textMessageQueue.empty() == false) { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] textMessageQueue.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,textMessageQueue.size()); - for(int i = 0; i < textMessageQueue.size(); ++i) { + for(int i = 0; i < (int)textMessageQueue.size(); ++i) { TextMessageQueue &item = textMessageQueue[i]; sendTextMessage(item.text, item.teamIndex, item.echoLocal, item.targetLanguage); } @@ -2366,7 +2366,7 @@ void ServerInterface::broadcastGameSetup(GameSettings *gameSettingsBuffer, bool if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); if(gameSettingsBuffer != NULL) { - for(unsigned int i = 0; i < gameSettingsBuffer->getFactionCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)gameSettingsBuffer->getFactionCount(); ++i) { int slotIndex = gameSettingsBuffer->getStartLocationIndex(i); if(gameSettingsBuffer->getFactionControl(i) == ctNetwork && isClientConnected(slotIndex) == false) { @@ -2545,7 +2545,7 @@ void ServerInterface::validateGameSettings(GameSettings *serverGameSettings) { printf("map not found on this server\n"); int currentIndex=-1; string currentMap=gameSettings.getMap(); - for (int i=0 ;igameSettings [%s] > [%s]\n",mapFile.c_str(),gameSettings.getMap().c_str()); int nextIndex=-1; - for (int i=0 ;imapFile) { diff --git a/source/glest_game/type_instances/faction.cpp b/source/glest_game/type_instances/faction.cpp index 8a1ec0e2..5d3b28e9 100644 --- a/source/glest_game/type_instances/faction.cpp +++ b/source/glest_game/type_instances/faction.cpp @@ -37,14 +37,14 @@ bool CommandGroupUnitSorterId::operator()(const int l, const int r) { if(!lUnit) { printf("Error lUnit == NULL for id = %d factionIndex = %d\n",l,faction->getIndex()); - for(unsigned int i = 0; i < faction->getUnitCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)faction->getUnitCount(); ++i) { printf("%u / %d id = %d [%s]\n",i,faction->getUnitCount(),faction->getUnit(i)->getId(),faction->getUnit(i)->getType()->getName(false).c_str()); } } if(!rUnit) { printf("Error rUnit == NULL for id = %d factionIndex = %d\n",r,faction->getIndex()); - for(unsigned int i = 0; i < faction->getUnitCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)faction->getUnitCount(); ++i) { printf("%u / %d id = %d [%s]\n",i,faction->getUnitCount(),faction->getUnit(i)->getId(),faction->getUnit(i)->getType()->getName(false).c_str()); } } @@ -172,7 +172,7 @@ void Faction::sortUnitsByCommandGroups() { //printf("====== Done sorting for faction # %d [%s] unitCount = %d\n",this->getIndex(),this->getType()->getName().c_str(),units.size()); - unsigned int originalUnitSize = (unsigned int)units.size(); + //unsigned int originalUnitSize = (unsigned int)units.size(); std::vector unitIds; for(unsigned int i = 0; i < units.size(); ++i) { @@ -751,13 +751,13 @@ void Faction::init( // ================== get ================== const Resource *Faction::getResource(const ResourceType *rt) const{ - for(int i=0; igetName().c_str() : "null")); - for(int i=0; igetName().c_str()); } @@ -766,13 +766,13 @@ const Resource *Faction::getResource(const ResourceType *rt) const{ } int Faction::getStoreAmount(const ResourceType *rt) const{ - for(int i=0; igetName().c_str() : "null")); - for(int i=0; igetName().c_str()); } @@ -1133,7 +1133,7 @@ void Faction::applyCostsOnInterval(const ResourceType *rtApply) { // Apply consequences to consumer units of this resource type std::vector &resourceConsumers = iter->second.second; - for(int i = 0; i < resourceConsumers.size(); ++i) { + for(int i = 0; i < (int)resourceConsumers.size(); ++i) { Unit *unit = resourceConsumers[i]; //decrease unit hp @@ -1194,7 +1194,7 @@ bool Faction::isAlly(const Faction *faction) { // ================== misc ================== void Faction::incResourceAmount(const ResourceType *rt, int amount) { - for(int i=0; igetType()==rt) { r->setAmount(r->getAmount()+amount); @@ -1208,7 +1208,7 @@ void Faction::incResourceAmount(const ResourceType *rt, int amount) { } void Faction::setResourceBalance(const ResourceType *rt, int balance){ - for(int i=0; igetType()==rt){ r->setBalance(balance); @@ -1238,7 +1238,7 @@ void Faction::removeUnit(Unit *unit){ assert(units.size()==unitMap.size()); int unitId = unit->getId(); - for(int i=0; igetId() == unitId) { units.erase(units.begin()+i); unitMap.erase(unitId); @@ -1259,7 +1259,7 @@ void Faction::addStore(const UnitType *unitType, bool replaceStorage) { const Resource *newUnitStoredResource = unitType->getStoredResource(newUnitStoredResourceIndex); for(int currentStoredResourceIndex = 0; - currentStoredResourceIndex < store.size(); + currentStoredResourceIndex < (int)store.size(); ++currentStoredResourceIndex) { Resource *storedResource= &store[currentStoredResourceIndex]; @@ -1279,7 +1279,7 @@ void Faction::removeStore(const UnitType *unitType){ assert(unitType != NULL); for(int i=0; igetStoredResourceCount(); ++i){ const Resource *r= unitType->getStoredResource(i); - for(int j=0; jgetType() == r->getType()){ storedResource->setAmount(storedResource->getAmount() - r->getAmount()); @@ -1290,7 +1290,7 @@ void Faction::removeStore(const UnitType *unitType){ } void Faction::limitResourcesToStore() { - for(int i=0; igetType()->getClass() != rcStatic && r->getAmount()>s->getAmount()) { @@ -1300,7 +1300,7 @@ void Faction::limitResourcesToStore() { } void Faction::resetResourceAmount(const ResourceType *rt){ - for(int i=0; i *deleteListPtr,i } } - for(int i = 0; i < deleteList.size(); ++i) { + for(int i = 0; i < (int)deleteList.size(); ++i) { Vec2i &cache = deleteList[i]; cacheResourceTargetList.erase(cache); } @@ -1872,7 +1872,7 @@ Unit * Faction::findClosestUnitWithSkillClass( const Vec2i &pos,const CommandCla if(isUnitPossibleCandidate == true && skillClassList.empty() == false) { isUnitPossibleCandidate = false; - for(int j = 0; j < skillClassList.size(); ++j) { + for(int j = 0; j < (int)skillClassList.size(); ++j) { SkillClass skValue = skillClassList[j]; if(curUnit->getCurrSkill()->getClass() == skValue) { isUnitPossibleCandidate = true; @@ -2103,22 +2103,22 @@ std::string Faction::toString(bool crcMode) const { result += this->upgradeManager.toString() + "\n"; result += "ResourceCount = " + intToStr(resources.size()) + "\n"; - for(int idx = 0; idx < resources.size(); idx ++) { + for(int idx = 0; idx < (int)resources.size(); idx ++) { result += "index = " + intToStr(idx) + " " + resources[idx].toString() + "\n"; } result += "StoreCount = " + intToStr(store.size()) + "\n"; - for(int idx = 0; idx < store.size(); idx ++) { + for(int idx = 0; idx < (int)store.size(); idx ++) { result += "index = " + intToStr(idx) + " " + store[idx].toString() + "\n"; } result += "Allies = " + intToStr(allies.size()) + "\n"; - for(int idx = 0; idx < allies.size(); idx ++) { + for(int idx = 0; idx < (int)allies.size(); idx ++) { result += "index = " + intToStr(idx) + " name: " + allies[idx]->factionType->getName(false) + " factionindex = " + intToStr(allies[idx]->index) + "\n"; } result += "Units = " + intToStr(units.size()) + "\n"; - for(int idx = 0; idx < units.size(); idx ++) { + for(int idx = 0; idx < (int)units.size(); idx ++) { result += units[idx]->toString(crcMode) + "\n"; } @@ -2415,7 +2415,7 @@ Checksum Faction::getCRC() { } void Faction::addCRC_DetailsForWorldFrame(int worldFrameCount,bool isNetworkServer) { - int MAX_FRAME_CACHE = 250; + unsigned int MAX_FRAME_CACHE = 250; if(isNetworkServer == true) { MAX_FRAME_CACHE += 250; } @@ -2430,10 +2430,10 @@ void Faction::addCRC_DetailsForWorldFrame(int worldFrameCount,bool isNetworkServ unit->clearParticleInfo(); } - if(crcWorldFrameDetails.size() > MAX_FRAME_CACHE) { + if((unsigned int)crcWorldFrameDetails.size() > MAX_FRAME_CACHE) { //printf("===> Removing older world frame log entries: %lld\n",(long long int)crcWorldFrameDetails.size()); - for(;crcWorldFrameDetails.size() - MAX_FRAME_CACHE > 0;) { + for(;(unsigned int)crcWorldFrameDetails.size() - MAX_FRAME_CACHE > 0;) { crcWorldFrameDetails.erase(crcWorldFrameDetails.begin()); } } diff --git a/source/glest_game/type_instances/resource.cpp b/source/glest_game/type_instances/resource.cpp index 998b7ecc..fa76d2bc 100644 --- a/source/glest_game/type_instances/resource.cpp +++ b/source/glest_game/type_instances/resource.cpp @@ -119,7 +119,7 @@ void Resource::saveGame(XmlNode *rootNode) const { void Resource::loadGame(const XmlNode *rootNode, int index,const TechTree *techTree) { vector resourceNodeList = rootNode->getChildList("Resource"); - if(index < resourceNodeList.size()) { + if(index < (int)resourceNodeList.size()) { XmlNode *resourceNode = resourceNodeList[index]; amount = resourceNode->getAttribute("amount")->getIntValue(); diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index ad9a144c..45bc18c7 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -134,7 +134,7 @@ Vec2i UnitPathBasic::pop(bool removeFrontPos) { } std::string UnitPathBasic::toString() const { std::string result = "unit path blockCount = " + intToStr(blockCount) + "\npathQueue size = " + intToStr(pathQueue.size()); - for(int idx = 0; idx < pathQueue.size(); ++idx) { + for(int idx = 0; idx < (int)pathQueue.size(); ++idx) { result += " index = " + intToStr(idx) + " value = " + pathQueue[idx].getString(); } @@ -1229,7 +1229,7 @@ void Unit::setPos(const Vec2i &pos, bool clearPathFinder) { if(clearPathFinder == true && this->unitPath != NULL) { this->unitPath->clear(); } - Vec2i oldLastPos = this->lastPos; + //Vec2i oldLastPos = this->lastPos; this->lastPos= this->pos; this->pos= pos; @@ -1948,8 +1948,8 @@ const CommandType *Unit::computeCommandType(const Vec2i &pos, const Unit *target //printf("Line: %d Unit::computeCommandType pos [%s] targetUnit [%s] commandType [%p]\n",__LINE__,pos.getString().c_str(),(targetUnit != NULL ? targetUnit->getType()->getName().c_str() : "(null)"),commandType); if(commandType == NULL && targetUnit != NULL) { - Command *command= this->getCurrCommand(); - const HarvestCommandType *hct= dynamic_cast((command != NULL ? command->getCommandType() : NULL)); + //Command *command= this->getCurrCommand(); + //const HarvestCommandType *hct= dynamic_cast((command != NULL ? command->getCommandType() : NULL)); // Check if we can return whatever resources we have if(targetUnit->getFactionIndex() == this->getFactionIndex() && @@ -4045,7 +4045,7 @@ void Unit::removeBadHarvestPos(const Vec2i &value) { } void Unit::cleanupOldBadHarvestPos() { - const int cleanupInterval = (GameConstants::updateFps * 5); + const unsigned int cleanupInterval = (GameConstants::updateFps * 5); bool needToCleanup = (getFrameCount() % cleanupInterval == 0); //printf("========================> cleanupOldBadHarvestPos() [%d] badHarvestPosList.size [%ld] cleanupInterval [%d] getFrameCount() [%d] needToCleanup [%d]\n",getFrameCount(),badHarvestPosList.size(),cleanupInterval,getFrameCount(),needToCleanup); @@ -4066,7 +4066,7 @@ void Unit::cleanupOldBadHarvestPos() { snprintf(szBuf,8096,"[cleaning old bad harvest targets] purgeList.size() [" MG_SIZE_T_SPECIFIER "]",purgeList.size()); logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__,szBuf); - for(int i = 0; i < purgeList.size(); ++i) { + for(int i = 0; i < (int)purgeList.size(); ++i) { const Vec2i &item = purgeList[i]; badHarvestPosList.erase(item); } @@ -4091,7 +4091,7 @@ void Unit::setLastHarvestResourceTarget(const Vec2i *pos) { else { // If we cannot harvest for > 10 seconds tag the position // as a bad one - const int addInterval = (GameConstants::updateFps * 5); + const unsigned int addInterval = (GameConstants::updateFps * 5); if(lastHarvestResourceTarget.second - getFrameCount() >= addInterval) { //printf("-----------------------> setLastHarvestResourceTarget() [%d][%d]\n",getFrameCount(),lastHarvestResourceTarget.second); addBadHarvestPos(resourceLocation); @@ -4130,7 +4130,7 @@ void Unit::setLastStuckFrameToCurrentFrame() { bool Unit::isLastStuckFrameWithinCurrentFrameTolerance(bool evalMode) { //const int MIN_FRAME_ELAPSED_RETRY = 300; const int MAX_BLOCKED_FRAME_THRESHOLD = 25000; - int MIN_FRAME_ELAPSED_RETRY = 6; + unsigned int MIN_FRAME_ELAPSED_RETRY = 6; if(lastStuckFrame < MAX_BLOCKED_FRAME_THRESHOLD) { if(evalMode == true) { MIN_FRAME_ELAPSED_RETRY = 4; @@ -4951,7 +4951,7 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction * } vector unitParticleSystemNodeList = fireParticleSystemsNode->getChildList("FireParticleSystem"); - for(unsigned int i = 0; i < unitParticleSystemNodeList.size(); ++i) { + for(int i = 0; i < (int)unitParticleSystemNodeList.size(); ++i) { XmlNode *node = unitParticleSystemNodeList[i]; FireParticleSystem *ups = new FireParticleSystem(); diff --git a/source/glest_game/type_instances/upgrade.cpp b/source/glest_game/type_instances/upgrade.cpp index 4e6d1e9d..2a0233fd 100644 --- a/source/glest_game/type_instances/upgrade.cpp +++ b/source/glest_game/type_instances/upgrade.cpp @@ -114,7 +114,7 @@ void UpgradeManager::startUpgrade(const UpgradeType *upgradeType, int factionInd void UpgradeManager::cancelUpgrade(const UpgradeType *upgradeType) { map::iterator iterFind = upgradesLookup.find(upgradeType); if(iterFind != upgradesLookup.end()) { - if(iterFind->second >= upgrades.size()) { + if(iterFind->second >= (int)upgrades.size()) { char szBuf[8096]=""; snprintf(szBuf,8096,"Error canceling upgrade, iterFind->second >= upgrades.size() - [%d] : [%d]",iterFind->second,(int)upgrades.size()); throw megaglest_runtime_error("Error canceling upgrade, upgrade not found in upgrade manager"); @@ -125,7 +125,7 @@ void UpgradeManager::cancelUpgrade(const UpgradeType *upgradeType) { for(map::iterator iterMap = upgradesLookup.begin(); iterMap != upgradesLookup.end(); ++iterMap) { - if(iterMap->second >= upgrades.size()) { + if(iterMap->second >= (int)upgrades.size()) { iterMap->second--; } if(iterMap->second < 0) { @@ -250,7 +250,7 @@ void UpgradeManager::computeTotalUpgrade(const Unit *unit, TotalUpgrade *totalUp std::string UpgradeManager::toString() const { std::string result = "UpgradeCount: " + intToStr(this->getUpgradeCount()); - for(int idx = 0; idx < upgrades.size(); idx++) { + for(int idx = 0; idx < (int)upgrades.size(); idx++) { result += " index = " + intToStr(idx) + " " + upgrades[idx]->toString(); } return result; diff --git a/source/glest_game/types/command_type.cpp b/source/glest_game/types/command_type.cpp index 20a68c92..6e775622 100644 --- a/source/glest_game/types/command_type.cpp +++ b/source/glest_game/types/command_type.cpp @@ -64,7 +64,7 @@ void CommandType::load(int id, const XmlNode *n, const string &dir, //unit requirements const XmlNode *unitRequirementsNode= n->getChild("unit-requirements"); - for(int i = 0; i < unitRequirementsNode->getChildCount(); ++i) { + for(int i = 0; i < (int)unitRequirementsNode->getChildCount(); ++i) { const XmlNode *unitNode= unitRequirementsNode->getChild("unit", i); string name= unitNode->getAttribute("name")->getRestrictedValue(); unitReqs.push_back(ft->getUnitType(name)); @@ -72,7 +72,7 @@ void CommandType::load(int id, const XmlNode *n, const string &dir, //upgrade requirements const XmlNode *upgradeRequirementsNode= n->getChild("upgrade-requirements"); - for(int i = 0; i < upgradeRequirementsNode->getChildCount(); ++i) { + for(int i = 0; i < (int)upgradeRequirementsNode->getChildCount(); ++i) { const XmlNode *upgradeReqNode= upgradeRequirementsNode->getChild("upgrade", i); string name= upgradeReqNode->getAttribute("name")->getRestrictedValue(); upgradeReqs.push_back(ft->getUpgradeType(name)); @@ -425,7 +425,7 @@ void BuildCommandType::load(int id, const XmlNode *n, const string &dir, //buildings built const XmlNode *buildingsNode= n->getChild("buildings"); - for(int i=0; igetChildCount(); ++i){ + for(int i=0; i < (int)buildingsNode->getChildCount(); ++i){ const XmlNode *buildingNode= buildingsNode->getChild("building", i); string name= buildingNode->getAttribute("name")->getRestrictedValue(); buildings.push_back(ft->getUnitType(name)); @@ -435,7 +435,7 @@ void BuildCommandType::load(int id, const XmlNode *n, const string &dir, const XmlNode *startSoundNode= n->getChild("start-sound"); if(startSoundNode->getAttribute("enabled")->getBoolValue()){ startSounds.resize((int)startSoundNode->getChildCount()); - for(int i=0; igetChildCount(); ++i){ + for(int i=0; i < (int)startSoundNode->getChildCount(); ++i){ const XmlNode *soundFileNode= startSoundNode->getChild("sound-file", i); string currentPath = dir; endPathWithSlash(currentPath); @@ -453,7 +453,7 @@ void BuildCommandType::load(int id, const XmlNode *n, const string &dir, const XmlNode *builtSoundNode= n->getChild("built-sound"); if(builtSoundNode->getAttribute("enabled")->getBoolValue()){ builtSounds.resize((int)builtSoundNode->getChildCount()); - for(int i=0; igetChildCount(); ++i){ + for(int i=0; i < (int)builtSoundNode->getChildCount(); ++i){ const XmlNode *soundFileNode= builtSoundNode->getChild("sound-file", i); string currentPath = dir; endPathWithSlash(currentPath); @@ -537,7 +537,7 @@ void HarvestCommandType::load(int id, const XmlNode *n, const string &dir, //resources can harvest const XmlNode *resourcesNode= n->getChild("harvested-resources"); - for(int i=0; igetChildCount(); ++i){ + for(int i=0; i < (int)resourcesNode->getChildCount(); ++i){ const XmlNode *resourceNode= resourcesNode->getChild("resource", i); harvestedResources.push_back(tt->getResourceType(resourceNode->getAttribute("name")->getRestrictedValue())); } @@ -654,7 +654,7 @@ void RepairCommandType::load(int id, const XmlNode *n, const string &dir, //repaired units const XmlNode *unitsNode= n->getChild("repaired-units"); - for(int i=0; igetChildCount(); ++i){ + for(int i=0; i < (int)unitsNode->getChildCount(); ++i){ const XmlNode *unitNode= unitsNode->getChild("unit", i); repairableUnits.push_back(ft->getUnitType(unitNode->getAttribute("name")->getRestrictedValue())); } @@ -675,7 +675,7 @@ string RepairCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transla str+= lang.getString("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(repairSkillType->getHpCost())+"\n"; } str+="\n"+lang.getString("CanRepair",(translatedValue == true ? "" : "english"))+":\n"; - for(int i=0; i(repairableUnits[i]))->getName(translatedValue)+"\n"; } str+=repairSkillType->getBoostDesc(translatedValue); @@ -692,7 +692,7 @@ string RepairCommandType::toString(bool translatedValue) const{ //get bool RepairCommandType::isRepairableUnitType(const UnitType *unitType) const { - for(int i = 0; i < repairableUnits.size(); ++i) { + for(int i = 0; i < (int)repairableUnits.size(); ++i) { const UnitType *curUnitType = static_cast(repairableUnits[i]); //printf("Lookup index = %d Can repair unittype [%s][%p] looking for [%s][%p] lookup found result = %d\n",i,curUnitType->getName().c_str(),curUnitType,unitType->getName().c_str(),unitType,(curUnitType == unitType)); if(curUnitType == unitType) { diff --git a/source/glest_game/types/damage_multiplier.cpp b/source/glest_game/types/damage_multiplier.cpp index d2ce8500..192b4e07 100644 --- a/source/glest_game/types/damage_multiplier.cpp +++ b/source/glest_game/types/damage_multiplier.cpp @@ -96,7 +96,7 @@ void DamageMultiplierTable::saveGame(XmlNode *rootNode) { damageMultiplierTableNode->addAttribute("armorTypeCount",intToStr(armorTypeCount), mapTagReplacements); int valueCount= attackTypeCount * armorTypeCount; - for(unsigned int i=0; i < valueCount; ++i) { + for(int i=0; i < valueCount; ++i) { XmlNode *valuesNode = damageMultiplierTableNode->addChild("values"); valuesNode->addAttribute("value",doubleToStr(values[i]), mapTagReplacements); } diff --git a/source/glest_game/types/element_type.cpp b/source/glest_game/types/element_type.cpp index 5c0da086..b1c7b15f 100644 --- a/source/glest_game/types/element_type.cpp +++ b/source/glest_game/types/element_type.cpp @@ -120,7 +120,7 @@ ProducibleType::~ProducibleType(){ } const Resource *ProducibleType::getCost(const ResourceType *rt) const{ - for(int i=0; igetChild("starting-resources"); startingResources.resize(startingResourcesNode->getChildCount()); - for(int i = 0; i < startingResources.size(); ++i) { + for(int i = 0; i < (int)startingResources.size(); ++i) { const XmlNode *resourceNode= startingResourcesNode->getChild("resource", i); string name= resourceNode->getAttribute("name")->getRestrictedValue(); int amount= resourceNode->getAttribute("amount")->getIntValue(); @@ -254,7 +254,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec //read starting units const XmlNode *startingUnitsNode= factionNode->getChild("starting-units"); - for(int i = 0; i < startingUnitsNode->getChildCount(); ++i) { + for(int i = 0; i < (int)startingUnitsNode->getChildCount(); ++i) { const XmlNode *unitNode= startingUnitsNode->getChild("unit", i); string name= unitNode->getAttribute("name")->getRestrictedValue(); int amount= unitNode->getAttribute("amount")->getIntValue(); @@ -281,7 +281,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec if(aiNode->hasChild("static-values") == true) { const XmlNode *aiNodeUnits= aiNode->getChild("static-values"); - for(int i = 0; i < aiNodeUnits->getChildCount(); ++i) { + for(int i = 0; i < (int)aiNodeUnits->getChildCount(); ++i) { const XmlNode *unitNode= aiNodeUnits->getChild("static", i); AIBehaviorStaticValueCategory type = aibsvcMaxBuildRadius; if(unitNode->hasAttribute("type") == true) { @@ -302,7 +302,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec if(aiNode->hasChild("worker-units") == true) { const XmlNode *aiNodeUnits= aiNode->getChild("worker-units"); - for(int i = 0; i < aiNodeUnits->getChildCount(); ++i) { + for(int i = 0; i < (int)aiNodeUnits->getChildCount(); ++i) { const XmlNode *unitNode= aiNodeUnits->getChild("unit", i); string name= unitNode->getAttribute("name")->getRestrictedValue(); int minimum= unitNode->getAttribute("minimum")->getIntValue(); @@ -312,7 +312,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec } if(aiNode->hasChild("warrior-units") == true) { const XmlNode *aiNodeUnits= aiNode->getChild("warrior-units"); - for(int i = 0; i < aiNodeUnits->getChildCount(); ++i) { + for(int i = 0; i < (int)aiNodeUnits->getChildCount(); ++i) { const XmlNode *unitNode= aiNodeUnits->getChild("unit", i); string name= unitNode->getAttribute("name")->getRestrictedValue(); int minimum= unitNode->getAttribute("minimum")->getIntValue(); @@ -322,7 +322,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec } if(aiNode->hasChild("resource-producer-units") == true) { const XmlNode *aiNodeUnits= aiNode->getChild("resource-producer-units"); - for(int i = 0; i < aiNodeUnits->getChildCount(); ++i) { + for(int i = 0; i < (int)aiNodeUnits->getChildCount(); ++i) { const XmlNode *unitNode= aiNodeUnits->getChild("unit", i); string name= unitNode->getAttribute("name")->getRestrictedValue(); int minimum= unitNode->getAttribute("minimum")->getIntValue(); @@ -332,7 +332,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec } if(aiNode->hasChild("building-units") == true) { const XmlNode *aiNodeUnits= aiNode->getChild("building-units"); - for(int i = 0; i < aiNodeUnits->getChildCount(); ++i) { + for(int i = 0; i < (int)aiNodeUnits->getChildCount(); ++i) { const XmlNode *unitNode= aiNodeUnits->getChild("unit", i); string name= unitNode->getAttribute("name")->getRestrictedValue(); int minimum= unitNode->getAttribute("minimum")->getIntValue(); @@ -343,7 +343,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec if(aiNode->hasChild("upgrades") == true) { const XmlNode *aiNodeUpgrades= aiNode->getChild("upgrades"); - for(int i = 0; i < aiNodeUpgrades->getChildCount(); ++i) { + for(int i = 0; i < (int)aiNodeUpgrades->getChildCount(); ++i) { const XmlNode *upgradeNode= aiNodeUpgrades->getChild("upgrade", i); string name= upgradeNode->getAttribute("name")->getRestrictedValue(); @@ -389,10 +389,10 @@ std::vector FactionType::validateFactionType() { results.push_back(szBuf); } - for(int i=0; igetInfo()->getBitRate() > MAX_BITRATE_WARNING) { char szBuf[8096]=""; @@ -400,7 +400,7 @@ std::vector FactionType::validateFactionType() { results.push_back(szBuf); } } - for(int i = 0; i < unitType.getCommandSounds().getSounds().size(); ++i) { + for(int i = 0; i < (int)unitType.getCommandSounds().getSounds().size(); ++i) { StaticSound *sound = unitType.getCommandSounds().getSounds()[i]; if(sound != NULL && sound->getInfo()->getBitRate() > MAX_BITRATE_WARNING) { char szBuf[8096]=""; @@ -410,7 +410,7 @@ std::vector FactionType::validateFactionType() { } int morphCommandCount = 0; - for(int j = 0; j < unitType.getCommandTypeCount(); ++j) { + for(int j = 0; j < (int)unitType.getCommandTypeCount(); ++j) { const CommandType *cmdType = unitType.getCommandType(j); if(cmdType != NULL) { // Check every unit's commands to validate that for every upgrade-requirements @@ -421,7 +421,7 @@ std::vector FactionType::validateFactionType() { if(upgradeType != NULL) { // Now lets find a unit that can produced-upgrade this upgrade bool foundUpgraderUnit = false; - for(int l=0; l FactionType::validateFactionType() { // Now lets find the unit that we should be able to build bool foundUnit = false; - for(int l=0; lgetName()) { foundUnit = true; @@ -486,7 +486,7 @@ std::vector FactionType::validateFactionType() { // Now lets find the unit that we should be able to repair bool foundUnit = false; - for(int l=0; lgetName()) { foundUnit = true; @@ -512,7 +512,7 @@ std::vector FactionType::validateFactionType() { // Now lets find the unit that we should be able to morph // to bool foundUnit = false; - for(int l=0; lgetName()) { foundUnit = true; @@ -544,7 +544,7 @@ std::vector FactionType::validateFactionType() { if(unitType2 != NULL) { // Now lets find the required unit bool foundUnit = false; - for(int l=0; lgetName() == unitType3.getName()) { @@ -563,7 +563,7 @@ std::vector FactionType::validateFactionType() { // Now check that at least 1 other unit can produce, build or morph this unit bool foundUnit = false; - for(int l=0; l FactionType::validateFactionType() { std::vector FactionType::validateFactionTypeResourceTypes(vector &resourceTypes) { std::vector results; - for(int i=0; i FactionType::validateFactionTypeResourceTypes(vectorgetType() != NULL) { bool foundResourceType = false; // Now lets find a matching faction resource type for the unit - for(int k=0; kgetType()->getName() == rt.getName()) { @@ -714,7 +714,7 @@ std::vector FactionType::validateFactionTypeResourceTypes(vectorgetType() != NULL) { bool foundResourceType = false; // Now lets find a matching faction resource type for the unit - for(int k=0; kgetType()->getName() == rt.getName()) { @@ -743,7 +743,7 @@ std::vector FactionType::validateFactionTypeResourceTypes(vectorgetName() == rt.getName()) { @@ -771,12 +771,12 @@ std::vector FactionType::validateFactionTypeUpgradeTypes() { // For each upgrade type make sure there is at least 1 unit that can produce // the upgrade - for(int i = 0; i < upgradeTypes.size(); ++i) { + for(int i = 0; i < (int)upgradeTypes.size(); ++i) { const UpgradeType &upgradeType = upgradeTypes[i]; // First find a unit with a command type to upgrade to this Upgrade type bool foundUnit = false; - for(int j=0; j FactionType::validateFactionTypeUpgradeTypes() { // ==================== get ==================== const UnitType *FactionType::getUnitType(const string &name) const{ - for(int i=0; igetUnitTypeCount(); ++j) { + for(unsigned int j = 0; factionUsesResourceType == false && j < (unsigned int)this->getUnitTypeCount(); ++j) { const UnitType *ut= this->getUnitType(j); for(int k = 0; factionUsesResourceType == false && k < ut->getCostCount(); ++k) { const Resource *costResource = ut->getCost(k); @@ -905,12 +905,12 @@ bool FactionType::factionUsesResourceType(const ResourceType *rt) const { } } if(factionUsesResourceType == false) { - for(unsigned int k = 0; factionUsesResourceType == false && k < ut->getCommandTypeCount(); ++k) { + for(unsigned int k = 0; factionUsesResourceType == false && k < (unsigned int)ut->getCommandTypeCount(); ++k) { const CommandType *commandType = ut->getCommandType(k); if(commandType != NULL && commandType->getClass() == ccHarvest) { const HarvestCommandType *hct = dynamic_cast(commandType); if(hct != NULL && hct->getHarvestedResourceCount() > 0) { - for(unsigned int l = 0; factionUsesResourceType == false && l < hct->getHarvestedResourceCount(); ++l) { + for(unsigned int l = 0; factionUsesResourceType == false && l < (unsigned int)hct->getHarvestedResourceCount(); ++l) { //printf("#2 factionUsesResourceType, unit [%s] resource [%s] harvest [%s]\n",ut->getName().c_str(),rt->getName().c_str(),hct->getHarvestedResource(l)->getName().c_str()); if(hct->getHarvestedResource(l)->getName() == rt->getName()) { @@ -931,12 +931,12 @@ std::string FactionType::toString() const { std::string result = "Faction Name: " + name + "\n"; result += "Unit Type List count = " + intToStr(this->getUnitTypeCount()) + "\n"; - for(int i=0; igetUpgradeTypeCount()) + "\n"; - for(int i=0; igetModel() != NULL) { model->getModel()->deletePixels(); diff --git a/source/glest_game/types/resource_type.cpp b/source/glest_game/types/resource_type.cpp index 84233cd3..8c150a54 100644 --- a/source/glest_game/types/resource_type.cpp +++ b/source/glest_game/types/resource_type.cpp @@ -120,7 +120,7 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre const XmlNode *particleNode= modelNode->getChild("particles"); bool particleEnabled= particleNode->getAttribute("value")->getBoolValue(); if(particleEnabled == true) { - for(int k= 0; k < particleNode->getChildCount(); ++k) { + for(int k= 0; k < (int)particleNode->getChildCount(); ++k) { const XmlNode *particleFileNode= particleNode->getChild("particle-file", k); string particlePath= particleFileNode->getAttribute("path")->getRestrictedValue(); diff --git a/source/glest_game/types/skill_type.cpp b/source/glest_game/types/skill_type.cpp index bb9f2276..fc0d3681 100644 --- a/source/glest_game/types/skill_type.cpp +++ b/source/glest_game/types/skill_type.cpp @@ -190,7 +190,7 @@ string AttackBoost::getDesc(bool translatedValue) const{ } if(boostUnitList.empty() == false) { - for(int i=0; igetName(translatedValue)+"\n"; } } @@ -258,7 +258,7 @@ const XmlNode * SkillType::findAttackBoostDetails(string attackBoostName, const XmlNode *result = attackBoostNode; if(attackBoostsNode != NULL && attackBoostName != "") { - for(int i = 0; i < attackBoostsNode->getChildCount(); ++i) { + for(int i = 0; i < (int)attackBoostsNode->getChildCount(); ++i) { const XmlNode *abn= attackBoostsNode->getChild("attack-boost", i); string sharedName = abn->getAttribute("name")->getRestrictedValue(); @@ -303,35 +303,35 @@ void SkillType::loadAttackBoost(const XmlNode *attackBoostsNode, const XmlNode * if(targetType == "ally") { attackBoost.targetType = abtAlly; - for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) { + for(int i = 0;i < (int)attackBoostNode->getChild("target")->getChildCount();++i) { const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i); attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue())); } } else if(targetType == "foe") { attackBoost.targetType = abtFoe; - for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) { + for(int i = 0;i < (int)attackBoostNode->getChild("target")->getChildCount();++i) { const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i); attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue())); } } else if(targetType == "faction") { attackBoost.targetType = abtFaction; - for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) { + for(int i = 0;i < (int)attackBoostNode->getChild("target")->getChildCount();++i) { const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i); attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue())); } } else if(targetType == "unit-types") { attackBoost.targetType = abtUnitTypes; - for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) { + for(int i = 0;i < (int)attackBoostNode->getChild("target")->getChildCount();++i) { const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i); attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue())); } } else if(targetType == "all") { attackBoost.targetType = abtAll; - for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) { + for(int i = 0;i < (int)attackBoostNode->getChild("target")->getChildCount();++i) { const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i); attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue())); } @@ -451,7 +451,7 @@ void SkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, const XmlNode *particleNode= sn->getChild("particles"); bool particleEnabled= particleNode->getAttribute("value")->getBoolValue(); if(particleEnabled) { - for(int i = 0; i < particleNode->getChildCount(); ++i) { + for(int i = 0; i < (int)particleNode->getChildCount(); ++i) { const XmlNode *particleFileNode= particleNode->getChild("particle-file", i); string path= particleFileNode->getAttribute("path")->getRestrictedValue(); UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType(); @@ -479,7 +479,7 @@ void SkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, if(soundNode->getAttribute("enabled")->getBoolValue()) { soundStartTime= soundNode->getAttribute("start-time")->getFloatValue(); sounds.resize((int)soundNode->getChildCount()); - for(int i = 0; i < soundNode->getChildCount(); ++i) { + for(int i = 0; i < (int)soundNode->getChildCount(); ++i) { const XmlNode *soundFileNode= soundNode->getChild("sound-file", i); string path= soundFileNode->getAttribute("path")->getRestrictedValue(currentPath, true); @@ -789,7 +789,7 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, } //attack fields const XmlNode *attackFieldsNode= sn->getChild("attack-fields"); - for(int i=0; igetChildCount(); ++i){ + for(int i=0; i < (int)attackFieldsNode->getChildCount(); ++i){ const XmlNode *fieldNode= attackFieldsNode->getChild("field", i); string fieldName= fieldNode->getAttribute("value")->getRestrictedValue(); if(fieldName=="land"){ @@ -824,7 +824,7 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, if(soundNode->getAttribute("enabled")->getBoolValue()){ projSounds.resize((int)soundNode->getChildCount()); - for(int i=0; igetChildCount(); ++i){ + for(int i=0; i < (int)soundNode->getChildCount(); ++i){ const XmlNode *soundFileNode= soundNode->getChild("sound-file", i); string path= soundFileNode->getAttribute("path")->getRestrictedValue(currentPath, true); //printf("\n\n\n\n!@#$ ---> parentLoader [%s] path [%s] nodeValue [%s] i = %d",parentLoader.c_str(),path.c_str(),soundFileNode->getAttribute("path")->getRestrictedValue().c_str(),i); diff --git a/source/glest_game/types/tech_tree.cpp b/source/glest_game/types/tech_tree.cpp index 75d57195..6e5bc3ad 100644 --- a/source/glest_game/types/tech_tree.cpp +++ b/source/glest_game/types/tech_tree.cpp @@ -222,7 +222,7 @@ void TechTree::load(const string &dir, set &factions, Checksum* checksum findAll(str, filenames); resourceTypes.resize(filenames.size()); - for(int i=0; i &factions, Checksum* checksum } // Cleanup pixmap memory - for(int i = 0; i < filenames.size(); ++i) { + for(int i = 0; i < (int)filenames.size(); ++i) { resourceTypes[i].deletePixels(); } } @@ -268,7 +268,7 @@ void TechTree::load(const string &dir, set &factions, Checksum* checksum //attack types const XmlNode *attackTypesNode= techTreeNode->getChild("attack-types"); attackTypes.resize(attackTypesNode->getChildCount()); - for(int i = 0; i < attackTypes.size(); ++i) { + for(int i = 0; i < (int)attackTypes.size(); ++i) { const XmlNode *attackTypeNode= attackTypesNode->getChild("attack-type", i); attackTypes[i].setName(attackTypeNode->getAttribute("name")->getRestrictedValue()); attackTypes[i].setId(i); @@ -284,7 +284,7 @@ void TechTree::load(const string &dir, set &factions, Checksum* checksum //armor types const XmlNode *armorTypesNode= techTreeNode->getChild("armor-types"); armorTypes.resize(armorTypesNode->getChildCount()); - for(int i = 0; i < armorTypes.size(); ++i) { + for(int i = 0; i < (int)armorTypes.size(); ++i) { const XmlNode *armorTypeNode= armorTypesNode->getChild("armor-type", i); armorTypes[i].setName(armorTypeNode->getAttribute("name")->getRestrictedValue()); armorTypes[i].setId(i); @@ -296,7 +296,7 @@ void TechTree::load(const string &dir, set &factions, Checksum* checksum //damage multipliers damageMultiplierTable.init((int)attackTypes.size(), (int)armorTypes.size()); const XmlNode *damageMultipliersNode= techTreeNode->getChild("damage-multipliers"); - for(int i = 0; i < damageMultipliersNode->getChildCount(); ++i) { + for(int i = 0; i < (int)damageMultipliersNode->getChildCount(); ++i) { const XmlNode *damageMultiplierNode= damageMultipliersNode->getChild("damage-multiplier", i); const AttackType *attackType= getAttackType(damageMultiplierNode->getAttribute("attack")->getRestrictedValue()); const ArmorType *armorType= getArmorType(damageMultiplierNode->getAttribute("armor")->getRestrictedValue()); @@ -370,7 +370,7 @@ TechTree::~TechTree() { std::vector TechTree::validateFactionTypes() { std::vector results; - for (int i = 0; i < factionTypes.size(); ++i) { + for (int i = 0; i < (int)factionTypes.size(); ++i) { std::vector factionResults = factionTypes[i].validateFactionType(); if(factionResults.empty() == false) { results.insert(results.end(), factionResults.begin(), factionResults.end()); @@ -429,7 +429,7 @@ std::vector TechTree::validateResourceTypes() { // ==================== get ==================== FactionType *TechTree::getTypeByName(const string &name) { - for(int i=0; i < factionTypes.size(); ++i) { + for(int i=0; i < (int)factionTypes.size(); ++i) { if(factionTypes[i].getName(false) == name) { return &factionTypes[i]; } @@ -439,7 +439,7 @@ FactionType *TechTree::getTypeByName(const string &name) { } const FactionType *TechTree::getType(const string &name) const { - for(int i=0; i < factionTypes.size(); ++i) { + for(int i=0; i < (int)factionTypes.size(); ++i) { if(factionTypes[i].getName(false) == name) { return &factionTypes[i]; } @@ -477,7 +477,7 @@ const ResourceType *TechTree::getFirstTechResourceType() const{ const ResourceType *TechTree::getResourceType(const string &name) const{ - for(int i=0; igetChild("row", i); string row= rowNode->getAttribute("value")->getRestrictedValue(); - if(row.size()!=size){ + if((int)row.size() != size){ throw megaglest_runtime_error("Cellmap row has not the same length as unit size",validationMode); } - for(int j=0; jgetChild("levels"); levels.resize(levelsNode->getChildCount()); - for(int i=0; igetChild("level", i); levels[i].init( @@ -304,7 +304,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, //fields const XmlNode *fieldsNode= parametersNode->getChild("fields"); - for(int i=0; igetChildCount(); ++i){ + for(int i=0; i < (int)fieldsNode->getChildCount(); ++i){ const XmlNode *fieldNode= fieldsNode->getChild("field", i); string fieldName= fieldNode->getAttribute("value")->getRestrictedValue(); if(fieldName=="land"){ @@ -330,7 +330,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, //properties const XmlNode *propertiesNode= parametersNode->getChild("properties"); - for(int i = 0; i < propertiesNode->getChildCount(); ++i) { + for(int i = 0; i < (int)propertiesNode->getChildCount(); ++i) { const XmlNode *propertyNode= propertiesNode->getChild("property", i); string propertyName= propertyNode->getAttribute("value")->getRestrictedValue(); bool found= false; @@ -351,7 +351,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, bool particleEnabled= particleNode->getAttribute("value")->getBoolValue(); if(particleEnabled) { - for(int i = 0; i < particleNode->getChildCount(); ++i) { + for(int i = 0; i < (int)particleNode->getChildCount(); ++i) { const XmlNode *particleFileNode= particleNode->getChild("particle-file", i); string path= particleFileNode->getAttribute("path")->getRestrictedValue(); UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType(); @@ -401,7 +401,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, //unit requirements bool hasDup = false; const XmlNode *unitRequirementsNode= parametersNode->getChild("unit-requirements"); - for(int i=0; igetChildCount(); ++i){ + for(int i=0; i < (int)unitRequirementsNode->getChildCount(); ++i){ const XmlNode *unitNode= unitRequirementsNode->getChild("unit", i); string name= unitNode->getAttribute("name")->getRestrictedValue(); @@ -424,7 +424,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, //upgrade requirements const XmlNode *upgradeRequirementsNode= parametersNode->getChild("upgrade-requirements"); - for(int i=0; igetChildCount(); ++i){ + for(int i=0; i < (int)upgradeRequirementsNode->getChildCount(); ++i){ const XmlNode *upgradeReqNode= upgradeRequirementsNode->getChild("upgrade", i); string name= upgradeReqNode->getAttribute("name")->getRestrictedValue(); @@ -449,7 +449,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, //resource requirements const XmlNode *resourceRequirementsNode= parametersNode->getChild("resource-requirements"); costs.resize(resourceRequirementsNode->getChildCount()); - for(int i = 0; i < costs.size(); ++i) { + for(int i = 0; i < (int)costs.size(); ++i) { const XmlNode *resourceNode= resourceRequirementsNode->getChild("resource", i); string name= resourceNode->getAttribute("name")->getRestrictedValue(); int amount= resourceNode->getAttribute("amount")->getIntValue(); @@ -490,7 +490,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, //resources stored const XmlNode *resourcesStoredNode= parametersNode->getChild("resources-stored"); storedResources.resize(resourcesStoredNode->getChildCount()); - for(int i=0; igetChild("resource", i); string name= resourceNode->getAttribute("name")->getRestrictedValue(); int amount= resourceNode->getAttribute("amount")->getIntValue(); @@ -597,7 +597,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const XmlNode *selectionSoundNode= parametersNode->getChild("selection-sounds"); if(selectionSoundNode->getAttribute("enabled")->getBoolValue()){ selectionSounds.resize((int)selectionSoundNode->getChildCount()); - for(int i = 0; i < selectionSounds.getSounds().size(); ++i) { + for(int i = 0; i < (int)selectionSounds.getSounds().size(); ++i) { const XmlNode *soundNode= selectionSoundNode->getChild("sound", i); string path= soundNode->getAttribute("path")->getRestrictedValue(currentPath); StaticSound *sound= new StaticSound(); @@ -611,7 +611,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const XmlNode *commandSoundNode= parametersNode->getChild("command-sounds"); if(commandSoundNode->getAttribute("enabled")->getBoolValue()) { commandSounds.resize((int)commandSoundNode->getChildCount()); - for(int i = 0; i < commandSoundNode->getChildCount(); ++i) { + for(int i = 0; i < (int)commandSoundNode->getChildCount(); ++i) { const XmlNode *soundNode= commandSoundNode->getChild("sound", i); string path= soundNode->getAttribute("path")->getRestrictedValue(currentPath); StaticSound *sound= new StaticSound(); @@ -634,7 +634,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, snprintf(szBuf,8096,Lang::getInstance().getString("LogScreenGameLoadingUnitTypeSkills","",true).c_str(),formatString(this->getName(true)).c_str(),skillTypes.size()); Logger::getInstance().add(szBuf, true); - for(int i = 0; i < skillTypes.size(); ++i) { + for(int i = 0; i < (int)skillTypes.size(); ++i) { const XmlNode *sn= skillsNode->getChild("skill", i); const XmlNode *typeNode= sn->getChild("type"); string classId= typeNode->getAttribute("value")->getRestrictedValue(); @@ -658,7 +658,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, //commands const XmlNode *commandsNode= unitNode->getChild("commands"); commandTypes.resize(commandsNode->getChildCount()); - for(int i = 0; i < commandTypes.size(); ++i) { + for(int i = 0; i < (int)commandTypes.size(); ++i) { const XmlNode *commandNode= commandsNode->getChild("command", i); const XmlNode *typeNode= commandNode->getChild("type"); string classId= typeNode->getAttribute("value")->getRestrictedValue(); @@ -755,7 +755,7 @@ const SkillType *UnitType::getFirstStOfClass(SkillClass skillClass) const{ } const HarvestCommandType *UnitType::getFirstHarvestCommand(const ResourceType *resourceType, const Faction *faction) const { - for(int i = 0; i < commandTypes.size(); ++i) { + for(int i = 0; i < (int)commandTypes.size(); ++i) { if(commandTypes[i]->getClass() == ccHarvest) { const HarvestCommandType *hct = static_cast(commandTypes[i]); @@ -779,7 +779,7 @@ const HarvestEmergencyReturnCommandType *UnitType::getFirstHarvestEmergencyRetur const AttackCommandType *UnitType::getFirstAttackCommand(Field field) const{ //printf("$$$ Unit [%s] commandTypes.size() = %d\n",this->getName().c_str(),(int)commandTypes.size()); - for(int i = 0; i < commandTypes.size(); ++i){ + for(int i = 0; i < (int)commandTypes.size(); ++i){ if(commandTypes[i] == NULL) { throw megaglest_runtime_error("commandTypes[i] == NULL"); } @@ -800,7 +800,7 @@ const AttackCommandType *UnitType::getFirstAttackCommand(Field field) const{ const AttackStoppedCommandType *UnitType::getFirstAttackStoppedCommand(Field field) const{ //printf("$$$ Unit [%s] commandTypes.size() = %d\n",this->getName().c_str(),(int)commandTypes.size()); - for(int i = 0; i < commandTypes.size(); ++i){ + for(int i = 0; i < (int)commandTypes.size(); ++i){ if(commandTypes[i] == NULL) { throw megaglest_runtime_error("commandTypes[i] == NULL"); } @@ -819,7 +819,7 @@ const AttackStoppedCommandType *UnitType::getFirstAttackStoppedCommand(Field fie } const RepairCommandType *UnitType::getFirstRepairCommand(const UnitType *repaired) const{ - for(int i=0; igetClass()== ccRepair){ const RepairCommandType *rct= static_cast(commandTypes[i]); if(rct->isRepairableUnitType(repaired)){ @@ -895,7 +895,7 @@ bool UnitType::getCellMapCell(int x, int y, CardinalDir facing) const { } int UnitType::getStore(const ResourceType *rt) const{ - for(int i=0; igetName()==skillName){ if(skillTypes[i]->getClass()==skillClass){ return skillTypes[i]; @@ -975,7 +975,7 @@ bool UnitType::hasCommandType(const CommandType *commandType) const { return true; } - for(int i=0; igetClass()== SkillClass(j)) { firstSkillTypeOfClass[j]= skillTypes[i]; break; @@ -1025,7 +1025,7 @@ void UnitType::computeFirstStOfClass() { void UnitType::computeFirstCtOfClass() { for(int j = 0; j < ccCount; ++j) { firstCommandTypeOfClass[j]= NULL; - for(int i = 0; i < commandTypes.size(); ++i) { + for(int i = 0; i < (int)commandTypes.size(); ++i) { if(commandTypes[i] != NULL && commandTypes[i]->getClass() == CommandClass(j)) { firstCommandTypeOfClass[j] = commandTypes[i]; break; @@ -1050,7 +1050,7 @@ const CommandType* UnitType::findCommandTypeById(int id) const{ } const CommandType *UnitType::getCommandType(int i) const { - if(i >= commandTypes.size()) { + if(i >= (int)commandTypes.size()) { char szBuf[8096]=""; snprintf(szBuf,8096,"In [%s::%s Line: %d] i >= commandTypes.size(), i = %d, commandTypes.size() = " MG_SIZE_T_SPECIFIER "",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,i,commandTypes.size()); throw megaglest_runtime_error(szBuf); @@ -1131,22 +1131,22 @@ std::string UnitType::toString() const { } result += " skillTypes: [" + intToStr(skillTypes.size()) + "]"; - for(int i = 0; i < skillTypes.size(); ++i) { + for(int i = 0; i < (int)skillTypes.size(); ++i) { result += " i = " + intToStr(i) + " " + skillTypes[i]->toString(false); } result += " commandTypes: [" + intToStr(commandTypes.size()) + "]"; - for(int i = 0; i < commandTypes.size(); ++i) { + for(int i = 0; i < (int)commandTypes.size(); ++i) { result += " i = " + intToStr(i) + " " + commandTypes[i]->toString(false); } result += " storedResources: [" + intToStr(storedResources.size()) + "]"; - for(int i = 0; i < storedResources.size(); ++i) { + for(int i = 0; i < (int)storedResources.size(); ++i) { result += " i = " + intToStr(i) + " " + storedResources[i].getDescription(false); } result += " levels: [" + intToStr(levels.size()) + "]"; - for(int i = 0; i < levels.size(); ++i) { + for(int i = 0; i < (int)levels.size(); ++i) { result += " i = " + intToStr(i) + " " + levels[i].getName(); } diff --git a/source/glest_game/types/upgrade_type.cpp b/source/glest_game/types/upgrade_type.cpp index 09f6c001..3ca8a9bb 100644 --- a/source/glest_game/types/upgrade_type.cpp +++ b/source/glest_game/types/upgrade_type.cpp @@ -625,7 +625,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree, //unit requirements bool hasDup = false; const XmlNode *unitRequirementsNode= upgradeNode->getChild("unit-requirements"); - for(int i = 0; i < unitRequirementsNode->getChildCount(); ++i) { + for(int i = 0; i < (int)unitRequirementsNode->getChildCount(); ++i) { const XmlNode *unitNode= unitRequirementsNode->getChild("unit", i); string name= unitNode->getAttribute("name")->getRestrictedValue(); @@ -649,7 +649,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree, //upgrade requirements const XmlNode *upgradeRequirementsNode= upgradeNode->getChild("upgrade-requirements"); - for(int i = 0; i < upgradeRequirementsNode->getChildCount(); ++i) { + for(int i = 0; i < (int)upgradeRequirementsNode->getChildCount(); ++i) { const XmlNode *upgradeReqNode= upgradeRequirementsNode->getChild("upgrade", i); string name= upgradeReqNode->getAttribute("name")->getRestrictedValue(); @@ -676,7 +676,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree, const XmlNode *resourceRequirementsNode= upgradeNode->getChild("resource-requirements"); costs.resize(resourceRequirementsNode->getChildCount()); - for(int i = 0; i < costs.size(); ++i) { + for(int i = 0; i < (int)costs.size(); ++i) { const XmlNode *resourceNode= resourceRequirementsNode->getChild("resource", i); string name= resourceNode->getAttribute("name")->getRestrictedValue(); int amount= resourceNode->getAttribute("amount")->getIntValue(); @@ -720,7 +720,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree, //effects const XmlNode *effectsNode= upgradeNode->getChild("effects"); - for(int i = 0; i < effectsNode->getChildCount(); ++i) { + for(int i = 0; i < (int)effectsNode->getChildCount(); ++i) { const XmlNode *unitNode= effectsNode->getChild("unit", i); string name= unitNode->getAttribute("name")->getRestrictedValue(); @@ -877,7 +877,7 @@ void TotalUpgrade::sum(const UpgradeTypeBase *ut, const Unit *unit) { } if(ut->getAttackStrengthIsMultiplier() == true) { - for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) { const SkillType *skillType = unit->getType()->getSkillType(i); const AttackSkillType *ast = dynamic_cast(skillType); if(ast != NULL) { @@ -890,7 +890,7 @@ void TotalUpgrade::sum(const UpgradeTypeBase *ut, const Unit *unit) { } if(ut->getAttackRangeIsMultiplier() == true) { - for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) { const SkillType *skillType = unit->getType()->getSkillType(i); const AttackSkillType *ast = dynamic_cast(skillType); if(ast != NULL) { @@ -905,7 +905,7 @@ void TotalUpgrade::sum(const UpgradeTypeBase *ut, const Unit *unit) { if(ut->getMoveSpeedIsMultiplier() == true) { //printf("BEFORE Applying moveSpeedIsMultiplier\n"); - for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) { const SkillType *skillType = unit->getType()->getSkillType(i); const MoveSkillType *mst = dynamic_cast(skillType); if(mst != NULL) { @@ -922,7 +922,7 @@ void TotalUpgrade::sum(const UpgradeTypeBase *ut, const Unit *unit) { } if(ut->getProdSpeedIsMultiplier() == true) { - for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) { const SkillType *skillType = unit->getType()->getSkillType(i); const ProduceSkillType *pst = dynamic_cast(skillType); if(pst != NULL) { @@ -1007,7 +1007,7 @@ void TotalUpgrade::deapply(const UpgradeTypeBase *ut,const Unit *unit) { enforceMinimumValue(0,armor); if(ut->getAttackStrengthIsMultiplier() == true) { - for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) { const SkillType *skillType = unit->getType()->getSkillType(i); const AttackSkillType *ast = dynamic_cast(skillType); if(ast != NULL) { @@ -1023,7 +1023,7 @@ void TotalUpgrade::deapply(const UpgradeTypeBase *ut,const Unit *unit) { if(ut->getAttackRangeIsMultiplier() == true) { - for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) { const SkillType *skillType = unit->getType()->getSkillType(i); const AttackSkillType *ast = dynamic_cast(skillType); if(ast != NULL) { @@ -1040,7 +1040,7 @@ void TotalUpgrade::deapply(const UpgradeTypeBase *ut,const Unit *unit) { if(ut->getMoveSpeedIsMultiplier() == true) { //printf("BEFORE Applying moveSpeedIsMultiplier, moveSpeed = %d, ut->getMoveSpeed() = %d\n",moveSpeed,ut->getMoveSpeed()); - for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) { const SkillType *skillType = unit->getType()->getSkillType(i); const MoveSkillType *mst = dynamic_cast(skillType); if(mst != NULL) { @@ -1057,7 +1057,7 @@ void TotalUpgrade::deapply(const UpgradeTypeBase *ut,const Unit *unit) { } if(ut->getProdSpeedIsMultiplier() == true) { - for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) { const SkillType *skillType = unit->getType()->getSkillType(i); const ProduceSkillType *pst = dynamic_cast(skillType); if(pst != NULL) { diff --git a/source/glest_game/world/map.cpp b/source/glest_game/world/map.cpp index 7a285fb3..6ff9762d 100644 --- a/source/glest_game/world/map.cpp +++ b/source/glest_game/world/map.cpp @@ -101,7 +101,7 @@ void Cell::loadGame(const XmlNode *rootNode, int index, World *world) { if(rootNode->hasChild("Cell" + intToStr(index)) == true) { const XmlNode *cellNode = rootNode->getChild("Cell" + intToStr(index)); - int unitCount = (int)cellNode->getChildCount(); + unsigned int unitCount = (unsigned int)cellNode->getChildCount(); for(unsigned int i = 0; i < unitCount; ++i) { if(cellNode->hasChildAtIndex("units",i) == true) { const XmlNode *unitsNode = cellNode->getChild("units",i); @@ -844,7 +844,7 @@ bool Map::canOccupy(const Vec2i &pos, Field field, const UnitType *ut, CardinalD } } else { - false; + return false; } } } @@ -1702,7 +1702,7 @@ string Map::getMapPath(const string &mapName, string scenarioDir, bool errorOnNo Config &config = Config::getInstance(); vector pathList = config.getPathListForType(ptMaps,scenarioDir); - for(int idx = 0; idx < pathList.size(); idx++) { + for(int idx = 0; idx < (int)pathList.size(); idx++) { string map_path = pathList[idx]; endPathWithSlash(map_path); @@ -1760,7 +1760,7 @@ void Map::saveGame(XmlNode *rootNode) const { string exploredList = ""; string visibleList = ""; - for(unsigned int i = 0; i < getSurfaceCellArraySize(); ++i) { + for(unsigned int i = 0; i < (unsigned int)getSurfaceCellArraySize(); ++i) { SurfaceCell &surfaceCell = surfaceCells[i]; if(exploredList != "") { @@ -1808,7 +1808,7 @@ void Map::saveGame(XmlNode *rootNode) const { } // Vec2i *startLocations; - for(unsigned int i = 0; i < maxPlayers; ++i) { + for(unsigned int i = 0; i < (unsigned int)maxPlayers; ++i) { XmlNode *startLocationsNode = mapNode->addChild("startLocations"); startLocationsNode->addAttribute("location",startLocations[i].getString(), mapTagReplacements); } @@ -1841,7 +1841,7 @@ void Map::loadGame(const XmlNode *rootNode, World *world) { // } // printf("getSurfaceCellArraySize() = %d\n",getSurfaceCellArraySize()); - for(unsigned int i = 0; i < getSurfaceCellArraySize(); ++i) { + for(unsigned int i = 0; i < (unsigned int)getSurfaceCellArraySize(); ++i) { SurfaceCell &surfaceCell = surfaceCells[i]; surfaceCell.loadGame(mapNode,i,world); } diff --git a/source/glest_game/world/scenario.cpp b/source/glest_game/world/scenario.cpp index 92e67a27..bdc2efb0 100644 --- a/source/glest_game/world/scenario.cpp +++ b/source/glest_game/world/scenario.cpp @@ -82,7 +82,7 @@ Checksum Scenario::load(const string &path) { const XmlNode *scenarioNode= xmlTree.getRootNode(); const XmlNode *scriptsNode= scenarioNode->getChild("scripts"); - for(int i= 0; igetChildCount(); ++i){ + for(int i= 0; i < (int)scriptsNode->getChildCount(); ++i){ const XmlNode *scriptNode = scriptsNode->getChild(i); scripts.push_back(Script(getFunctionName(scriptNode), scriptNode->getText())); @@ -103,7 +103,7 @@ Checksum Scenario::load(const string &path) { int Scenario::getScenarioPathIndex(const vector dirList, const string &scenarioName) { int iIndex = 0; - for(int idx = 0; idx < dirList.size(); idx++) { + for(int idx = 0; idx < (int)dirList.size(); idx++) { string currentPath = dirList[idx]; endPathWithSlash(currentPath); string scenarioFile = currentPath + scenarioName + "/" + scenarioName + ".xml"; @@ -118,7 +118,7 @@ int Scenario::getScenarioPathIndex(const vector dirList, const string &s string Scenario::getScenarioDir(const vector dir, const string &scenarioName) { string scenarioDir = ""; - for(int idx = 0; idx < dir.size(); idx++) { + for(int idx = 0; idx < (int)dir.size(); idx++) { string currentPath = dir[idx]; endPathWithSlash(currentPath); string scenarioFile = currentPath + scenarioName + "/" + scenarioName + ".xml"; @@ -136,7 +136,7 @@ string Scenario::getScenarioDir(const vector dir, const string &scenario string Scenario::getScenarioPath(const vector dirList, const string &scenarioName, bool getMatchingRootScenarioPathOnly){ string scenarioFile = ""; - for(int idx = 0; idx < dirList.size(); idx++) { + for(int idx = 0; idx < (int)dirList.size(); idx++) { string currentPath = dirList[idx]; endPathWithSlash(currentPath); scenarioFile = currentPath + scenarioName + "/" + scenarioName + ".xml"; @@ -172,7 +172,7 @@ string Scenario::getScenarioPath(const string &dir, const string &scenarioName){ string Scenario::getFunctionName(const XmlNode *scriptNode){ string name= scriptNode->getName(); - for(int i= 0; igetAttributeCount(); ++i){ + for(int i= 0; i < (int)scriptNode->getAttributeCount(); ++i){ name+= "_" + scriptNode->getAttribute(i)->getValue(); } return name; diff --git a/source/glest_game/world/tileset.cpp b/source/glest_game/world/tileset.cpp index cd14aa70..65595e2d 100644 --- a/source/glest_game/world/tileset.cpp +++ b/source/glest_game/world/tileset.cpp @@ -125,7 +125,7 @@ Checksum Tileset::loadTileset(const vector pathList, const string &tiles Checksum tilesetChecksum; bool found = false; - for(int idx = 0; idx < pathList.size(); idx++) { + for(int idx = 0; idx < (int)pathList.size(); idx++) { string currentPath = pathList[idx]; endPathWithSlash(currentPath); string path = currentPath + tilesetName; @@ -240,7 +240,7 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck string exceptionError = ""; Pixmap2D *pixmap = NULL; int width = 0; - int heith = 0; + int height = 0; try { pixmap=new Pixmap2D(); @@ -248,8 +248,8 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck pixmap->load(textureNode->getAttribute("path")->getRestrictedValue(currentPath)); loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,textureNode->getAttribute("path")->getRestrictedValue())); - width = pixmap->getW(); - heith = pixmap->getW(); + width = pixmap->getW(); + height = pixmap->getW(); } catch(const exception &ex) { SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); @@ -268,9 +268,15 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck throw megaglest_runtime_error(exceptionError.c_str()); } - assert(width==heith); - assert(width%64==0); - assert(width%partsize==0); + if(width != height) { + throw megaglest_runtime_error("width != height"); + } + if(width % 64 != 0) { + throw megaglest_runtime_error("width % 64 != 0"); + } + if(width % partsize != 0) { + throw megaglest_runtime_error("width % partsize != 0"); + } int parts=width/partsize; int numberOfPieces=parts*parts; @@ -325,7 +331,7 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck const XmlNode *particleNode= modelNode->getChild("particles"); bool particleEnabled= particleNode->getAttribute("value")->getBoolValue(); if(particleEnabled){ - for(int k=0; kgetChildCount(); ++k){ + for(int k=0; k < (int)particleNode->getChildCount(); ++k){ const XmlNode *particleFileNode= particleNode->getChild("particle-file", k); string path= particleFileNode->getAttribute("path")->getRestrictedValue(); ObjectParticleSystemType *objectParticleSystemType= new ObjectParticleSystemType(); @@ -523,7 +529,7 @@ void Tileset::addSurfTex(int leftUp, int rightUp, int leftDown, int rightDown, V else { float max= 0.f; int var= 0; - for(int i=0; i < surfProbs[leftUp].size(); ++i) { + for(int i=0; i < (int)surfProbs[leftUp].size(); ++i) { max += surfProbs[leftUp][i]; if(r <= max) { var= i; diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index 6efc088a..af71c3a6 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -898,7 +898,7 @@ std::pair UnitUpdater::unitBeingAttacked(const Unit *unit) { std::pair result = make_pair(false,(Unit *)NULL); float distToUnit = -1; - for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) { const SkillType *st = unit->getType()->getSkillType(i); const AttackSkillType *ast = dynamic_cast(st); unitBeingAttacked(result, unit, ast, &distToUnit); @@ -1281,7 +1281,7 @@ void UnitUpdater::updateHarvest(Unit *unit, int frameIndex) { const HarvestCommandType *hct= dynamic_cast(command->getCommandType()); Vec2i targetPos(-1); - TravelState tsValue = tsImpossible; + //TravelState tsValue = tsImpossible; //UnitPathInterface *path= unit->getPath(); if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis()); @@ -2667,7 +2667,7 @@ bool UnitUpdater::findCachedCellsEnemies(Vec2i center, int range, int size, vect result = true; std::vector &cellList = iterFind4->second.rangeCellList; - for(int idx = 0; idx < cellList.size(); ++idx) { + for(int idx = 0; idx < (int)cellList.size(); ++idx) { Cell *cell = cellList[idx]; findEnemiesForCell(ast,cell,unit,commandTarget,enemies); @@ -2805,7 +2805,7 @@ bool UnitUpdater::unitOnRange(Unit *unit, int range, Unit **rangedPtr, string randomInfoData = "enemies.size() = " + intToStr(enemies.size()); //printf("unit %d has control:%d\n",unit->getId(),controlType); - for(int i = 0; i< enemies.size(); ++i) { + for(int i = 0; i< (int)enemies.size(); ++i) { Unit *enemy = enemies[i]; diff --git a/source/glest_game/world/water_effects.cpp b/source/glest_game/world/water_effects.cpp index a2794d26..af6d8607 100644 --- a/source/glest_game/world/water_effects.cpp +++ b/source/glest_game/world/water_effects.cpp @@ -51,13 +51,13 @@ void WaterEffects::update(float speed){ if(anim>1.f){ anim= 0; } - for(int i=0; iend(); } masterController.clearSlaves(true); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - for(int i= 0; iend(); } masterController.clearSlaves(true); - for(int i= 0; igetLastStuckFrame() == frameCount) { + if(unit->getLastStuckFrame() == (unsigned int)frameCount) { unitCountStuck++; } mapCommandCount[unitCommandClass] = mapCommandCount[unitCommandClass] + 1; @@ -1280,7 +1280,7 @@ void World::morphToUnit(int unitId,const string &morphName,bool ignoreRequiremen void World::createUnit(const string &unitName, int factionIndex, const Vec2i &pos, bool spaciated) { if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] unitName [%s] factionIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,unitName.c_str(),factionIndex); - if(factionIndex < factions.size()) { + if(factionIndex < (int)factions.size()) { Faction* faction= factions[factionIndex]; if(faction->getIndex() != factionIndex) { @@ -1324,7 +1324,7 @@ void World::createUnit(const string &unitName, int factionIndex, const Vec2i &po } void World::giveResource(const string &resourceName, int factionIndex, int amount) { - if(factionIndex < factions.size()) { + if(factionIndex < (int)factions.size()) { Faction* faction= factions[factionIndex]; const ResourceType* rt= techTree->getResourceType(resourceName); faction->incResourceAmount(rt, amount); @@ -1728,7 +1728,7 @@ void World::giveUpgradeCommand(int unitId, const string &upgradeName) { int World::getResourceAmount(const string &resourceName, int factionIndex) { - if(factionIndex < factions.size()) { + if(factionIndex < (int)factions.size()) { Faction* faction= factions[factionIndex]; const ResourceType* rt= techTree->getResourceType(resourceName); return faction->getResource(rt)->getAmount(); @@ -1739,7 +1739,7 @@ int World::getResourceAmount(const string &resourceName, int factionIndex) { } Vec2i World::getStartLocation(int factionIndex) { - if(factionIndex < factions.size()) { + if(factionIndex < (int)factions.size()) { Faction* faction= factions[factionIndex]; return map.getStartLocation(faction->getStartLocationIndex()); } @@ -1854,7 +1854,7 @@ const string World::getUnitName(int unitId) { } int World::getUnitCount(int factionIndex) { - if(factionIndex < factions.size()) { + if(factionIndex < (int)factions.size()) { Faction* faction= factions[factionIndex]; int count= 0; @@ -1872,7 +1872,7 @@ int World::getUnitCount(int factionIndex) { } int World::getUnitCountOfType(int factionIndex, const string &typeName) { - if(factionIndex < factions.size()) { + if(factionIndex < (int)factions.size()) { Faction* faction= factions[factionIndex]; int count= 0; @@ -1992,7 +1992,7 @@ void World::initFactionTypes(GameSettings *gs) { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] factions.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,factions.size()); - for(int i=0; i < factions.size(); ++i) { + for(int i=0; i < (int)factions.size(); ++i) { FactionType *ft= techTree->getTypeByName(gs->getFactionTypeName(i)); if(ft == NULL) { throw megaglest_runtime_error("ft == NULL"); @@ -2241,10 +2241,10 @@ void World::initUnits() { } void World::refreshAllUnitExplorations() { - for(unsigned int i = 0; i < getFactionCount(); ++i) { + for(unsigned int i = 0; i < (unsigned int)getFactionCount(); ++i) { Faction *faction = factions[i]; - for(unsigned int j = 0; j < faction->getUnitCount(); ++j) { + for(unsigned int j = 0; j < (unsigned int)faction->getUnitCount(); ++j) { Unit *unit = faction->getUnit(j); unit->refreshPos(); } @@ -2259,12 +2259,12 @@ void World::initMap() { void World::exploreCells(int teamIndex, ExploredCellsLookupItem &exploredCellsCache) { std::vector &cellList = exploredCellsCache.exploredCellList; - for (int idx2 = 0; idx2 < cellList.size(); ++idx2) { + for (int idx2 = 0; idx2 < (int)cellList.size(); ++idx2) { SurfaceCell* sc = cellList[idx2]; sc->setExplored(teamIndex, true); } cellList = exploredCellsCache.visibleCellList; - for (int idx2 = 0; idx2 < cellList.size(); ++idx2) { + for (int idx2 = 0; idx2 < (int)cellList.size(); ++idx2) { SurfaceCell* sc = cellList[idx2]; sc->setVisible(teamIndex, true); } @@ -2284,7 +2284,7 @@ ExploredCellsLookupItem World::exploreCells(const Vec2i &newPos, int sightRange, // Ok we limit the cache size due to possible RAM constraints when // the threshold is met bool MaxExploredCellsLookupItemCacheTriggered = false; - if(ExploredCellsLookupItemCache.size() >= MaxExploredCellsLookupItemCache) { + if((int)ExploredCellsLookupItemCache.size() >= MaxExploredCellsLookupItemCache) { MaxExploredCellsLookupItemCacheTriggered = true; // Snag the oldest entry in the list std::map::reverse_iterator purgeItem = ExploredCellsLookupItemCacheTimer.rbegin(); @@ -2616,7 +2616,7 @@ void World::stopAllVideo() { } void World::removeResourceTargetFromCache(const Vec2i &pos) { - for(int i= 0; i < factions.size(); ++i) { + for(int i= 0; i < (int)factions.size(); ++i) { factions[i]->removeResourceTargetFromCache(pos); } } diff --git a/source/glest_map_editor/main.cpp b/source/glest_map_editor/main.cpp index 819e51e9..9b2dc57c 100644 --- a/source/glest_map_editor/main.cpp +++ b/source/glest_map_editor/main.cpp @@ -67,7 +67,14 @@ wxString ToUnicode(const string& str) { MainWindow::MainWindow(string appPath) : wxFrame(NULL, -1, ToUnicode(winHeader), wxPoint(0,0), wxSize(1024, 768)) - , lastX(0), lastY(0) + , glCanvas(NULL) + , program(NULL) + , lastX(0) + , lastY(0) + , panel(NULL) + , menuBar(NULL) + , fileDialog(NULL) + , currentBrush(btHeight) , height(0) , surface(1) @@ -77,11 +84,8 @@ MainWindow::MainWindow(string appPath) , startLocation(1) , enabledGroup(ctHeight) , fileModified(false) - , menuBar(NULL) - , panel(NULL) - , glCanvas(NULL) - , fileDialog(NULL) - , program(NULL), boxsizer(NULL), startupSettingsInited(false) { + , boxsizer(NULL) + ,startupSettingsInited(false) { menuFile=NULL; menuEdit=NULL; diff --git a/source/shared_lib/include/platform/sdl/gl_wrap.h b/source/shared_lib/include/platform/sdl/gl_wrap.h index 2ec67be4..b4f45db8 100644 --- a/source/shared_lib/include/platform/sdl/gl_wrap.h +++ b/source/shared_lib/include/platform/sdl/gl_wrap.h @@ -47,6 +47,16 @@ protected: SDL_Surface *icon; SDL_Surface *screen; +public: + // Example values: + // DEFAULT_CHARSET (English) = 1 + // GB2312_CHARSET (Chinese) = 134 + #ifdef WIN32 + static DWORD charSet; + #else + static int charSet; + #endif + public: PlatformContextGl(); virtual ~PlatformContextGl(); @@ -68,15 +78,6 @@ public: // Global Fcs // ===================================================== -// Example values: -// DEFAULT_CHARSET (English) = 1 -// GB2312_CHARSET (Chinese) = 134 -#ifdef WIN32 -static DWORD charSet = DEFAULT_CHARSET; -#else -static int charSet = 1; -#endif - #if defined(__APPLE__) void createGlFontBitmaps(uint32 &base, const string &type, int size, int width, int charCount, FontMetrics &metrics); void createGlFontOutlines(uint32 &base, const string &type, int width, float depth, int charCount, FontMetrics &metrics); diff --git a/source/shared_lib/include/util/gen_uuid.h b/source/shared_lib/include/util/gen_uuid.h index a1261079..45dad2d8 100644 --- a/source/shared_lib/include/util/gen_uuid.h +++ b/source/shared_lib/include/util/gen_uuid.h @@ -162,6 +162,7 @@ inline static void get_random_info(char seed[16]) { if (NULL != fp) { size_t bytes = fread(seed,sizeof(char),16,fp); + if(bytes <= 0) { } fclose(fp); return; } diff --git a/source/shared_lib/sources/feathery_ftp/ftpCmds.c b/source/shared_lib/sources/feathery_ftp/ftpCmds.c index aaa252e8..c23a00a8 100644 --- a/source/shared_lib/sources/feathery_ftp/ftpCmds.c +++ b/source/shared_lib/sources/feathery_ftp/ftpCmds.c @@ -201,7 +201,7 @@ LOCAL int ftpCmdSyst(int sessionId, const char* args, int len) } LOCAL int ftpCmdPort(int sessionId, const char* args, int len) { - char clientIp[16]; + //char clientIp[16]=""; uint16_t clientPort=0; int commaCnt = 0; @@ -215,13 +215,13 @@ LOCAL int ftpCmdPort(int sessionId, const char* args, int len) if(args[n] == ',') { commaCnt++; - if(commaCnt < 4) - clientIp[n] = '.'; - else - clientIp[n] = '\0'; +// if(commaCnt < 4) +// clientIp[n] = '.'; +// else +// clientIp[n] = '\0'; } - else - clientIp[n] = args[n]; +// else +// clientIp[n] = args[n]; } else // Port-Nummer { @@ -957,7 +957,7 @@ int execFtpCmd(int sessionId, const char* cmd, int cmdlen) //if(VERBOSE_MODE_ENABLED) printf("In execFtpCmd ARRAY_SIZE(cmds) = %lu for sessionId = %d\n",ARRAY_SIZE(cmds),sessionId); if(VERBOSE_MODE_ENABLED) printf("In execFtpCmd cmd [%s] for sessionId = %d\n",cmd,sessionId); - for(n = 0; n < ARRAY_SIZE(cmds); n++) + for(n = 0; n < (int)ARRAY_SIZE(cmds); n++) { if(!strncmp(cmds[n].cmdToken, cmd, cmds[n].tokLen)) { diff --git a/source/shared_lib/sources/graphics/font.cpp b/source/shared_lib/sources/graphics/font.cpp index e637182b..e20ca266 100644 --- a/source/shared_lib/sources/graphics/font.cpp +++ b/source/shared_lib/sources/graphics/font.cpp @@ -166,7 +166,7 @@ float FontMetrics::getTextWidth(const string &str) { width+= (widths[97]); // This is the letter a which is a normal wide character and good to use for spacing } else { - width+= widths[longestLine[i]]; + width+= widths[(int)longestLine[i]]; } } return width; @@ -522,7 +522,7 @@ void Font::bidi_cvt(string &str_) { if(is_converted == true) { nonASCIIWordList.push_back(str_); - if(wordIndex+1 == words.size()) { + if(wordIndex+1 == (int)words.size()) { if(nonASCIIWordList.size() > 1) { std::reverse(nonASCIIWordList.begin(),nonASCIIWordList.end()); copy(nonASCIIWordList.begin(), nonASCIIWordList.end(), std::inserter(wordList, wordList.begin())); diff --git a/source/shared_lib/sources/graphics/gl/texture_gl.cpp b/source/shared_lib/sources/graphics/gl/texture_gl.cpp index 4cc0d448..0dbd26ed 100644 --- a/source/shared_lib/sources/graphics/gl/texture_gl.cpp +++ b/source/shared_lib/sources/graphics/gl/texture_gl.cpp @@ -631,7 +631,7 @@ TextureGl::~TextureGl() { // ===================================================== // class Texture1DGl // ===================================================== -Texture1DGl::Texture1DGl() : TextureGl(), Texture1D() {} +Texture1DGl::Texture1DGl() : Texture1D(), TextureGl() {} Texture1DGl::~Texture1DGl() { end(); @@ -753,7 +753,7 @@ void Texture1DGl::end(bool deletePixelBuffer) { // class Texture2DGl // ===================================================== -Texture2DGl::Texture2DGl() : TextureGl(), Texture2D() {} +Texture2DGl::Texture2DGl() : Texture2D(), TextureGl() {} Texture2DGl::~Texture2DGl() { end(); @@ -959,7 +959,7 @@ void Texture2DGl::end(bool deletePixelBuffer) { // class Texture3DGl // ===================================================== -Texture3DGl::Texture3DGl() : TextureGl(), Texture3D() {} +Texture3DGl::Texture3DGl() : Texture3D(), TextureGl() {} Texture3DGl::~Texture3DGl() { end(); @@ -1068,7 +1068,7 @@ void Texture3DGl::end(bool deletePixelBuffer) { // class TextureCubeGl // ===================================================== -TextureCubeGl::TextureCubeGl() : TextureGl(), TextureCube() {} +TextureCubeGl::TextureCubeGl() : TextureCube(), TextureGl() {} TextureCubeGl::~TextureCubeGl() { end(); diff --git a/source/shared_lib/sources/graphics/model.cpp b/source/shared_lib/sources/graphics/model.cpp index 09c99d7b..23db7723 100644 --- a/source/shared_lib/sources/graphics/model.cpp +++ b/source/shared_lib/sources/graphics/model.cpp @@ -1982,7 +1982,7 @@ vector BaseColorPickEntity::getPickedList(int x,int y,int w,int h, map > > colorAlreadyPickedList; int skipSteps=4; - unsigned char *oldpixel = &pixelBuffer[0]; + //unsigned char *oldpixel = &pixelBuffer[0]; // now we check the screenshot if we find pixels in color of unit identity // to speedup we only check every "skipSteps" line and pixel in a row if we find such a color. diff --git a/source/shared_lib/sources/graphics/particle.cpp b/source/shared_lib/sources/graphics/particle.cpp index 0ffa3c7d..ca33174a 100644 --- a/source/shared_lib/sources/graphics/particle.cpp +++ b/source/shared_lib/sources/graphics/particle.cpp @@ -765,9 +765,9 @@ GameParticleSystem::GameParticleSystem(int particleCount): primitive(pQuad), model(NULL), modelCycle(0.0f), - tween(0.0f), offset(0.0f), - direction(0.0f, 1.0f, 0.0f) + direction(0.0f, 1.0f, 0.0f), + tween(0.0f) {} GameParticleSystem::~GameParticleSystem(){ diff --git a/source/shared_lib/sources/graphics/pixmap.cpp b/source/shared_lib/sources/graphics/pixmap.cpp index 020e0e18..9e777f78 100644 --- a/source/shared_lib/sources/graphics/pixmap.cpp +++ b/source/shared_lib/sources/graphics/pixmap.cpp @@ -991,8 +991,7 @@ void Pixmap2D::Scale(int format, int newW, int newH) { const char *errorString= reinterpret_cast(gluErrorString(error)); printf("ERROR Scaling image from [%d x %d] to [%d x %d] error: %d [%s]\n",originalW,originalH,w,h,error,errorString); - GLenum glErr = error; - assertGlWithErrorNumber(glErr); + assertGlWithErrorNumber(error); } CalculatePixelsCRC(pixels,getPixelByteCount(), crc); @@ -1063,7 +1062,7 @@ void Pixmap2D::savePng(const string &path) { void Pixmap2D::getPixel(int x, int y, uint8 *value) const { for(int i=0; i= getPixelByteCount()) { + if((unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); @@ -1076,7 +1075,7 @@ void Pixmap2D::getPixel(int x, int y, uint8 *value) const { void Pixmap2D::getPixel(int x, int y, float32 *value) const { for(int i=0; i= getPixelByteCount()) { + if((unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); @@ -1088,7 +1087,7 @@ void Pixmap2D::getPixel(int x, int y, float32 *value) const { void Pixmap2D::getComponent(int x, int y, int component, uint8 &value) const { int index = (w*y+x)*components+component; - if(index >= getPixelByteCount()) { + if(index < 0 || (unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); @@ -1099,7 +1098,7 @@ void Pixmap2D::getComponent(int x, int y, int component, uint8 &value) const { void Pixmap2D::getComponent(int x, int y, int component, float32 &value) const { int index = (w*y+x)*components+component; - if(index >= getPixelByteCount()) { + if(index < 0 || (unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); @@ -1113,7 +1112,7 @@ Vec4f Pixmap2D::getPixel4f(int x, int y) const { Vec4f v(0.f); for(int i=0; i= getPixelByteCount()) { + if(index < 0 || (unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); @@ -1128,7 +1127,7 @@ Vec3f Pixmap2D::getPixel3f(int x, int y) const { Vec3f v(0.f); for(int i=0; i= getPixelByteCount()) { + if(index < 0 || (unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); @@ -1141,7 +1140,7 @@ Vec3f Pixmap2D::getPixel3f(int x, int y) const { float Pixmap2D::getPixelf(int x, int y) const { int index = (w*y+x)*components; - if(index >= getPixelByteCount()) { + if(index < 0 || (unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); @@ -1158,7 +1157,7 @@ float Pixmap2D::getComponentf(int x, int y, int component) const { void Pixmap2D::setPixel(int x, int y, const uint8 *value) { for(int i=0; i= getPixelByteCount()) { + if(index < 0 || (unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); @@ -1172,7 +1171,7 @@ void Pixmap2D::setPixel(int x, int y, const uint8 *value) { void Pixmap2D::setPixel(int x, int y, const float32 *value) { for(int i=0; i= getPixelByteCount()) { + if(index < 0 || (unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); @@ -1184,7 +1183,7 @@ void Pixmap2D::setPixel(int x, int y, const float32 *value) { void Pixmap2D::setComponent(int x, int y, int component, uint8 value) { int index = (w*y+x)*components+component; - if(index >= getPixelByteCount()) { + if(index < 0 || (unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); @@ -1196,7 +1195,7 @@ void Pixmap2D::setComponent(int x, int y, int component, uint8 value) { void Pixmap2D::setComponent(int x, int y, int component, float32 value) { int index = (w*y+x)*components+component; - if(index >= getPixelByteCount()) { + if(index < 0 || (unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); @@ -1210,7 +1209,7 @@ void Pixmap2D::setComponent(int x, int y, int component, float32 value) { void Pixmap2D::setPixel(int x, int y, const Vec3f &p) { for(int i = 0; i < components && i < 3; ++i) { int index = (w*y+x)*components+i; - if(index >= getPixelByteCount()) { + if(index < 0 || (unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); @@ -1223,7 +1222,7 @@ void Pixmap2D::setPixel(int x, int y, const Vec3f &p) { void Pixmap2D::setPixel(int x, int y, const Vec4f &p) { for(int i = 0; i < components && i < 4; ++i) { int index = (w*y+x)*components+i; - if(index >= getPixelByteCount()) { + if(index < 0 || (unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); @@ -1235,7 +1234,7 @@ void Pixmap2D::setPixel(int x, int y, const Vec4f &p) { void Pixmap2D::setPixel(int x, int y, float p) { int index = (w*y+x)*components; - if(index >= getPixelByteCount()) { + if(index < 0 || (unsigned int)index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y); throw megaglest_runtime_error(szBuf); diff --git a/source/shared_lib/sources/graphics/video_player.cpp b/source/shared_lib/sources/graphics/video_player.cpp index 2f7194cc..972b2012 100644 --- a/source/shared_lib/sources/graphics/video_player.cpp +++ b/source/shared_lib/sources/graphics/video_player.cpp @@ -163,31 +163,31 @@ static inline void loadTexture(class ctx *ctx) { glTexImage2D(GL_TEXTURE_2D, 0, 4, ctx->width, ctx->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (Uint8 *) rawData); } -static void *lock(void *data, void **p_pixels) { - class ctx *ctx = (class ctx *)data; - if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__); - - SDL_LockMutex(ctx->mutex); - SDL_LockSurface(ctx->surf); - *p_pixels = ctx->surf->pixels; - - return NULL; /* picture identifier, not needed here */ -} - -static void unlock(void *data, void *id, void *const *p_pixels) { - class ctx *ctx = (class ctx *)data; - if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__); - - /* VLC just rendered the video, but we can also render stuff */ - SDL_UnlockSurface(ctx->surf); - SDL_UnlockMutex(ctx->mutex); -} - -static void display(void *data, void *id) { - // VLC wants to display the video - class ctx *ctx = (class ctx *)data; - if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__); -} +//static void *lock(void *data, void **p_pixels) { +// class ctx *ctx = (class ctx *)data; +// if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__); +// +// SDL_LockMutex(ctx->mutex); +// SDL_LockSurface(ctx->surf); +// *p_pixels = ctx->surf->pixels; +// +// return NULL; /* picture identifier, not needed here */ +//} +// +//static void unlock(void *data, void *id, void *const *p_pixels) { +// class ctx *ctx = (class ctx *)data; +// if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__); +// +// /* VLC just rendered the video, but we can also render stuff */ +// SDL_UnlockSurface(ctx->surf); +// SDL_UnlockMutex(ctx->mutex); +//} +// +//static void display(void *data, void *id) { +// // VLC wants to display the video +// class ctx *ctx = (class ctx *)data; +// if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__); +//} #if defined(HAS_LIBVLC) && defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_0) static void catchError(libvlc_exception_t *ex) { diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index 8cd7ac4b..6851fe2c 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -365,7 +365,7 @@ void findAll(const string &path, vector &results, bool cutExtension, boo } } else { - for(int i = 0; i < globbuf.gl_pathc; ++i) { + for(int i = 0; i < (int)globbuf.gl_pathc; ++i) { const char* p = globbuf.gl_pathv[i]; const char* begin = p; for( ; *p != 0; ++p) { @@ -598,7 +598,7 @@ void updatePathClimbingParts(string &path) { for(int x = (int)pos; x >= 0; --x) { //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 != pos) { + if((path[x] == '/' || path[x] == '\\') && x != (int)pos) { path.erase(x,pos-x); break; } @@ -1034,7 +1034,7 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string int fileLoopCount = 0; int fileMatchCount = 0; - for(int i = 0; i < globbuf.gl_pathc; ++i) { + for(int i = 0; i < (int)globbuf.gl_pathc; ++i) { const char* p = globbuf.gl_pathv[i]; //printf("Line: %d p [%s]\n",__LINE__,p); @@ -1072,7 +1072,7 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string } #endif - for(int i = 0; i < globbuf.gl_pathc; ++i) { + for(int i = 0; i < (int)globbuf.gl_pathc; ++i) { #if defined(__APPLE__) || defined(__FreeBSD__) struct stat statStruct; // only process if dir.. @@ -1212,7 +1212,7 @@ vector getFolderTreeContentsListRecursively(const string &path, const st throw megaglest_runtime_error(msg.str()); } #endif - for(int i = 0; i < globbuf.gl_pathc; ++i) { + for(int i = 0; i < (int)globbuf.gl_pathc; ++i) { const char* p = globbuf.gl_pathv[i]; bool skipItem = (EndsWith(p, ".") == true || EndsWith(p, "..") == true); @@ -1253,7 +1253,7 @@ vector getFolderTreeContentsListRecursively(const string &path, const st } #endif - for(int i = 0; i < globbuf.gl_pathc; ++i) { + for(int i = 0; i < (int)globbuf.gl_pathc; ++i) { #if defined(__APPLE__) || defined(__FreeBSD__) struct stat statStruct; // only get if dir.. @@ -1354,7 +1354,7 @@ vector > getFolderTreeContentsCheckSumListRecursively(c } #endif - for(int i = 0; i < globbuf.gl_pathc; ++i) { + for(int i = 0; i < (int)globbuf.gl_pathc; ++i) { const char* p = globbuf.gl_pathv[i]; if(isdir(p) == false) { @@ -1392,7 +1392,7 @@ vector > getFolderTreeContentsCheckSumListRecursively(c } #endif - for(int i = 0; i < globbuf.gl_pathc; ++i) { + for(int i = 0; i < (int)globbuf.gl_pathc; ++i) { #if defined(__APPLE__) || defined(__FreeBSD__) struct stat statStruct; // only get if dir.. diff --git a/source/shared_lib/sources/platform/common/simple_threads.cpp b/source/shared_lib/sources/platform/common/simple_threads.cpp index 295c4f52..507dc820 100644 --- a/source/shared_lib/sources/platform/common/simple_threads.cpp +++ b/source/shared_lib/sources/platform/common/simple_threads.cpp @@ -301,10 +301,10 @@ void FileCRCPreCacheThread::execute() { } if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\t\tStart Processing CRC for techName [%s]\n",techName.c_str()); - int32 techCRC = getFolderTreeContentsCheckSumRecursively(techDataPaths, string("/") + techName + string("/*"), ".xml", NULL, true); + uint32 techCRC = getFolderTreeContentsCheckSumRecursively(techDataPaths, string("/") + techName + string("/*"), ".xml", NULL, true); //if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] cached CRC value for Tech [%s] is [%d] took %.3f seconds.\n",__FILE__,__FUNCTION__,__LINE__,techName.c_str(),techCRC,difftime(time(NULL),elapsedTime)); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] cached CRC value for Tech [%s] is [%d] took %.3f seconds.\n",__FILE__,__FUNCTION__,__LINE__,techName.c_str(),techCRC,difftime(time(NULL),elapsedTime)); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] cached CRC value for Tech [%s] is [%u] took %.3f seconds.\n",__FILE__,__FUNCTION__,__LINE__,techName.c_str(),techCRC,difftime(time(NULL),elapsedTime)); vector results; for(unsigned int idx = 0; idx < techDataPaths.size(); idx++) { @@ -337,9 +337,9 @@ void FileCRCPreCacheThread::execute() { } if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\t\t\tStart Processing CRC for factionName [%s]\n",factionName.c_str()); - int32 factionCRC = getFolderTreeContentsCheckSumRecursively(techDataPaths, "/" + techName + "/factions/" + factionName + "/*", ".xml", NULL, true); + uint32 factionCRC = getFolderTreeContentsCheckSumRecursively(techDataPaths, "/" + techName + "/factions/" + factionName + "/*", ".xml", NULL, true); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\t\t\tDone Processing CRC for factionName [%s]\n",factionName.c_str()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\t\t\tDone Processing CRC for factionName [%s] CRC [%d]\n",factionName.c_str(),factionCRC); } } diff --git a/source/shared_lib/sources/platform/posix/socket.cpp b/source/shared_lib/sources/platform/posix/socket.cpp index a5fd4df2..8a040796 100644 --- a/source/shared_lib/sources/platform/posix/socket.cpp +++ b/source/shared_lib/sources/platform/posix/socket.cpp @@ -349,6 +349,7 @@ void Ip::Inet_NtoA(uint32 addr, char * ipbuf) sprintf(ipbuf, "%d.%d.%d.%d", (addr>>24)&0xFF, (addr>>16)&0xFF, (addr>>8)&0xFF, (addr>>0)&0xFF); } +#if defined(WIN32) // convert a string represenation of an IP address into its numeric equivalent static uint32 Inet_AtoN(const char * buf) { @@ -369,6 +370,7 @@ static uint32 Inet_AtoN(const char * buf) } return ret; } +#endif /* static void PrintNetworkInterfaceInfos() @@ -702,7 +704,7 @@ std::vector Socket::getLocalIPAddressList() { intfTypes.push_back("br-lan"); intfTypes.push_back("br-gest"); - for(int intfIdx = 0; intfIdx < intfTypes.size(); intfIdx++) { + for(int intfIdx = 0; intfIdx < (int)intfTypes.size(); intfIdx++) { string intfName = intfTypes[intfIdx]; for(int idx = 0; idx < 10; ++idx) { PLATFORM_SOCKET fd = socket(AF_INET, SOCK_DGRAM, 0); diff --git a/source/shared_lib/sources/platform/sdl/thread.cpp b/source/shared_lib/sources/platform/sdl/thread.cpp index d5e9347b..9cddeaf7 100644 --- a/source/shared_lib/sources/platform/sdl/thread.cpp +++ b/source/shared_lib/sources/platform/sdl/thread.cpp @@ -128,7 +128,7 @@ public: // ===================================== // Threads // ===================================== -Thread::Thread() : thread(NULL), deleteAfterExecute(false), mutexthreadAccessor(new Mutex()) { +Thread::Thread() : thread(NULL), mutexthreadAccessor(new Mutex()), deleteAfterExecute(false) { addThreadToList(); } @@ -249,7 +249,7 @@ int Thread::beginExecution(void* data) { } BaseThread *base_thread = dynamic_cast(thread); - ThreadGarbageCollector *garbage_collector = dynamic_cast(thread); + //ThreadGarbageCollector *garbage_collector = dynamic_cast(thread); if(Thread::getEnableVerboseMode()) printf("In Thread::execute Line: %d thread = %p base_thread = %p [%s]\n",__LINE__,thread,base_thread,(base_thread != NULL ? base_thread->getUniqueID().c_str() : "n/a")); if(thread->threadObjectValid() == true) { diff --git a/source/shared_lib/sources/platform/sdl/window.cpp b/source/shared_lib/sources/platform/sdl/window.cpp index 3269975b..686f3969 100644 --- a/source/shared_lib/sources/platform/sdl/window.cpp +++ b/source/shared_lib/sources/platform/sdl/window.cpp @@ -1034,7 +1034,7 @@ vector extractKeyPressedUnicodeLength(string text) { wchar_t keyW = c; wchar_t textAppend[] = { keyW, 0 }; - if(textAppend) { + if(*textAppend) { wchar_t newKey = textAppend[0]; if (newKey < 0x80) { result.push_back(1); diff --git a/source/shared_lib/sources/platform/unix/gl_wrap.cpp b/source/shared_lib/sources/platform/unix/gl_wrap.cpp index 20858b0a..8d3e8e59 100644 --- a/source/shared_lib/sources/platform/unix/gl_wrap.cpp +++ b/source/shared_lib/sources/platform/unix/gl_wrap.cpp @@ -28,6 +28,15 @@ using namespace Shared::Util; namespace Shared { namespace Platform { +// Example values: +// DEFAULT_CHARSET (English) = 1 +// GB2312_CHARSET (Chinese) = 134 +#ifdef WIN32 +DWORD PlatformContextGl::charSet = DEFAULT_CHARSET; +#else +int PlatformContextGl::charSet = 1; +#endif + // ====================================== // Global Fcs // ====================================== diff --git a/source/shared_lib/sources/platform/win32/gl_wrap_billy.cpp b/source/shared_lib/sources/platform/win32/gl_wrap_billy.cpp index 2c25c7fb..84884ca2 100644 --- a/source/shared_lib/sources/platform/win32/gl_wrap_billy.cpp +++ b/source/shared_lib/sources/platform/win32/gl_wrap_billy.cpp @@ -56,7 +56,7 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width, LOGFONT lf; //POSITION pos; //lf.lfCharSet = ANSI_CHARSET; - lf.lfCharSet = (BYTE)charSet; + lf.lfCharSet = (BYTE)PlatformContextGl::charSet; lf.lfFaceName[0]='\0'; //HGLRC hdRC =wglGetCurrentContext(); @@ -94,7 +94,7 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width, LPWSTR wstr = Ansi2WideString(useRealFontName.c_str()); HFONT font= CreateFont( - size, 0, 0, 0, width, FALSE, FALSE, FALSE, charSet, + size, 0, 0, 0, width, FALSE, FALSE, FALSE, PlatformContextGl::charSet, OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH| (useRealFontName.c_str() ? FF_DONTCARE:FF_SWISS), wstr); if(wstr) delete [] wstr; diff --git a/source/shared_lib/sources/util/checksum.cpp b/source/shared_lib/sources/util/checksum.cpp index fdf62342..788c47c1 100644 --- a/source/shared_lib/sources/util/checksum.cpp +++ b/source/shared_lib/sources/util/checksum.cpp @@ -40,7 +40,7 @@ namespace Shared{ namespace Util{ Mutex Checksum::fileListCacheSynchAccessor; std::map Checksum::fileListCache; -int crc_table[256] = +unsigned int crc_table[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, diff --git a/source/shared_lib/sources/xml/xml_parser.cpp b/source/shared_lib/sources/xml/xml_parser.cpp index 3e4c3c9b..9718cf2d 100644 --- a/source/shared_lib/sources/xml/xml_parser.cpp +++ b/source/shared_lib/sources/xml/xml_parser.cpp @@ -759,7 +759,7 @@ XmlNode *XmlNode::getChild(const string &childName, unsigned int i) const { throw megaglest_runtime_error("\"" + name + "\" node doesn't have " + uIntToStr(i+1) +" children named \"" + childName + "\"\n\nTree: "+getTreeString()); } - int count= 0; + unsigned int count= 0; for(unsigned int j = 0; j < children.size(); ++j) { if(children[j]->getName() == childName) { if(count == i) { @@ -791,7 +791,7 @@ XmlNode * XmlNode::getChildWithAliases(vector childNameList, unsigned in throw megaglest_runtime_error("\"" + name + "\" node doesn't have "+intToStr(childIndex+1)+" children named \"" + childName + "\"\n\nTree: "+getTreeString()); } - int count= 0; + unsigned int count= 0; for(unsigned int j = 0; j < children.size(); ++j) { if(children[j]->getName() == childName) { if(count == childIndex) {