ACR_ServerMisc.ACR_ServerMisc.CreateAreaInstance C# (CSharp) Method

CreateAreaInstance() private method

Create a new instanced area, or return one from the free list if there was a free instance.
private CreateAreaInstance ( uint TemplateArea ) : uint
TemplateArea uint Supplies the template area object id. ///
return uint
        private uint CreateAreaInstance(uint TemplateArea)
        {
            Stack<uint> FreeList;

            if (InstancedAreaFreeList.TryGetValue(TemplateArea, out FreeList))
            {
                if (FreeList.Count != 0)
                    return FreeList.Pop();
            }

            uint AreaObject = CreateInstancedAreaFromSource(TemplateArea);

            if (AreaObject == OBJECT_INVALID)
                return OBJECT_INVALID;

            //
            // We've created a new area, so inform the AI subsystem that there
            // is a new area to add to its representation.
            //

            ClearScriptParams();
            AddScriptParameterInt(200); // AREA_ON_INSTANCE_CREATE
            ExecuteScriptEnhanced("ACR_CreatureBehavior", AreaObject, TRUE);

            return AreaObject;
        }