[iagno] Add --first, --second and --two-players command-line options.
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] Add --first, --second and --two-players command-line options.
- Date: Mon, 21 Jul 2014 02:36:26 +0000 (UTC)
commit fd02c26d1d45b98ad97f8eedc66b5909e18b2bb3
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sun Jul 20 22:16:12 2014 +0200
Add --first, --second and --two-players command-line options.
https://bugzilla.gnome.org/show_bug.cgi?id=733415
src/iagno.vala | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/iagno.vala b/src/iagno.vala
index 31872b1..4f88059 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -45,8 +45,11 @@ public class Iagno : Gtk.Application
private static const OptionEntry[] option_entries =
{
{ "fast-mode", 'f', 0, OptionArg.NONE, ref fast_mode, N_("Reduce delay before AI moves"), null},
+ { "first", 0, 0, OptionArg.NONE, null, N_("Play first"), null},
{ "level", 'l', 0, OptionArg.INT, ref computer_level, N_("Set the level of the computer's AI"),
null},
{ "mute", 0, 0, OptionArg.NONE, null, N_("Turn off the sound"), null},
+ { "second", 0, 0, OptionArg.NONE, null, N_("Play second"), null},
+ { "two-players", 0, 0, OptionArg.NONE, null, N_("Two-players mode"), null},
{ "unmute", 0, 0, OptionArg.NONE, null, N_("Turn on the sound"), null},
{ "version", 'v', 0, OptionArg.NONE, null, N_("Print release version and exit"), null},
{ null }
@@ -205,6 +208,14 @@ public class Iagno : Gtk.Application
stderr.printf ("%1$s\n", _("Level should be between 1 (easy) and 3 (hard). Settings
unchanged."));
}
+ /* The game mode is set for the next game. */
+ if (options.contains ("second"))
+ settings.set_string ("play-as", "second");
+ if (options.contains ("first"))
+ settings.set_string ("play-as", "first");
+ if (options.contains ("two-players"))
+ settings.set_string ("play-as", "two-players");
+
/* Activate */
return -1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]