* Split systemRandom into graphicsRandom (particles, eye candy, etc.) and gameRandom...
[supertux.git] / src / video / color.hpp
index 05d176c..a3c360e 100644 (file)
@@ -38,9 +38,9 @@ public:
     blue(blue_), 
     alpha(alpha_)
   {
-#ifndef NDEBUG
-    check_color_ranges();
-#endif
+    assert(0 <= red   && red <= 1.0);
+    assert(0 <= green && green <= 1.0);
+    assert(0 <= blue  && blue <= 1.0);
   }
 
   Color(const std::vector<float>& vals) :
@@ -57,9 +57,9 @@ public:
       alpha = vals[3];
     else
       alpha = 1.0;
-#ifndef NDEBUG
-    check_color_ranges();
-#endif
+    assert(0 <= red   && red <= 1.0);
+    assert(0 <= green && green <= 1.0);
+    assert(0 <= blue  && blue <= 1.0);
   }
 
   bool operator==(const Color& other) const
@@ -68,14 +68,6 @@ public:
       && alpha == other.alpha;
   }
 
-  void check_color_ranges()
-  {
-    if(red < 0 || red > 1.0 || green < 0 || green > 1.0
-       || blue < 0 || blue > 1.0
-       || alpha < 0 || alpha > 1.0)
-      log_warning << "color value out of range: " << red << ", " << green << ", " << blue << ", " << alpha << std::endl;
-  }
-
   float greyscale() const
   {
     return red * 0.30 + green * 0.59 + blue * 0.11;