project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/EngineProtocol/Scheme.java
author Xeli
Tue, 09 Aug 2011 20:53:37 +0200
branchhedgeroid
changeset 5506 2b0c4fcde4c6
parent 5463 83c53a80f7ff
child 5508 dcf1b3645af6
permissions -rw-r--r--
Added color and team hog count
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
     1
package org.hedgewars.mobile.EngineProtocol;
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
     2
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
     3
import java.io.BufferedReader;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
     4
import java.io.File;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
     5
import java.io.FileNotFoundException;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
     6
import java.io.FileReader;
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
     7
import java.io.FilenameFilter;
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
     8
import java.io.IOException;
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
     9
import java.io.OutputStream;
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    10
import java.util.ArrayList;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    11
import java.util.Arrays;
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    12
import java.util.LinkedHashMap;
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    13
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    14
import org.xmlpull.v1.XmlPullParser;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    15
import org.xmlpull.v1.XmlPullParserException;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    16
import org.xmlpull.v1.XmlPullParserFactory;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    17
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    18
import android.content.Context;
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    19
import android.os.Parcel;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    20
import android.os.Parcelable;
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    21
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    22
public class Scheme implements Parcelable{
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    23
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    24
	public static final String DIRECTORY_SCHEME = "schemes";
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    25
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    26
	private String name;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    27
	//private ArrayList<Integer> basic;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    28
	private Integer gamemod;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    29
	private ArrayList<Integer> basic;;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    30
	private static ArrayList<LinkedHashMap<String, ?>> basicflags = new ArrayList<LinkedHashMap<String, ?>>();
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    31
	
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    32
	public Scheme(String _name, ArrayList<Integer> _basic, int _gamemod){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    33
		name = _name;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    34
		gamemod = _gamemod;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    35
		basic = _basic;
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    36
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    37
	}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    38
	
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    39
	public Scheme(Parcel in){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    40
		readFromParcel(in);
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    41
	}
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    42
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    43
	public void sendToEngine(OutputStream os)throws IOException{ 
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    44
		os.write(String.format("e$gmflags %d", gamemod).getBytes());
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    45
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    46
		for(int pos = 0; pos < basic.size(); pos++){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    47
			LinkedHashMap<String, ?> basicflag = basicflags.get(pos);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    48
			
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    49
			String command = (String)basicflag.get("command");
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    50
			Integer value = basic.get(pos);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    51
			Boolean checkOverMax = (Boolean) basicflag.get("checkOverMax");
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    52
			Boolean times1000 = (Boolean) basicflag.get("times1000");
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    53
			Integer max = (Integer) basicflag.get("max");
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    54
			
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    55
			if(checkOverMax && value >= max) value = max;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    56
			if(times1000) value *= 1000;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    57
			
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    58
			os.write(String.format("%s %d", command, value).getBytes());
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    59
		}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    60
		os.flush();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    61
	}
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    62
	public String toString(){
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    63
		return name;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    64
	}
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    65
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    66
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    67
	public static final int STATE_START = 0;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    68
	public static final int STATE_ROOT = 1;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    69
	public static final int STATE_NAME = 2;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    70
	public static final int STATE_BASICFLAGS = 3;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    71
	public static final int STATE_GAMEMOD = 4;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    72
	public static final int STATE_BASICFLAG_INTEGER = 5;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    73
	public static final int STATE_GAMEMOD_TRUE = 6;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    74
	public static final int STATE_GAMEMOD_FALSE = 7;
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    75
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    76
	public static ArrayList<Scheme> getSchemes(Context c) throws IllegalArgumentException{
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    77
		String dir = c.getFilesDir().getAbsolutePath() + '/' + DIRECTORY_SCHEME + '/';
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    78
		String[] files = new File(dir).list(fnf);
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    79
		if(files == null) files = new String[]{};
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    80
		Arrays.sort(files);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    81
		ArrayList<Scheme> schemes = new ArrayList<Scheme>();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    82
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    83
		try {
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    84
			XmlPullParserFactory xmlPullFactory = XmlPullParserFactory.newInstance();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    85
			XmlPullParser xmlPuller = xmlPullFactory.newPullParser();
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    86
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    87
			for(String file : files){
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    88
				BufferedReader br = new BufferedReader(new FileReader(dir + file), 1024);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    89
				xmlPuller.setInput(br);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    90
				String name = null;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    91
				ArrayList<Integer> basic = new ArrayList<Integer>();
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    92
				Integer gamemod = 0;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    93
				int mask = 0x000000004;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    94
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    95
				int eventType = xmlPuller.getEventType();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    96
				int state = STATE_START;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    97
				while(eventType != XmlPullParser.END_DOCUMENT){
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    98
					switch(state){
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    99
					case STATE_START:
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   100
						if(eventType == XmlPullParser.START_TAG && xmlPuller.getName().equals("scheme")) state = STATE_ROOT;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   101
						else if(eventType != XmlPullParser.START_DOCUMENT) throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   102
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   103
					case STATE_ROOT:
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   104
						if(eventType == XmlPullParser.START_TAG){
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   105
							if(xmlPuller.getName().equals("basicflags")) state = STATE_BASICFLAGS;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   106
							else if(xmlPuller.getName().toLowerCase().equals("gamemod")) state = STATE_GAMEMOD;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   107
							else if(xmlPuller.getName().toLowerCase().equals("name")) state = STATE_NAME;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   108
							else throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   109
						}else if(eventType == XmlPullParser.END_TAG) state = STATE_START;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   110
						else throwException(xmlPuller.getText(), eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   111
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   112
					case STATE_BASICFLAGS:
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   113
						if(eventType == XmlPullParser.START_TAG && xmlPuller.getName().toLowerCase().equals("integer")) state = STATE_BASICFLAG_INTEGER;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   114
						else if(eventType == XmlPullParser.END_TAG)	state = STATE_ROOT;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   115
						else throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   116
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   117
					case STATE_GAMEMOD:
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   118
						if(eventType == XmlPullParser.START_TAG){
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   119
							if(xmlPuller.getName().toLowerCase().equals("true")) state = STATE_GAMEMOD_TRUE;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   120
							else if(xmlPuller.getName().toLowerCase().equals("false")) state = STATE_GAMEMOD_FALSE;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   121
							else throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   122
						}else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   123
						else throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   124
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   125
					case STATE_NAME:
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   126
						if(eventType == XmlPullParser.TEXT) name = xmlPuller.getText().trim();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   127
						else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   128
						else throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   129
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   130
					case STATE_BASICFLAG_INTEGER:
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   131
						if(eventType == XmlPullParser.TEXT) basic.add(Integer.parseInt(xmlPuller.getText().trim()));
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   132
						else if(eventType == XmlPullParser.END_TAG) state = STATE_BASICFLAGS;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   133
						else throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   134
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   135
					case STATE_GAMEMOD_FALSE:
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   136
						if(eventType == XmlPullParser.TEXT) gamemod <<= 1;
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   137
						else if(eventType == XmlPullParser.END_TAG) state = STATE_GAMEMOD;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   138
						else throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   139
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   140
					case STATE_GAMEMOD_TRUE:
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   141
						if(eventType == XmlPullParser.TEXT){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   142
							gamemod |= mask;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   143
							gamemod <<= 1;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   144
						}else if(eventType == XmlPullParser.END_TAG) state = STATE_GAMEMOD;
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   145
						else throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   146
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   147
					}
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   148
					eventType = getEventType(xmlPuller);
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   149
				}//end while(eventtype != END_DOCUMENT
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   150
				schemes.add(new Scheme(name, basic, gamemod));
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   151
			}//end for(string file : files
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   152
			return schemes;
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   153
		} catch (XmlPullParserException e) {
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   154
			e.printStackTrace();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   155
		} catch (FileNotFoundException e) {
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   156
			e.printStackTrace();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   157
		} catch (IOException e) {
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   158
			e.printStackTrace();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   159
		}
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   160
		return new ArrayList<Scheme>();//TODO handle correctly
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   161
	}
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   162
	
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   163
	private static FilenameFilter fnf = new FilenameFilter(){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   164
		public boolean accept(File dir, String filename) {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   165
			return filename.toLowerCase().startsWith("scheme_");
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   166
		}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   167
	};
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   168
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   169
	/**
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   170
	 * This method will parse the basic flags from a prespecified xml file.
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   171
	 * I use a raw xml file rather than one parsed by aatp at compile time
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   172
	 * to keep it generic with other frontends, ie in the future we could 
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   173
	 * use one provided by the Data folder.
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   174
	 */
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   175
	public static void parseBasicFlags(Context c){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   176
		String filename = String.format("%s/%s/basicflags", c.getFilesDir().getAbsolutePath(), DIRECTORY_SCHEME);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   177
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   178
		XmlPullParser xmlPuller = null;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   179
		BufferedReader br = null;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   180
		try {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   181
			XmlPullParserFactory xmlPullFactory = XmlPullParserFactory.newInstance();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   182
			xmlPuller = xmlPullFactory.newPullParser();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   183
			br = new BufferedReader(new FileReader(filename), 1024);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   184
			xmlPuller.setInput(br);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   185
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   186
			int eventType = getEventType(xmlPuller);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   187
			boolean continueParsing = true;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   188
			do{
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   189
				switch(eventType){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   190
				
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   191
				case XmlPullParser.START_TAG:
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   192
					if(xmlPuller.getName().toLowerCase().equals("flag")){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   193
						basicflags.add(parseFlag(xmlPuller));
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   194
					}else if(xmlPuller.getName().toLowerCase().equals("basicflags")){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   195
						eventType = getEventType(xmlPuller);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   196
					}else{
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   197
						skipCurrentTag(xmlPuller);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   198
						eventType = getEventType(xmlPuller);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   199
					}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   200
					break;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   201
				case XmlPullParser.START_DOCUMENT://ignore all tags not being "flag"
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   202
				case XmlPullParser.END_TAG:
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   203
				case XmlPullParser.TEXT:
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   204
				default:
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   205
					continueParsing = true;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   206
				case XmlPullParser.END_DOCUMENT:
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   207
					continueParsing = false;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   208
				}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   209
			}while(continueParsing);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   210
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   211
		}catch(IOException e){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   212
			e.printStackTrace();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   213
		}catch (XmlPullParserException e) {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   214
			e.printStackTrace();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   215
		}finally{
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   216
			if(br != null)
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   217
				try {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   218
					br.close();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   219
				} catch (IOException e) {}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   220
		}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   221
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   222
	}
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   223
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   224
	/*
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   225
	 * * Parses a Tag structure from xml as example we use
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   226
	 *<flag>
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   227
	 *   <checkOverMax>
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   228
	 *       <boolean>false</boolean>
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   229
	 *   </checkOverMax>
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   230
	 *</flag>
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   231
	 *
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   232
	 * It returns a LinkedHashMap with key/value pairs
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   233
	 */
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   234
	private static LinkedHashMap<String, Object> parseFlag(XmlPullParser xmlPuller)throws XmlPullParserException, IOException{
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   235
		LinkedHashMap<String, Object> hash = new LinkedHashMap<String, Object>();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   236
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   237
		int eventType = xmlPuller.getEventType();//Get the event type which triggered this method
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   238
		if(eventType == XmlPullParser.START_TAG && xmlPuller.getName().toLowerCase().equals("flag")){//valid start of flag tag
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   239
			String lcKey = null;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   240
			String lcType = null;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   241
			String value = null;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   242
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   243
			eventType = getEventType(xmlPuller);//<checkOverMax>
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   244
			while(eventType == XmlPullParser.START_TAG){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   245
				lcKey = xmlPuller.getName();//checkOverMax
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   246
				if(getEventType(xmlPuller) == XmlPullParser.START_TAG){//<boolean>
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   247
					lcType = xmlPuller.getName().toLowerCase();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   248
					if(getEventType(xmlPuller) == XmlPullParser.TEXT){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   249
						value = xmlPuller.getText();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   250
						if(getEventType(xmlPuller) == XmlPullParser.END_TAG && //</boolean> 
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   251
								getEventType(xmlPuller) == XmlPullParser.END_TAG){//</checkOverMax>
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   252
							if(lcType.equals("boolean")) hash.put(lcKey, new Boolean(value));
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   253
							else if(lcType.equals("string"))hash.put(lcKey, value);							
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   254
							else if(lcType.equals("integer")){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   255
								try{
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   256
									hash.put(lcKey, new Integer(value));
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   257
								}catch (NumberFormatException e){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   258
									throw new XmlPullParserException("Wrong integer value in xml file");
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   259
								}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   260
							}else{
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   261
								throwException("basicflags", eventType);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   262
							}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   263
						}//</boolean> / </checkOverMax>
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   264
					}//if TEXT
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   265
				}//if boolean
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   266
				eventType = getEventType(xmlPuller);//start new loop
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   267
			}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   268
			eventType = getEventType(xmlPuller);//</flag>
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   269
		}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   270
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   271
		return hash;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   272
	}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   273
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   274
	private static void skipCurrentTag(XmlPullParser xmlPuller) throws XmlPullParserException, IOException{
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   275
		int eventType = xmlPuller.getEventType();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   276
		if(eventType != XmlPullParser.START_TAG)return;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   277
		String tag = xmlPuller.getName().toLowerCase();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   278
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   279
		while(true){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   280
			eventType = getEventType(xmlPuller);//getNext()
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   281
			switch(eventType){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   282
			case XmlPullParser.START_DOCUMENT://we're inside of a start tag so START_ or END_DOCUMENT is just wrong
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   283
			case XmlPullParser.END_DOCUMENT:
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   284
				throw new XmlPullParserException("invalid xml file");
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   285
			case XmlPullParser.START_TAG://if we get a new tag recursively handle it
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   286
				skipCurrentTag(xmlPuller);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   287
				break;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   288
			case XmlPullParser.TEXT:
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   289
				break;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   290
			case XmlPullParser.END_TAG:
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   291
				if(!xmlPuller.getName().toLowerCase().equals(tag)){//if the end tag doesn't match the start tag
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   292
					throw new XmlPullParserException("invalid xml file");
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   293
				}else{
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   294
					return;//skip completed	
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   295
				}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   296
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   297
			}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   298
		}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   299
	}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   300
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   301
	/**
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   302
	 * Skips whitespaces..
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   303
	 */
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   304
	private static int getEventType(XmlPullParser xmlPuller)throws XmlPullParserException, IOException{
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   305
		int eventType = xmlPuller.next();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   306
		while(eventType == XmlPullParser.TEXT && xmlPuller.isWhitespace()){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   307
			eventType = xmlPuller.next();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   308
		}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   309
		return eventType;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   310
	}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   311
	private static void throwException(String file, int eventType){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   312
		throw new IllegalArgumentException(String.format("Xml file: %s malformed with error: %d.", file, eventType));
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   313
	}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   314
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   315
	@Override
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   316
	public int describeContents() {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   317
		// TODO Auto-generated method stub
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   318
		return 0;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   319
	}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   320
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   321
	public void writeToParcel(Parcel dest, int flags) {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   322
		dest.writeString(name);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   323
		dest.writeInt(gamemod);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   324
		dest.writeList(basic);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   325
		
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   326
	}
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   327
	
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   328
	public void readFromParcel(Parcel src){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   329
		name = src.readString();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   330
		gamemod = src.readInt();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   331
		basic = src.readArrayList(ArrayList.class.getClassLoader());
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   332
	}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   333
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   334
	public static final Parcelable.Creator<Scheme> CREATOR = new Parcelable.Creator<Scheme>() {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   335
		public Scheme createFromParcel(Parcel source) {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   336
			return new Scheme(source);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   337
		}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   338
		public Scheme[] newArray(int size) {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   339
			return new Scheme[size];
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   340
		}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   341
		
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   342
	};
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   343
}