diff --git a/Sources/AngelScript/addons/scriptarray.cpp b/Sources/AngelScript/addons/scriptarray.cpp index 26f6255dd..18fa03059 100644 --- a/Sources/AngelScript/addons/scriptarray.cpp +++ b/Sources/AngelScript/addons/scriptarray.cpp @@ -170,7 +170,9 @@ void RegisterScriptArray(asIScriptEngine *engine, bool defaultArray) if( defaultArray ) { +#ifndef NDEBUG int r = engine->RegisterDefaultArrayType("array"); assert( r >= 0 ); +#endif } } @@ -863,8 +865,9 @@ bool CScriptArray::operator==(const CScriptArray &other) const if( state == asEXECUTION_ABORTED ) cmpContext->Abort(); } - else + else{ cmpContext->Release(); + } return isEqual; } @@ -1045,8 +1048,9 @@ int CScriptArray::Find(asUINT index, void *value) const if( state == asEXECUTION_ABORTED ) cmpContext->Abort(); } - else + else{ cmpContext->Release(); + } return ret; } @@ -1218,8 +1222,9 @@ void CScriptArray::Sort(asUINT index, asUINT count, bool asc) if( state == asEXECUTION_ABORTED ) cmpContext->Abort(); } - else + else{ cmpContext->Release(); + } } // internal @@ -1346,7 +1351,7 @@ void CScriptArray::Precache() if( (flags & asTM_INREF) ) { - if( (paramTypeId & asTYPEID_OBJHANDLE) || mustBeConst && !(flags & asTM_CONST) ) + if( (paramTypeId & asTYPEID_OBJHANDLE) || (mustBeConst && !(flags & asTM_CONST)) ) continue; } else if( paramTypeId & asTYPEID_OBJHANDLE ) diff --git a/Sources/AngelScript/addons/scripthelper.cpp b/Sources/AngelScript/addons/scripthelper.cpp index e084463cd..1b2677f28 100644 --- a/Sources/AngelScript/addons/scripthelper.cpp +++ b/Sources/AngelScript/addons/scripthelper.cpp @@ -477,7 +477,7 @@ void PrintException(asIScriptContext *ctx, bool printStack) { if( ctx->GetState() != asEXECUTION_EXCEPTION ) return; - asIScriptEngine *engine = ctx->GetEngine(); + //asIScriptEngine *engine = ctx->GetEngine(); const asIScriptFunction *function = ctx->GetExceptionFunction(); printf("func: %s\n", function->GetDeclaration()); printf("modl: %s\n", function->GetModuleName()); diff --git a/Sources/AngelScript/addons/scriptstdstring.cpp b/Sources/AngelScript/addons/scriptstdstring.cpp index 90708559e..b73f8610b 100644 --- a/Sources/AngelScript/addons/scriptstdstring.cpp +++ b/Sources/AngelScript/addons/scriptstdstring.cpp @@ -435,10 +435,10 @@ static asINT64 parseInt(const string &val, asUINT base, asUINT *byteCount) if( *end == '-' ) { sign = true; - *end++; + end++; } else if( *end == '+' ) - *end++; + end++; asINT64 res = 0; if( base == 10 ) diff --git a/Sources/AngelScript/addons/weakref.cpp b/Sources/AngelScript/addons/weakref.cpp index a6dd08e5b..c8a43c048 100644 --- a/Sources/AngelScript/addons/weakref.cpp +++ b/Sources/AngelScript/addons/weakref.cpp @@ -230,7 +230,7 @@ static void ScriptWeakRefRelease_Generic(asIScriptGeneric *gen) void CScriptWeakRef_Get_Generic(asIScriptGeneric *gen) { - int typeId = gen->GetArgTypeId(0); + //int typeId = gen->GetArgTypeId(0); CScriptWeakRef *self = reinterpret_cast(gen->GetObject()); gen->SetReturnAddress(self->Get()); } diff --git a/Sources/Client/ChatWindow.cpp b/Sources/Client/ChatWindow.cpp index 3c001e1ff..854e64397 100644 --- a/Sources/Client/ChatWindow.cpp +++ b/Sources/Client/ChatWindow.cpp @@ -108,7 +108,7 @@ namespace spades { float x = 0.f, maxW = GetWidth(); float lh = GetLineHeight(), h = lh; size_t wordStart = std::string::npos; - size_t wordStartOutPos; + size_t wordStartOutPos = 0; for(size_t i = 0; i < msg.size(); i++){ if(msg[i] > MsgColorMax && diff --git a/Sources/Client/Client.cpp b/Sources/Client/Client.cpp index 33339191f..22f69c192 100644 --- a/Sources/Client/Client.cpp +++ b/Sources/Client/Client.cpp @@ -55,11 +55,6 @@ #include "NetClient.h" -static float nextRandom() { - return (float)rand() / (float)RAND_MAX; -} - - SPADES_SETTING(cg_chatBeep, "1"); diff --git a/Sources/Client/Client_Draw.cpp b/Sources/Client/Client_Draw.cpp index c1d861449..c9548eab5 100644 --- a/Sources/Client/Client_Draw.cpp +++ b/Sources/Client/Client_Draw.cpp @@ -300,11 +300,11 @@ namespace spades { void Client::DrawDebugAim() { SPADES_MARK_FUNCTION(); - float scrWidth = renderer->ScreenWidth(); - float scrHeight = renderer->ScreenHeight(); - float wTime = world->GetTime(); + //float scrWidth = renderer->ScreenWidth(); + //float scrHeight = renderer->ScreenHeight(); + //float wTime = world->GetTime(); Player *p = GetWorld()->GetLocalPlayer(); - IFont *font; + //IFont *font; Weapon *w = p->GetWeapon(); float spread = w->GetSpread(); @@ -378,7 +378,7 @@ namespace spades { float scrWidth = renderer->ScreenWidth(); float scrHeight = renderer->ScreenHeight(); - float wTime = world->GetTime(); + //float wTime = world->GetTime(); Player *p = GetWorld()->GetLocalPlayer(); IFont *font; @@ -705,7 +705,7 @@ namespace spades { Player *p = GetWorld()->GetLocalPlayer(); IFont *font; - float scrWidth = renderer->ScreenWidth(); + //float scrWidth = renderer->ScreenWidth(); float scrHeight = renderer->ScreenHeight(); std::string str = std::to_string(p->GetHealth()); @@ -730,9 +730,9 @@ namespace spades { SPADES_MARK_FUNCTION(); float scrWidth = renderer->ScreenWidth(); - float scrHeight = renderer->ScreenHeight(); + //float scrHeight = renderer->ScreenHeight(); IFont *font; - float wTime = world->GetTime(); + //float wTime = world->GetTime(); for(auto& ent: localEntities){ ent->Render2D(); diff --git a/Sources/Client/GameMap.cpp b/Sources/Client/GameMap.cpp index 5cad7b7a5..c1aceaa4d 100644 --- a/Sources/Client/GameMap.cpp +++ b/Sources/Client/GameMap.cpp @@ -30,12 +30,6 @@ #include #include -// silly VOXLAP function -static inline void ftol(float f, long *a) -{ - *a = (long)floor(f+0.5f); -} - namespace spades { namespace client { GameMap::GameMap(): @@ -413,7 +407,7 @@ namespace spades { for(int i = 0; i < maxSteps; i++){ IntVector3 nextBlock; int hasNextBlock = 0; - float nextBlockTime; + float nextBlockTime = 0.f; if(invX != 0.f){ nextBlock = iv; diff --git a/Sources/Client/NetClient.cpp b/Sources/Client/NetClient.cpp index 534891df7..7352dfe0c 100644 --- a/Sources/Client/NetClient.cpp +++ b/Sources/Client/NetClient.cpp @@ -858,7 +858,7 @@ namespace spades { break; { //reader.ReadByte(); // skip player Id - Player *p = GetPlayerOrNull(reader.ReadByte()); + //Player *p = GetPlayerOrNull(reader.ReadByte()); float fuseLen = reader.ReadFloat(); Vector3 pos, vel; pos.x = reader.ReadFloat(); @@ -1495,7 +1495,7 @@ namespace spades { } case PacketTypeChangeWeapon: { - Player * p = GetPlayerOrNull(reader.ReadByte()); + //Player * p = GetPlayerOrNull(reader.ReadByte()); WeaponType wType; int weapon = reader.ReadByte(); switch(weapon){ diff --git a/Sources/Client/PhysicsConstants.h b/Sources/Client/PhysicsConstants.h index 2adb67510..b98193470 100644 --- a/Sources/Client/PhysicsConstants.h +++ b/Sources/Client/PhysicsConstants.h @@ -86,7 +86,7 @@ enum hitTag_t { hit_Arms = 8 }; -static hitTag_t& operator |= ( hitTag_t& left, const hitTag_t& right ) +static inline hitTag_t& operator |= ( hitTag_t& left, const hitTag_t& right ) { left = static_cast( static_cast(left) | static_cast(right) ); return left; diff --git a/Sources/Client/Player.cpp b/Sources/Client/Player.cpp index 10a408569..840f468bb 100644 --- a/Sources/Client/Player.cpp +++ b/Sources/Client/Player.cpp @@ -565,8 +565,8 @@ namespace spades { std::map playerHits; std::vector bulletVectors; - Vector3 right = GetRight(); - Vector3 up = GetUp(); + //Vector3 right = GetRight(); + //Vector3 up = GetUp(); int pellets = weapon->GetPelletSize(); float spread = weapon->GetSpread(); @@ -850,10 +850,7 @@ namespace spades { outBlockCoord.x < map->Width() && outBlockCoord.y < map->Height() && outBlockCoord.z < map->Depth()){ if(outBlockCoord.z < 62){ - int x = outBlockCoord.x; - int y = outBlockCoord.y; - int z = outBlockCoord.z; - SPAssert(map->IsSolid(x, y, z)); + SPAssert(map->IsSolid(outBlockCoord.x, outBlockCoord.y, outBlockCoord.z)); // send destroy command only for local cmd if(this == world->GetLocalPlayer()) { @@ -894,7 +891,6 @@ namespace spades { 256); Player *hitPlayer = NULL; - float hitPlayerDistance = 3.f; int hitFlag = 0; for(int i = 0; i < world->GetNumPlayerSlots(); i++){ diff --git a/Sources/Client/ScoreboardView.cpp b/Sources/Client/ScoreboardView.cpp index 176189968..4def1bf59 100644 --- a/Sources/Client/ScoreboardView.cpp +++ b/Sources/Client/ScoreboardView.cpp @@ -98,10 +98,9 @@ namespace spades { Handleimage; IFont *font; Vector2 pos, size; - char buf[256]; std::string str; float scrWidth = renderer->ScreenWidth(); - float scrHeight = renderer->ScreenHeight(); + //float scrHeight = renderer->ScreenHeight(); const Vector4 whiteColor = {1,1,1,1}; Handle whiteImage = renderer->RegisterImage("Gfx/White.tga"); diff --git a/Sources/Client/TCProgressView.cpp b/Sources/Client/TCProgressView.cpp index b6971f3d4..ec6e1f237 100644 --- a/Sources/Client/TCProgressView.cpp +++ b/Sources/Client/TCProgressView.cpp @@ -85,7 +85,7 @@ namespace spades { if(p && p->GetTeamId() < 2 && p->IsAlive()){ // show approaching territory TCGameMode::Territory *nearTerritory = NULL; - int nearTerId; + int nearTerId = 0; float distance = 0.f; int myTeam = p->GetTeamId(); diff --git a/Sources/Core/DeflateStream.cpp b/Sources/Core/DeflateStream.cpp index 143039f1b..f96ea8f8d 100644 --- a/Sources/Core/DeflateStream.cpp +++ b/Sources/Core/DeflateStream.cpp @@ -184,7 +184,9 @@ namespace spades { SPAssert(mode == CompressModeDecompress); char inputBuffer[chunkSize]; char outputBuffer[chunkSize]; +#ifndef NDEBUG uLong oval = zstream.total_out; +#endif if(reachedEOF) return; diff --git a/Sources/Core/FltkPreferenceImporter.cpp b/Sources/Core/FltkPreferenceImporter.cpp index fca4cc677..2ddeec5dd 100644 --- a/Sources/Core/FltkPreferenceImporter.cpp +++ b/Sources/Core/FltkPreferenceImporter.cpp @@ -34,6 +34,8 @@ namespace spades { + +#ifdef WIN32 static std::string SdlReceiveString(char *ptr) { if(!ptr) { return ""; @@ -42,8 +44,6 @@ namespace spades { SDL_free(ptr); return s; } - -#ifdef WIN32 static std::wstring Utf8ToWString(const char *s) { auto *ws = (WCHAR*)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", (char *)(s), SDL_strlen(s)+1); if(!ws) return L""; diff --git a/Sources/Core/Math.h b/Sources/Core/Math.h index f9cadb497..882a2c878 100644 --- a/Sources/Core/Math.h +++ b/Sources/Core/Math.h @@ -836,7 +836,7 @@ namespace spades { AABB3 GetBoundingAABB() const; }; - static OBB3 operator *(const Matrix4&m, const OBB3& b) { + static inline OBB3 operator *(const Matrix4&m, const OBB3& b) { return OBB3(m * b.m); } diff --git a/Sources/Core/Settings.h b/Sources/Core/Settings.h index bdc4365b4..e770995ac 100644 --- a/Sources/Core/Settings.h +++ b/Sources/Core/Settings.h @@ -86,7 +86,7 @@ namespace spades { } };*/ - static bool operator ==(const std::string& str, Settings::ItemHandle& handle) { + static inline bool operator ==(const std::string& str, Settings::ItemHandle& handle) { return str == (std::string)handle; } diff --git a/Sources/Core/Strings.cpp b/Sources/Core/Strings.cpp index e0c7f7a7a..962863ddf 100644 --- a/Sources/Core/Strings.cpp +++ b/Sources/Core/Strings.cpp @@ -808,7 +808,7 @@ namespace spades { SkipWhitespace(); std::string directive; - int directiveIdx; + int directiveIdx = 0; while(pos < po.size()) { auto tk = ReadToken(); if(tk.first == TokenType::Symbol) { diff --git a/Sources/Draw/GLBasicShadowMapRenderer.cpp b/Sources/Draw/GLBasicShadowMapRenderer.cpp index 6bf8217a6..756a6954a 100644 --- a/Sources/Draw/GLBasicShadowMapRenderer.cpp +++ b/Sources/Draw/GLBasicShadowMapRenderer.cpp @@ -266,7 +266,7 @@ namespace spades { GLProfiler profiler(device, "Slice %d / %d", i + 1, (int)NumSlices); - float farDist; + float farDist = 0.0; // TODO: variable far distance according to the scene definition // (note that this needs uniform shader variable) switch(i){ diff --git a/Sources/Draw/GLMapShadowRenderer.cpp b/Sources/Draw/GLMapShadowRenderer.cpp index 207de10e5..52a94ca81 100644 --- a/Sources/Draw/GLMapShadowRenderer.cpp +++ b/Sources/Draw/GLMapShadowRenderer.cpp @@ -163,7 +163,7 @@ namespace spades{ int bx = 0, by = 0; for(size_t i = 0; i < coarseUpdateBitmap.size(); i++) { if(coarseUpdateBitmap[i]){ - int minValue = -1, maxValue; + int minValue = -1, maxValue = 0; uint32_t *bmp = bitmap.data(); bmp += bx + by * w; diff --git a/Sources/Draw/SWModelRenderer.cpp b/Sources/Draw/SWModelRenderer.cpp index 48a56bef0..f4202f6a3 100644 --- a/Sources/Draw/SWModelRenderer.cpp +++ b/Sources/Draw/SWModelRenderer.cpp @@ -76,8 +76,8 @@ namespace spades { float dot2 = Vector3::Dot(axis2, lightVec) * fastRSqrt(axis2.GetPoweredLength()); float dot3 = Vector3::Dot(axis3, lightVec) * fastRSqrt(axis3.GetPoweredLength()); for(int x = 0; x < 3; x++){ - float d; - int cnt; + float d = 0.0; + int cnt = 0; switch(x){ case 0: d = -dot1; cnt = 1; break; case 1: d = 0.f; cnt = 0; break; diff --git a/Sources/ENet/peer.c b/Sources/ENet/peer.c index 566f79786..44b0bc5a9 100644 --- a/Sources/ENet/peer.c +++ b/Sources/ENet/peer.c @@ -715,7 +715,7 @@ enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command, static ENetIncomingCommand dummyCommand; ENetChannel * channel = & peer -> channels [command -> header.channelID]; - enet_uint32 unreliableSequenceNumber = 0, reliableSequenceNumber; + enet_uint32 unreliableSequenceNumber = 0, reliableSequenceNumber = 0; enet_uint16 reliableWindow, currentWindow; ENetIncomingCommand * incomingCommand; ENetListIterator currentCommand; diff --git a/Sources/ENet/protocol.c b/Sources/ENet/protocol.c index 737e0489d..31f008460 100644 --- a/Sources/ENet/protocol.c +++ b/Sources/ENet/protocol.c @@ -83,6 +83,7 @@ enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event) } return 1; + default: break; } } @@ -170,7 +171,7 @@ enet_protocol_remove_sent_unreliable_commands (ENetPeer * peer) static ENetProtocolCommand enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliableSequenceNumber, enet_uint8 channelID) { - ENetOutgoingCommand * outgoingCommand; + ENetOutgoingCommand * outgoingCommand = NULL; ENetListIterator currentCommand; ENetProtocolCommand commandNumber; int wasSent = 1; @@ -863,6 +864,7 @@ enet_protocol_handle_acknowledge (ENetHost * host, ENetEvent * event, ENetPeer * enet_list_empty (& peer -> sentReliableCommands)) enet_peer_disconnect (peer, peer -> eventData); break; + default: break; } return 0; diff --git a/Sources/Gui/MainScreenHelper.cpp b/Sources/Gui/MainScreenHelper.cpp index ab27262f6..3a9ef6cb6 100644 --- a/Sources/Gui/MainScreenHelper.cpp +++ b/Sources/Gui/MainScreenHelper.cpp @@ -224,57 +224,7 @@ namespace spades { query = new ServerListQuery(this); query->Start(); } - - static std::string TextifyHTML(const std::string& html) { - std::string out; - int blankLineLength = 0; - bool inTag = false; - bool inTagName = false; - bool hasLetter = false; - std::string tagName; - for(size_t i = 0; i < html.size(); i++){ - if(html[i] == '<') { - inTag = true; - inTagName = true; - tagName.clear(); - } - if(inTag) { - if(inTagName) { - if(html[i] == '/') - i++; - if(html[i] < 'a' || html[i] > 'z') { - inTagName = false; - if(html[i] == '>') { - inTag = false; - } - if(tagName == "br" || - tagName == "h3" || - tagName == "h2") { - if(blankLineLength < 1) { - out += "\n"; - hasLetter = false; - blankLineLength++; - } - } - }else{ - tagName += html[i]; - } - }else if(html[i] == '>') { - inTag = false; - } - continue; - } - bool isLetter = !isspace(html[i]); - if(hasLetter == false && isLetter == false) - continue; - hasLetter = true; - blankLineLength = 0; - out += html[i]; - } - return out; - } - #include "Credits.inc" // C++11 raw string literal makes some tools (ex. xgettext, Xcode) misbehave std::string MainScreenHelper::GetCredits() { diff --git a/Sources/Gui/SDLGLDevice.cpp b/Sources/Gui/SDLGLDevice.cpp index dad17d406..f9aabeed5 100644 --- a/Sources/Gui/SDLGLDevice.cpp +++ b/Sources/Gui/SDLGLDevice.cpp @@ -39,7 +39,7 @@ SPADES_SETTING(r_ignoreGLErrors, "1"); static uint32_t vertCount = 0; static uint32_t drawOps = 0; -static Uint32 lastFrame = 0; +// static Uint32 lastFrame = 0; namespace spades { namespace gui { @@ -118,10 +118,12 @@ ReportError(err, __LINE__, __PRETTY_FUNCTION__); \ func, __FILE__, line); } } +#ifdef GLEW static void ReportMissingFunc(const char *func){ SPRaise("GL function %s missing", func); } +#endif SDLGLDevice::SDLGLDevice(SDL_Window *s): window(s) { @@ -160,7 +162,7 @@ ReportError(err, __LINE__, __PRETTY_FUNCTION__); \ SPLog("Shading Language Version: %s", ret); } SPLog("--- Extensions ---"); - if(glGetStringi) { + if(&glGetStringi) { GLint cnt = 0; glGetIntegerv(GL_NUM_EXTENSIONS, &cnt); if(cnt <= 0) goto retrvFail; diff --git a/Sources/ScriptBindings/GameMap.cpp b/Sources/ScriptBindings/GameMap.cpp index 6b7c5615c..9f276dcf3 100644 --- a/Sources/ScriptBindings/GameMap.cpp +++ b/Sources/ScriptBindings/GameMap.cpp @@ -243,6 +243,7 @@ namespace spades { manager->CheckError(r); break; + default: break; } } }; diff --git a/Sources/ScriptBindings/MathScript.cpp b/Sources/ScriptBindings/MathScript.cpp index a53379403..857583e3b 100644 --- a/Sources/ScriptBindings/MathScript.cpp +++ b/Sources/ScriptBindings/MathScript.cpp @@ -1065,6 +1065,7 @@ namespace spades { break; + default: break; }