small changes and small bug fixes

This commit is contained in:
sirjonasxx 2019-01-01 23:59:03 +01:00
parent 35fc3c2515
commit 3ff1abdf9b
2 changed files with 25 additions and 5 deletions

View File

@ -73,9 +73,9 @@ public class HEntity {
} }
public boolean tryUpdate(HEntityUpdate update) { public boolean tryUpdate(HEntityUpdate update) {
if (index != update.index) return false; if (index != update.getIndex()) return false;
tile = update.tile; tile = update.getTile();
lastUpdate = update; lastUpdate = update;
return true; return true;
} }

View File

@ -59,6 +59,12 @@ public class Injection extends SubForm {
HPacket[] packets = parsePackets(inputPacket.getText()); HPacket[] packets = parsePackets(inputPacket.getText());
if (packets.length == 0) {
dirty = true;
lbl_corrruption.setFill(Paint.valueOf("#ee0404b2"));
lbl_corrruption.setText("isCorrupted: True");
}
for (int i = 0; i < packets.length; i++) { for (int i = 0; i < packets.length; i++) {
if (packets[i].isCorrupted()) { if (packets[i].isCorrupted()) {
if (!dirty) { if (!dirty) {
@ -70,13 +76,27 @@ public class Injection extends SubForm {
} }
} }
if (dirty && packets.length == 1) {
lbl_corrruption.setText("isCorrupted: True"); // no index needed
}
if (!dirty) { if (!dirty) {
btn_sendToClient.setDisable(getHConnection().getState() != HConnection.State.CONNECTED); btn_sendToClient.setDisable(getHConnection().getState() != HConnection.State.CONNECTED);
btn_sendToServer.setDisable(getHConnection().getState() != HConnection.State.CONNECTED); btn_sendToServer.setDisable(getHConnection().getState() != HConnection.State.CONNECTED);
lbl_pcktInfo.setText("header (id:" + packets[packets.length - 1].headerId() + ", length:" + if (packets.length == 1) {
packets[packets.length - 1].length() + ")"); lbl_pcktInfo.setText("header (id:" + packets[0].headerId() + ", length:" +
packets[0].length() + ")");
}
else {
lbl_pcktInfo.setText("");
}
} else { } else {
lbl_pcktInfo.setText("header (id:NULL, length:" + packets[packets.length - 1].getBytesLength()+")"); if (packets.length == 1) {
lbl_pcktInfo.setText("header (id:NULL, length:" + packets[0].getBytesLength()+")");
}
else {
lbl_pcktInfo.setText("");
}
btn_sendToClient.setDisable(true); btn_sendToClient.setDisable(true);
btn_sendToServer.setDisable(true); btn_sendToServer.setDisable(true);