dredless 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4547,14 +4547,18 @@
|
|
|
4547
4547
|
return this.bytes[this.offset++];
|
|
4548
4548
|
}
|
|
4549
4549
|
readUnsigned() {
|
|
4550
|
-
|
|
4551
|
-
|
|
4550
|
+
const first = this.readByte();
|
|
4551
|
+
if (first < 128) return first;
|
|
4552
|
+
let result = first & 127;
|
|
4553
|
+
let multiplier = 128;
|
|
4554
|
+
let shift = 7;
|
|
4552
4555
|
while (true) {
|
|
4553
4556
|
const byte = this.readByte();
|
|
4554
|
-
result += (byte & 127) *
|
|
4557
|
+
result += (byte & 127) * multiplier;
|
|
4555
4558
|
if ((byte & 128) === 0) return result;
|
|
4556
4559
|
shift += 7;
|
|
4557
4560
|
if (shift > 70) throw new Error("model_data varint too large");
|
|
4561
|
+
multiplier *= 128;
|
|
4558
4562
|
}
|
|
4559
4563
|
}
|
|
4560
4564
|
readStreamInt() {
|
|
@@ -7360,6 +7364,7 @@
|
|
|
7360
7364
|
}
|
|
7361
7365
|
#readSectionRecords(reader, tag, tableId, spec) {
|
|
7362
7366
|
const section2 = { tag, table: tableId, name: spec?.name || null, records: [] };
|
|
7367
|
+
let records = this.tables.get(tableId);
|
|
7363
7368
|
let entity = 0;
|
|
7364
7369
|
while (reader.remaining > 0) {
|
|
7365
7370
|
const recordOffset = reader.offset;
|
|
@@ -7377,7 +7382,9 @@
|
|
|
7377
7382
|
} catch (error) {
|
|
7378
7383
|
throw new Error(`model table ${tableId} tag ${tag} entity ${entity} mask offset ${reader.offset}: ${error.message}`);
|
|
7379
7384
|
}
|
|
7380
|
-
|
|
7385
|
+
if (!records) this.tables.set(tableId, records = /* @__PURE__ */ new Map());
|
|
7386
|
+
let record = records.get(entity);
|
|
7387
|
+
if (!record) records.set(entity, record = { ...spec?.defaults });
|
|
7381
7388
|
record.lastMask = mask;
|
|
7382
7389
|
try {
|
|
7383
7390
|
if (spec) this.#applyRecordSpec(reader, record, mask, spec);
|
|
@@ -7390,12 +7397,6 @@
|
|
|
7390
7397
|
}
|
|
7391
7398
|
return section2;
|
|
7392
7399
|
}
|
|
7393
|
-
#getRecord(tableId, entity) {
|
|
7394
|
-
if (!this.tables.has(tableId)) this.tables.set(tableId, /* @__PURE__ */ new Map());
|
|
7395
|
-
const records = this.tables.get(tableId);
|
|
7396
|
-
if (!records.has(entity)) records.set(entity, { ...MODEL_TABLE_SPECS2.get(tableId)?.defaults });
|
|
7397
|
-
return records.get(entity);
|
|
7398
|
-
}
|
|
7399
7400
|
#applyRecordSpec(reader, record, mask, spec) {
|
|
7400
7401
|
if (typeof spec.read === "function") {
|
|
7401
7402
|
spec.read(reader, record, mask);
|