From dfe7a3f2185cf3d21825fdd66c1996845ad69253 Mon Sep 17 00:00:00 2001 From: Sebastien Alaiwan Date: Wed, 20 Dec 2017 13:03:37 +0100 Subject: [PATCH 1/4] Fix compilation: invalid conversion from boolean to pointer --- sources/sound/SoundHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/sound/SoundHandler.cpp b/sources/sound/SoundHandler.cpp index b7a2ffbf..5f0273dd 100644 --- a/sources/sound/SoundHandler.cpp +++ b/sources/sound/SoundHandler.cpp @@ -286,7 +286,7 @@ namespace hpl { iSoundData* pData = mpResources->GetSoundManager()->CreateSoundData(asFileName,true,abLoop); if(pData==NULL){ Error("Couldn't load stream '%s'\n",asFileName.c_str()); - return false; + return NULL; } iSoundChannel *pSound = pData->CreateChannel(256); From dda5d799ffe93a91d2761cd35eef1eb6fb156c07 Mon Sep 17 00:00:00 2001 From: Sebastien Alaiwan Date: Wed, 20 Dec 2017 13:14:10 +0100 Subject: [PATCH 2/4] Fix compilation: overloaded function with no contextual type information --- sources/impl/scriptstring.cpp | 7 ++++++- sources/impl/stdstring.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/sources/impl/scriptstring.cpp b/sources/impl/scriptstring.cpp index 2a1b6fab..09e88c8f 100644 --- a/sources/impl/scriptstring.cpp +++ b/sources/impl/scriptstring.cpp @@ -605,10 +605,15 @@ void RegisterScriptString_Native(asIScriptEngine *engine) // otherwise the library will not allow the use of object handles for this type r = engine->RegisterStringFactory("string@", asFUNCTION(StringFactory), asCALL_CDECL); assert( r >= 0 ); + struct operators + { + static bool equals(const string& a, const string& b) { return a == b; }; + }; + // Register the global operator overloads // Note: We can use std::string's methods directly because the // internal std::string is placed at the beginning of the class - r = engine->RegisterGlobalBehaviour(asBEHAVE_EQUAL, "bool f(const string &in, const string &in)", asFUNCTIONPR(operator==, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 ); + r = engine->RegisterGlobalBehaviour(asBEHAVE_EQUAL, "bool f(const string &in, const string &in)", asFUNCTIONPR(operators::equals, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 ); r = engine->RegisterGlobalBehaviour(asBEHAVE_NOTEQUAL, "bool f(const string &in, const string &in)", asFUNCTIONPR(operator!=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 ); r = engine->RegisterGlobalBehaviour(asBEHAVE_LEQUAL, "bool f(const string &in, const string &in)", asFUNCTIONPR(operator<=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 ); r = engine->RegisterGlobalBehaviour(asBEHAVE_GEQUAL, "bool f(const string &in, const string &in)", asFUNCTIONPR(operator>=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 ); diff --git a/sources/impl/stdstring.cpp b/sources/impl/stdstring.cpp index efdac29a..5a0894ec 100644 --- a/sources/impl/stdstring.cpp +++ b/sources/impl/stdstring.cpp @@ -158,8 +158,13 @@ void RegisterStdString(asIScriptEngine *engine) r = engine->RegisterObjectBehaviour("string", asBEHAVE_ASSIGNMENT, "string &f(string &in)", asMETHODPR(string, operator =, (const string&), string&), asCALL_THISCALL); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("string", asBEHAVE_ADD_ASSIGN, "string &f(string &in)", asMETHODPR(string, operator+=, (const string&), string&), asCALL_THISCALL); assert( r >= 0 ); + struct operators + { + static bool equals(const string& a, const string& b) { return a == b; } + }; + // Register the global operator overloads - r = engine->RegisterGlobalBehaviour(asBEHAVE_EQUAL, "bool f(string &in, string &in)", asFUNCTIONPR(operator==, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 ); + r = engine->RegisterGlobalBehaviour(asBEHAVE_EQUAL, "bool f(string &in, string &in)", asFUNCTIONPR(operators::equals, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 ); r = engine->RegisterGlobalBehaviour(asBEHAVE_NOTEQUAL, "bool f(string &in, string &in)", asFUNCTIONPR(operator!=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 ); r = engine->RegisterGlobalBehaviour(asBEHAVE_LEQUAL, "bool f(string &in, string &in)", asFUNCTIONPR(operator<=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 ); r = engine->RegisterGlobalBehaviour(asBEHAVE_GEQUAL, "bool f(string &in, string &in)", asFUNCTIONPR(operator>=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 ); From 029f506c18d7af411bdbdf341e8ed5d2b8f4838d Mon Sep 17 00:00:00 2001 From: Sebastien Alaiwan Date: Wed, 20 Dec 2017 13:16:37 +0100 Subject: [PATCH 3/4] Fix compilation: add missing inclusion of unistd.h (required for 'symlink') --- sources/impl/LowLevelSystemSDL.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/impl/LowLevelSystemSDL.cpp b/sources/impl/LowLevelSystemSDL.cpp index 7c28d567..2cbdce8d 100644 --- a/sources/impl/LowLevelSystemSDL.cpp +++ b/sources/impl/LowLevelSystemSDL.cpp @@ -62,6 +62,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLin return hplMain(lpCmdLine); } #else +#include // symlink int main(int argc, char *argv[]) { if(!std::setlocale(LC_CTYPE, "")) { From 150954c2d79d89dd5a716d3467a376c87dfb8627 Mon Sep 17 00:00:00 2001 From: Sebastien Alaiwan Date: Wed, 20 Dec 2017 13:42:19 +0100 Subject: [PATCH 4/4] Fix compilation: taking address of temporary --- sources/graphics/Renderer2D.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/sources/graphics/Renderer2D.cpp b/sources/graphics/Renderer2D.cpp index 8cfeb355..7dc52aa0 100644 --- a/sources/graphics/Renderer2D.cpp +++ b/sources/graphics/Renderer2D.cpp @@ -895,13 +895,25 @@ namespace hpl { //MAYBE TODO: Fix so that the shadows from different edges share vertices // Add vertexes and indexes to the vertex batcher - mpLowLevelGraphics->AddVertexToBatch(&cVertex(vPointPos[0],ShadowColor)); - mpLowLevelGraphics->AddVertexToBatch(&cVertex(vPointPos[1],ShadowColor)); + { + cVertex v0(vPointPos[0],ShadowColor); + mpLowLevelGraphics->AddVertexToBatch(&v0); + + cVertex v1(vPointPos[1],ShadowColor); + mpLowLevelGraphics->AddVertexToBatch(&v1); + } + mpLowLevelGraphics->AddIndexToBatch(lFirstIndex); mpLowLevelGraphics->AddIndexToBatch(lFirstIndex+1); - mpLowLevelGraphics->AddVertexToBatch(&cVertex(vEndPos[0],ShadowColor)); - mpLowLevelGraphics->AddVertexToBatch(&cVertex(vEndPos[1],ShadowColor)); + { + cVertex v0(vEndPos[0],ShadowColor); + mpLowLevelGraphics->AddVertexToBatch(&v0); + + cVertex v1(vEndPos[1],ShadowColor); + mpLowLevelGraphics->AddVertexToBatch(&v1); + } + mpLowLevelGraphics->AddIndexToBatch(lFirstIndex+2); mpLowLevelGraphics->AddIndexToBatch(lFirstIndex+1); @@ -920,7 +932,8 @@ namespace hpl { //If we had an extra point one for triangle is needed. if(bExtraPos){ - mpLowLevelGraphics->AddVertexToBatch(&cVertex(vExtraPos,ShadowColor)); + cVertex v(vExtraPos,ShadowColor); + mpLowLevelGraphics->AddVertexToBatch(&v); mpLowLevelGraphics->AddIndexToBatch(lFirstIndex+3); mpLowLevelGraphics->AddIndexToBatch(lFirstIndex+2);