mahjong-helper icon indicating copy to clipboard operation
mahjong-helper copied to clipboard

观战出现 index out of range 内部错误及其他问题

Open ZhaoWeicheng98 opened this issue 2 years ago • 0 comments

使用0.2.8 release 或 master 直接clone运行均会出现。

选择观战时出现内部错误。

尝试进行了分析,发现在观战时,收到的消息LiveFastAction不为空,而LiveBaseInfo为空。因此server.go 中279-286行的逻辑不会触发,导致h.majsoulRoundData.selfSeat仍然为-1,而不会设为0。在h._loadLiveAction(d.LiveFastAction, true) -> h._analysisMajsoulRoundData(action.Action, "") -> h.majsoulRoundData.analysis() -> roundNumber, benNumber, dealer, doraIndicators, hands, numRedFives := d.parser.ParseInit() 的调用链后,会在majsoul.go 第332行majsoulTiles = [][]string{msg.Tiles0, msg.Tiles1, msg.Tiles2, msg.Tiles3}[d.selfSeat] 因为 d.selfSeat为-1而引发Runtime Error。

我尝试将原有观战逻辑复制过去后,发现有显示不正常的情况,还存在一局结束之后不会继续的问题,即使手动切换座位,也无法。(debug和牌之后不能接收到RecordDiscardTile和RecordDealTile这些消息,导致不会继续,但和了消息似乎可以正常接收到,可能core.js方面也需要改动)结合雀魂在观战中追加了牌谱回看的功能,有理由怀疑雀魂将观战和观看牌谱的逻辑进行了合并,导致出现了问题。(另外如果在观战时回溯牌谱,则会出现div 0 的Runtime Error, 应该是不能正确获取局数所致。)

ZhaoWeicheng98 avatar Apr 02 '22 04:04 ZhaoWeicheng98