sort list of users

This commit is contained in:
Settel 2021-08-26 12:35:33 +02:00
parent 0e67101943
commit b3be0ba704

View File

@ -3,6 +3,7 @@ package game
import ( import (
"fmt" "fmt"
"sirlab.de/go/knyt/syncdata" "sirlab.de/go/knyt/syncdata"
"sort"
) )
func (gm *Game) populateSyncDataCb(syncData *syncdata.SyncData) { func (gm *Game) populateSyncDataCb(syncData *syncdata.SyncData) {
@ -34,6 +35,10 @@ func (gm *Game) getPlayers() []syncdata.PlayerInfo {
} }
} }
sort.Slice(players, func(a, b int) bool {
return players[a].Name < players[b].Name
})
return players return players
} }