project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/EngineProtocol/GameConfig.java
branchhedgeroid
changeset 5508 dcf1b3645af6
parent 5475 06a87ff38ffb
child 5621 ea796c83ea47
equal deleted inserted replaced
5506:2b0c4fcde4c6 5508:dcf1b3645af6
     1 package org.hedgewars.mobile.EngineProtocol;
     1 package org.hedgewars.mobile.EngineProtocol;
     2 
     2 
     3 import java.io.IOException;
     3 import java.io.IOException;
     4 import java.io.OutputStream;
       
     5 import java.util.ArrayList;
     4 import java.util.ArrayList;
     6 import java.util.UUID;
     5 import java.util.UUID;
     7 
     6 
     8 import android.os.Parcel;
     7 import android.os.Parcel;
     9 import android.os.Parcelable;
     8 import android.os.Parcelable;
    18 	public Weapon weapon = null;
    17 	public Weapon weapon = null;
    19 	
    18 	
    20 	public String mission = null;
    19 	public String mission = null;
    21 	public String seed = null;
    20 	public String seed = null;
    22 	
    21 	
    23 	public ArrayList<Team> teams = new ArrayList<Team>(8);
    22 	public ArrayList<Team> teams = new ArrayList<Team>();
    24 	
    23 	
    25 	public GameConfig(){
    24 	public GameConfig(){
    26 		
    25 		
    27 	}
    26 	}
    28 	
    27 	
    32 	
    31 	
    33 
    32 
    34 	
    33 	
    35 	public void sendToEngine(EngineProtocolNetwork epn) throws IOException{
    34 	public void sendToEngine(EngineProtocolNetwork epn) throws IOException{
    36 		Log.d("HW_Frontend", "Sending Gameconfig...");
    35 		Log.d("HW_Frontend", "Sending Gameconfig...");
    37 		int teamCount = 8;
    36 		int teamCount = 4;
    38 		epn.sendToEngine("TL"); //Write game mode
    37 		epn.sendToEngine("TL"); //Write game mode
    39 		if(mission != null) epn.sendToEngine(mission);
    38 		if(mission != null) epn.sendToEngine(mission);
    40 		
    39 		
    41 		//seed info
    40 		//seed info
    42 		epn.sendToEngine(String.format("eseed {%s}", UUID.randomUUID().toString()));
    41 		epn.sendToEngine(String.format("eseed {%s}", UUID.randomUUID().toString()));
    45 		//dimensions of the map
    44 		//dimensions of the map
    46 		//templatefilter_command
    45 		//templatefilter_command
    47 		//mapgen_command
    46 		//mapgen_command
    48 		//mazesize_command
    47 		//mazesize_command
    49 		
    48 		
    50 		//epn.sendToEngine(String.format("etheme %s", theme));
    49 		epn.sendToEngine(String.format("etheme %s", theme));
    51 		
    50 		
    52 		//scheme.sendToEngine(epn);
    51 		scheme.sendToEngine(epn);
    53 		
    52 		
    54 		//weapon.sendToEngine(os, teamCount);
    53 		weapon.sendToEngine(epn, teamCount);
    55 		
    54 		
    56 		for(Team t : teams){
    55 		for(Team t : teams){
    57 			//t.sendToEngine(os, teamCount, 50, 0);
    56 			if(t != null)t.sendToEngine(epn, teamCount, 50);
    58 		}
    57 		}
    59 		
       
    60 		
       
    61 	}
    58 	}
    62 	
    59 	
    63 	public int describeContents() {
    60 	public int describeContents() {
    64 		return 0;
    61 		return 0;
    65 	}
    62 	}