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:
parent
fc6d758a31
commit
5fcbbe540e
2 changed files with 15 additions and 16 deletions
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue