From 75bd202ca94057a5073cacfb65a1ba54ec319e4d Mon Sep 17 00:00:00 2001 From: Lukas Werling Date: Tue, 26 Dec 2017 22:03:44 +0100 Subject: [PATCH] Fix warnings in C4Landscape --- src/landscape/C4Landscape.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/landscape/C4Landscape.cpp b/src/landscape/C4Landscape.cpp index 306ef446a..02683ba60 100644 --- a/src/landscape/C4Landscape.cpp +++ b/src/landscape/C4Landscape.cpp @@ -3448,6 +3448,7 @@ bool C4Landscape::DrawBrush(int32_t iX, int32_t iY, int32_t iGrade, const char * break; // Exact: draw directly to landscape by color & pattern case LandscapeMode::Exact: + { C4Rect BoundingBox(iX - iGrade - 1, iY - iGrade - 1, iGrade * 2 + 2, iGrade * 2 + 2); // Draw to landscape p->PrepareChange(this, BoundingBox); @@ -3456,6 +3457,8 @@ bool C4Landscape::DrawBrush(int32_t iX, int32_t iY, int32_t iGrade, const char * p->FinishChange(this, BoundingBox); break; } + case LandscapeMode::Undefined: assert(false); break; + } return true; } @@ -3518,6 +3521,7 @@ bool C4Landscape::DrawLine(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2, i break; // Exact: draw directly to landscape by color & pattern case LandscapeMode::Exact: + { // Set texture pattern & get material color C4Rect BoundingBox(iX1 - iGrade, iY1 - iGrade, iGrade * 2 + 1, iGrade * 2 + 1); BoundingBox.Add(C4Rect(iX2 - iGrade, iY2 - iGrade, iGrade * 2 + 1, iGrade * 2 + 1)); @@ -3527,6 +3531,8 @@ bool C4Landscape::DrawLine(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2, i p->FinishChange(this, BoundingBox); break; } + case LandscapeMode::Undefined: assert(false); break; + } return true; } @@ -3565,6 +3571,7 @@ bool C4Landscape::DrawBox(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2, in break; // Exact: draw directly to landscape by color & pattern case LandscapeMode::Exact: + { C4Rect BoundingBox(iX1, iY1, iX2 - iX1 + 1, iY2 - iY1 + 1); // Draw to landscape p->PrepareChange(this, BoundingBox); @@ -3573,6 +3580,8 @@ bool C4Landscape::DrawBox(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2, in p->FinishChange(this, BoundingBox); break; } + case LandscapeMode::Undefined: assert(false); break; + } return true; } @@ -4186,13 +4195,13 @@ C4FoW * C4Landscape::GetFoW() int32_t C4Landscape::GetMatCount(int material) const { - assert(material >= 0 && material < p->MatCount.size()); + assert(material >= 0 && (unsigned) material < p->MatCount.size()); return p->MatCount[material]; } int32_t C4Landscape::GetEffectiveMatCount(int material) const { - assert(material >= 0 && material < p->EffectiveMatCount.size()); + assert(material >= 0 && (unsigned) material < p->EffectiveMatCount.size()); return p->EffectiveMatCount[material]; }