From ab64b9343f7445ec3cf729f073916d2aef8cbb1d Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 19 Nov 2013 21:57:28 +0000 Subject: [PATCH] - updated to support building with clang compiler (And cleaned up clang warnings from initial compile). Edit build-mg.sh and read the clang section as to how to build. --- CMakeLists.txt | 1 + build-mg.sh | 9 ++- source/glest_game/game/game.cpp | 34 +++++------ source/glest_game/game/game.h | 4 +- source/glest_game/game/game_camera.h | 8 +-- source/glest_game/global/core_data.h | 14 ++--- source/glest_game/graphics/renderer.cpp | 16 +++--- source/glest_game/graphics/renderer.h | 6 +- source/glest_game/main/battle_end.cpp | 2 +- source/glest_game/main/battle_end.h | 2 +- source/glest_game/main/intro.cpp | 6 +- source/glest_game/main/main.cpp | 56 +++++++++---------- source/glest_game/menu/main_menu.cpp | 2 +- source/glest_game/menu/main_menu.h | 2 +- .../menu/menu_state_connected_game.cpp | 10 ++-- .../menu/menu_state_connected_game.h | 2 +- .../menu/menu_state_custom_game.cpp | 14 ++--- .../glest_game/menu/menu_state_custom_game.h | 2 +- .../glest_game/menu/menu_state_join_game.cpp | 2 +- source/glest_game/menu/menu_state_mods.cpp | 2 +- .../menu/menu_state_options_graphics.cpp | 2 +- .../glest_game/menu/menu_state_scenario.cpp | 6 +- source/glest_game/network/network_types.cpp | 56 +++++++++---------- source/glest_game/network/server_interface.h | 2 +- source/glest_game/sound/sound_renderer.h | 10 ++-- source/glest_game/type_instances/unit.cpp | 2 +- source/glest_game/world/map.cpp | 10 ++-- source/glest_game/world/world.cpp | 4 +- source/glest_game/world/world.h | 7 ++- .../include/platform/common/byte_order.h | 2 +- source/shared_lib/include/xml/xml_parser.h | 3 +- source/shared_lib/sources/map/map_preview.cpp | 5 +- .../tests/shared_lib/xml/xml_parser_test.cpp | 4 +- 33 files changed, 157 insertions(+), 150 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c2d806bd..9d4dc0536 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ MESSAGE(STATUS "Build type for this compile will be: ${CMAKE_BUILD_TYPE}") IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") SET(CMAKE_COMPILER_IS_GNUCXX "YES") + ADD_DEFINITIONS("-Qunused-arguments -Wno-switch") ENDIF() FUNCTION(Subversion_IS_WC FOLDER RESULT_VAR) diff --git a/build-mg.sh b/build-mg.sh index d6b6b6cc2..f81479218 100755 --- a/build-mg.sh +++ b/build-mg.sh @@ -4,7 +4,12 @@ # Written by Mark Vejvoda # Copyright (c) 2011-2013 Mark Vejvoda under GNU GPL v3.0+ +# to enable clang compilation: +# 1. sudo apt-get install clang +# 2. Set the two vars below, WANT_CLANG=YES and CLANG_BIN_PATH= WANT_CLANG=NO +CLANG_BIN_PATH=/usr/bin/ + LANG=C NUMCORES=`lscpu -p | grep -cv '^#'` if [ "$NUMCORES" = '' ]; then NUMCORES=1; fi @@ -113,9 +118,7 @@ esac CURRENTDIR="$(dirname $(readlink -f $0))" if [ "$WANT_CLANG" = 'YES' ]; then - export CC=/usr/bin/clang - export CXX=/usr/bin/clang++ - EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -D_CMAKE_TOOLCHAIN_PREFIX=llvm-" + EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DCMAKE_C_COMPILER=${CLANG_BIN_PATH}clang -DCMAKE_CXX_COMPILER=${CLANG_BIN_PATH}clang++" echo "USER WANTS to use CLANG / LLVM compiler! EXTRA_CMAKE_OPTIONS = ${EXTRA_CMAKE_OPTIONS}" #exit 1; fi diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index e65970e34..e17f9bfc3 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -1039,7 +1039,7 @@ void Game::load(int loadTypes) { else { logger.loadGameHints(englishFile,languageFile,true); - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); SDL_PumpEvents(); } @@ -1047,7 +1047,7 @@ void Game::load(int loadTypes) { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); Game::findFactionLogoFile(&gameSettings, &logger); - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); SDL_PumpEvents(); } @@ -1097,7 +1097,7 @@ void Game::load(int loadTypes) { // give CPU time to update other things to avoid apperance of hanging sleep(0); - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); SDL_PumpEvents(); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); @@ -1145,7 +1145,7 @@ void Game::load(int loadTypes) { // give CPU time to update other things to avoid apperance of hanging sleep(0); - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); SDL_PumpEvents(); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); @@ -1163,7 +1163,7 @@ void Game::load(int loadTypes) { // give CPU time to update other things to avoid apperance of hanging sleep(0); - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); SDL_PumpEvents(); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); @@ -1252,7 +1252,7 @@ void Game::init(bool initForPreviewOnly) { // give CPU time to update other things to avoid apperance of hanging sleep(0); - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); SDL_PumpEvents(); } @@ -1302,7 +1302,7 @@ void Game::init(bool initForPreviewOnly) { if(initForPreviewOnly == false) { // give CPU time to update other things to avoid apperance of hanging sleep(0); - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); SDL_PumpEvents(); gui.init(this); @@ -1370,7 +1370,7 @@ void Game::init(bool initForPreviewOnly) { if(initForPreviewOnly == false) { // give CPU time to update other things to avoid apperance of hanging sleep(0); - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); SDL_PumpEvents(); scriptManager.init(&world, &gameCamera,loadGameNode); @@ -1425,7 +1425,7 @@ void Game::init(bool initForPreviewOnly) { // give CPU time to update other things to avoid apperance of hanging sleep(0); - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); SDL_PumpEvents(); if(world.getFactionCount() == 1 && world.getFaction(0)->getPersonalityType() == fpt_Observer) { @@ -1492,7 +1492,7 @@ void Game::init(bool initForPreviewOnly) { // give CPU time to update other things to avoid apperance of hanging sleep(0); - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); SDL_PumpEvents(); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Waiting for network\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__); @@ -4351,7 +4351,7 @@ void Game::mouseMove(int x, int y, const MouseState *ms) { float ymult = 0.2f; float xmult = 0.2f; - Vec2i oldPos=Shared::Platform::Window::getOldMousePos(); + Vec2i oldPos = ::Shared::Platform::Window::getOldMousePos(); int oldx= (oldPos.x * metrics.getVirtualW() / metrics.getScreenW()); int oldy= ((metrics.getScreenH()-oldPos.y) * metrics.getVirtualH() / metrics.getScreenH()); lastMousePos.x=oldx; @@ -4360,7 +4360,7 @@ void Game::mouseMove(int x, int y, const MouseState *ms) { } mouseX=lastMousePos.x; mouseY=lastMousePos.y; - Shared::Platform::Window::revertMousePos(); + ::Shared::Platform::Window::revertMousePos(); return; } @@ -6120,7 +6120,7 @@ void Game::renderVideoPlayer() { void Game::playStaticVideo(const string &playVideo) { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && - Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { + ::Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { //togglePauseGame(true,true); tryPauseToggle(true); @@ -6151,13 +6151,13 @@ void Game::playStaticVideo(const string &playVideo) { void Game::playStreamingVideo(const string &playVideo) { if(videoPlayer == NULL) { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && - Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { + ::Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { Context *c= GraphicsInterface::getInstance().getCurrentContext(); SDL_Surface *screen = static_cast(c)->getPlatformContextGlPtr()->getScreen(); string vlcPluginsPath = Config::getInstance().getString("VideoPlayerPluginsPath",""); - videoPlayer = new Shared::Graphics::VideoPlayer( + videoPlayer = new ::Shared::Graphics::VideoPlayer( &Renderer::getInstance(), playVideo, "", @@ -6177,13 +6177,13 @@ void Game::playStreamingVideo(const string &playVideo) { videoPlayer = NULL; if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && - Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { + ::Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { Context *c= GraphicsInterface::getInstance().getCurrentContext(); SDL_Surface *screen = static_cast(c)->getPlatformContextGlPtr()->getScreen(); string vlcPluginsPath = Config::getInstance().getString("VideoPlayerPluginsPath",""); - videoPlayer = new Shared::Graphics::VideoPlayer( + videoPlayer = new ::Shared::Graphics::VideoPlayer( &Renderer::getInstance(), playVideo, "", diff --git a/source/glest_game/game/game.h b/source/glest_game/game/game.h index d7a0e6278..dc6695963 100644 --- a/source/glest_game/game/game.h +++ b/source/glest_game/game/game.h @@ -37,7 +37,7 @@ using namespace Shared::PlatformCommon; namespace Shared { namespace Graphics { class VideoPlayer; -}} +}}; namespace Glest{ namespace Game{ @@ -197,7 +197,7 @@ private: std::vector > replayCommandList; std::vector streamingVideos; - Shared::Graphics::VideoPlayer *videoPlayer; + ::Shared::Graphics::VideoPlayer *videoPlayer; bool playingStaticVideo; Unit *currentCameraFollowUnit; diff --git a/source/glest_game/game/game_camera.h b/source/glest_game/game/game_camera.h index b881c78ea..70ae23c83 100644 --- a/source/glest_game/game/game_camera.h +++ b/source/glest_game/game/game_camera.h @@ -29,10 +29,10 @@ namespace Shared { namespace Xml { namespace Glest{ namespace Game{ -using Shared::Graphics::Quad2i; -using Shared::Graphics::Vec3f; -using Shared::Graphics::Vec2f; -using Shared::Xml::XmlNode; +using ::Shared::Graphics::Quad2i; +using ::Shared::Graphics::Vec3f; +using ::Shared::Graphics::Vec2f; +using ::Shared::Xml::XmlNode; class Config; diff --git a/source/glest_game/global/core_data.h b/source/glest_game/global/core_data.h index 270b2c392..50060b980 100644 --- a/source/glest_game/global/core_data.h +++ b/source/glest_game/global/core_data.h @@ -26,12 +26,12 @@ namespace Glest{ namespace Game{ -using Shared::Graphics::Texture2D; -using Shared::Graphics::Texture3D; -using Shared::Graphics::Font2D; -using Shared::Graphics::Font3D; -using Shared::Sound::StrSound; -using Shared::Sound::StaticSound; +using ::Shared::Graphics::Texture2D; +using ::Shared::Graphics::Texture3D; +using ::Shared::Graphics::Font2D; +using ::Shared::Graphics::Font3D; +using ::Shared::Sound::StrSound; +using ::Shared::Sound::StaticSound; // ===================================================== // class CoreData @@ -47,7 +47,7 @@ private: StrSound menuMusic; StaticSound clickSoundA; StaticSound clickSoundB; - StaticSound clickSoundC; + StaticSound clickSoundC; StaticSound attentionSound; StaticSound highlightSound; StaticSound markerSound; diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 861f3dcea..77ce9f6b8 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -941,7 +941,7 @@ Font3D *Renderer::newFont3D(ResourceScope rs){ return fontManager[rs]->newFont3D(); } -void Renderer::endFont(Shared::Graphics::Font *font, ResourceScope rs, bool mustExistInList) { +void Renderer::endFont(::Shared::Graphics::Font *font, ResourceScope rs, bool mustExistInList) { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { return; } @@ -2576,7 +2576,7 @@ void Renderer::renderTextBoundingBox3D(const string &text, Font3D *font, for(int i = 0; i < useWidth; ++i) { temp += DEFAULT_CHAR_FOR_WIDTH_CALC; } - float lineWidth = (font->getTextHandler()->Advance(temp.c_str()) * Shared::Graphics::Font::scaleFontValue); + float lineWidth = (font->getTextHandler()->Advance(temp.c_str()) * ::Shared::Graphics::Font::scaleFontValue); useWidth = (int)lineWidth; maxEditWidth = useWidth; @@ -2642,7 +2642,7 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i throw megaglest_runtime_error("font->getTextHandler() == NULL (5)"); } - float lineWidth = (font->getTextHandler()->Advance(text.c_str()) * Shared::Graphics::Font::scaleFontValue); + float lineWidth = (font->getTextHandler()->Advance(text.c_str()) * ::Shared::Graphics::Font::scaleFontValue); if(lineWidth < w) { pos.x += ((w / 2.f) - (lineWidth / 2.f)); } @@ -2658,7 +2658,7 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i //const Metrics &metrics= Metrics::getInstance(); //float lineHeight = (font->getTextHandler()->LineHeight(text.c_str()) * Font::scaleFontValue); - float lineHeight = (font->getTextHandler()->LineHeight(text.c_str()) * Shared::Graphics::Font::scaleFontValue); + float lineHeight = (font->getTextHandler()->LineHeight(text.c_str()) * ::Shared::Graphics::Font::scaleFontValue); //lineHeight=metrics.toVirtualY(lineHeight); //lineHeight= lineHeight / (2.f + 0.2f * FontMetrics::DEFAULT_Y_OFFSET_FACTOR); //pos.y += (h / 2.f) - (lineHeight / 2.f); @@ -2671,7 +2671,7 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i //if(Font::forceFTGLFonts == true) { // First go to top of bounding box pos.y += (h - lineHeight); - pos.y -= ((h - lineHeight) / Shared::Graphics::Font::scaleFontValueCenterHFactor); + pos.y -= ((h - lineHeight) / ::Shared::Graphics::Font::scaleFontValueCenterHFactor); // } // else { // pos.y += (float)(((float)h) / 2.0); @@ -2718,7 +2718,7 @@ void Renderer::renderTextBoundingBox3D(const string &text, Font3D *font, for(int i = 0; i < useWidth; ++i) { temp += DEFAULT_CHAR_FOR_WIDTH_CALC; } - float lineWidth = (font->getTextHandler()->Advance(temp.c_str()) * Shared::Graphics::Font::scaleFontValue); + float lineWidth = (font->getTextHandler()->Advance(temp.c_str()) * ::Shared::Graphics::Font::scaleFontValue); useWidth = (int)lineWidth; maxEditWidth = useWidth; @@ -2794,7 +2794,7 @@ void Renderer::renderTextBoundingBox3D(const string &text, Font3D *font, for(int i = 0; i < useWidth; ++i) { temp += DEFAULT_CHAR_FOR_WIDTH_CALC; } - float lineWidth = (font->getTextHandler()->Advance(temp.c_str()) * Shared::Graphics::Font::scaleFontValue); + float lineWidth = (font->getTextHandler()->Advance(temp.c_str()) * ::Shared::Graphics::Font::scaleFontValue); useWidth = (int)lineWidth; maxEditWidth = useWidth; @@ -9259,7 +9259,7 @@ uint64 Renderer::getCurrentPixelByteCount(ResourceScope rs) const { uint64 result = 0; for(int i = (rs == rsCount ? 0 : rs); i < rsCount; ++i) { if(textureManager[i] != NULL) { - const Shared::Graphics::TextureContainer &textures = textureManager[i]->getTextures(); + const ::Shared::Graphics::TextureContainer &textures = textureManager[i]->getTextures(); for(int j = 0; j < (int)textures.size(); ++j) { const Texture *texture = textures[j]; result += texture->getPixelByteCount(); diff --git a/source/glest_game/graphics/renderer.h b/source/glest_game/graphics/renderer.h index 510697b98..6f832fa6c 100644 --- a/source/glest_game/graphics/renderer.h +++ b/source/glest_game/graphics/renderer.h @@ -55,8 +55,8 @@ enum DebugUILevelType { namespace Glest{ namespace Game{ -using namespace Shared::Graphics; -using namespace Shared::PlatformCommon; +using namespace ::Shared::Graphics; +using namespace ::Shared::PlatformCommon; //non shared classes class Config; @@ -466,7 +466,7 @@ public: Texture3D *newTexture3D(ResourceScope rs); Font2D *newFont(ResourceScope rs); Font3D *newFont3D(ResourceScope rs); - void endFont(Shared::Graphics::Font *font, ResourceScope rs, bool mustExistInList=false); + void endFont(::Shared::Graphics::Font *font, ResourceScope rs, bool mustExistInList=false); void resetFontManager(ResourceScope rs); inline TextRenderer2D *getTextRenderer() const {return textRenderer;} diff --git a/source/glest_game/main/battle_end.cpp b/source/glest_game/main/battle_end.cpp index 4f3dfefd3..0e67b9831 100644 --- a/source/glest_game/main/battle_end.cpp +++ b/source/glest_game/main/battle_end.cpp @@ -288,7 +288,7 @@ void BattleEnd::initBackgroundMusic() { void BattleEnd::initBackgroundVideo() { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && - Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { + ::Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { if(menuBackgroundVideo != NULL) { menuBackgroundVideo->closePlayer(); diff --git a/source/glest_game/main/battle_end.h b/source/glest_game/main/battle_end.h index c1691d4dc..62991b6b1 100644 --- a/source/glest_game/main/battle_end.h +++ b/source/glest_game/main/battle_end.h @@ -46,7 +46,7 @@ private: ProgramState *originState; const char *containerName; - Shared::Graphics::VideoPlayer *menuBackgroundVideo; + ::Shared::Graphics::VideoPlayer *menuBackgroundVideo; GameSettings *gameSettings; StrSound battleEndMusic; diff --git a/source/glest_game/main/intro.cpp b/source/glest_game/main/intro.cpp index 5276bb7cb..8ef096ce3 100644 --- a/source/glest_game/main/intro.cpp +++ b/source/glest_game/main/intro.cpp @@ -96,7 +96,7 @@ Intro::Intro(Program *program): SoundRenderer &soundRenderer= SoundRenderer::getInstance(); if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && - (Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == false || + (::Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == false || CoreData::getInstance().hasIntroVideoFilename() == false)) { soundRenderer.playMusic(CoreData::getInstance().getIntroMusic()); } @@ -509,7 +509,7 @@ Intro::Intro(Program *program): SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && - Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true && + ::Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true && CoreData::getInstance().hasIntroVideoFilename() == true) { string introVideoFile = CoreData::getInstance().getIntroVideoFilename(); string introVideoFileFallback = CoreData::getInstance().getIntroVideoFilenameFallback(); @@ -521,7 +521,7 @@ Intro::Intro(Program *program): string vlcPluginsPath = Config::getInstance().getString("VideoPlayerPluginsPath",""); //printf("screen->w = %d screen->h = %d screen->format->BitsPerPixel = %d\n",screen->w,screen->h,screen->format->BitsPerPixel); - Shared::Graphics::VideoPlayer player( + ::Shared::Graphics::VideoPlayer player( &Renderer::getInstance(), introVideoFile, introVideoFileFallback, diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 9e32893db..61d82a9a6 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -662,7 +662,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) { if(glActiveTexture != NULL) { for(;GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && mainProgram->isMessageShowing();) { - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); try { mainProgram->loop(); } @@ -682,7 +682,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) { if(glActiveTexture != NULL) { for(;GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && mainProgram->isMessageShowing();) { - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); try { mainProgram->loop(); } @@ -4022,7 +4022,7 @@ int glestMain(int argc, char** argv) { if( haveSpecialOutputCommandLineOption == false || hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_VERSION]) == true) { printf("%s %s",extractFileFromDirectoryPath(argv[0]).c_str(),getNetworkPlatformFreeVersionString().c_str()); - printf("\nCompiled using: %s on: %s platform: %s endianness: %s",getCompilerNameString().c_str(),getCompileDateTime().c_str(),getPlatformNameString().c_str(),(Shared::PlatformByteOrder::isBigEndian() == true ? "big" : "little")); + printf("\nCompiled using: %s on: %s platform: %s endianness: %s",getCompilerNameString().c_str(),getCompileDateTime().c_str(),getPlatformNameString().c_str(),(::Shared::PlatformByteOrder::isBigEndian() == true ? "big" : "little")); // printf("\n\nData type sizes int8 = " MG_SIZE_T_SPECIFIER " int16 = " MG_SIZE_T_SPECIFIER " int32 = " MG_SIZE_T_SPECIFIER " int64 = " MG_SIZE_T_SPECIFIER "\n\n",sizeof(int8),sizeof(int16),sizeof(int32),sizeof(int64)); // @@ -4089,9 +4089,9 @@ int glestMain(int argc, char** argv) { if(SystemFlags::VERBOSE_MODE_ENABLED == true) { int8 testVar = 111; printf("\nEndian value = %d",testVar); - testVar = Shared::PlatformByteOrder::toCommonEndian(testVar); + testVar = ::Shared::PlatformByteOrder::toCommonEndian(testVar); printf("\nEndian to common value = %d",testVar); - testVar = Shared::PlatformByteOrder::fromCommonEndian(testVar); + testVar = ::Shared::PlatformByteOrder::fromCommonEndian(testVar); printf("\nEndian from common value = %d",testVar); printf("\nint8 sizeof = " MG_SIZE_T_SPECIFIER "",sizeof(int8)); @@ -4421,7 +4421,7 @@ int glestMain(int argc, char** argv) { } if(config.getBool("ForceFTGLFonts","false") == true || hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_FORCE_FTGLFONTS]) == true) { - Shared::Graphics::Font::forceFTGLFonts = true; + ::Shared::Graphics::Font::forceFTGLFonts = true; printf("**WARNING** Forcing use of FTGL Fonts\n"); } else { @@ -4429,7 +4429,7 @@ int glestMain(int argc, char** argv) { } if(config.getBool("EnableLegacyFonts","false") == true || hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_ENABLE_LEGACYFONTS]) == true) { - Shared::Graphics::Font::forceLegacyFonts = true; + ::Shared::Graphics::Font::forceLegacyFonts = true; Renderer::renderText3DEnabled = false; printf("**WARNING** Forcing Legacy Fonts Enabled\n"); } @@ -4574,20 +4574,20 @@ int glestMain(int argc, char** argv) { // 256 for English // 30000 for Chinese - Shared::Graphics::Font::charCount = config.getInt("FONT_CHARCOUNT",intToStr(Shared::Graphics::Font::charCount).c_str()); - Shared::Graphics::Font::fontTypeName = config.getString("FONT_TYPENAME",Shared::Graphics::Font::fontTypeName.c_str()); - Shared::Graphics::Font::fontIsMultibyte = config.getBool("FONT_MULTIBYTE",intToStr(Shared::Graphics::Font::fontIsMultibyte).c_str()); - Shared::Graphics::Font::fontIsRightToLeft = config.getBool("FONT_RIGHTTOLEFT",intToStr(Shared::Graphics::Font::fontIsRightToLeft).c_str()); - Shared::Graphics::Font::baseSize = config.getInt("FONT_BASE_SIZE",intToStr(Shared::Graphics::Font::baseSize).c_str()); - Shared::Graphics::Font::scaleFontValue = config.getFloat("FONT_SCALE_SIZE",floatToStr(Shared::Graphics::Font::scaleFontValue).c_str()); - Shared::Graphics::Font::scaleFontValueCenterHFactor = config.getFloat("FONT_SCALE_CENTERH_FACTOR",floatToStr(Shared::Graphics::Font::scaleFontValueCenterHFactor).c_str()); - Shared::Graphics::Font::langHeightText = config.getString("FONT_HEIGHT_TEXT",Shared::Graphics::Font::langHeightText.c_str()); - Shared::Graphics::Font::fontSupportMixedRightToLeft = config.getBool("FONT_RIGHTTOLEFT_MIXED_SUPPORT",intToStr(Shared::Graphics::Font::fontSupportMixedRightToLeft).c_str()); + ::Shared::Graphics::Font::charCount = config.getInt("FONT_CHARCOUNT",intToStr(::Shared::Graphics::Font::charCount).c_str()); + ::Shared::Graphics::Font::fontTypeName = config.getString("FONT_TYPENAME",::Shared::Graphics::Font::fontTypeName.c_str()); + ::Shared::Graphics::Font::fontIsMultibyte = config.getBool("FONT_MULTIBYTE",intToStr(::Shared::Graphics::Font::fontIsMultibyte).c_str()); + ::Shared::Graphics::Font::fontIsRightToLeft = config.getBool("FONT_RIGHTTOLEFT",intToStr(::Shared::Graphics::Font::fontIsRightToLeft).c_str()); + ::Shared::Graphics::Font::baseSize = config.getInt("FONT_BASE_SIZE",intToStr(::Shared::Graphics::Font::baseSize).c_str()); + ::Shared::Graphics::Font::scaleFontValue = config.getFloat("FONT_SCALE_SIZE",floatToStr(::Shared::Graphics::Font::scaleFontValue).c_str()); + ::Shared::Graphics::Font::scaleFontValueCenterHFactor = config.getFloat("FONT_SCALE_CENTERH_FACTOR",floatToStr(::Shared::Graphics::Font::scaleFontValueCenterHFactor).c_str()); + ::Shared::Graphics::Font::langHeightText = config.getString("FONT_HEIGHT_TEXT",::Shared::Graphics::Font::langHeightText.c_str()); + ::Shared::Graphics::Font::fontSupportMixedRightToLeft = config.getBool("FONT_RIGHTTOLEFT_MIXED_SUPPORT",intToStr(::Shared::Graphics::Font::fontSupportMixedRightToLeft).c_str()); // Example values: // DEFAULT_CHARSET (English) = 1 // GB2312_CHARSET (Chinese) = 134 - Shared::Platform::PlatformContextGl::charSet = config.getInt("FONT_CHARSET",intToStr(Shared::Platform::PlatformContextGl::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); } @@ -4595,8 +4595,8 @@ int glestMain(int argc, char** argv) { SystemFlags::DEFAULT_HTTP_TIMEOUT = config.getInt("DEFAULT_HTTP_TIMEOUT",intToStr(SystemFlags::DEFAULT_HTTP_TIMEOUT).c_str()); } - bool allowAltEnterFullscreenToggle = config.getBool("AllowAltEnterFullscreenToggle",boolToStr(Shared::Platform::Window::getAllowAltEnterFullscreenToggle()).c_str()); - Shared::Platform::Window::setAllowAltEnterFullscreenToggle(allowAltEnterFullscreenToggle); + bool allowAltEnterFullscreenToggle = config.getBool("AllowAltEnterFullscreenToggle",boolToStr(::Shared::Platform::Window::getAllowAltEnterFullscreenToggle()).c_str()); + ::Shared::Platform::Window::setAllowAltEnterFullscreenToggle(allowAltEnterFullscreenToggle); if(config.getBool("noTeamColors","false") == true) { MeshCallbackTeamColor::noTeamColors = true; @@ -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::PlatformContextGl::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); + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::PlatformContextGl::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); @@ -4640,7 +4640,7 @@ int glestMain(int argc, char** argv) { } if(config.getBool("EnableVSynch","false") == true) { - Shared::Platform::Window::setTryVSynch(true); + ::Shared::Platform::Window::setTryVSynch(true); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("**ENABLED OPENGL VSYNCH**\n"); } @@ -4749,7 +4749,7 @@ int glestMain(int argc, char** argv) { lang.loadGameStrings(language,false, true); if( lang.hasString("FONT_HEIGHT_TEXT")) { - Shared::Graphics::Font::langHeightText = config.getString("FONT_HEIGHT_TEXT",Shared::Graphics::Font::langHeightText.c_str()); + ::Shared::Graphics::Font::langHeightText = config.getString("FONT_HEIGHT_TEXT",::Shared::Graphics::Font::langHeightText.c_str()); } if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_FONT_BASESIZE]) == true) { @@ -4765,7 +4765,7 @@ int glestMain(int argc, char** argv) { string newfontBaseSize = paramPartTokens[1]; printf("Forcing font base size[%s]\n",newfontBaseSize.c_str()); - Shared::Graphics::Font::baseSize = strToInt(newfontBaseSize); + ::Shared::Graphics::Font::baseSize = strToInt(newfontBaseSize); } else { printf("\nInvalid missing font base size specified on commandline [%s] value [%s]\n\n",argv[foundParamIndIndex],(paramPartTokens.size() >= 2 ? paramPartTokens[1].c_str() : NULL)); @@ -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::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); + 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; @@ -5146,7 +5146,7 @@ int glestMain(int argc, char** argv) { } sleep(0); - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); SDL_PumpEvents(); int result = 0; @@ -5177,7 +5177,7 @@ int glestMain(int argc, char** argv) { renderer.swapBuffers(); sleep(0); - Shared::Platform::Window::handleEvent(); + ::Shared::Platform::Window::handleEvent(); SDL_PumpEvents(); Model *model = renderer.newModel(rsGlobal); @@ -5322,7 +5322,7 @@ int glestMain(int argc, char** argv) { //throw 123; //main loop - while(program->isShutdownApplicationEnabled() == false && Shared::Platform::Window::handleEvent()) { + while(program->isShutdownApplicationEnabled() == false && ::Shared::Platform::Window::handleEvent()) { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { if(disableheadless_console == false) { diff --git a/source/glest_game/menu/main_menu.cpp b/source/glest_game/menu/main_menu.cpp index 9b12a092d..73aafceae 100644 --- a/source/glest_game/menu/main_menu.cpp +++ b/source/glest_game/menu/main_menu.cpp @@ -113,7 +113,7 @@ void MainMenu::init() { void MainMenu::initBackgroundVideo() { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && - Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true && + ::Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true && CoreData::getInstance().hasMainMenuVideoFilename() == true) { string introVideoFile = CoreData::getInstance().getMainMenuVideoFilename(); string introVideoFileFallback = CoreData::getInstance().getMainMenuVideoFilenameFallback(); diff --git a/source/glest_game/menu/main_menu.h b/source/glest_game/menu/main_menu.h index 1a3e363d6..e1cbc775c 100644 --- a/source/glest_game/menu/main_menu.h +++ b/source/glest_game/menu/main_menu.h @@ -51,7 +51,7 @@ private: //shared GameSettings gameSettings; MenuBackground menuBackground; - Shared::Graphics::VideoPlayer *menuBackgroundVideo; + ::Shared::Graphics::VideoPlayer *menuBackgroundVideo; MenuState *state; diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index bb03f8274..817ea1ea3 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -1124,8 +1124,8 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){ string advanceToItemStartingWith = ""; if(mainMessageBox.getEnabled() == false) { - if(Shared::Platform::Window::isKeyStateModPressed(KMOD_SHIFT) == true) { - wchar_t lastKey = Shared::Platform::Window::extractLastKeyPressed(); + if(::Shared::Platform::Window::isKeyStateModPressed(KMOD_SHIFT) == true) { + wchar_t lastKey = ::Shared::Platform::Window::extractLastKeyPressed(); //printf("lastKey = %d [%c]\n",lastKey,lastKey); advanceToItemStartingWith = lastKey; } @@ -2367,7 +2367,7 @@ void MenuStateConnectedGame::render() { } else { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && - Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { + ::Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { if(factionVideo != NULL) { factionVideo->closePlayer(); delete factionVideo; @@ -3536,7 +3536,7 @@ void MenuStateConnectedGame::keyDown(SDL_KeyboardEvent key) { chatManager.keyDown(key); } if(chatManager.getEditEnabled() == false && - (Shared::Platform::Window::isKeyStateModPressed(KMOD_SHIFT) == false)) { + (::Shared::Platform::Window::isKeyStateModPressed(KMOD_SHIFT) == false)) { Config &configKeys = Config::getInstance(std::pair(cfgMainKeys,cfgUserKeys)); if(isKeyPressed(configKeys.getSDLKey("ShowFullConsole"),key) == true) { @@ -4693,7 +4693,7 @@ void MenuStateConnectedGame::initFactionPreview(const GameSettings *gameSettings if(currentFactionLogo != factionVideoUrl) { currentFactionLogo = factionVideoUrl; if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && - Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { + ::Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { if(factionVideo != NULL) { factionVideo->closePlayer(); diff --git a/source/glest_game/menu/menu_state_connected_game.h b/source/glest_game/menu/menu_state_connected_game.h index deda1be2a..298f14709 100644 --- a/source/glest_game/menu/menu_state_connected_game.h +++ b/source/glest_game/menu/menu_state_connected_game.h @@ -137,7 +137,7 @@ private: string currentFactionName_factionPreview; string currentFactionLogo; Texture2D *factionTexture; - Shared::Graphics::VideoPlayer *factionVideo; + ::Shared::Graphics::VideoPlayer *factionVideo; bool factionVideoSwitchedOffVolume; MapPreview mapPreview; diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index 8a836fe88..573989eee 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -37,7 +37,7 @@ namespace Glest{ namespace Game{ -using namespace Shared::Util; +using namespace ::Shared::Util; const int MASTERSERVER_BROADCAST_MAX_WAIT_RESPONSE_SECONDS = 15; const int MASTERSERVER_BROADCAST_PUBLISH_SECONDS = 6; @@ -1035,8 +1035,8 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) { } else { string advanceToItemStartingWith = ""; - if(Shared::Platform::Window::isKeyStateModPressed(KMOD_SHIFT) == true) { - const wchar_t lastKey = Shared::Platform::Window::extractLastKeyPressed(); + if(::Shared::Platform::Window::isKeyStateModPressed(KMOD_SHIFT) == true) { + const wchar_t lastKey = ::Shared::Platform::Window::extractLastKeyPressed(); // xxx: // string hehe=lastKey; // printf("lastKey = %d [%c] '%s'\n",lastKey,lastKey,hehe); @@ -1325,7 +1325,7 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) { int slotsToChangeStart = i; int slotsToChangeEnd = i; // If control is pressed while changing player types then change all other slots to same type - if(Shared::Platform::Window::isKeyStateModPressed(KMOD_CTRL) == true && + if(::Shared::Platform::Window::isKeyStateModPressed(KMOD_CTRL) == true && currentControlType != ctHuman) { slotsToChangeStart = 0; slotsToChangeEnd = mapInfo.players-1; @@ -1956,7 +1956,7 @@ void MenuStateCustomGame::render() { } else { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && - Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { + ::Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { if(factionVideo != NULL) { factionVideo->closePlayer(); delete factionVideo; @@ -2867,7 +2867,7 @@ void MenuStateCustomGame::initFactionPreview(const GameSettings *gameSettings) { if(currentFactionLogo != factionVideoUrl) { currentFactionLogo = factionVideoUrl; if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && - Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { + ::Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true) { if(factionVideo != NULL) { factionVideo->closePlayer(); @@ -4246,7 +4246,7 @@ void MenuStateCustomGame::keyDown(SDL_KeyboardEvent key) { chatManager.keyDown(key); } if(chatManager.getEditEnabled() == false && - (Shared::Platform::Window::isKeyStateModPressed(KMOD_SHIFT) == false) ) { + (::Shared::Platform::Window::isKeyStateModPressed(KMOD_SHIFT) == false) ) { Config &configKeys = Config::getInstance(std::pair(cfgMainKeys,cfgUserKeys)); //if(key == configKeys.getCharKey("ShowFullConsole")) { diff --git a/source/glest_game/menu/menu_state_custom_game.h b/source/glest_game/menu/menu_state_custom_game.h index 588adc2e1..f1d191e09 100644 --- a/source/glest_game/menu/menu_state_custom_game.h +++ b/source/glest_game/menu/menu_state_custom_game.h @@ -187,7 +187,7 @@ private: string currentFactionName_factionPreview; string currentFactionLogo; Texture2D *factionTexture; - Shared::Graphics::VideoPlayer *factionVideo; + ::Shared::Graphics::VideoPlayer *factionVideo; bool factionVideoSwitchedOffVolume; MapPreview mapPreview; diff --git a/source/glest_game/menu/menu_state_join_game.cpp b/source/glest_game/menu/menu_state_join_game.cpp index ec163d519..18faac120 100644 --- a/source/glest_game/menu/menu_state_join_game.cpp +++ b/source/glest_game/menu/menu_state_join_game.cpp @@ -31,7 +31,7 @@ namespace Glest{ namespace Game{ -using namespace Shared::Util; +using namespace ::Shared::Util; // =============================== // class MenuStateJoinGame diff --git a/source/glest_game/menu/menu_state_mods.cpp b/source/glest_game/menu/menu_state_mods.cpp index 6a6a0a520..3f74eb7ea 100644 --- a/source/glest_game/menu/menu_state_mods.cpp +++ b/source/glest_game/menu/menu_state_mods.cpp @@ -28,7 +28,7 @@ namespace Glest{ namespace Game{ -using namespace Shared::Util; +using namespace ::Shared::Util; struct FormatString { void operator()(string &s) { diff --git a/source/glest_game/menu/menu_state_options_graphics.cpp b/source/glest_game/menu/menu_state_options_graphics.cpp index e6b65520d..bd220305b 100644 --- a/source/glest_game/menu/menu_state_options_graphics.cpp +++ b/source/glest_game/menu/menu_state_options_graphics.cpp @@ -47,7 +47,7 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m this->console.setOnlyChatMessagesInStoredLines(false); screenModeChangedTimer= time(NULL); // just init //modeinfos=list (); - Shared::PlatformCommon::getFullscreenVideoModes(&modeInfos,!config.getBool("Windowed")); + ::Shared::PlatformCommon::getFullscreenVideoModes(&modeInfos,!config.getBool("Windowed")); int leftLabelStart=50; int leftColumnStart=leftLabelStart+280; diff --git a/source/glest_game/menu/menu_state_scenario.cpp b/source/glest_game/menu/menu_state_scenario.cpp index 9bf22a802..15e3e898a 100644 --- a/source/glest_game/menu/menu_state_scenario.cpp +++ b/source/glest_game/menu/menu_state_scenario.cpp @@ -25,7 +25,7 @@ namespace Glest{ namespace Game{ -using namespace Shared::Xml; +using namespace ::Shared::Xml; // ===================================================== // class MenuStateScenario @@ -221,8 +221,8 @@ void MenuStateScenario::mouseClick(int x, int y, MouseButton mouseButton) { return; } else { - if(Shared::Platform::Window::isKeyStateModPressed(KMOD_SHIFT) == true) { - const wchar_t lastKey = Shared::Platform::Window::extractLastKeyPressed(); + if(::Shared::Platform::Window::isKeyStateModPressed(KMOD_SHIFT) == true) { + const wchar_t lastKey = ::Shared::Platform::Window::extractLastKeyPressed(); // xxx: // string hehe=lastKey; // printf("lastKey = %d [%c] '%s'\n",lastKey,lastKey,hehe); diff --git a/source/glest_game/network/network_types.cpp b/source/glest_game/network/network_types.cpp index 45d44365d..11c077fd4 100644 --- a/source/glest_game/network/network_types.cpp +++ b/source/glest_game/network/network_types.cpp @@ -98,37 +98,37 @@ string NetworkCommand::toString() const { } void NetworkCommand::toEndian() { - networkCommandType = Shared::PlatformByteOrder::toCommonEndian(networkCommandType); - unitId = Shared::PlatformByteOrder::toCommonEndian(unitId); - unitTypeId = Shared::PlatformByteOrder::toCommonEndian(unitTypeId); - commandTypeId = Shared::PlatformByteOrder::toCommonEndian(commandTypeId); - positionX = Shared::PlatformByteOrder::toCommonEndian(positionX); - positionY = Shared::PlatformByteOrder::toCommonEndian(positionY); - targetId = Shared::PlatformByteOrder::toCommonEndian(targetId); - wantQueue = Shared::PlatformByteOrder::toCommonEndian(wantQueue); - fromFactionIndex = Shared::PlatformByteOrder::toCommonEndian(fromFactionIndex); - unitFactionUnitCount = Shared::PlatformByteOrder::toCommonEndian(unitFactionUnitCount); - unitFactionIndex = Shared::PlatformByteOrder::toCommonEndian(unitFactionIndex); - commandStateType = Shared::PlatformByteOrder::toCommonEndian(commandStateType); - commandStateValue = Shared::PlatformByteOrder::toCommonEndian(commandStateValue); - unitCommandGroupId = Shared::PlatformByteOrder::toCommonEndian(unitCommandGroupId); + networkCommandType = ::Shared::PlatformByteOrder::toCommonEndian(networkCommandType); + unitId = ::Shared::PlatformByteOrder::toCommonEndian(unitId); + unitTypeId = ::Shared::PlatformByteOrder::toCommonEndian(unitTypeId); + commandTypeId = ::Shared::PlatformByteOrder::toCommonEndian(commandTypeId); + positionX = ::Shared::PlatformByteOrder::toCommonEndian(positionX); + positionY = ::Shared::PlatformByteOrder::toCommonEndian(positionY); + targetId = ::Shared::PlatformByteOrder::toCommonEndian(targetId); + wantQueue = ::Shared::PlatformByteOrder::toCommonEndian(wantQueue); + fromFactionIndex = ::Shared::PlatformByteOrder::toCommonEndian(fromFactionIndex); + unitFactionUnitCount = ::Shared::PlatformByteOrder::toCommonEndian(unitFactionUnitCount); + unitFactionIndex = ::Shared::PlatformByteOrder::toCommonEndian(unitFactionIndex); + commandStateType = ::Shared::PlatformByteOrder::toCommonEndian(commandStateType); + commandStateValue = ::Shared::PlatformByteOrder::toCommonEndian(commandStateValue); + unitCommandGroupId = ::Shared::PlatformByteOrder::toCommonEndian(unitCommandGroupId); } void NetworkCommand::fromEndian() { - networkCommandType = Shared::PlatformByteOrder::fromCommonEndian(networkCommandType); - unitId = Shared::PlatformByteOrder::fromCommonEndian(unitId); - unitTypeId = Shared::PlatformByteOrder::fromCommonEndian(unitTypeId); - commandTypeId = Shared::PlatformByteOrder::fromCommonEndian(commandTypeId); - positionX = Shared::PlatformByteOrder::fromCommonEndian(positionX); - positionY = Shared::PlatformByteOrder::fromCommonEndian(positionY); - targetId = Shared::PlatformByteOrder::fromCommonEndian(targetId); - wantQueue = Shared::PlatformByteOrder::fromCommonEndian(wantQueue); - fromFactionIndex = Shared::PlatformByteOrder::fromCommonEndian(fromFactionIndex); - unitFactionUnitCount = Shared::PlatformByteOrder::fromCommonEndian(unitFactionUnitCount); - unitFactionIndex = Shared::PlatformByteOrder::fromCommonEndian(unitFactionIndex); - commandStateType = Shared::PlatformByteOrder::fromCommonEndian(commandStateType); - commandStateValue = Shared::PlatformByteOrder::fromCommonEndian(commandStateValue); - unitCommandGroupId = Shared::PlatformByteOrder::fromCommonEndian(unitCommandGroupId); + networkCommandType = ::Shared::PlatformByteOrder::fromCommonEndian(networkCommandType); + unitId = ::Shared::PlatformByteOrder::fromCommonEndian(unitId); + unitTypeId = ::Shared::PlatformByteOrder::fromCommonEndian(unitTypeId); + commandTypeId = ::Shared::PlatformByteOrder::fromCommonEndian(commandTypeId); + positionX = ::Shared::PlatformByteOrder::fromCommonEndian(positionX); + positionY = ::Shared::PlatformByteOrder::fromCommonEndian(positionY); + targetId = ::Shared::PlatformByteOrder::fromCommonEndian(targetId); + wantQueue = ::Shared::PlatformByteOrder::fromCommonEndian(wantQueue); + fromFactionIndex = ::Shared::PlatformByteOrder::fromCommonEndian(fromFactionIndex); + unitFactionUnitCount = ::Shared::PlatformByteOrder::fromCommonEndian(unitFactionUnitCount); + unitFactionIndex = ::Shared::PlatformByteOrder::fromCommonEndian(unitFactionIndex); + commandStateType = ::Shared::PlatformByteOrder::fromCommonEndian(commandStateType); + commandStateValue = ::Shared::PlatformByteOrder::fromCommonEndian(commandStateValue); + unitCommandGroupId = ::Shared::PlatformByteOrder::fromCommonEndian(unitCommandGroupId); } XmlNode * NetworkCommand::saveGame(XmlNode *rootNode) { diff --git a/source/glest_game/network/server_interface.h b/source/glest_game/network/server_interface.h index c9f77bc79..8e19cc25e 100644 --- a/source/glest_game/network/server_interface.h +++ b/source/glest_game/network/server_interface.h @@ -71,7 +71,7 @@ private: time_t lastMasterserverHeartbeatTime; bool needToRepublishToMasterserver; - Shared::PlatformCommon::FTPServerThread *ftpServer; + ::Shared::PlatformCommon::FTPServerThread *ftpServer; bool exitServer; int64 nextEventId; diff --git a/source/glest_game/sound/sound_renderer.h b/source/glest_game/sound/sound_renderer.h index 0964a5325..687086336 100644 --- a/source/glest_game/sound/sound_renderer.h +++ b/source/glest_game/sound/sound_renderer.h @@ -27,11 +27,11 @@ namespace Glest{ namespace Game{ -using Shared::Sound::StrSound; -using Shared::Sound::StaticSound; -using Shared::Sound::SoundPlayer; -using Shared::Graphics::Vec3f; -using namespace Shared::PlatformCommon; +using ::Shared::Sound::StrSound; +using ::Shared::Sound::StaticSound; +using ::Shared::Sound::SoundPlayer; +using ::Shared::Graphics::Vec3f; +using namespace ::Shared::PlatformCommon; // ===================================================== // class SoundRenderer diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 61b0ca8a1..72ed30d74 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -3878,7 +3878,7 @@ void Unit::startDamageParticles() { ups->setOffset(Vec3f(0,2,0)); ups->setDirection(Vec3f(0,1,-0.2f)); ups->setRadius(type->getSize()/3.f); - ups->setShape(Shared::Graphics::UnitParticleSystem::sLinear); + ups->setShape(::Shared::Graphics::UnitParticleSystem::sLinear); ups->setTexture(CoreData::getInstance().getFireTexture()); const Game *game = Renderer::getInstance().getGame(); ups->setSpeed(2.0f / game->getWorld()->getUpdateFps(this->getFactionIndex())); diff --git a/source/glest_game/world/map.cpp b/source/glest_game/world/map.cpp index 5c3ee2ff4..ff36aa502 100644 --- a/source/glest_game/world/map.cpp +++ b/source/glest_game/world/map.cpp @@ -413,7 +413,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) { snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } - x = Shared::PlatformByteOrder::fromCommonEndian(x); + x = ::Shared::PlatformByteOrder::fromCommonEndian(x); readBytes = fread(&y, sizeof(int32), 1, f); if(readBytes != 1) { @@ -421,7 +421,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) { snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } - y = Shared::PlatformByteOrder::fromCommonEndian(y); + y = ::Shared::PlatformByteOrder::fromCommonEndian(y); startLocations[i]= Vec2i(x, y)*cellScale; } @@ -440,7 +440,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) { snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } - alt = Shared::PlatformByteOrder::fromCommonEndian(alt); + alt = ::Shared::PlatformByteOrder::fromCommonEndian(alt); SurfaceCell *sc= getSurfaceCell(i, j); sc->setVertex(Vec3f(i*mapScale, alt / heightFactor, j*mapScale)); @@ -457,7 +457,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) { snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } - surf = Shared::PlatformByteOrder::fromCommonEndian(surf); + surf = ::Shared::PlatformByteOrder::fromCommonEndian(surf); getSurfaceCell(i, j)->setSurfaceType(surf-1); } @@ -474,7 +474,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) { snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } - objNumber = Shared::PlatformByteOrder::fromCommonEndian(objNumber); + objNumber = ::Shared::PlatformByteOrder::fromCommonEndian(objNumber); SurfaceCell *sc= getSurfaceCell(toSurfCoords(Vec2i(i, j))); if(objNumber == 0) { diff --git a/source/glest_game/world/world.cpp b/source/glest_game/world/world.cpp index 020f64764..c612e5302 100644 --- a/source/glest_game/world/world.cpp +++ b/source/glest_game/world/world.cpp @@ -119,13 +119,13 @@ void World::cleanup() { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - for(std::map::iterator iterMap = staticSoundList.begin(); + for(std::map::iterator iterMap = staticSoundList.begin(); iterMap != staticSoundList.end(); ++iterMap) { delete iterMap->second; } staticSoundList.clear(); - for(std::map::iterator iterMap = streamSoundList.begin(); + for(std::map::iterator iterMap = streamSoundList.begin(); iterMap != streamSoundList.end(); ++iterMap) { delete iterMap->second; } diff --git a/source/glest_game/world/world.h b/source/glest_game/world/world.h index 260a62c75..ceca8acb4 100644 --- a/source/glest_game/world/world.h +++ b/source/glest_game/world/world.h @@ -49,8 +49,11 @@ class Config; class Game; class GameSettings; class ScriptManager; + +namespace Shared{ namespace Sound{ class StaticSound; class StrSound; +}}; // ===================================================== // class World @@ -116,8 +119,8 @@ private: bool perfTimerEnabled; bool unitParticlesEnabled; - std::map staticSoundList; - std::map streamSoundList; + std::map staticSoundList; + std::map streamSoundList; uint32 nextCommandGroupId; diff --git a/source/shared_lib/include/platform/common/byte_order.h b/source/shared_lib/include/platform/common/byte_order.h index 1047c41c2..2451e5bf3 100644 --- a/source/shared_lib/include/platform/common/byte_order.h +++ b/source/shared_lib/include/platform/common/byte_order.h @@ -32,7 +32,7 @@ template T EndianReverse(T t) { return t; } -static bool isBigEndian() { +inline static bool isBigEndian() { short n = 0x1; return (*(char*)(&n) == 0x0); } diff --git a/source/shared_lib/include/xml/xml_parser.h b/source/shared_lib/include/xml/xml_parser.h index 04451aeca..7bba65c81 100644 --- a/source/shared_lib/include/xml/xml_parser.h +++ b/source/shared_lib/include/xml/xml_parser.h @@ -45,7 +45,6 @@ enum xml_engine_parser_type { XML_RAPIDXML_ENGINE = 1 } ; -static xml_engine_parser_type DEFAULT_XML_ENGINE = XML_RAPIDXML_ENGINE; const int strSize= 8094; class XmlIo; @@ -129,7 +128,7 @@ private: void clearRootNode(); public: - XmlTree(xml_engine_parser_type engine_type = DEFAULT_XML_ENGINE); + XmlTree(xml_engine_parser_type engine_type = XML_RAPIDXML_ENGINE); ~XmlTree(); void init(const string &name); diff --git a/source/shared_lib/sources/map/map_preview.cpp b/source/shared_lib/sources/map/map_preview.cpp index 69187e316..3f50c9832 100644 --- a/source/shared_lib/sources/map/map_preview.cpp +++ b/source/shared_lib/sources/map/map_preview.cpp @@ -52,6 +52,7 @@ MapPreview::MapPreview() { title = ""; desc = ""; author = ""; + maxFactions = 0; refAlt = DEFAULT_MAP_CELL_HEIGHT; hasChanged = false; } @@ -561,7 +562,7 @@ void MapPreview::reset(int w, int h, float alt, MapSurfaceType surf) { this->w = w; this->h = h; - this->maxFactions = maxFactions; + //this->maxFactions = maxFactions; //cells = new Cell*[w]; cells.resize(w); @@ -608,7 +609,7 @@ void MapPreview::resize(int w, int h, float alt, MapSurfaceType surf) { int oldH = this->h; this->w = w; this->h = h; - this->maxFactions = maxFactions; + //this->maxFactions = maxFactions; //create new cells //Cell **oldCells = cells; diff --git a/source/tests/shared_lib/xml/xml_parser_test.cpp b/source/tests/shared_lib/xml/xml_parser_test.cpp index 7ada263fa..3267dcf6e 100644 --- a/source/tests/shared_lib/xml/xml_parser_test.cpp +++ b/source/tests/shared_lib/xml/xml_parser_test.cpp @@ -232,13 +232,13 @@ public: void test_invalid_xml_engine_lowerbound() { xml_engine_parser_type testType = static_cast(XML_XERCES_ENGINE - 1); - if(testType == XML_XERCES_ENGINE - 1) { + if((int)testType == (int)(XML_XERCES_ENGINE - 1)) { XmlTree xml(testType); } } void test_invalid_xml_engine_upperbound() { xml_engine_parser_type testType = static_cast(XML_RAPIDXML_ENGINE + 1); - if(testType == XML_RAPIDXML_ENGINE + 1) { + if((int)testType == (int)(XML_RAPIDXML_ENGINE + 1)) { XmlTree xml(testType); } }