use connectingPlayer instead of request
This commit is contained in:
parent
e478bf46fc
commit
8aa5cd88ef
4
main.go
4
main.go
@ -106,7 +106,7 @@ func joinPrivateGame(c *gin.Context) {
|
|||||||
req.PlayerID != nil &&
|
req.PlayerID != nil &&
|
||||||
req.LobbyID != nil { //is reconnect
|
req.LobbyID != nil { //is reconnect
|
||||||
lobby := u.FindExistingPrivateLobbyByID(utils.Passphrase(*req.Passphrase))
|
lobby := u.FindExistingPrivateLobbyByID(utils.Passphrase(*req.Passphrase))
|
||||||
_, found := lobby.GetPlayerByUUID(*req.PlayerID)
|
_, found := lobby.GetPlayerByUUID(connectingPlayer.Uuid)
|
||||||
if found {
|
if found {
|
||||||
c.IndentedJSON(
|
c.IndentedJSON(
|
||||||
http.StatusOK,
|
http.StatusOK,
|
||||||
@ -121,8 +121,6 @@ func joinPrivateGame(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player = chess.NewPlayer(uuid.New())
|
|
||||||
|
|
||||||
mut.Lock()
|
mut.Lock()
|
||||||
defer mut.Unlock()
|
defer mut.Unlock()
|
||||||
lobby := u.FindExistingPrivateLobbyByID(utils.Passphrase(*req.Passphrase))
|
lobby := u.FindExistingPrivateLobbyByID(utils.Passphrase(*req.Passphrase))
|
||||||
|
Loading…
Reference in New Issue
Block a user