1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-04 00:54:14 +02:00

fix encoding string sendprops

This commit is contained in:
Robin Appelman 2017-11-20 00:32:36 +01:00
commit 8fe977ff9f
4 changed files with 261 additions and 13 deletions

View file

@ -68,9 +68,11 @@ export class SendPropEncoder {
}
public static writeString(value: string, stream: BitStream) {
// +1 for null
stream.writeBits(value.length + 1, 9);
stream.writeASCIIString(value);
stream.writeBits(value.length, 9);
if (value) {
// specify the length to exclude the null terminator
stream.writeASCIIString(value, value.length);
}
}
public static writeVector(value: Vector, propDefinition: SendPropDefinition, stream: BitStream) {