Revert "In RemoveCellsFromPlayerShroud, don't call RemoveSource unless required."
This reverts commit 86b9227577.
This commit relied on the relationship not changing, but when a player is defeated their relationship can change due to becoming a spectator. This can cause a crash if the shroud is not removed. Revert the commit to resolve this crash.
This commit is contained in:
committed by
Gustas Kažukauskas
parent
89a4823a83
commit
ba632fbf8b
@@ -49,13 +49,7 @@ namespace OpenRA.Mods.Common.Effects
|
||||
p.Shroud.AddSource(this, sourceType, uv);
|
||||
}
|
||||
|
||||
void RemoveCellsFromPlayerShroud(Player p)
|
||||
{
|
||||
if (!validStances.HasRelationship(player.RelationshipWith(p)))
|
||||
return;
|
||||
|
||||
p.Shroud.RemoveSource(this);
|
||||
}
|
||||
void RemoveCellsFromPlayerShroud(Player p) { p.Shroud.RemoveSource(this); }
|
||||
|
||||
PPos[] ProjectedCells(World world)
|
||||
{
|
||||
|
||||
@@ -49,13 +49,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
p.Shroud.AddSource(this, Shroud.SourceType.Shroud, uv);
|
||||
}
|
||||
|
||||
protected override void RemoveCellsFromPlayerShroud(Actor self, Player p)
|
||||
{
|
||||
if (!info.ValidRelationships.HasRelationship(self.Owner.RelationshipWith(p)))
|
||||
return;
|
||||
|
||||
p.Shroud.RemoveSource(this);
|
||||
}
|
||||
protected override void RemoveCellsFromPlayerShroud(Actor self, Player p) { p.Shroud.RemoveSource(this); }
|
||||
|
||||
public override WDist Range
|
||||
{
|
||||
|
||||
@@ -44,13 +44,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
p.Shroud.AddSource(this, type, uv);
|
||||
}
|
||||
|
||||
protected void RemoveCellsFromPlayerShroud(Actor self, Player p)
|
||||
{
|
||||
if (!Info.ValidRelationships.HasRelationship(self.Owner.RelationshipWith(p)))
|
||||
return;
|
||||
|
||||
p.Shroud.RemoveSource(this);
|
||||
}
|
||||
protected void RemoveCellsFromPlayerShroud(Player p) { p.Shroud.RemoveSource(this); }
|
||||
|
||||
protected PPos[] ProjectedCells(Actor self)
|
||||
{
|
||||
@@ -64,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var cells = ProjectedCells(self);
|
||||
foreach (var player in self.World.Players)
|
||||
{
|
||||
RemoveCellsFromPlayerShroud(self, player);
|
||||
RemoveCellsFromPlayerShroud(player);
|
||||
AddCellsToPlayerShroud(self, player, cells);
|
||||
}
|
||||
}
|
||||
@@ -73,13 +67,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
void INotifyActorDisposing.Disposing(Actor self)
|
||||
{
|
||||
foreach (var player in self.World.Players)
|
||||
RemoveCellsFromPlayerShroud(self, player);
|
||||
RemoveCellsFromPlayerShroud(player);
|
||||
}
|
||||
|
||||
void INotifyKilled.Killed(Actor self, AttackInfo e)
|
||||
{
|
||||
foreach (var player in self.World.Players)
|
||||
RemoveCellsFromPlayerShroud(self, player);
|
||||
RemoveCellsFromPlayerShroud(player);
|
||||
}
|
||||
|
||||
protected override void TraitEnabled(Actor self)
|
||||
@@ -92,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
protected override void TraitDisabled(Actor self)
|
||||
{
|
||||
foreach (var player in self.World.Players)
|
||||
RemoveCellsFromPlayerShroud(self, player);
|
||||
RemoveCellsFromPlayerShroud(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,13 +55,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
p.Shroud.AddSource(this, type, uv);
|
||||
}
|
||||
|
||||
protected override void RemoveCellsFromPlayerShroud(Actor self, Player p)
|
||||
{
|
||||
if (!info.ValidRelationships.HasRelationship(self.Owner.RelationshipWith(p)))
|
||||
return;
|
||||
|
||||
p.Shroud.RemoveSource(this);
|
||||
}
|
||||
protected override void RemoveCellsFromPlayerShroud(Actor self, Player p) { p.Shroud.RemoveSource(this); }
|
||||
|
||||
public override WDist Range
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user