www.pudn.com > boogiebot.zip > WmoManager.cs


using System; 
using System.Collections.Generic; 
using System.Text; 
 
namespace BoogieBot.Common 
{ 
    /// Manages WMO Data. Provides numerous useful methods to query wmo data, and does so by looking up (and if nessessary, loading in) the appropriate wmo. 
    public class WMOManager 
    { 
        private List wmos; 
 
        public WMOManager() 
        { 
            wmos = new List(); 
        } 
 
        // Notify the wmo manager that we have just zoned. 
        public void zoned() 
        { 
            // If we just zoned to a different map, do maintenance and flush the current wmo list 
            doMaintenance(true); 
        } 
 
        // Do maintenance 
        private void doMaintenance(Boolean flush) 
        { 
            // Delete all wmos off the list 
            if (flush) 
            { 
                wmos = new List(); 
            } 
 
            // If the list is getting long 
            if (wmos.Count > 100) 
            { 
                // Prune it. 
                wmos = new List(); 
            } 
        } 
 
        // DEBUG METHODS ///////////////////////////////////////////////////////////////// 
        public int DEBUG_wmoCount() 
        { 
            return wmos.Count; 
        } 
    } 
}