Skip to content

Commit

Permalink
simplify World name concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
sekaiwish committed Dec 31, 2023
1 parent 5a8bc3b commit 1aa2e36
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions server/entranceserver/make_resp.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,15 @@ func encodeServerInfo(config *_config.Config, s *Server, local bool) []byte {
bf.WriteUint8(si.Recommended)
}

if s.erupeConfig.RealClientMode <= _config.F5 {
combined := append(stringsupport.UTF8ToSJIS(si.Name), []byte{0x00}...)
combined = append(combined, stringsupport.UTF8ToSJIS(si.Description)...)
bf.WriteBytes(stringsupport.PaddedString(string(combined), 65, false))
} 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)
fullName := append(append(stringsupport.UTF8ToSJIS(si.Name), []byte{0x00}...), stringsupport.UTF8ToSJIS(si.Description)...)
if s.erupeConfig.RealClientMode >= _config.G1 && s.erupeConfig.RealClientMode <= _config.G5 {
bf.WriteUint8(uint8(len(fullName)))
bf.WriteBytes(fullName)
} else {
bf.WriteUint8(0) // Ignored
combined := append(stringsupport.UTF8ToSJIS(si.Name), []byte{0x00}...)
combined = append(combined, stringsupport.UTF8ToSJIS(si.Description)...)
bf.WriteBytes(stringsupport.PaddedString(string(combined), 65, false))
if s.erupeConfig.RealClientMode >= _config.G51 {
bf.WriteUint8(0) // Ignored
}
bf.WriteBytes(stringsupport.PaddedString(string(fullName), 65, false))
}

if s.erupeConfig.RealClientMode >= _config.GG {
Expand Down

0 comments on commit 1aa2e36

Please sign in to comment.