[gnome-nibbles/arnaudb/modernize-code: 13/58] Clean game init.



commit 9add10d5983ed2dbf67a1e52d7bd35f95a25626b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Tue May 26 20:56:28 2020 +0200

    Clean game init.

 src/nibbles-game.vala | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/src/nibbles-game.vala b/src/nibbles-game.vala
index f6db5b5..b89a083 100644
--- a/src/nibbles-game.vala
+++ b/src/nibbles-game.vala
@@ -55,7 +55,7 @@ private class NibblesGame : Object
 
     /* Board data */
     public int tile_size        { internal get; internal construct set; }
-    internal int[,] board;
+    internal int[,] board = new int[WIDTH, HEIGHT];
 
     /* Worms data */
     internal int numhumans      { internal get; internal set; }
@@ -63,10 +63,10 @@ private class NibblesGame : Object
     internal int numworms       { internal get; private set; }
 
     /* Game models */
-    internal Gee.LinkedList<Worm> worms { get; private set; }
-    public Boni boni { internal get; private construct; default = new Boni (); }
-    internal WarpManager warp_manager { get; private set; }
-    internal Gee.HashMap<Worm, WormProperties?> worm_props { get; private set; }
+    public Gee.LinkedList<Worm> worms                       { internal get; default = new 
Gee.LinkedList<Worm> (); }
+    public Boni boni                                        { internal get; default = new Boni (); }
+    public WarpManager warp_manager                         { internal get; default = new WarpManager (); }
+    public Gee.HashMap<Worm, WormProperties?> worm_props    { internal get; default = new Gee.HashMap<Worm, 
WormProperties?> (); }
 
     /* Game controls */
     internal bool is_running    { internal get; private set; default = false; }
@@ -87,11 +87,6 @@ private class NibblesGame : Object
     {
         Object (tile_size: tile_size, start_level: start_level, current_level: start_level, speed: speed, 
fakes: fakes);
 
-        warp_manager = new WarpManager ();
-        board = new int[WIDTH, HEIGHT];
-        worms = new Gee.LinkedList<Worm> ();
-        worm_props = new Gee.HashMap<Worm, WormProperties?> ();
-
         Random.set_seed ((uint32) time_t ());
     }
 


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