author | Medo <smaxein@googlemail.com> |
Sun, 12 Aug 2012 22:37:57 +0200 | |
changeset 7482 | d70a5b0d1190 |
parent 7476 | 2fb781bbdd51 |
child 7485 | 0481bd74267c |
permissions | -rw-r--r-- |
6047
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
1 |
/* |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
2 |
* Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game |
6700 | 3 |
* Copyright (c) 2011-2012 Richard Deurwaarder <xeli@xelification.com> |
6852
9e724f4863a3
Added copyright notice to Scheme.java
Medo <smaxein@googlemail.com>
parents:
6848
diff
changeset
|
4 |
* Copyright (c) 2012 Simeon Maxein <smaxein@googlemail.com> |
9e724f4863a3
Added copyright notice to Scheme.java
Medo <smaxein@googlemail.com>
parents:
6848
diff
changeset
|
5 |
* |
6047
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
6 |
* This program is free software; you can redistribute it and/or modify |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
7 |
* it under the terms of the GNU General Public License as published by |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
8 |
* the Free Software Foundation; version 2 of the License |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
9 |
* |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
13 |
* GNU General Public License for more details. |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
14 |
* |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
16 |
* along with this program; if not, write to the Free Software |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
18 |
*/ |
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
19 |
|
6505 | 20 |
package org.hedgewars.hedgeroid.Datastructures; |
6047
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
21 |
|
7476
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
22 |
import java.util.Collections; |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
23 |
import java.util.Comparator; |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
24 |
import java.util.HashMap; |
6844
69fb04c8a841
Scheme definitions now use .ini files.
Medo <smaxein@googlemail.com>
parents:
6725
diff
changeset
|
25 |
import java.util.Map; |
69fb04c8a841
Scheme definitions now use .ini files.
Medo <smaxein@googlemail.com>
parents:
6725
diff
changeset
|
26 |
|
7476
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
27 |
public final class Scheme { |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
28 |
public final MetaScheme metascheme; |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
29 |
public final String name; |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
30 |
public final Map<String, Integer> settings; |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
31 |
public final Map<String, Boolean> mods; |
6844
69fb04c8a841
Scheme definitions now use .ini files.
Medo <smaxein@googlemail.com>
parents:
6725
diff
changeset
|
32 |
|
7476
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
33 |
public Scheme(MetaScheme metascheme, String name, Map<String, Integer> settings, Map<String, Boolean> mods) { |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
34 |
this.metascheme = metascheme; |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
35 |
this.name = name; |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
36 |
this.settings = Collections.unmodifiableMap(new HashMap<String, Integer>(settings)); |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
37 |
this.mods = Collections.unmodifiableMap(new HashMap<String, Boolean>(mods)); |
6047
10011f051f9c
Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff
changeset
|
38 |
} |
6844
69fb04c8a841
Scheme definitions now use .ini files.
Medo <smaxein@googlemail.com>
parents:
6725
diff
changeset
|
39 |
|
7476
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
40 |
public int getHealth() { |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
41 |
return settings.get("health"); |
6844
69fb04c8a841
Scheme definitions now use .ini files.
Medo <smaxein@googlemail.com>
parents:
6725
diff
changeset
|
42 |
} |
6848
ec371186361b
Added some toString methods to help when debugging
Medo <smaxein@googlemail.com>
parents:
6844
diff
changeset
|
43 |
|
ec371186361b
Added some toString methods to help when debugging
Medo <smaxein@googlemail.com>
parents:
6844
diff
changeset
|
44 |
@Override |
ec371186361b
Added some toString methods to help when debugging
Medo <smaxein@googlemail.com>
parents:
6844
diff
changeset
|
45 |
public String toString() { |
7476
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
46 |
return "Scheme [metascheme=" + metascheme + ", name=" + name |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
47 |
+ ", settings=" + settings + ", mods=" + mods + "]"; |
6844
69fb04c8a841
Scheme definitions now use .ini files.
Medo <smaxein@googlemail.com>
parents:
6725
diff
changeset
|
48 |
} |
69fb04c8a841
Scheme definitions now use .ini files.
Medo <smaxein@googlemail.com>
parents:
6725
diff
changeset
|
49 |
|
7476
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
50 |
public static final Comparator<Scheme> caseInsensitiveNameComparator = new Comparator<Scheme>() { |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
51 |
public int compare(Scheme lhs, Scheme rhs) { |
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
52 |
return lhs.name.compareToIgnoreCase(rhs.name); |
6844
69fb04c8a841
Scheme definitions now use .ini files.
Medo <smaxein@googlemail.com>
parents:
6725
diff
changeset
|
53 |
} |
7476
2fb781bbdd51
Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
6852
diff
changeset
|
54 |
}; |
6844
69fb04c8a841
Scheme definitions now use .ini files.
Medo <smaxein@googlemail.com>
parents:
6725
diff
changeset
|
55 |
} |