Update messages
This commit is contained in:
@@ -25,14 +25,10 @@ export class MapBlockReplyMessage implements MessageBase
|
||||
Agents: number;
|
||||
MapImageID: UUID;
|
||||
}[];
|
||||
Size: {
|
||||
SizeX: number;
|
||||
SizeY: number;
|
||||
}[];
|
||||
|
||||
getSize(): number
|
||||
{
|
||||
return this.calculateVarVarSize(this.Data, 'Name', 1) + ((27) * this.Data.length) + ((4) * this.Size.length) + 22;
|
||||
return this.calculateVarVarSize(this.Data, 'Name', 1) + ((27) * this.Data.length) + 21;
|
||||
}
|
||||
|
||||
calculateVarVarSize(block: { [key: string]: any }[], paramName: string, extraPerVar: number): number
|
||||
@@ -53,7 +49,7 @@ export class MapBlockReplyMessage implements MessageBase
|
||||
pos += 16;
|
||||
buf.writeUInt32LE(this.AgentData['Flags'], pos);
|
||||
pos += 4;
|
||||
let count = this.Data.length;
|
||||
const count = this.Data.length;
|
||||
buf.writeUInt8(this.Data.length, pos++);
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
@@ -72,15 +68,6 @@ export class MapBlockReplyMessage implements MessageBase
|
||||
this.Data[i]['MapImageID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
}
|
||||
count = this.Size.length;
|
||||
buf.writeUInt8(this.Size.length, pos++);
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
buf.writeUInt16LE(this.Size[i]['SizeX'], pos);
|
||||
pos += 2;
|
||||
buf.writeUInt16LE(this.Size[i]['SizeY'], pos);
|
||||
pos += 2;
|
||||
}
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
@@ -105,7 +92,7 @@ export class MapBlockReplyMessage implements MessageBase
|
||||
{
|
||||
return pos - startPos;
|
||||
}
|
||||
let count = buf.readUInt8(pos++);
|
||||
const count = buf.readUInt8(pos++);
|
||||
this.Data = [];
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
@@ -144,27 +131,6 @@ export class MapBlockReplyMessage implements MessageBase
|
||||
pos += 16;
|
||||
this.Data.push(newObjData);
|
||||
}
|
||||
if (pos >= buf.length)
|
||||
{
|
||||
return pos - startPos;
|
||||
}
|
||||
count = buf.readUInt8(pos++);
|
||||
this.Size = [];
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
const newObjSize: {
|
||||
SizeX: number,
|
||||
SizeY: number
|
||||
} = {
|
||||
SizeX: 0,
|
||||
SizeY: 0
|
||||
};
|
||||
newObjSize['SizeX'] = buf.readUInt16LE(pos);
|
||||
pos += 2;
|
||||
newObjSize['SizeY'] = buf.readUInt16LE(pos);
|
||||
pos += 2;
|
||||
this.Size.push(newObjSize);
|
||||
}
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user