Require explicit INotifyActorDisposing
This commit is contained in:
@@ -135,6 +135,8 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public interface INotifyAddedToWorld { void AddedToWorld(Actor self); }
|
public interface INotifyAddedToWorld { void AddedToWorld(Actor self); }
|
||||||
public interface INotifyRemovedFromWorld { void RemovedFromWorld(Actor self); }
|
public interface INotifyRemovedFromWorld { void RemovedFromWorld(Actor self); }
|
||||||
|
|
||||||
|
[RequireExplicitImplementation]
|
||||||
public interface INotifyActorDisposing { void Disposing(Actor self); }
|
public interface INotifyActorDisposing { void Disposing(Actor self); }
|
||||||
public interface INotifyOwnerChanged { void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner); }
|
public interface INotifyOwnerChanged { void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner); }
|
||||||
public interface INotifyEffectiveOwnerChanged { void OnEffectiveOwnerChanged(Actor self, Player oldEffectiveOwner, Player newEffectiveOwner); }
|
public interface INotifyEffectiveOwnerChanged { void OnEffectiveOwnerChanged(Actor self, Player oldEffectiveOwner, Player newEffectiveOwner); }
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
ActOnFrozenActorsForAllPlayers(Refresh);
|
ActOnFrozenActorsForAllPlayers(Refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Disposing(Actor self)
|
void INotifyActorDisposing.Disposing(Actor self)
|
||||||
{
|
{
|
||||||
ActOnFrozenActorsForAllPlayers(Remove);
|
ActOnFrozenActorsForAllPlayers(Remove);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -523,7 +523,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
Clear(t);
|
Clear(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Disposing(Actor self)
|
void INotifyActorDisposing.Disposing(Actor self)
|
||||||
{
|
{
|
||||||
ClearAll();
|
ClearAll();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -824,7 +824,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void Disposing(Actor self)
|
void INotifyActorDisposing.Disposing(Actor self)
|
||||||
{
|
{
|
||||||
UnReserve();
|
UnReserve();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public int NetWorth { get; protected set; }
|
public int NetWorth { get; protected set; }
|
||||||
|
|
||||||
|
bool disposed;
|
||||||
|
|
||||||
public EditorResourceLayer(Actor self)
|
public EditorResourceLayer(Actor self)
|
||||||
{
|
{
|
||||||
if (self.World.Type != WorldType.Editor)
|
if (self.World.Type != WorldType.Editor)
|
||||||
@@ -198,8 +200,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
l.Draw(wr.Viewport);
|
l.Draw(wr.Viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool disposed;
|
void INotifyActorDisposing.Disposing(Actor self)
|
||||||
public void Disposing(Actor self)
|
|
||||||
{
|
{
|
||||||
if (disposed)
|
if (disposed)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
protected readonly CellLayer<CellContents> Content;
|
protected readonly CellLayer<CellContents> Content;
|
||||||
protected readonly CellLayer<CellContents> RenderContent;
|
protected readonly CellLayer<CellContents> RenderContent;
|
||||||
|
|
||||||
|
bool disposed;
|
||||||
|
|
||||||
public ResourceLayer(Actor self)
|
public ResourceLayer(Actor self)
|
||||||
{
|
{
|
||||||
world = self.World;
|
world = self.World;
|
||||||
@@ -286,8 +288,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return Content[cell].Type.Info.MaxDensity;
|
return Content[cell].Type.Info.MaxDensity;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool disposed;
|
void INotifyActorDisposing.Disposing(Actor self)
|
||||||
public void Disposing(Actor self)
|
|
||||||
{
|
{
|
||||||
if (disposed)
|
if (disposed)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
Shroud currentShroud;
|
Shroud currentShroud;
|
||||||
Func<PPos, bool> visibleUnderShroud, visibleUnderFog;
|
Func<PPos, bool> visibleUnderShroud, visibleUnderFog;
|
||||||
TerrainSpriteLayer shroudLayer, fogLayer;
|
TerrainSpriteLayer shroudLayer, fogLayer;
|
||||||
|
bool disposed;
|
||||||
|
|
||||||
public ShroudRenderer(World world, ShroudRendererInfo info)
|
public ShroudRenderer(World world, ShroudRendererInfo info)
|
||||||
{
|
{
|
||||||
@@ -301,8 +302,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return sprites[variant * variantStride + edgesToSpriteIndexOffset[(byte)edges]];
|
return sprites[variant * variantStride + edgesToSpriteIndexOffset[(byte)edges]];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool disposed;
|
void INotifyActorDisposing.Disposing(Actor self)
|
||||||
public void Disposing(Actor self)
|
|
||||||
{
|
{
|
||||||
if (disposed)
|
if (disposed)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
readonly World world;
|
readonly World world;
|
||||||
|
|
||||||
TerrainSpriteLayer render;
|
TerrainSpriteLayer render;
|
||||||
|
bool disposed;
|
||||||
|
|
||||||
public SmudgeLayer(Actor self, SmudgeLayerInfo info)
|
public SmudgeLayer(Actor self, SmudgeLayerInfo info)
|
||||||
{
|
{
|
||||||
@@ -207,8 +208,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
render.Draw(wr.Viewport);
|
render.Draw(wr.Viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool disposed;
|
void INotifyActorDisposing.Disposing(Actor self)
|
||||||
public void Disposing(Actor self)
|
|
||||||
{
|
{
|
||||||
if (disposed)
|
if (disposed)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
|
|
||||||
TerrainSpriteLayer render;
|
TerrainSpriteLayer render;
|
||||||
Theater theater;
|
Theater theater;
|
||||||
|
bool disposed;
|
||||||
|
|
||||||
public BuildableTerrainLayer(Actor self, BuildableTerrainLayerInfo info)
|
public BuildableTerrainLayer(Actor self, BuildableTerrainLayerInfo info)
|
||||||
{
|
{
|
||||||
@@ -75,8 +76,7 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
render.Draw(wr.Viewport);
|
render.Draw(wr.Viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool disposed;
|
void INotifyActorDisposing.Disposing(Actor self)
|
||||||
public void Disposing(Actor self)
|
|
||||||
{
|
{
|
||||||
if (disposed)
|
if (disposed)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user