From 15b40c7915fca14e537534ae9ba03f3add965943 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Fri, 13 Jun 2025 03:35:56 -0300 Subject: more work on `operate.cc` --- src/info.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/info.cc') diff --git a/src/info.cc b/src/info.cc index 3cdfe02..0461356 100644 --- a/src/info.cc +++ b/src/info.cc @@ -486,6 +486,17 @@ Object GetInventoryObject(uint32 CreatureID, ObjectType Type, uint32 Value){ return Result; } +bool IsHeldByContainer(Object Obj, Object Con){ + // TODO(fusion): Why do we check for map container in some loops? + while(Obj != NONE && !Obj.getObjectType().isMapContainer()){ + if(Obj == Con){ + return true; + } + Obj = Obj.getContainer(); + } + return false; +} + int CountObjectsInContainer(Object Con){ if(!Con.exists()){ error("CountObjectsInContainer: Container existiert nicht.\n"); -- cgit v1.2.3