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);
|
extractDisplayMessage(packet);
|
||||||
break;
|
break;
|
||||||
case XML_MESSAGE:
|
case XML_MESSAGE:
|
||||||
newRaceXmlReceived = true;
|
|
||||||
extractXmlMessage(packet);
|
extractXmlMessage(packet);
|
||||||
break;
|
break;
|
||||||
case RACE_START_STATUS:
|
case RACE_START_STATUS:
|
||||||
@@ -292,6 +291,7 @@ public class ClientPacketParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
xmlObject.constructXML(doc, messageType);
|
xmlObject.constructXML(doc, messageType);
|
||||||
|
|
||||||
if (messageType == 7) { //7 is the boat XML
|
if (messageType == 7) { //7 is the boat XML
|
||||||
boats = xmlObject.getBoatXML().getCompetingBoats();
|
boats = xmlObject.getBoatXML().getCompetingBoats();
|
||||||
// Set/Update the ClientState boats after receiving new boat xml.
|
// Set/Update the ClientState boats after receiving new boat xml.
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ public class ClientToServerThread implements Runnable {
|
|||||||
if (computedCrc == packetCrc) {
|
if (computedCrc == packetCrc) {
|
||||||
ClientPacketParser
|
ClientPacketParser
|
||||||
.parsePacket(new StreamPacket(type, payloadLength, timeStamp, payload));
|
.parsePacket(new StreamPacket(type, payloadLength, timeStamp, payload));
|
||||||
// packetBufferDelegate.addToBuffer(new StreamPacket(type, payloadLength, timeStamp, payload));
|
|
||||||
} else {
|
} else {
|
||||||
clientLog("Packet has been dropped", 1);
|
clientLog("Packet has been dropped", 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ public class CanvasController {
|
|||||||
private final int BUFFER_SIZE = 50;
|
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_WIDTH = 1260; // it should be 1280 but, minors 40 to cancel the bias.
|
||||||
private final int PANEL_HEIGHT = 960;
|
private final int PANEL_HEIGHT = 960;
|
||||||
private final int CANVAS_WIDTH = 720;
|
private final int CANVAS_WIDTH = 1100;
|
||||||
private final int CANVAS_HEIGHT = 720;
|
private final int CANVAS_HEIGHT = 920;
|
||||||
private boolean horizontalInversion = false;
|
private boolean horizontalInversion = false;
|
||||||
|
|
||||||
private double distanceScaleFactor;
|
private double distanceScaleFactor;
|
||||||
|
|||||||
@@ -140,11 +140,6 @@ public class ServerToClientThread implements Runnable, Observer {
|
|||||||
while (socket.isConnected()) {
|
while (socket.isConnected()) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// if (initialisedRace) {
|
|
||||||
// sendSetupMessages();
|
|
||||||
// initialisedRace = false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
//Perform a write if it is time to as delegated by the MainServerThread
|
//Perform a write if it is time to as delegated by the MainServerThread
|
||||||
if (updateClient) {
|
if (updateClient) {
|
||||||
// TODO: 13/07/17 wmu16 - Write out game state - some function that would write all appropriate messages to this output stream
|
// TODO: 13/07/17 wmu16 - Write out game state - some function that would write all appropriate messages to this output stream
|
||||||
@@ -210,7 +205,8 @@ public class ServerToClientThread implements Runnable, Observer {
|
|||||||
xml.setRegatta(new Regatta("RaceVision Test Game", 57.6679590, 11.8503233));
|
xml.setRegatta(new Regatta("RaceVision Test Game", 57.6679590, 11.8503233));
|
||||||
xml.setRace(race);
|
xml.setRace(race);
|
||||||
|
|
||||||
XMLMessage xmlMessage = new XMLMessage(xml.getRegattaAsXml(), XMLMessageSubType.REGATTA,
|
XMLMessage xmlMessage;
|
||||||
|
xmlMessage = new XMLMessage(xml.getRegattaAsXml(), XMLMessageSubType.REGATTA,
|
||||||
xml.getRegattaAsXml().length());
|
xml.getRegattaAsXml().length());
|
||||||
sendMessage(xmlMessage);
|
sendMessage(xmlMessage);
|
||||||
|
|
||||||
@@ -221,7 +217,6 @@ public class ServerToClientThread implements Runnable, Observer {
|
|||||||
xmlMessage = new XMLMessage(xml.getRaceAsXml(), XMLMessageSubType.RACE,
|
xmlMessage = new XMLMessage(xml.getRaceAsXml(), XMLMessageSubType.RACE,
|
||||||
xml.getRaceAsXml().length());
|
xml.getRaceAsXml().length());
|
||||||
sendMessage(xmlMessage);
|
sendMessage(xmlMessage);
|
||||||
// System.out.println("Sent xml messages for " + thread.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateClient() {
|
public void updateClient() {
|
||||||
|
|||||||
Reference in New Issue
Block a user