Change send modifications

This commit is contained in:
Niko Jochim 2020-05-13 15:07:23 +02:00
parent d553b72daf
commit a8e0bac437

View File

@ -46,12 +46,10 @@ class MultiplayerNetwork{
} }
func sendPlayerMove(unitcount:Int) { func sendPlayerMove(unitcount:Int) {
var playerMoveMsg = PlayerMove(messageType: MessageType.PlayerMove, unitCount: unitcount) let playerMoveMsg = PlayerMove(messageType: MessageType.PlayerMove, unitCount: unitcount)
let encoder = JSONEncoder()
let encoded = (try? encoder.encode(playerMoveMsg))!
let data = Data(bytes: &playerMoveMsg, count: MemoryLayout<PlayerMove>.size) sendData(data: encoded)
sendData(data: data)
} }
} }