fix(service): 修复玩家离开地图时的逻辑判断

移除重复的 MapID 检查逻辑,避免在 controller 和 service 中
同时进行相同判断。原 controller 中的 MapID 重置逻辑已被注释,
确保 leave map 流程的一致性和正确性。
```
This commit is contained in:
2025-11-16 12:23:30 +08:00
parent 4c21c4ac78
commit a6c11e0837
2 changed files with 1 additions and 4 deletions

View File

@@ -49,7 +49,7 @@ func (h *Controller) MapLeave(data *maps.LeaveMapInboundInfo, c *player.Player)
// 如果有正在运行的刷怪协程,发送停止信号
c.Info.MapID = 0 // 重置当前地图
//c.Info.MapID = 0 // 重置当前地图
return &info.LeaveMapOutboundInfo{UserID: c.Info.UserID}, 0
}
func (h *Controller) MapList(data *maps.ListMapPlayerInboundInfo, c *player.Player) (result *info.ListMapPlayerOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的

View File

@@ -17,9 +17,6 @@ func (s *Space) LeaveMap(c common.PlayerI) {
if c.GetInfo() == nil {
return
}
if c.GetInfo().MapID == 0 {
return
}
s.UP_ARENA(c, 0) //退出擂台
s.User.Range(func(k uint32, v common.PlayerI) (stop bool) {