Merge pull request #105 from learn-more/master

fix msvc build & disable unwanted killsound
This commit is contained in:
yvt 2013-12-16 20:14:31 -08:00
commit 00ca0e67c1
5 changed files with 20 additions and 20 deletions

View File

@ -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<InitializeFunc>(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<SdlAudioDevice>(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();

View File

@ -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){

View File

@ -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();
}

View File

@ -23,6 +23,7 @@
#include <vector>
#include <math.h>
#include <string>
#include <stdint.h> //uint32_t --> msvc
#ifdef _MSC_VER
#define isnan _isnan

View File

@ -28,7 +28,7 @@
#include "MainScreen.h"
#include <Core/Settings.h>
#include <algorithm>
#include <cctype>
#include "MainWindow.h" // for credits
SPADES_SETTING(cl_serverListUrl, "http://services.buildandshoot.com/serverlist.json");