simplify World name concatenation

This commit is contained in:
wish
2023-12-31 16:30:11 +11:00
parent 5a8bc3b67a
commit 1aa2e36087

View File

@@ -47,20 +47,15 @@ func encodeServerInfo(config *_config.Config, s *Server, local bool) []byte {
bf.WriteUint8(si.Recommended) bf.WriteUint8(si.Recommended)
} }
if s.erupeConfig.RealClientMode <= _config.F5 { fullName := append(append(stringsupport.UTF8ToSJIS(si.Name), []byte{0x00}...), stringsupport.UTF8ToSJIS(si.Description)...)
combined := append(stringsupport.UTF8ToSJIS(si.Name), []byte{0x00}...) if s.erupeConfig.RealClientMode >= _config.G1 && s.erupeConfig.RealClientMode <= _config.G5 {
combined = append(combined, stringsupport.UTF8ToSJIS(si.Description)...) bf.WriteUint8(uint8(len(fullName)))
bf.WriteBytes(stringsupport.PaddedString(string(combined), 65, false)) bf.WriteBytes(fullName)
} else if s.erupeConfig.RealClientMode <= _config.G5 {
combined := append(stringsupport.UTF8ToSJIS(si.Name), []byte{0x00}...)
combined = append(combined, stringsupport.UTF8ToSJIS(si.Description)...)
bf.WriteUint8(uint8(len(combined)))
bf.WriteBytes(combined)
} else { } else {
bf.WriteUint8(0) // Ignored if s.erupeConfig.RealClientMode >= _config.G51 {
combined := append(stringsupport.UTF8ToSJIS(si.Name), []byte{0x00}...) bf.WriteUint8(0) // Ignored
combined = append(combined, stringsupport.UTF8ToSJIS(si.Description)...) }
bf.WriteBytes(stringsupport.PaddedString(string(combined), 65, false)) bf.WriteBytes(stringsupport.PaddedString(string(fullName), 65, false))
} }
if s.erupeConfig.RealClientMode >= _config.GG { if s.erupeConfig.RealClientMode >= _config.GG {