优化代码结构,移除未使用的依赖和冗余代码
This commit is contained in:
@@ -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 { // 恢复 panic,err 为 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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user