Add ISingleInstanceInit interface.
Inits that are logically singletons (e.g. actor location or owner) should implement this interface to avoid runtime inconsistencies. Duplicate instances are rejected at init-time, allowing simpler queries when they are used.
This commit is contained in:
@@ -41,6 +41,11 @@ namespace OpenRA.Primitives
|
||||
return data.ContainsKey(typeof(T));
|
||||
}
|
||||
|
||||
public bool Contains(Type t)
|
||||
{
|
||||
return data.ContainsKey(t);
|
||||
}
|
||||
|
||||
public T Get<T>()
|
||||
{
|
||||
return (T)Get(typeof(T), true);
|
||||
|
||||
Reference in New Issue
Block a user