project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/GameConfig.java
author Medo <smaxein@googlemail.com>
Sun, 12 Aug 2012 22:46:23 +0200
changeset 7485 0481bd74267c
child 7508 763d3961400b
permissions -rw-r--r--
Hedgeroid: - (hopefully) completed the frontlib JNA mappings - added documentation - Changed more code to use frontlib for ini reading/writing - tried to make everything work again that was working before - Teamlist can now be used to add and remove teams - Netplay now correctly handles team additions when being room chief - Fixed TeamCreatorActivity so that editing teams works
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7485
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     1
/*
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     2
 * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     3
 * Copyright (c) 2011-2012 Richard Deurwaarder <xeli@xelification.com>
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     4
 *
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     8
 *
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    13
 *
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    17
 */
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    18
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    19
package org.hedgewars.hedgeroid.Datastructures;
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
import java.util.ArrayList;
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    22
import java.util.Collections;
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    23
import java.util.List;
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    24
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    25
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    26
/**
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    27
 * Game configuration from the point of view of the UI. This differs slightly from the
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    28
 * frontlib view, because the engine allows setting a separate initial health and weapon set
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    29
 * for each hog, while the Android UI currently only supports both attributes on a per-game
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    30
 * basis (initial health is contained in the scheme).
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    31
 * 
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    32
 * This difference means that creating a GameConfig object from a frontlib object can, in
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    33
 * theory, lose information. This does not cause problems at the moment because for now
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    34
 * weaponset and initial health are always per-game, but that might change in the future.
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    35
 */
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    36
public final class GameConfig {
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    37
	public static final String DEFAULT_STYLE = "Normal";
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    38
	public static final String DEFAULT_SCHEME = "Default";
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    39
	public static final String DEFAULT_WEAPONSET = "Default";
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    40
	
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    41
	public final String style;
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    42
	public final Scheme scheme;
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    43
	public final MapRecipe map;
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    44
	public final List<TeamInGame> teams;
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    45
	public final Weaponset weaponset;
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    46
	
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    47
	public GameConfig(String style, Scheme scheme, MapRecipe map, List<TeamInGame> teams, Weaponset weaponset) {
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    48
		this.style = style;
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    49
		this.scheme = scheme;
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    50
		this.map = map;
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    51
		this.teams = Collections.unmodifiableList(new ArrayList<TeamInGame>(teams));
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    52
		this.weaponset = weaponset;
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    53
	}
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    54
}