1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-03 16:44:12 +02:00

minor cleanup

This commit is contained in:
Robin Appelman 2017-02-14 23:19:59 +01:00
commit 15704c89fc

View file

@ -8,10 +8,8 @@ import {SendTable} from "../Data/SendTable";
export function applyEntityUpdate(entity: PacketEntity, sendTable: SendTable, stream: BitStream): PacketEntity { export function applyEntityUpdate(entity: PacketEntity, sendTable: SendTable, stream: BitStream): PacketEntity {
let index = -1; let index = -1;
const allProps = sendTable.flattenedProps; const allProps = sendTable.flattenedProps;
let lastProps:SendProp[] = [];
while ((index = readFieldIndex(stream, index)) != -1) { while ((index = readFieldIndex(stream, index)) != -1) {
if (index >= 4096 || index > allProps.length) { if (index >= 4096 || index > allProps.length) {
console.log(lastProps[lastProps.length - 1]);
throw new Error('prop index out of bounds while applying update for ' + sendTable.name + ' got ' + index throw new Error('prop index out of bounds while applying update for ' + sendTable.name + ' got ' + index
+ ' property only has ' + allProps.length + ' properties'); + ' property only has ' + allProps.length + ' properties');
} }
@ -21,7 +19,6 @@ export function applyEntityUpdate(entity: PacketEntity, sendTable: SendTable, st
const prop = existingProp ? existingProp : new SendProp(propDefinition); const prop = existingProp ? existingProp : new SendProp(propDefinition);
prop.value = SendPropParser.decode(propDefinition, stream); prop.value = SendPropParser.decode(propDefinition, stream);
lastProps.push(prop);
if (!existingProp) { if (!existingProp) {
entity.props.push(prop); entity.props.push(prop);