Skip to content

fix(record): remove duplicated header written by StandardVariableRecord.serialize - #90

Open
ngjunsiang wants to merge 1 commit into
open-dis:masterfrom
ngjunsiang:fix/sv-duplicated-header
Open

ngjunsiang wants to merge 1 commit into
open-dis:masterfrom
ngjunsiang:fix/sv-duplicated-header

Conversation

@ngjunsiang

Copy link
Copy Markdown
Contributor

Problem: StandardVariableRecord.serialize has a concrete abstract-method body that writes recordType (u32) + recordLength (u32), while every concrete subclass writes its own recordType u32 + recordLength u16 header after calling super().serialize() — so serialized SV records carry 8 duplicated header bytes and recordLength under-reports the record size (e.g. DirectedEnergyDamage: marshalledSize() 40, serialize() emits 48), and parse — which expects the single 6-byte header — misaligns on self-produced output.

Fix: reduce StandardVariableRecord.serialize to a docstring-only abstract method so subclasses own the §6.2.83 header; no production behavior other than removing the duplicated bytes.

Fixes #89.

Adds regression test tests/test_StandardVariableRecord.py (serialized length == marshalledSize == recordLength).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StandardVariableRecord.serialize writes a duplicated header (type u32 + length u32); recordLength should be u16 per §6.2.83

1 participant