socket断开自动保存数据

This commit is contained in:
hahwu 2026-03-12 11:23:31 +08:00
parent a446431de4
commit 042f6339d5
2 changed files with 2 additions and 1 deletions

View File

@ -513,6 +513,7 @@ func (ad *GameLogic) ClearData(args []interface{}) {
player := args[0].(*Player) player := args[0].(*Player)
if player != nil && player.M_DwUin != 0 { if player != nil && player.M_DwUin != 0 {
player.agent = nil player.agent = nil
player.AutoSaveData()
log.Debug("player %d 断开连接", player.M_DwUin) log.Debug("player %d 断开连接", player.M_DwUin)
player.CallEvent(120*time.Second, func() { player.CallEvent(120*time.Second, func() {
player.lock.Lock() player.lock.Lock()

View File

@ -556,7 +556,7 @@ func (p *Player) AutoSaveData() {
if err != nil { if err != nil {
log.Debug("AutoSaveData Commit failed:", err) log.Debug("AutoSaveData Commit failed:", err)
} }
log.Release("uid: %d, auto save data", p.M_DwUin)
} }
// 重新连接 // 重新连接