Skip to content

Commit

Permalink
Update eo-protocol to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Aug 4, 2023
1 parent 582f3fc commit f9a2dc7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion eo-protocol
32 changes: 16 additions & 16 deletions pkg/eolib/protocol/net/server/structs_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -1172,23 +1172,23 @@ func (s *PubFile) Deserialize(reader data.EoReader) (err error) {

// PlayersList :: Information about online players.
type PlayersList struct {
OnlineCount int
Players []OnlinePlayer
PlayersCount int
Players []OnlinePlayer
}

func (s *PlayersList) Serialize(writer data.EoWriter) (err error) {
oldSanitizeStrings := writer.SanitizeStrings
defer func() { writer.SanitizeStrings = oldSanitizeStrings }()

writer.SanitizeStrings = true
// OnlineCount : field : short
if err = writer.AddShort(s.OnlineCount); err != nil {
// PlayersCount : length : short
if err = writer.AddShort(s.PlayersCount); err != nil {
return
}

writer.AddByte(0xFF)
// Players : array : OnlinePlayer
for ndx := 0; ndx < len(s.Players); ndx++ {
for ndx := 0; ndx < s.PlayersCount; ndx++ {
if err = s.Players[ndx].Serialize(writer); err != nil {
return
}
Expand All @@ -1204,13 +1204,13 @@ func (s *PlayersList) Deserialize(reader data.EoReader) (err error) {
defer func() { reader.SetIsChunked(oldIsChunked) }()

reader.SetIsChunked(true)
// OnlineCount : field : short
s.OnlineCount = reader.GetShort()
// PlayersCount : length : short
s.PlayersCount = reader.GetShort()
if err = reader.NextChunk(); err != nil {
return
}
// Players : array : OnlinePlayer
for ndx := 0; reader.Remaining() > 0; ndx++ {
for ndx := 0; ndx < s.PlayersCount; ndx++ {
s.Players = append(s.Players, OnlinePlayer{})
if err = s.Players[ndx].Deserialize(reader); err != nil {
return
Expand All @@ -1227,23 +1227,23 @@ func (s *PlayersList) Deserialize(reader data.EoReader) (err error) {

// PlayersListFriends :: Information about online players. Sent in reply to friends list requests.
type PlayersListFriends struct {
OnlineCount int
Players []string
PlayersCount int
Players []string
}

func (s *PlayersListFriends) Serialize(writer data.EoWriter) (err error) {
oldSanitizeStrings := writer.SanitizeStrings
defer func() { writer.SanitizeStrings = oldSanitizeStrings }()

writer.SanitizeStrings = true
// OnlineCount : field : short
if err = writer.AddShort(s.OnlineCount); err != nil {
// PlayersCount : length : short
if err = writer.AddShort(s.PlayersCount); err != nil {
return
}

writer.AddByte(0xFF)
// Players : array : string
for ndx := 0; ndx < len(s.Players); ndx++ {
for ndx := 0; ndx < s.PlayersCount; ndx++ {
if err = writer.AddString(s.Players[ndx]); err != nil {
return
}
Expand All @@ -1260,13 +1260,13 @@ func (s *PlayersListFriends) Deserialize(reader data.EoReader) (err error) {
defer func() { reader.SetIsChunked(oldIsChunked) }()

reader.SetIsChunked(true)
// OnlineCount : field : short
s.OnlineCount = reader.GetShort()
// PlayersCount : length : short
s.PlayersCount = reader.GetShort()
if err = reader.NextChunk(); err != nil {
return
}
// Players : array : string
for ndx := 0; reader.Remaining() > 0; ndx++ {
for ndx := 0; ndx < s.PlayersCount; ndx++ {
if s.Players[ndx], err = reader.GetString(); err != nil {
return
}
Expand Down

0 comments on commit f9a2dc7

Please sign in to comment.