[gbrainy] Allow playing all variants when using custom games
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy] Allow playing all variants when using custom games
- Date: Sun, 13 Nov 2011 18:38:50 +0000 (UTC)
commit fac267f29ff8aee9b9b9a63e860ac31742a09d38
Author: Jordi Mas <jmas softcatala org>
Date: Sun Nov 13 19:38:57 2011 +0100
Allow playing all variants when using custom games
src/Clients/Classical/CommandLine.cs | 30 ++++++++----------------------
1 files changed, 8 insertions(+), 22 deletions(-)
---
diff --git a/src/Clients/Classical/CommandLine.cs b/src/Clients/Classical/CommandLine.cs
index abe44c6..e1ac9b9 100644
--- a/src/Clients/Classical/CommandLine.cs
+++ b/src/Clients/Classical/CommandLine.cs
@@ -96,7 +96,7 @@ namespace gbrainy.Clients.Classical
cont_execution = false;
break;
default:
- Console.WriteLine ("Unknown parameter {0}", args [idx]);
+ Console.WriteLine (Catalog.GetString ("Unknown command line parameter {0}"), args [idx]);
break;
}
}
@@ -133,26 +133,26 @@ namespace gbrainy.Clients.Classical
void BuildPlayList (string [] names)
{
- Dictionary <string, int> dictionary;
+ List <int> list = new List <int> ();
GameLocator [] games;
GameManager gm = new GameManager ();
GtkClient.GameManagerPreload (gm);
games = gm.AvailableGames;
- // Create a hash to map from game name to locator
- dictionary = new Dictionary <string, int> (games.Length);
for (int i = 0; i < games.Length; i++)
{
- if (games[i].IsGame == false)
- continue;
-
Game game = (Game) Activator.CreateInstance (games[i].TypeOf, true);
game.translations = translations;
game.Variant = games[i].Variant;
try
{
- dictionary.Add (game.Name.ToLower (), i);
+ for (int n = 0; n < names.Length; n++)
+ {
+ if (String.Compare (game.Name, names [n], StringComparison.OrdinalIgnoreCase) == 0)
+ list.Add (i);
+ }
+
}
catch (Exception e)
{
@@ -160,20 +160,6 @@ namespace gbrainy.Clients.Classical
}
}
- List <int> list = new List <int> (names.Length);
-
- for (int i = 0; i < names.Length; i++)
- {
- try
- {
- list.Add (dictionary [names [i].ToLower ()]);
- }
- catch (KeyNotFoundException)
- {
- Console.WriteLine ("CommandLine.BuildPlayList. Game [{0}] not found", names [i]);
- }
- }
-
play_list = list.ToArray ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]