diff --git a/d2common/d2fileformats/d2pl2/pl2.go b/d2common/d2fileformats/d2pl2/pl2.go index 1dd93832..79db5c21 100644 --- a/d2common/d2fileformats/d2pl2/pl2.go +++ b/d2common/d2fileformats/d2pl2/pl2.go @@ -42,8 +42,10 @@ func Load(data []byte) (*PL2, error) { return result, nil } +// Marshal encodes PL2 back into byte slice func (p *PL2) Marshal() []byte { restruct.EnableExprBeta() + data, err := restruct.Pack(binary.LittleEndian, p) if err != nil { panic(err) diff --git a/d2common/d2fileformats/d2pl2/pl2_test.go b/d2common/d2fileformats/d2pl2/pl2_test.go index f1e5a2f5..87be05ac 100644 --- a/d2common/d2fileformats/d2pl2/pl2_test.go +++ b/d2common/d2fileformats/d2pl2/pl2_test.go @@ -35,5 +35,6 @@ func TestPL2_MarshalUnmarshal(t *testing.T) { } if pl2.DarkendColorShift.Indices[0] != newPL2.DarkendColorShift.Indices[0] { + t.Fatal("unexpected index set") } }