From 49392da794c6f6e799e07513ac170c8d2f314adb Mon Sep 17 00:00:00 2001 From: learn_more Date: Tue, 17 Dec 2013 01:28:22 +0100 Subject: [PATCH 1/2] disable kill sound on windows (side effect of the images) make the build work on msvc 2k10 --- Sources/Audio/YsrDevice.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Sources/Audio/YsrDevice.cpp b/Sources/Audio/YsrDevice.cpp index 9acd2c5a..04bd5b84 100644 --- a/Sources/Audio/YsrDevice.cpp +++ b/Sources/Audio/YsrDevice.cpp @@ -44,7 +44,7 @@ namespace spades { struct SpatializeResult; struct YVec3 { float x, y, z; - YVec3() = default; + YVec3() : x(0), y(0), z(0) {;} YVec3(const Vector3& v): x(v.x), y(v.y), z(v.z) {} operator Vector3() const { @@ -198,7 +198,7 @@ namespace spades { SPLog("'%s' loaded", s_ysrDriver.CString()); } - using InitializeFunc = const char *(*)(const char *magic, uint32_t version, YsrContext *); + typedef const char *(*InitializeFunc)(const char *magic, uint32_t version, YsrContext *); auto initFunc = reinterpret_cast(library->GetSymbol("YsrInitialize")); const char *a = (*initFunc)("OpenYsrSpades", 1, &ctx); if(a) { @@ -353,7 +353,7 @@ namespace spades { SDL_CloseAudioDevice(id); } - decltype(id) operator()() const { + SDL_AudioDeviceID operator()() const { return id; } }; @@ -377,8 +377,7 @@ namespace spades { spec.samples = (int)s_ysrBufferSize; spec.channels = 2; - sdlAudioDevice = decltype(sdlAudioDevice) - (new SdlAudioDevice(nullptr, SDL_FALSE, + sdlAudioDevice = std::unique_ptr(new SdlAudioDevice(nullptr, SDL_FALSE, spec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE)); YsrContext::InitParam param; @@ -405,8 +404,8 @@ namespace spades { } YsrDevice::~YsrDevice() { - for(auto& chunk: chunks){ - chunk.second->Release(); + for(auto chunk = chunks.begin(); chunk != chunks.end(); ++chunk){ + chunk->second->Release(); } if(this->gameMap) this->gameMap->Release(); From d9cd0dc402b82c2ea6723f2947906da700ac96b1 Mon Sep 17 00:00:00 2001 From: learn_more Date: Tue, 17 Dec 2013 01:28:56 +0100 Subject: [PATCH 2/2] rest of the files from prev commit. --- Sources/Client/Client.cpp | 6 +++--- Sources/Client/IFont.cpp | 18 +++++++++--------- Sources/Core/Math.h | 1 + Sources/Gui/MainScreenHelper.cpp | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Sources/Client/Client.cpp b/Sources/Client/Client.cpp index 0ee72100..4663e22b 100644 --- a/Sources/Client/Client.cpp +++ b/Sources/Client/Client.cpp @@ -2195,7 +2195,7 @@ namespace spades { renderer->SetColorAlphaPremultiplied(MakeVector4(0, 0, 0, 1)); img = renderer->RegisterImage("Gfx/White.tga"); - renderer->DrawImage(img, AABB2(0, 0, siz.x, siz.y)); + renderer->DrawImage(img, AABB2(0, 0, scrSize.x, scrSize.y)); renderer->SetColorAlphaPremultiplied(MakeVector4(1, 1, 1, 1.)); img = renderer->RegisterImage("Gfx/Title/Logo.png"); @@ -3763,7 +3763,7 @@ namespace spades { killfeedWindow->AddMessage(s); // log to netlog - if(killer != victim) { + /*if(killer != victim) { NetLog("%s (%s)%s%s (%s)", killer->GetName().c_str(), world->GetTeam(killer->GetTeamId()).name.c_str(), @@ -3775,7 +3775,7 @@ namespace spades { killer->GetName().c_str(), world->GetTeam(killer->GetTeamId()).name.c_str(), cause.c_str()); - } + }*/ // show big message if player is involved if(victim != killer){ diff --git a/Sources/Client/IFont.cpp b/Sources/Client/IFont.cpp index f41cbbfa..90984c7e 100644 --- a/Sources/Client/IFont.cpp +++ b/Sources/Client/IFont.cpp @@ -113,8 +113,8 @@ namespace spades { SPRaise("Reading %s: file truncated: trying to read %d byte(s)", path.c_str(), (int)siz); } - for(const auto& i: infos) { - glyphs[i.unicode] = i; + for(auto i = infos.begin(); i != infos.end(); ++i) { + glyphs[i->unicode] = *i; } // remove .ospfont and add .tga @@ -136,12 +136,12 @@ namespace spades { FallbackFontManager() { auto files = FileManager::EnumFiles("Gfx/Fonts"); - for(const auto& file: files) { - if(file.rfind(".ospfont") != file.size() - 8) { + for(auto file = files.begin(); file != files.end(); ++file) { + if(file->rfind(".ospfont") != file->size() - 8) { continue; } - std::string path = "Gfx/Fonts/" + file; + std::string path = "Gfx/Fonts/" + *file; auto fnt = new FallbackFont(path); fonts.push_back(fnt); } @@ -164,8 +164,8 @@ namespace spades { FallbackFontRenderer::FallbackFontRenderer(IRenderer *renderer, FallbackFontManager *manager): renderer(renderer), manager(manager){ - for(auto* font: manager->fonts) { - auto imgPath = font->imagePath; + for(auto font = manager->fonts.begin(); font != manager->fonts.end(); ++font) { + auto imgPath = (*font)->imagePath; auto *img = renderer->RegisterImage(imgPath.c_str()); // addref'd images.push_back(img); } @@ -173,8 +173,8 @@ namespace spades { } FallbackFontRenderer::~FallbackFontRenderer() { - for(auto* img: images) { - img->Release(); + for(auto img = images.begin(); img != images.end(); ++img) { + (*img)->Release(); } images.clear(); } diff --git a/Sources/Core/Math.h b/Sources/Core/Math.h index 9f23e7b5..84b1a842 100644 --- a/Sources/Core/Math.h +++ b/Sources/Core/Math.h @@ -23,6 +23,7 @@ #include #include #include +#include //uint32_t --> msvc #ifdef _MSC_VER #define isnan _isnan diff --git a/Sources/Gui/MainScreenHelper.cpp b/Sources/Gui/MainScreenHelper.cpp index 74caaab6..1ff2053a 100644 --- a/Sources/Gui/MainScreenHelper.cpp +++ b/Sources/Gui/MainScreenHelper.cpp @@ -28,7 +28,7 @@ #include "MainScreen.h" #include #include - +#include #include "MainWindow.h" // for credits SPADES_SETTING(cl_serverListUrl, "http://services.buildandshoot.com/serverlist.json");