[gnome-nibbles/arnaudb/modernize-code: 19/58] Make a method private.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-nibbles/arnaudb/modernize-code: 19/58] Make a method private.
- Date: Wed, 10 Jun 2020 17:14:32 +0000 (UTC)
commit 676c766a52f8e13efa4f7a1f01e9db54751e76c7
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed May 27 14:14:45 2020 +0200
Make a method private.
src/gnome-nibbles.vala | 5 ++---
src/nibbles-game.vala | 9 ++++++---
2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/gnome-nibbles.vala b/src/gnome-nibbles.vala
index e7e2d11..af9651a 100644
--- a/src/gnome-nibbles.vala
+++ b/src/gnome-nibbles.vala
@@ -307,8 +307,7 @@ private class Nibbles : Gtk.Application
statusbar_stack.set_visible_child_name ("scoreboard");
view.name_labels.hide ();
- game.add_bonus (true);
- game.start ();
+ game.start (/* add initial bonus */ true);
pause_action.set_enabled (true);
back_action.set_enabled (true);
@@ -466,7 +465,7 @@ private class Nibbles : Gtk.Application
&& !game.is_paused)
{
if (seconds == 0)
- game.start ();
+ game.start (/* add initial bonus */ false);
else
countdown_id = Timeout.add_seconds (1, countdown_cb);
diff --git a/src/nibbles-game.vala b/src/nibbles-game.vala
index fb3d648..513ee47 100644
--- a/src/nibbles-game.vala
+++ b/src/nibbles-game.vala
@@ -94,8 +94,11 @@ private class NibblesGame : Object
* * Game controls
\*/
- internal void start ()
+ internal void start (bool add_initial_bonus)
{
+ if (add_initial_bonus)
+ add_bonus (true);
+
is_running = true;
main_id = Timeout.add (GAMEDELAY * speed, main_loop_cb);
@@ -131,7 +134,7 @@ private class NibblesGame : Object
internal void unpause ()
{
is_paused = false;
- start ();
+ start (/* add initial bonus */ false);
}
internal inline void reset ()
@@ -309,7 +312,7 @@ private class NibblesGame : Object
* * Handling bonuses
\*/
- internal void add_bonus (bool regular)
+ private void add_bonus (bool regular)
{
bool good = false;
int x = 0, y = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]