In RemoveCellsFromPlayerShroud, don't call RemoveSource unless required.
Since AddCellsToPlayerShroud only adds for players with a valid relationship, we can skip a dictionary lookup in RemoveSource by only attempting the remove if the relationship check passes as well.
This commit is contained in:
@@ -44,11 +44,19 @@ namespace OpenRA.Mods.Common.Effects
|
||||
|
||||
void AddCellsToPlayerShroud(Player p, PPos[] uv)
|
||||
{
|
||||
if (validStances.HasRelationship(player.RelationshipWith(p)))
|
||||
p.Shroud.AddSource(this, sourceType, uv);
|
||||
if (!validStances.HasRelationship(player.RelationshipWith(p)))
|
||||
return;
|
||||
|
||||
p.Shroud.AddSource(this, sourceType, uv);
|
||||
}
|
||||
|
||||
void RemoveCellsFromPlayerShroud(Player p) { p.Shroud.RemoveSource(this); }
|
||||
void RemoveCellsFromPlayerShroud(Player p)
|
||||
{
|
||||
if (!validStances.HasRelationship(player.RelationshipWith(p)))
|
||||
return;
|
||||
|
||||
p.Shroud.RemoveSource(this);
|
||||
}
|
||||
|
||||
PPos[] ProjectedCells(World world)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user