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

save baseline in packet handler instead of parser

This commit is contained in:
Robin Appelman 2017-02-14 22:28:16 +01:00
commit 5fcbbe540e
2 changed files with 15 additions and 16 deletions

View file

@ -1,5 +1,6 @@
import {StringTablePacket} from "../Data/Packet";
import {Match} from "../Data/Match";
import {StringTableEntry} from "../Data/StringTable";
export function handleStringTable(packet: StringTablePacket, match: Match) {
for (const table of packet.tables) {
@ -20,5 +21,18 @@ export function handleStringTable(packet: StringTablePacket, match: Match) {
}
}
}
if (table.name === 'instancebaseline') {
for (const instanceBaseLine of table.entries) {
saveInstanceBaseLine(instanceBaseLine, match);
}
}
}
}
function saveInstanceBaseLine(entry: StringTableEntry, match: Match) {
if (entry.extraData) {
match.staticBaseLines[parseInt(entry.text, 10)] = entry.extraData;
} else {
throw new Error('Missing baseline');
}
}