test
This commit is contained in:
parent
e8cd1c1764
commit
123ef0bdf5
10
packet.go
10
packet.go
@ -210,7 +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.OpenTTDVersion, _ = r.ReadString(0)
|
||||
p.OpenTTDVersion = p.Origin[:len(p.OpenTTDVersion)-1]
|
||||
c, _ := r.ReadByte()
|
||||
if c > 0 {
|
||||
p.Dedicated = true
|
||||
@ -218,6 +220,7 @@ func (p *PacketServerWelcome) Read(b []byte) {
|
||||
p.Dedicated = false
|
||||
}
|
||||
p.MapName, _ = r.ReadString(0)
|
||||
p.MapName = p.Origin[:len(p.MapName)-1]
|
||||
bs := make([]byte, 13)
|
||||
_, _ = r.Read(bs)
|
||||
p.MapSeed = binary.LittleEndian.Uint32(bs[0:])
|
||||
@ -270,7 +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.Name, _ = r.ReadString(0)
|
||||
p.Name = p.Origin[:len(p.Name)-1]
|
||||
c, _ := r.ReadByte()
|
||||
p.Lang = uint8(c)
|
||||
bs = make([]byte, 4)
|
||||
@ -309,6 +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]
|
||||
bs = make([]byte, 8)
|
||||
_, _ = r.Read(bs)
|
||||
p.Amount = binary.LittleEndian.Uint64(bs[0:])
|
||||
@ -318,7 +324,9 @@ func (p *PacketServerConsole) Read(b []byte) {
|
||||
r := bufio.NewReader(bytes.NewReader(b))
|
||||
r.Discard(3)
|
||||
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]
|
||||
}
|
||||
|
||||
func (p *PacketServerRCon) Read(b []byte) {
|
||||
@ -328,10 +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]
|
||||
}
|
||||
|
||||
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]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user