[gnome-nibbles/arnaudb/modernize-code: 17/58] Remove a warning.



commit a53c35064c2118f702e21ab524bc4a0101c8069f
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed May 27 01:14:15 2020 +0200

    Remove a warning.

 src/worm.vala | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/worm.vala b/src/worm.vala
index 5fe6cd1..f96e6d8 100644
--- a/src/worm.vala
+++ b/src/worm.vala
@@ -21,7 +21,7 @@
 
 private enum WormDirection
 {
-    NONE,
+    NONE,   // unused, but allows to cast an integer from 1 to 4 into the four directions
     RIGHT,
     DOWN,
     LEFT,
@@ -153,7 +153,7 @@ private class Worm : Object
                     position.x = 0;
                 break;
             default:
-                break;
+                assert_not_reached ();
         }
 
         /* Add a new body piece */
@@ -354,7 +354,7 @@ private class Worm : Object
                     position.x = 0;
                 break;
             default:
-                break;
+                assert_not_reached ();
         }
 
         return position;
@@ -507,6 +507,8 @@ private class Worm : Object
                 case WormDirection.RIGHT:
                     cx += 1;
                     break;
+                default:
+                    assert_not_reached ();
             }
 
             if (cx >= NibblesGame.WIDTH)
@@ -588,6 +590,8 @@ private class Worm : Object
             case WormDirection.RIGHT:
                 cx += 1;
                 break;
+            default:
+                assert_not_reached ();
         }
 
         if (cx >= NibblesGame.WIDTH)
@@ -639,6 +643,8 @@ private class Worm : Object
                     if (dx < 0 && dx >= -3 && dy >= -1 && dy <= 1)
                         return true;
                     break;
+                default:
+                    assert_not_reached ();
             }
         }
 
@@ -666,6 +672,8 @@ private class Worm : Object
             case WormDirection.RIGHT:
                 x += 1;
                 break;
+            default:
+                assert_not_reached ();
         }
 
         if (x >= NibblesGame.WIDTH)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]