mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Fixed a bug that program crashes when it receive regatta xml during the race, as it doesn't know how to handle the xml.
#story[984]
This commit is contained in:
@@ -79,7 +79,6 @@ public class ClientPacketParser {
|
||||
extractDisplayMessage(packet);
|
||||
break;
|
||||
case XML_MESSAGE:
|
||||
newRaceXmlReceived = true;
|
||||
extractXmlMessage(packet);
|
||||
break;
|
||||
case RACE_START_STATUS:
|
||||
@@ -292,6 +291,7 @@ public class ClientPacketParser {
|
||||
}
|
||||
|
||||
xmlObject.constructXML(doc, messageType);
|
||||
|
||||
if (messageType == 7) { //7 is the boat XML
|
||||
boats = xmlObject.getBoatXML().getCompetingBoats();
|
||||
// Set/Update the ClientState boats after receiving new boat xml.
|
||||
|
||||
@@ -105,7 +105,6 @@ public class ClientToServerThread implements Runnable {
|
||||
if (computedCrc == packetCrc) {
|
||||
ClientPacketParser
|
||||
.parsePacket(new StreamPacket(type, payloadLength, timeStamp, payload));
|
||||
// packetBufferDelegate.addToBuffer(new StreamPacket(type, payloadLength, timeStamp, payload));
|
||||
} else {
|
||||
clientLog("Packet has been dropped", 1);
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@ public class CanvasController {
|
||||
private final int BUFFER_SIZE = 50;
|
||||
private final int PANEL_WIDTH = 1260; // it should be 1280 but, minors 40 to cancel the bias.
|
||||
private final int PANEL_HEIGHT = 960;
|
||||
private final int CANVAS_WIDTH = 720;
|
||||
private final int CANVAS_HEIGHT = 720;
|
||||
private final int CANVAS_WIDTH = 1100;
|
||||
private final int CANVAS_HEIGHT = 920;
|
||||
private boolean horizontalInversion = false;
|
||||
|
||||
private double distanceScaleFactor;
|
||||
|
||||
@@ -140,11 +140,6 @@ public class ServerToClientThread implements Runnable, Observer {
|
||||
while (socket.isConnected()) {
|
||||
|
||||
try {
|
||||
// if (initialisedRace) {
|
||||
// sendSetupMessages();
|
||||
// initialisedRace = false;
|
||||
// }
|
||||
|
||||
//Perform a write if it is time to as delegated by the MainServerThread
|
||||
if (updateClient) {
|
||||
// TODO: 13/07/17 wmu16 - Write out game state - some function that would write all appropriate messages to this output stream
|
||||
@@ -210,18 +205,18 @@ public class ServerToClientThread implements Runnable, Observer {
|
||||
xml.setRegatta(new Regatta("RaceVision Test Game", 57.6679590, 11.8503233));
|
||||
xml.setRace(race);
|
||||
|
||||
XMLMessage xmlMessage = new XMLMessage(xml.getRegattaAsXml(), XMLMessageSubType.REGATTA,
|
||||
xml.getRegattaAsXml().length());
|
||||
XMLMessage xmlMessage;
|
||||
xmlMessage = new XMLMessage(xml.getRegattaAsXml(), XMLMessageSubType.REGATTA,
|
||||
xml.getRegattaAsXml().length());
|
||||
sendMessage(xmlMessage);
|
||||
|
||||
xmlMessage = new XMLMessage(xml.getBoatsAsXml(), XMLMessageSubType.BOAT,
|
||||
xml.getBoatsAsXml().length());
|
||||
xml.getBoatsAsXml().length());
|
||||
sendMessage(xmlMessage);
|
||||
|
||||
xmlMessage = new XMLMessage(xml.getRaceAsXml(), XMLMessageSubType.RACE,
|
||||
xml.getRaceAsXml().length());
|
||||
xml.getRaceAsXml().length());
|
||||
sendMessage(xmlMessage);
|
||||
// System.out.println("Sent xml messages for " + thread.getName());
|
||||
}
|
||||
|
||||
public void updateClient() {
|
||||
|
||||
Reference in New Issue
Block a user