project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/EngineProtocol/Weapon.java
author Xeli
Thu, 04 Aug 2011 17:27:05 +0200
branchhedgeroid
changeset 5463 83c53a80f7ff
parent 5433 project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/Weapon.java@8f82045953c1
child 5508 dcf1b3645af6
permissions -rw-r--r--
datastructures for the different aspects of a gameconfiguration
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;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
     7
import java.io.IOException;
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
     8
import java.io.OutputStream;
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
     9
import java.util.ArrayList;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    10
import java.util.Arrays;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    11
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    12
import org.xmlpull.v1.XmlPullParser;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    13
import org.xmlpull.v1.XmlPullParserException;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    14
import org.xmlpull.v1.XmlPullParserFactory;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    15
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    16
import android.content.Context;
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    17
import android.os.Parcel;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    18
import android.os.Parcelable;
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    19
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    20
public class Weapon implements Parcelable{
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    21
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    22
	public static final String DIRECTORY_WEAPON = "weapons";
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
	private String name;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    25
	private String QT;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    26
	private String prob;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    27
	private String delay;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    28
	private String crate;
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    29
	private static int maxWeapons;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    30
	
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    31
	static{
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    32
		//maxWeapons = PascalExports.HWgetNumberOfWeapons();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    33
	}
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    34
	
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    35
	public Weapon(String _name, String _QT, String _prob, String _delay, String _crate){
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    36
		name = _name;
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
		//Incase there's a newer ammoStore which is bigger we append with zeros
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    39
		StringBuffer sb = new StringBuffer();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    40
		while(_QT.length() + sb.length() < maxWeapons){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    41
			sb.append('0');
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    42
		}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    43
		
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    44
		QT = String.format("e%s %s%s", "ammloadt", _QT, sb);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    45
		prob = String.format("e%s %s%s", "ammprob", _prob, sb);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    46
		delay = String.format("e%s %s%s", "ammdelay", _delay, sb);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    47
		crate = String.format("e%s %s%s", "ammreinf", _crate, sb);
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
	
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    50
	public Weapon(Parcel in){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    51
		readFromParcel(in);
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    52
	}
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    53
	
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    54
	public String toString(){
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    55
		return name;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    56
	}
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    57
	
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    58
	public void sendToEngine(OutputStream os, int teamsCount) throws IOException{
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    59
		os.write(QT.getBytes());//command prefix is already in string 
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    60
		os.write(prob.getBytes());
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    61
		os.write(delay.getBytes());
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    62
		os.write(crate.getBytes());
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    63
		
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    64
		byte[] ammstore = "eammstore".getBytes();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    65
		for(int i = 0; i < teamsCount; i++){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    66
			os.write(ammstore);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    67
		}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    68
		os.flush();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    69
	}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    70
	
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    71
	public static final int STATE_START = 0;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    72
	public static final int STATE_ROOT = 1;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    73
	public static final int STATE_NAME = 2;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    74
	public static final int STATE_QT = 3;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    75
	public static final int STATE_PROBABILITY = 4;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    76
	public static final int STATE_DELAY = 5;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    77
	public static final int STATE_CRATE = 6;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    78
	
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
    79
	public static ArrayList<Weapon> getWeapons(Context c) throws IllegalArgumentException{
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    80
		String dir = c.getFilesDir().getAbsolutePath() + '/' + DIRECTORY_WEAPON + '/';
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    81
		String[] files = new File(dir).list();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    82
		if(files == null) files = new String[]{};
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    83
		Arrays.sort(files);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    84
		
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    85
		ArrayList<Weapon> weapons = new ArrayList<Weapon>();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    86
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    87
		try {
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    88
			XmlPullParserFactory xmlPullFactory = XmlPullParserFactory.newInstance();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    89
			XmlPullParser xmlPuller = xmlPullFactory.newPullParser();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    90
			
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    91
			for(String file : files){
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    92
				BufferedReader br = new BufferedReader(new FileReader(dir + file), 1024);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    93
				xmlPuller.setInput(br);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    94
				String name = null;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    95
				String qt = null;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    96
				String prob = null;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    97
				String delay = null;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    98
				String crate = null;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
    99
				
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   100
				int eventType = xmlPuller.getEventType();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   101
				int state = STATE_START;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   102
				while(eventType != XmlPullParser.END_DOCUMENT){
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   103
					switch(state){
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   104
					case STATE_START:
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   105
						if(eventType == XmlPullParser.START_TAG && xmlPuller.getName().equals("weapon")) state = STATE_ROOT;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   106
						else if(eventType != XmlPullParser.START_DOCUMENT) throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   107
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   108
					case STATE_ROOT:
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   109
						if(eventType == XmlPullParser.START_TAG){
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   110
							if(xmlPuller.getName().toLowerCase().equals("qt")) state = STATE_QT;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   111
							else if(xmlPuller.getName().toLowerCase().equals("name")) state = STATE_NAME;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   112
							else if(xmlPuller.getName().toLowerCase().equals("probability")) state = STATE_PROBABILITY;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   113
							else if(xmlPuller.getName().toLowerCase().equals("delay")) state = STATE_DELAY;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   114
							else if(xmlPuller.getName().toLowerCase().equals("crate")) state = STATE_CRATE;
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
						}else if(eventType == XmlPullParser.END_TAG) state = STATE_START;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   117
						else throwException(xmlPuller.getText(), eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   118
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   119
					case STATE_NAME:
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   120
						if(eventType == XmlPullParser.TEXT) name = xmlPuller.getText().trim();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   121
						else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   122
						else throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   123
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   124
					case STATE_QT:
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   125
						if(eventType == XmlPullParser.TEXT) qt = xmlPuller.getText().trim();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   126
						else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   127
						else throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   128
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   129
					case STATE_PROBABILITY:
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   130
						if(eventType == XmlPullParser.TEXT) prob = xmlPuller.getText().trim();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   131
						else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   132
						else throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   133
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   134
					case STATE_DELAY:
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   135
						if(eventType == XmlPullParser.TEXT) delay = xmlPuller.getText().trim();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   136
						else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   137
						else throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   138
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   139
					case STATE_CRATE:
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   140
						if(eventType == XmlPullParser.TEXT) crate = xmlPuller.getText().trim();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   141
						else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   142
						else throwException(file, eventType);
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   143
						break;
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   144
					}
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   145
					eventType = xmlPuller.next();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   146
					while(eventType == XmlPullParser.TEXT && xmlPuller.isWhitespace()){//Skip whitespaces
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   147
						eventType = xmlPuller.next();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   148
					}
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
				weapons.add(new Weapon(name, qt, prob, delay, crate));
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 weapons;
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   153
			
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   154
		} catch (XmlPullParserException e) {
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   155
			e.printStackTrace();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   156
		} catch (FileNotFoundException e) {
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   157
			e.printStackTrace();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   158
		} catch (IOException e) {
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   159
			e.printStackTrace();
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   160
		}
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   161
		return new ArrayList<Weapon>();//TODO handle correctly
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   162
	}
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   163
	
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   164
	private static void throwException(String file, int eventType){
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   165
		throw new IllegalArgumentException(String.format("Xml file: %s malformed with eventType: %d.", file, eventType));
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   166
	}
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   167
5463
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   168
	public int describeContents() {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   169
		return 0;
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   170
	}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   171
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   172
	public void writeToParcel(Parcel dest, int flags) {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   173
		dest.writeString(name);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   174
		dest.writeString(QT);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   175
		dest.writeString(prob);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   176
		dest.writeString(delay);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   177
		dest.writeString(crate);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   178
	}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   179
	
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   180
	private void readFromParcel(Parcel src){
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   181
		name = src.readString();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   182
		QT = src.readString();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   183
		prob = src.readString();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   184
		delay = src.readString();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   185
		crate = src.readString();
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   186
	}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   187
	
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   188
	public static final Parcelable.Creator<Weapon> CREATOR = new Parcelable.Creator<Weapon>() {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   189
		public Weapon createFromParcel(Parcel source) {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   190
			return new Weapon(source);
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   191
		}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   192
		public Weapon[] newArray(int size) {
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   193
			return new Weapon[size];
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   194
		}
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   195
		
83c53a80f7ff datastructures for the different aspects of a gameconfiguration
Xeli
parents: 5433
diff changeset
   196
	};
5433
8f82045953c1 Main class files for the start-local-game screen
Xeli
parents:
diff changeset
   197
}