Fixed baselines for Intangible objects not being sent properly and made a minor improvement to encode method in SWGList and SWGMap

This commit is contained in:
Waverunner
2015-06-04 18:06:15 -04:00
parent abd632c793
commit 76cb745cb9
6 changed files with 22 additions and 20 deletions
+10 -2
View File
@@ -152,7 +152,7 @@ public class SWGMap<K, V> extends AbstractMap<K, V> implements Encodable {
public byte[] encode() {
int size = map.size();
if (size == 0 || dataSize == 0) {
if (size == 0) {
return new byte[8];
}
@@ -160,7 +160,15 @@ public class SWGMap<K, V> extends AbstractMap<K, V> implements Encodable {
buffer.putInt(size);
buffer.putInt(updateCount);
if (data.size() != size) {
// Data got out of sync with the map, so lets clean that up!
data.clear();
for (Entry<K, V> entry : map.entrySet()) {
addData(entry.getKey(), entry.getValue(), (byte) 0);
}
}
for (byte[] bytes : data.values()) {
buffer.put((byte) 0);
buffer.put(bytes);