add Deleted property to IEntity

cleanup Map.GetObjectsInRange
additional hashtable -> dictionary conversions
generic timer impl for EffectController
This commit is contained in:
Mark Sturgill 2013-11-02 10:52:08 -07:00
parent 4fccb0c3d3
commit 436e8f054a
7 changed files with 84 additions and 76 deletions

View file

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Collections;
using Server;
namespace Server.Engines.BulkOrders
@ -127,22 +127,22 @@ namespace Server.Engines.BulkOrders
}
private static Hashtable m_Cache;
private static Dictionary<string,Dictionary<string,SmallBulkEntry[]>> m_Cache;
public static SmallBulkEntry[] GetEntries( string type, string name )
{
if ( m_Cache == null )
m_Cache = new Hashtable();
if (m_Cache == null)
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
Hashtable table = (Hashtable)m_Cache[type];
Dictionary<string, SmallBulkEntry[]> table = null;
if ( table == null )
m_Cache[type] = table = new Hashtable();
if (!m_Cache.TryGetValue(type, out table))
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
SmallBulkEntry[] entries = (SmallBulkEntry[])table[name];
SmallBulkEntry[] entries = null;
if ( entries == null )
table[name] = entries = SmallBulkEntry.LoadEntries( type, name );
if (!table.TryGetValue(name, out entries))
table[name] = entries = SmallBulkEntry.LoadEntries(type, name);
return entries;
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Server;
@ -43,22 +42,22 @@ namespace Server.Engines.BulkOrders
get{ return GetEntries( "Tailoring", "leather" ); }
}
private static Hashtable m_Cache;
private static Dictionary<string, Dictionary<string, SmallBulkEntry[]>> m_Cache;
public static SmallBulkEntry[] GetEntries( string type, string name )
{
if ( m_Cache == null )
m_Cache = new Hashtable();
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
Hashtable table = (Hashtable)m_Cache[type];
Dictionary<string, SmallBulkEntry[]> table = null;
if ( table == null )
m_Cache[type] = table = new Hashtable();
if (!m_Cache.TryGetValue(type, out table))
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
SmallBulkEntry[] entries = (SmallBulkEntry[])table[name];
SmallBulkEntry[] entries = null;
if ( entries == null )
table[name] = entries = LoadEntries( type, name );
if (!table.TryGetValue(name, out entries))
table[name] = entries = LoadEntries(type, name);
return entries;
}

View file

@ -1,5 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
namespace Server.Engines.Plants
@ -40,11 +40,11 @@ namespace Server.Engines.Plants
public class PlantHueInfo
{
private static Hashtable m_Table;
private static Dictionary<PlantHue, PlantHueInfo> m_Table;
static PlantHueInfo()
{
m_Table = new Hashtable();
m_Table = new Dictionary<PlantHue, PlantHueInfo>();
m_Table[PlantHue.Plain] = new PlantHueInfo( 0, 1060813, PlantHue.Plain, 0x835 );
m_Table[PlantHue.Red] = new PlantHueInfo( 0x66D, 1060814, PlantHue.Red, 0x24 );
@ -69,12 +69,12 @@ namespace Server.Engines.Plants
public static PlantHueInfo GetInfo( PlantHue plantHue )
{
PlantHueInfo info = m_Table[plantHue] as PlantHueInfo;
PlantHueInfo info = null;
if ( info != null )
if (m_Table.TryGetValue(plantHue, out info))
return info;
else
return (PlantHueInfo)m_Table[PlantHue.Plain];
return m_Table[PlantHue.Plain];
}
public static PlantHue RandomFirstGeneration()