string table: fixed bug, when (despite OpenDiablo2#1080) string tables wasn't encoded correctly

This commit is contained in:
M. Sz 2021-03-05 13:12:53 +01:00
parent fb7279f6b0
commit da3fe0ed09
1 changed files with 3 additions and 8 deletions

View File

@ -2,7 +2,6 @@ package d2tbl
import ( import (
"fmt" "fmt"
"strconv" "strconv"
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2datautils" "github.com/OpenDiablo2/OpenDiablo2/d2common/d2datautils"
@ -190,7 +189,7 @@ func (td *TextDictionary) Marshal() []byte {
keys = append(keys, key) keys = append(keys, key)
} }
sw.PushInt32(int32(len(keys))) sw.PushUint32(uint32(len(keys)))
// version (always 0) // version (always 0)
sw.PushBytes(0) sw.PushBytes(0)
@ -246,16 +245,12 @@ func (td *TextDictionary) Marshal() []byte {
key = "x" key = "x"
} }
for _, i := range key { sw.PushBytes([]byte(key)...)
sw.PushBytes(byte(i))
}
// 0 as separator // 0 as separator
sw.PushBytes(0) sw.PushBytes(0)
for _, i := range value { sw.PushBytes([]byte(value)...)
sw.PushBytes(byte(i))
}
// 0 as separator // 0 as separator
sw.PushBytes(0) sw.PushBytes(0)