From 5074ed24edd1530b793d0a62ef38994e3dcb075a Mon Sep 17 00:00:00 2001 From: gravestench Date: Tue, 30 Mar 2021 11:22:34 -0700 Subject: [PATCH] export ds1.SubstitutionType --- d2common/d2fileformats/d2ds1/ds1.go | 12 ++++++------ d2common/d2fileformats/d2ds1/ds1_test.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/d2common/d2fileformats/d2ds1/ds1.go b/d2common/d2fileformats/d2ds1/ds1.go index d78d553d..7ac603b0 100644 --- a/d2common/d2fileformats/d2ds1/ds1.go +++ b/d2common/d2fileformats/d2ds1/ds1.go @@ -34,7 +34,7 @@ type DS1 struct { version ds1version Act int32 // Act, from 1 to 5. This tells which Act table to use for the Objects list - substitutionType int32 // SubstitutionType (layer type): 0 if no layer, else type 1 or type 2 + SubstitutionType int32 // SubstitutionType (layer type): 0 if no layer, else type 1 or type 2 unknown1 []byte unknown2 uint32 } @@ -104,12 +104,12 @@ func (ds1 *DS1) loadHeader(br *d2datautils.StreamReader) error { } if ds1.version.specifiesSubstitutionType() { - ds1.substitutionType, err = br.ReadInt32() + ds1.SubstitutionType, err = br.ReadInt32() if err != nil { return fmt.Errorf("reading substitution type: %w", err) } - switch ds1.substitutionType { + switch ds1.SubstitutionType { case subType1, subType2: ds1.PushSubstitution(&layer{}) } @@ -282,7 +282,7 @@ func (ds1 *DS1) loadSubstitutions(br *d2datautils.StreamReader) error { var err error hasSubstitutions := ds1.version.hasSubstitutions() && - (ds1.substitutionType == subType1 || ds1.substitutionType == subType2) + (ds1.SubstitutionType == subType1 || ds1.SubstitutionType == subType2) if !hasSubstitutions { ds1.substitutionGroups = make([]SubstitutionGroup, 0) @@ -548,7 +548,7 @@ func (ds1 *DS1) Marshal() []byte { } if ds1.version.specifiesSubstitutionType() { - sw.PushInt32(ds1.substitutionType) + sw.PushInt32(ds1.SubstitutionType) } if ds1.version.hasFileList() { @@ -592,7 +592,7 @@ func (ds1 *DS1) Marshal() []byte { // Step 4 - encode Substitutions hasSubstitutions := ds1.version.hasSubstitutions() && - (ds1.substitutionType == subType1 || ds1.substitutionType == subType2) + (ds1.SubstitutionType == subType1 || ds1.SubstitutionType == subType2) if hasSubstitutions { sw.PushUint32(ds1.unknown2) diff --git a/d2common/d2fileformats/d2ds1/ds1_test.go b/d2common/d2fileformats/d2ds1/ds1_test.go index cf0e9534..37246152 100644 --- a/d2common/d2fileformats/d2ds1/ds1_test.go +++ b/d2common/d2fileformats/d2ds1/ds1_test.go @@ -177,7 +177,7 @@ func exampleData() *DS1 { //nolint:funlen // not a big deal if this is long func substitutionGroups: nil, version: 17, Act: 1, - substitutionType: 0, + SubstitutionType: 0, unknown1: make([]byte, 8), unknown2: 20, }