Fixed SWGList and SWGMap sending excessive data after a delta and then relogging, which often lead to a "blue ghost" for equipment

Blue Ghost. Never Forget. RIP.
This commit is contained in:
Waverunner
2015-06-06 18:02:56 -04:00
parent 81e9b8f0b0
commit fd723f18d3
4 changed files with 21 additions and 7 deletions
+10 -3
View File
@@ -163,7 +163,7 @@ public class SWGMap<K, V> extends AbstractMap<K, V> implements Encodable {
if (data.size() != size) {
// Data got out of sync with the map, so lets clean that up!
data.clear();
clearAllData();
for (Entry<K, V> entry : map.entrySet()) {
addData(entry.getKey(), entry.getValue(), (byte) 0);
}
@@ -188,7 +188,7 @@ public class SWGMap<K, V> extends AbstractMap<K, V> implements Encodable {
DeltaBuilder builder = new DeltaBuilder(target, baseline, view, updateType, getDeltaData());
builder.send();
// Clear the queue since the delta has been sent to observers through the builder
clearDeltaQueue();
}
@@ -222,7 +222,14 @@ public class SWGMap<K, V> extends AbstractMap<K, V> implements Encodable {
deltas.put(key, combindedUpdate);
}
}
private void clearAllData() {
dataSize = 0;
data.clear();
clearDeltaQueue();
}
private void addData(Object key, Object value, byte update) {
byte[] encodedKey = Encoder.encode(key, strType);
byte[] encodedValue = Encoder.encode(value, strType);