// add the given list to the head of the list public void prepend_list(simple_list <_ElementType> list) { int count = list.count(); if (count == 0) { return; } _ElementType tail = list.last(); _ElementType head = list.detach_all(); tail.m_next_set(m_head); m_head = head; if (m_tail == null) { m_tail = tail; } m_count += count; }
//------------------------------------------------- // postload - after loading a save state //------------------------------------------------- void postload() { // remove all timers and make a private list of permanent ones simple_list <emu_timer> private_list = new simple_list <emu_timer>(); while (m_timer_list != null) { emu_timer timer = m_timer_list; // temporary timers go away entirely (except our special never-expiring one) if (timer.m_temporary && !timer.expire().is_never()) { m_timer_allocator.reclaim(timer.release()); } // permanent ones get added to our private list else { private_list.append(timer_list_remove(timer)); } } { // now re-insert them; this effectively re-sorts them by time emu_timer timer; while ((timer = private_list.detach_head()) != null) { timer_list_insert(timer); } } m_suspend_changes_pending = true; rebuild_execute_list(); // report the timer state after a log LOG("After resetting/reordering timers:\n"); #if VERBOSE dump_timers(); #endif }
// add the given list to the tail of the list void append_list(simple_list <_ElementType>&list) { int count = list.count(); if (count == 0) { return; } _ElementType *tail = list.last(); _ElementType *head = list.detach_all(); if (m_tail != NULL) { m_tail->m_next = head; } else { m_head = head; } m_tail = tail; m_count += count; }