test
This commit is contained in:
parent
4362855786
commit
503fd8d938
18
packet.go
18
packet.go
@ -210,9 +210,9 @@ func (p *PacketServerWelcome) Read(b []byte) {
|
||||
r := bufio.NewReader(bytes.NewReader(b))
|
||||
r.Discard(3)
|
||||
p.ServerName, _ = r.ReadString(0)
|
||||
p.ServerName = p.Origin[:len(p.ServerName)-1]
|
||||
p.ServerName = p.ServerName[:len(p.ServerName)-1]
|
||||
p.OpenTTDVersion, _ = r.ReadString(0)
|
||||
p.OpenTTDVersion = p.Origin[:len(p.OpenTTDVersion)-1]
|
||||
p.OpenTTDVersion = p.OpenTTDVersion[:len(p.OpenTTDVersion)-1]
|
||||
c, _ := r.ReadByte()
|
||||
if c > 0 {
|
||||
p.Dedicated = true
|
||||
@ -220,7 +220,7 @@ func (p *PacketServerWelcome) Read(b []byte) {
|
||||
p.Dedicated = false
|
||||
}
|
||||
p.MapName, _ = r.ReadString(0)
|
||||
p.MapName = p.Origin[:len(p.MapName)-1]
|
||||
p.MapName = p.MapName[:len(p.MapName)-1]
|
||||
bs := make([]byte, 13)
|
||||
_, _ = r.Read(bs)
|
||||
p.MapSeed = binary.LittleEndian.Uint32(bs[0:])
|
||||
@ -273,9 +273,9 @@ func (p *PacketServerClientInfo) Read(b []byte) {
|
||||
_, _ = r.Read(bs)
|
||||
p.ClientID = binary.LittleEndian.Uint32(bs[0:])
|
||||
p.Address, _ = r.ReadString(0)
|
||||
p.Address = p.Origin[:len(p.Address)-1]
|
||||
p.Address = p.Address[:len(p.Address)-1]
|
||||
p.Name, _ = r.ReadString(0)
|
||||
p.Name = p.Origin[:len(p.Name)-1]
|
||||
p.Name = p.Name[:len(p.Name)-1]
|
||||
c, _ := r.ReadByte()
|
||||
p.Lang = uint8(c)
|
||||
bs = make([]byte, 4)
|
||||
@ -314,7 +314,7 @@ func (p *PacketServerChat) Read(b []byte) {
|
||||
_, _ = r.Read(bs)
|
||||
p.ClientID = binary.LittleEndian.Uint32(bs[0:])
|
||||
p.Message, _ = r.ReadString(0)
|
||||
p.Message = p.Origin[:len(p.Message)-1]
|
||||
p.Message = p.Message[:len(p.Message)-1]
|
||||
bs = make([]byte, 8)
|
||||
_, _ = r.Read(bs)
|
||||
p.Amount = binary.LittleEndian.Uint64(bs[0:])
|
||||
@ -326,7 +326,7 @@ func (p *PacketServerConsole) Read(b []byte) {
|
||||
p.Origin, _ = r.ReadString(0)
|
||||
p.Origin = p.Origin[:len(p.Origin)-1]
|
||||
p.Text, _ = r.ReadString(0)
|
||||
p.Text = p.Origin[:len(p.Text)-1]
|
||||
p.Text = p.Text[:len(p.Text)-1]
|
||||
}
|
||||
|
||||
func (p *PacketServerRCon) Read(b []byte) {
|
||||
@ -336,12 +336,12 @@ func (p *PacketServerRCon) Read(b []byte) {
|
||||
_, _ = r.Read(bs)
|
||||
p.ColorID = binary.LittleEndian.Uint16(bs[0:])
|
||||
p.Output, _ = r.ReadString(0)
|
||||
p.Output = p.Origin[:len(p.Output)-1]
|
||||
p.Output = p.Output[:len(p.Output)-1]
|
||||
}
|
||||
|
||||
func (p *PacketServerRConEnd) Read(b []byte) {
|
||||
r := bufio.NewReader(bytes.NewReader(b))
|
||||
r.Discard(3)
|
||||
p.Command, _ = r.ReadString(0)
|
||||
p.Command = p.Origin[:len(p.Command)-1]
|
||||
p.Command = p.Command[:len(p.Command)-1]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user