[iagno] Small optimisation.



commit faa67b8f2f85eee360a06c6320c8734ae09fb884
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri May 24 14:16:23 2019 +0200

    Small optimisation.

 src/game.vala | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/game.vala b/src/game.vala
index a359fa7..7a2e40e 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -114,10 +114,10 @@ private struct GameStateStruct
     }
     private static inline void flip_tiles (ref Player [,] tiles, uint8 x, uint8 y, Player color, int8 
x_step, int8 y_step, uint8 count)
     {
-        for (int8 i = 1; i <= (int8) count; i++)
+        for (; count > 0; count--)
         {
-            tiles [(int8) x + (i * x_step),
-                   (int8) y + (i * y_step)] = color;
+            tiles [(int8) x + ((int8) count * x_step),
+                   (int8) y + ((int8) count * y_step)] = color;
         }
     }
 


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