From a52413daf70b49ab96d139a24ce4f220bf3bbff0 Mon Sep 17 00:00:00 2001 From: xzb <223@qq.com> Date: Wed, 23 Aug 2023 16:08:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=85=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- system/face_system.go | 8 ++++++-- util/common_util.go | 6 ------ 2 files changed, 6 insertions(+), 8 deletions(-) delete mode 100644 util/common_util.go diff --git a/system/face_system.go b/system/face_system.go index 01e1a40..ad025c8 100644 --- a/system/face_system.go +++ b/system/face_system.go @@ -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() +} diff --git a/util/common_util.go b/util/common_util.go deleted file mode 100644 index a1da24d..0000000 --- a/util/common_util.go +++ /dev/null @@ -1,6 +0,0 @@ -package util - -// 捕获panic并恢复执行 -func Recover() { - recover() -}