mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-09-25 04:36:12 -04:00
text dictionary: added support for non-name (#??) strings
This commit is contained in:
parent
287fb2bf4d
commit
4104d9d9ae
@ -224,7 +224,13 @@ func (td *TextDictionary) Marshal() []byte {
|
||||
sw.PushUint32(0)
|
||||
|
||||
sw.PushUint32(uint32(dataPos))
|
||||
dataPos += len(key) + 1
|
||||
|
||||
if key[0] == '#' {
|
||||
// 1 for X, and 1 for separator
|
||||
dataPos += 2
|
||||
} else {
|
||||
dataPos += len(key) + 1
|
||||
}
|
||||
|
||||
sw.PushUint32(uint32(dataPos))
|
||||
dataPos += len(value) + 1
|
||||
@ -236,6 +242,10 @@ func (td *TextDictionary) Marshal() []byte {
|
||||
for _, key := range keys {
|
||||
value := (*td)[key]
|
||||
|
||||
if key[0] == '#' {
|
||||
key = "x"
|
||||
}
|
||||
|
||||
for _, i := range key {
|
||||
sw.PushBytes(byte(i))
|
||||
}
|
||||
|
@ -6,8 +6,11 @@ import (
|
||||
|
||||
func exampleData() *TextDictionary {
|
||||
result := &TextDictionary{
|
||||
"abc": "def",
|
||||
"someStr": "Some long string",
|
||||
"abc": "def",
|
||||
"someStr": "Some long string",
|
||||
// #2 is non-named (X: OK)
|
||||
// so 2 is an index in map
|
||||
"#2": "OK",
|
||||
"teststring": "TeStxwsas123 long strin122*8:wq",
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user