mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Implemented list views initialisation which will set the first pane to be your source id (after three way handshake) and the remaining pane to be the source id of other players based on boats.xml received.
Updated client parser and client state to save a list of player's boat WIP: refresh list view to show the latest update in players #story[1055]
This commit is contained in:
@@ -2,12 +2,11 @@ package seng302.gameServer;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
import seng302.client.ClientPacketParser;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import seng302.models.Player;
|
||||
import seng302.models.Yacht;
|
||||
import seng302.models.stream.packets.PacketType;
|
||||
import seng302.models.stream.packets.StreamPacket;
|
||||
import seng302.server.messages.Heartbeat;
|
||||
import seng302.server.messages.BoatActionType;
|
||||
import seng302.server.messages.Message;
|
||||
|
||||
@@ -15,6 +14,8 @@ import java.io.*;
|
||||
import java.net.Socket;
|
||||
import java.util.zip.CRC32;
|
||||
import java.util.zip.Checksum;
|
||||
import seng302.server.messages.XMLMessage;
|
||||
import seng302.server.messages.XMLMessageSubType;
|
||||
import seng302.utilities.GeoPoint;
|
||||
|
||||
/**
|
||||
@@ -78,6 +79,20 @@ public class ServerToClientThread implements Runnable {
|
||||
int sync1;
|
||||
int sync2;
|
||||
// TODO: 14/07/17 wmu16 - Work out how to fix this while loop
|
||||
|
||||
// used by ryan to simulate sending boats.xml
|
||||
// InputStream inputStream = getClass().getResourceAsStream("/server_config/boats.xml");
|
||||
// StringWriter writer = new StringWriter();
|
||||
// try {
|
||||
// IOUtils.copy(inputStream, writer);
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// String xml = writer.toString();
|
||||
// Message message = new XMLMessage(xml, XMLMessageSubType.BOAT, 0);
|
||||
// sendMessage(message);
|
||||
//-------
|
||||
|
||||
while(true) {
|
||||
|
||||
try {
|
||||
@@ -92,9 +107,11 @@ public class ServerToClientThread implements Runnable {
|
||||
updateClient = false;
|
||||
}
|
||||
|
||||
|
||||
crcBuffer = new ByteArrayOutputStream();
|
||||
sync1 = readByte();
|
||||
sync2 = readByte();
|
||||
|
||||
//checking if it is the start of the packet
|
||||
if(sync1 == 0x47 && sync2 == 0x83) {
|
||||
int type = readByte();
|
||||
@@ -204,11 +221,6 @@ public class ServerToClientThread implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Thread getThread() {
|
||||
return thread;
|
||||
}
|
||||
|
||||
public void sendMessage(Message message){
|
||||
try {
|
||||
os.write(message.getBuffer());
|
||||
@@ -216,4 +228,9 @@ public class ServerToClientThread implements Runnable {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Thread getThread() {
|
||||
return thread;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user