包重构
This commit is contained in:
parent
c289fd2f6d
commit
a52413daf7
@ -8,7 +8,6 @@ import (
|
||||
"github.com/yohamta/donburi/filter"
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/components"
|
||||
"joylink.club/rtsssimulation/util"
|
||||
)
|
||||
|
||||
// 外界与world交互请求定义
|
||||
@ -85,7 +84,7 @@ func FindEntityById(world ecs.World, id string) *ecs.Entry {
|
||||
func QueryEntityById(world ecs.World, q *ecs.Query, id string) *ecs.Entry {
|
||||
var entry *ecs.Entry = nil
|
||||
func() {
|
||||
defer util.Recover()
|
||||
defer simpleRecover()
|
||||
q.Each(world, func(e *ecs.Entry) {
|
||||
if id == components.DeviceIdentityComponent.Get(e).Id {
|
||||
entry = e
|
||||
@ -96,3 +95,8 @@ func QueryEntityById(world ecs.World, q *ecs.Query, id string) *ecs.Entry {
|
||||
//
|
||||
return entry
|
||||
}
|
||||
|
||||
// 捕获panic并恢复执行
|
||||
func simpleRecover() {
|
||||
recover()
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
package util
|
||||
|
||||
// 捕获panic并恢复执行
|
||||
func Recover() {
|
||||
recover()
|
||||
}
|
Loading…
Reference in New Issue
Block a user