debug日志

This commit is contained in:
hahwu 2025-01-21 19:16:05 +08:00
parent 038b89db28
commit 056dd07c15

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,
@ -80,7 +88,7 @@ func (p *PlayerChessData) UpdatePlayerChessData(player *Player, buf []byte) erro
for _, v := range update.MChessHandle {
HandleStr += fmt.Sprintf("%v-%v-%v,", v.Id, v.ChessId, v.Type)
}
log.Debug("棋子数据不一致, %v===%v===%v===%v", update.MChessHandle, LastMap, p.Data.MChessData, player.PlayMod.getChessMod().GetChessList())
log.Debug("棋子数据不一致, %v===%v===%v===%v", HandleStr, LastMap, p.Data.MChessData, player.PlayMod.getChessMod().GetChessList())
player.SendErrClienRes(res)
return fmt.Errorf("棋子数据不一致")
}