This commit is contained in:
hahwu 2025-02-06 19:04:58 +08:00
parent 4b5b936a18
commit 0db815ba45

View File

@ -55,11 +55,20 @@ func (p *PlayerChessData) UpdatePlayerChessData(player *Player, buf []byte) erro
update := &msg.UpdatePlayerChessData{}
proto.Unmarshal(buf, update)
err := p.HandleChess(player, update.MChessHandle)
LastMap := player.PlayMod.getChessMod().ChessMap
if err != nil {
res := &msg.ResUpdatePlayerChessData{
Code: msg.RES_CODE_FAIL,
Msg: err.Error(),
}
HandleStr := ""
sort.Slice(update.MChessHandle, func(i, j int) bool {
return update.MChessHandle[i].Id < update.MChessHandle[j].Id
})
for _, v := range update.MChessHandle {
HandleStr += fmt.Sprintf("%v-%v-%v,", v.Id, v.ChessId, v.Type)
}
log.Debug("棋子操作队列错误, %v===%v===%v===%v", HandleStr, LastMap, p.Data.MChessData, player.PlayMod.getChessMod().GetChessList())
player.SendErrClienRes(res)
return err
}
@ -67,7 +76,6 @@ func (p *PlayerChessData) UpdatePlayerChessData(player *Player, buf []byte) erro
Code: msg.RES_CODE_SUCCESS,
})
p.Data.MChessData = update.MChessData
LastMap := player.PlayMod.getChessMod().ChessMap
if !p.checkChessEqual(player) {
res := &msg.ResUpdatePlayerChessData{
Code: msg.RES_CODE_FAIL,