优化代码结构,移除未使用的依赖和冗余代码

This commit is contained in:
1
2026-01-26 14:12:12 +00:00
parent c42650145d
commit 1a95ce8c48
6 changed files with 50 additions and 27 deletions

View File

@@ -2,6 +2,7 @@ package fight
import (
"blazing/common/data/xmlres"
"blazing/common/socket/errorcode"
"blazing/common/utils"
"blazing/cool"
"context"
@@ -20,7 +21,25 @@ import (
)
func (f *FightC) battleLoop() {
defer func() {
if err := recover(); err != nil { // 恢复 panicerr 为 panic 错误值
// 1. 打印错误信息
cool.Logger.Error(context.TODO(), "panic 错误:", err)
f.Broadcast(func(ff *input.Input) {
if p, ok := ff.Player.(*player.Player); ok {
head := common.NewTomeeHeader(1001, p.Info.UserID)
head.Result = uint32(errorcode.ErrorCodes.ErrSystemBusyTryLater)
//实际上这里有个问题,会造成重复保存问题
p.SendPack(head.Pack(nil))
}
})
}
}()
f.actionChan = make(chan action.BattleActionI, 10)
//fmt.Println("战斗开始精灵", f.Our.Player.GetInfo().PetList[0].CatchTime)