Fix bug that did not delete the pawn taken by enPassant.
This commit is contained in:
parent
9fbffc61f9
commit
72faedc000
@ -122,7 +122,8 @@ func (p *Pawn) HandleEnPassant(b *Board, move, lastMove types.Move) (bool, error
|
|||||||
}
|
}
|
||||||
|
|
||||||
if wasEnPassant { //play the move
|
if wasEnPassant { //play the move
|
||||||
delete(b.position, lastMove.EndSquare)
|
delete(b.position, lastMove.EndSquare) // take opponent's pawn
|
||||||
|
delete(b.position, move.StartSquare) // move moving pawn
|
||||||
b.position[move.EndSquare] = GetPieceForShortName(move.PieceMoved)
|
b.position[move.EndSquare] = GetPieceForShortName(move.PieceMoved)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
main.go
1
main.go
@ -88,7 +88,6 @@ func hostPrivateGame(c *gin.Context) {
|
|||||||
|
|
||||||
func joinPrivateGame(c *gin.Context) {
|
func joinPrivateGame(c *gin.Context) {
|
||||||
req := api.PlayerInfo{}
|
req := api.PlayerInfo{}
|
||||||
log.Println("OI, WHERES ME LOGS")
|
|
||||||
log.Println(c.Request.Body)
|
log.Println(c.Request.Body)
|
||||||
err := c.ShouldBindJSON(&req)
|
err := c.ShouldBindJSON(&req)
|
||||||
if err != nil || req.Passphrase == nil || *req.Passphrase == "" {
|
if err != nil || req.Passphrase == nil || *req.Passphrase == "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user