[swell-foop] No new game confirmation before first move (bgo #736989)
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [swell-foop] No new game confirmation before first move (bgo #736989)
- Date: Thu, 1 Jan 2015 22:13:15 +0000 (UTC)
commit 4356caca3aadb1f9d6461dc588de2229b37081e4
Author: Robert Roth <robert roth off gmail com>
Date: Thu Jan 1 16:42:27 2015 +0200
No new game confirmation before first move (bgo #736989)
src/game.vala | 10 +++++++++-
src/swell-foop.vala | 10 ++++++++--
2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/game.vala b/src/game.vala
index 3688777..39de31b 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -69,7 +69,7 @@ public class Tile : Object
public class Game : Object
{
private Tile[,] tiles;
-
+ private bool is_started = false;
/* Game score */
public int score { get; set; default = 0; }
@@ -92,6 +92,7 @@ public class Game : Object
public signal void update_score (int points_awarded);
public signal void complete ();
+ public signal void started ();
/* Constructor */
public Game (int rows, int columns, int color_num)
@@ -111,6 +112,8 @@ public class Game : Object
tiles[y, x] = new Tile (x, y, c);
}
}
+
+ is_started = false;
}
/* Recursively find all the connected tile from li */
@@ -232,6 +235,11 @@ public class Game : Object
increment_score_from_tiles ((int)cl.length ());
+ if (!is_started) {
+ is_started = true;
+ started ();
+ }
+
if (this.has_completed ())
{
if (this.has_won ())
diff --git a/src/swell-foop.vala b/src/swell-foop.vala
index 623c295..0942fa4 100644
--- a/src/swell-foop.vala
+++ b/src/swell-foop.vala
@@ -32,7 +32,7 @@ public class SwellFoop : Gtk.Application
private Gtk.HeaderBar headerbar;
- private bool game_in_progress = true;
+ private bool game_in_progress = false;
/* Store size options */
public Size[] sizes;
@@ -271,6 +271,11 @@ public class SwellFoop : Gtk.Application
game_in_progress = false;
}
+ private void started_cb ()
+ {
+ game_in_progress = true;
+ }
+
protected override void shutdown ()
{
base.shutdown ();
@@ -470,6 +475,7 @@ public class SwellFoop : Gtk.Application
settings.get_int ("colors"));
game.update_score.connect (update_score_cb);
game.complete.connect (complete_cb);
+ game.started.connect (started_cb);
view.theme_name = settings.get_string ("theme");
view.game = game;
view.is_zealous = settings.get_boolean ("zealous");
@@ -477,7 +483,7 @@ public class SwellFoop : Gtk.Application
stage.set_size (view.width, view.height);
clutter_embed.set_size_request ((int) stage.width, (int) stage.height);
- game_in_progress = true;
+ game_in_progress = false;
update_score_cb (0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]