Added player movement
This commit is contained in:
@ -3,7 +3,6 @@ package game
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net"
|
||||
@ -46,20 +45,14 @@ func (game *Game) Login(data []byte, address *net.UDPAddr, server *Server) error
|
||||
player.KeepAlive()
|
||||
|
||||
response := []byte{Success}
|
||||
response = appendString(response, account.ID)
|
||||
response = appendString(response, player.authToken)
|
||||
response = AppendString(response, account.ID)
|
||||
response = AppendString(response, player.authToken)
|
||||
server.Send(packet.Login, response, address)
|
||||
|
||||
game.onLogin(player)
|
||||
return nil
|
||||
}
|
||||
|
||||
func appendString(data []byte, str string) []byte {
|
||||
data = binary.LittleEndian.AppendUint32(data, uint32(len(str)))
|
||||
data = append(data, []byte(str)...)
|
||||
return data
|
||||
}
|
||||
|
||||
// Inform the newly logged in player about existing players.
|
||||
// Also inform existing players about the newly logged in player.
|
||||
func (game *Game) onLogin(player *Player) {
|
||||
|
Reference in New Issue
Block a user