diff --git a/src/coders/xml.cpp b/src/coders/xml.cpp index b2cb8809..84cc9f37 100644 --- a/src/coders/xml.cpp +++ b/src/coders/xml.cpp @@ -92,11 +92,11 @@ glm::vec4 Attribute::asColor() const { throw std::runtime_error("#RRGGBB or #RRGGBBAA required"); } int a = 255; - int r = (hexchar2int(text[1]) << 4) | hexchar2int(text[2]); - int g = (hexchar2int(text[3]) << 4) | hexchar2int(text[4]); - int b = (hexchar2int(text[5]) << 4) | hexchar2int(text[6]); + int r = (std::max(0, hexchar2int(text[1])) << 4) | hexchar2int(text[2]); + int g = (std::max(0, hexchar2int(text[3])) << 4) | hexchar2int(text[4]); + int b = (std::max(0, hexchar2int(text[5])) << 4) | hexchar2int(text[6]); if (text.length() == 9) { - a = (hexchar2int(text[7]) << 4) | hexchar2int(text[8]); + a = (std::max(0, hexchar2int(text[7])) << 4) | hexchar2int(text[8]); } return glm::vec4(r / 255.f, g / 255.f, b / 255.f, a / 255.f); } else { diff --git a/src/data/StructLayout.cpp b/src/data/StructLayout.cpp index a3e0fd23..3716bc44 100644 --- a/src/data/StructLayout.cpp +++ b/src/data/StructLayout.cpp @@ -95,8 +95,8 @@ static inline FieldIncapatibilityType checkIncapatibility( static inline integer_t clamp_value(integer_t value, FieldType type) { auto typesize = sizeof_type(type) * CHAR_BIT; - integer_t minval = -(1 << (typesize-1)); - integer_t maxval = (1 << (typesize-1))-1; + integer_t minval = -(1LL << (typesize-1)); + integer_t maxval = (1LL << (typesize-1))-1; return std::min(maxval, std::max(minval, value)); } diff --git a/src/devtools/syntax_highlighting.cpp b/src/devtools/syntax_highlighting.cpp index f68780df..2963daf2 100644 --- a/src/devtools/syntax_highlighting.cpp +++ b/src/devtools/syntax_highlighting.cpp @@ -32,7 +32,6 @@ static std::unique_ptr build_styles( continue; } if (token.start.pos > offset) { - int n = token.start.pos - offset; styles.map.insert(styles.map.end(), token.start.pos - offset, 0); } offset = token.end.pos; diff --git a/src/frontend/hud.cpp b/src/frontend/hud.cpp index 36dbceb9..139e94ae 100644 --- a/src/frontend/hud.cpp +++ b/src/frontend/hud.cpp @@ -289,8 +289,6 @@ void Hud::updateWorldGenDebugVisualization() { for (int z = 0; z < height; z++) { for (int x = 0; x < width; x++) { - int cx = x + ox; - int cz = z + oz; int flippedZ = height - z - 1; int ax = x - (width - areaWidth) / 2; diff --git a/src/frontend/screens/LevelScreen.cpp b/src/frontend/screens/LevelScreen.cpp index 32c098c5..0c7c8397 100644 --- a/src/frontend/screens/LevelScreen.cpp +++ b/src/frontend/screens/LevelScreen.cpp @@ -148,7 +148,6 @@ void LevelScreen::saveWorldPreview() { } void LevelScreen::updateHotkeys() { - auto player = playerController->getPlayer(); auto& settings = engine.getSettings(); if (Events::jpressed(keycode::O)) { settings.graphics.frustumCulling.toggle(); diff --git a/src/graphics/core/Mesh.cpp b/src/graphics/core/Mesh.cpp index e8cffe6f..808b88c4 100644 --- a/src/graphics/core/Mesh.cpp +++ b/src/graphics/core/Mesh.cpp @@ -1,4 +1,5 @@ #include "Mesh.hpp" +#include #include int Mesh::meshesCount = 0; @@ -9,6 +10,7 @@ inline size_t calc_vertex_size(const VertexAttribute* attrs) { for (int i = 0; attrs[i].size; i++) { vertexSize += attrs[i].size; } + assert(vertexSize != 0); return vertexSize; } diff --git a/src/logic/PlayerController.cpp b/src/logic/PlayerController.cpp index 8e787a8e..d81e2c5b 100644 --- a/src/logic/PlayerController.cpp +++ b/src/logic/PlayerController.cpp @@ -479,7 +479,6 @@ void PlayerController::updateEntityInteraction( void PlayerController::updateInteraction(float delta) { auto indices = level.content.getIndices(); - auto chunks = player.chunks.get(); const auto& selection = player.selection; if (interactionTimer > 0.0f) { diff --git a/src/util/stringutil.cpp b/src/util/stringutil.cpp index ac80d134..5242e01a 100644 --- a/src/util/stringutil.cpp +++ b/src/util/stringutil.cpp @@ -382,7 +382,6 @@ int util::replaceAll( str.replace(start_pos, from.length(), to); offset = start_pos + to.length(); count++; - break; } return count; }