public void AddThing(int index, Thing thing)
        {
            #if DEBUG_TILE
            if (debugEnable)
                Trace.WriteLine("[AddThing] Id: " + thing.Id + ", Index: " + index);
            #endif
            if (thing == null)
                throw new Exception("[AddThing] Null thing.");

            if (index != 0xFF)
            {
                if (index == 0)
                {
                    var item = thing as Item;
                    if (item == null || !item.IsGround)
                        throw new Exception("[AddThing] Invalid ground item.");
                }

                things.Insert(index, thing);
            }
            else
            {
                if (thing is Creature)
                {
                    int pos = things.Count;
                    for (int i = 0; i < things.Count; i++)
                    {
                        if (things[i].Order > thing.Order)
                        {
                            pos = i;
                            break;
                        }
                    }

                    things.Insert(pos, thing);
                    ((Creature)thing).Location = Location;
                }
                else
                {
                    int pos = things.Count;
                    for (int i = 0; i < things.Count; i++)
                    {
                        if (things[i].Order >= thing.Order)
                        {
                            pos = i;
                            break;
                        }
                    }

                    things.Insert(pos, thing);
                }
            }

            if (things.Count > 10)
                RemoveThing(10);
        }
 public void AddThing(Thing thing)
 {
     AddThing(0xFF, thing);
 }
        public void ReplaceThing(int index, Thing thing)
        {
            #if DEBUG_TILE
            if (debugEnable)
                Trace.WriteLine("[ReplaceThing] Id: " + thing.Id + ", Index: " + index);
            #endif

            if (index < 0 || index >= ThingCount)
                throw new Exception("[ReplaceThing] Invalid stack value: " + index);

            if (index == 0)
            {
                var item = thing as Item;
                if (item == null || !item.IsGround)
                    throw new Exception("[ReplaceThing] Invalid ground item.");
            }

            things[index] = thing;

            if(thing is Creature)
                ((Creature)thing).Location = Location;
        }