small think in screen.cs

09/26/2011 14:15 asdalhog#1
hello everyone i this code in my source
this code make monster
Disappear..
can anyone help
Code:
        public double interval = 100;
        public System.Timers.Timer MyTimer;
  
        public List<Interfaces.IMapObject> Objects;
        public Client.GameState Owner;

        private Queue<IMapObject> OnAdd;
        private Queue<IMapObject> OnRemove;

        public Screen(Client.GameState client)
        {
            Owner = client;
            Objects = new List<IMapObject>(1000);
            OnAdd = new Queue<IMapObject>(300);
            OnRemove = new Queue<IMapObject>(300);


            MyTimer = new System.Timers.Timer(interval);
            MyTimer.AutoReset = true;

            MyTimer.Elapsed += new System.Timers.ElapsedEventHandler(Sceen_thread);
            MyTimer.Start();
        }

        public void Sceen_thread(object jjjhh, System.Timers.ElapsedEventArgs arg)
        {
            try
            {
                if (Owner.Alive)
                {
                    
                    try
                    {
                        while (OnAdd.Count != 0)
                            Objects.Add(OnAdd.Dequeue());
                        while (OnRemove.Count != 0)
                            Objects.Remove(OnRemove.Dequeue());
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.ToString());
                    }

                    if (Owner.Map.FreezeMonsters)
                        return;
                    for (int c = 0; c < Objects.Count; c++)
                    {
                        if (c >= Objects.Count)
                            break;
                        IMapObject obj = Objects[c];
                        if (obj != null)
                        {
09/26/2011 14:28 hatem555#2
i have the same code

but monisters are visable

dont have this problem

so the problem isnt at this code

i think
09/26/2011 14:38 asdalhog#3
its Disappear after kill like 300.000 monster