diff --git a/examples/island/Island.cpp b/examples/island/Island.cpp index 3edc39ff7..8c35d631a 100644 --- a/examples/island/Island.cpp +++ b/examples/island/Island.cpp @@ -346,19 +346,23 @@ sf::Color colorFromFloats(float r, float g, float b) sf::Color getLowlandsTerrainColor(float moisture) { - sf::Color color = moisture < 0.27f ? colorFromFloats(240, 240, 180) - : moisture < 0.3f ? colorFromFloats(240 - (240 * (moisture - 0.27f) / 0.03f), - 240 - (40 * (moisture - 0.27f) / 0.03f), - 180 - (180 * (moisture - 0.27f) / 0.03f)) - : moisture < 0.4f ? colorFromFloats(0, 200, 0) - : moisture < 0.48f ? colorFromFloats(0, 200 - (40 * (moisture - 0.4f) / 0.08f), 0) - : moisture < 0.6f ? colorFromFloats(0, 160, 0) - : moisture < 0.7f ? colorFromFloats((34 * (moisture - 0.6f) / 0.1f), - 160 - (60 * (moisture - 0.6f) / 0.1f), - (34 * (moisture - 0.6f) / 0.1f)) - : colorFromFloats(34, 100, 34); - - return color; + if (moisture < 0.27f) + return colorFromFloats(240, 240, 180); + if (moisture < 0.3f) + return colorFromFloats(240 - (240 * (moisture - 0.27f) / 0.03f), + 240 - (40 * (moisture - 0.27f) / 0.03f), + 180 - (180 * (moisture - 0.27f) / 0.03f)); + if (moisture < 0.4f) + return colorFromFloats(0, 200, 0); + if (moisture < 0.48f) + return colorFromFloats(0, 200 - (40 * (moisture - 0.4f) / 0.08f), 0); + if (moisture < 0.6f) + return colorFromFloats(0, 160, 0); + if (moisture < 0.7f) + return colorFromFloats((34 * (moisture - 0.6f) / 0.1f), + 160 - (60 * (moisture - 0.6f) / 0.1f), + (34 * (moisture - 0.6f) / 0.1f)); + return colorFromFloats(34, 100, 34); }