Esempio n. 1
0
        public void Dump()
        {
            // Dump - Print contents to the debug output window
            //        Using HASH code as its unique identifier
            Debug.WriteLine("   Name: {0} ({1})", this.name, this.GetHashCode());

            // Data:
            Debug.WriteLine("      Command: {0}", this.pCommand);
            Debug.WriteLine("   Event Name: {0}", this.name);
            Debug.WriteLine(" Trigger Time: {0}", this.triggerTime);
            Debug.WriteLine("   Delta Time: {0}", this.deltaTime);

            if (this.pNext == null)
            {
                Debug.WriteLine("      next: null");
            }
            else
            {
                TimeEvent pTmp = (TimeEvent)this.pNext;
                Debug.WriteLine("      next: {0} ({1})", pTmp.name, pTmp.GetHashCode());
            }

            if (this.pPrev == null)
            {
                Debug.WriteLine("      prev: null");
            }
            else
            {
                TimeEvent pTmp = (TimeEvent)this.pPrev;
                Debug.WriteLine("      prev: {0} ({1})", pTmp.name, pTmp.GetHashCode());
            }
        }
Esempio n. 2
0
        public void DumpTimeEvent()
        {
            Debug.WriteLine("Name: {0}, {1}", this.name, this.GetHashCode());
            Debug.WriteLine("Trigger: {0}, deltaTime: {1}", this.trigger, this.deltaTime);

            if (pCommand == null)
            {
                Debug.WriteLine("Command: null");
            }

            else
            {
                Debug.WriteLine("Command: #{0}", this.pCommand.GetHashCode());
            }

            if (this.pPrev == null)
            {
                Debug.WriteLine("previous: null");
            }
            else
            {
                TimeEvent pTemp = (TimeEvent)this.pPrev;
                Debug.WriteLine("previous: {0}, {1}", pTemp.name, pTemp.GetHashCode());
            }

            if (this.pNext == null)
            {
                Debug.WriteLine("next: null");
            }
            else
            {
                TimeEvent pTemp = (TimeEvent)this.pNext;
                Debug.WriteLine("next: {0}, {1}", pTemp.name, pTemp.GetHashCode());
            }
        }
Esempio n. 3
0
        //i definitely think the insert() needs to be cleaned up
        // i had alot of reference issues
        private static void Insert(TimeEvent pTEnode)
        {
            Debug.Assert(pTEnode != null);

            TimerMan pTMan = TimerMan.PrivGetInstance();

            Debug.Assert(pTMan != null);

            TimeEvent pEvent     = (TimeEvent)pTMan.BaseGetActive();
            TimeEvent pNextEvent = null;
            TimeEvent pPrevEvent = null;


            //very first node
            if (pEvent == null)
            {
                pTEnode.pPrev = null;
                pTEnode.pNext = null;
                DLink pTemp = (DLink)pTEnode;

                pEvent = (TimeEvent)pTMan.SetActive(ref pTemp);
            }

            //insert before the first node
            if (pTEnode.trigger < pEvent.trigger)
            {
                pTEnode.pNext = pEvent;
                pEvent.pPrev  = pTEnode;
                pTEnode.pPrev = null;


                DLink pTemp = (DLink)pTEnode;
                pEvent = (TimeEvent)pTMan.SetActive(ref pTemp);
            }

            while (pTEnode.trigger >= pEvent.trigger && pTEnode.GetHashCode() != pEvent.GetHashCode())
            {
                pNextEvent = (TimeEvent)pEvent.pNext;

                //then something is there
                if (pNextEvent != null)
                {
                    //insert into middle of list
                    if (pTEnode.trigger <= pNextEvent.trigger)
                    {
                        pPrevEvent = (TimeEvent)pEvent;

                        pTEnode.pNext = pNextEvent;
                        pTEnode.pPrev = pPrevEvent;

                        pPrevEvent.pNext = pTEnode;

                        pNextEvent.pPrev = pTEnode;

                        break;
                    }
                }

                //insert at the end of the list
                else
                {
                    pTEnode.pPrev = pEvent;
                    pEvent.pNext  = pTEnode;
                    pTEnode.pNext = null;

                    break;
                }
                pEvent = pNextEvent;
            }
        }