Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
BododB committed Jan 23, 2021
2 parents b5cba04 + 500f110 commit 5e5f49d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/renderer/components/ChessGround.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export default {
left = 87.5 - left
}
const vertical = this.turn === this.orientation ? 0 : (7 - 3) * 12.5
const vertical = this.turn === this.orientation ? 0 : (8 - this.promotions.length) * 12.5
return { left: `${left}%`, top: `${vertical}%` }
} else {
return undefined
Expand Down Expand Up @@ -468,6 +468,16 @@ export default {
if (this.variant === 'shogi') {
const key = uciMove.substring(2, 4)
const type = this.board.state.pieces[key].role
let num = 0
let promo = false
for (let i = 0; i < this.legalMoves.length; i++) {
if (this.legalMoves[i].includes(uciMove)) {
num = num + 1
if (this.legalMoves[i].includes('+')) {
promo = true
}
}
}
if (type === 'pawn') {
this.promotions = [
{ type: 'pawn' },
Expand Down Expand Up @@ -499,6 +509,9 @@ export default {
{ type: 'prook' }
]
}
if (num === 1 && promo) {
this.promotions = [this.promotions[1]]
}
}
},
resetPockets (pieces) {
Expand Down

0 comments on commit 5e5f49d

Please sign in to comment.