From e4a8cacb7688b08e2778fe36a4685489b22e7cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Gim=C3=A9nez?= Date: Mon, 3 Jun 2024 18:33:37 +0900 Subject: [PATCH] find object by ID --- pkg/data/objects.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/data/objects.go b/pkg/data/objects.go index c9d647d..9bc548e 100644 --- a/pkg/data/objects.go +++ b/pkg/data/objects.go @@ -24,6 +24,16 @@ func (o Objects) FindOne(name object.Name) (Object, bool) { return Object{}, false } +func (o Objects) FindByID(id UnitID) (Object, bool) { + for _, obj := range o { + if obj.ID == id { + return obj, true + } + } + + return Object{}, false +} + func (o Object) IsWaypoint() bool { switch o.Name { case object.WaypointPortal,