dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit b11ca02d5ce0b4dd231edde987b4f50eb5d00aa0
parent 9e7dfb2e6de781bec6a6d10f0d8281aab7a495db
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 12 Jun 2023 12:11:49 -0700

useless code

Diffstat:
Mpkg/web/handlers/handlers.go | 5+++--
Mpkg/web/handlers/interceptors/chess.go | 3---
2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -4998,7 +4998,7 @@ func ChessGameHandler(c echo.Context) error { user2, _ := db.GetUserByID(30814) interceptors.ChessInstance.NewGame(key, user1, user2) g = interceptors.ChessInstance.GetGame(key) - chessGameEnPassant(g) + chessGamePromoW(g) } else { return c.Redirect(http.StatusFound, "/") } @@ -5173,7 +5173,8 @@ Loop: send(fmt.Sprintf(`<style>#%s { display: none; }</style>`, payload.IDStr2)) } if payload.Move.Promo() != chess.NoPieceType { - promoImg := "/public/img/chess/" + payload.Turn.String() + strings.ToUpper(payload.Move.Promo().String()) + ".png" + pieceColor := utils.Ternary(payload.Move.S2().Rank() == 7, chess.White, chess.Black) + promoImg := "/public/img/chess/" + pieceColor.String() + strings.ToUpper(payload.Move.Promo().String()) + ".png" send(fmt.Sprintf(`<style>#%s { background-image: url("%s") !important; }</style>`, payload.IDStr1, promoImg)) } c.Response().Flush() diff --git a/pkg/web/handlers/interceptors/chess.go b/pkg/web/handlers/interceptors/chess.go @@ -32,7 +32,6 @@ type ChessMove struct { CheckW bool CheckB bool Move chess.Move - Turn chess.Color } var ChessPubSub = pubsub.NewPubSub[ChessMove]() @@ -536,7 +535,6 @@ func (b *Chess) SendMove(gameKey string, userID database.UserID, g *ChessGame, c //fmt.Println(moveStr) - turn := g.Game.Position().Turn() _ = g.Game.MoveStr(moveStr) g.lastUpdated = time.Now() idStr2 := g.PiecesCache[mov.S2()] @@ -558,7 +556,6 @@ func (b *Chess) SendMove(gameKey string, userID database.UserID, g *ChessGame, c CheckW: g.Game.Position().Turn() == chess.White && mov.HasTag(chess.Check), CheckB: g.Game.Position().Turn() == chess.Black && mov.HasTag(chess.Check), Move: mov, - Turn: turn, } ChessPubSub.Pub(gameKey, chessMov)