Remove unnecessary this. references.

This commit is contained in:
Paul Chote
2019-06-07 21:07:16 +01:00
committed by abcdefg30
parent ebe37a44ad
commit dabc7ec8dd
15 changed files with 24 additions and 23 deletions

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Activities
public Activity TickOuter(Actor self) public Activity TickOuter(Actor self)
{ {
if (State == ActivityState.Done && Game.Settings.Debug.StrictActivityChecking) if (State == ActivityState.Done && Game.Settings.Debug.StrictActivityChecking)
throw new InvalidOperationException("Actor {0} attempted to tick activity {1} after it had already completed.".F(self, this.GetType())); throw new InvalidOperationException("Actor {0} attempted to tick activity {1} after it had already completed.".F(self, GetType()));
if (State == ActivityState.Queued) if (State == ActivityState.Queued)
{ {
@@ -147,7 +147,7 @@ namespace OpenRA.Activities
if (origin == this) if (origin == this)
Console.Write("*"); Console.Write("*");
Console.WriteLine(this.GetType().ToString().Split('.').Last()); Console.WriteLine(GetType().ToString().Split('.').Last());
if (ChildActivity != null) if (ChildActivity != null)
ChildActivity.PrintActivityTree(self, origin, level + 1); ChildActivity.PrintActivityTree(self, origin, level + 1);

View File

@@ -412,7 +412,7 @@ namespace OpenRA
if (enabledTargetablePositionTraits.Any()) if (enabledTargetablePositionTraits.Any())
return enabledTargetablePositionTraits.SelectMany(tp => tp.TargetablePositions(this)); return enabledTargetablePositionTraits.SelectMany(tp => tp.TargetablePositions(this));
return new[] { this.CenterPosition }; return new[] { CenterPosition };
} }
#region Scripting interface #region Scripting interface

View File

@@ -114,9 +114,10 @@ namespace OpenRA
// - a small margin so that tiles rendered partially above the top edge of the screen aren't pushed behind the clip plane // - a small margin so that tiles rendered partially above the top edge of the screen aren't pushed behind the clip plane
// We need an offset of mapGrid.MaximumTerrainHeight * mapGrid.TileSize.Height / 2 to cover the terrain height // We need an offset of mapGrid.MaximumTerrainHeight * mapGrid.TileSize.Height / 2 to cover the terrain height
// and choose to use mapGrid.MaximumTerrainHeight * mapGrid.TileSize.Height / 4 for each of the actor and top-edge cases // and choose to use mapGrid.MaximumTerrainHeight * mapGrid.TileSize.Height / 4 for each of the actor and top-edge cases
this.depthScale = mapGrid == null || !mapGrid.EnableDepthBuffer ? 0 : depthScale = mapGrid == null || !mapGrid.EnableDepthBuffer ? 0 :
(float)Resolution.Height / (Resolution.Height + mapGrid.TileSize.Height * mapGrid.MaximumTerrainHeight); (float)Resolution.Height / (Resolution.Height + mapGrid.TileSize.Height * mapGrid.MaximumTerrainHeight);
this.depthOffset = this.depthScale / 2;
depthOffset = depthScale / 2;
} }
public void BeginFrame(int2 scroll, float zoom) public void BeginFrame(int2 scroll, float zoom)

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Activities
readonly IMove move; readonly IMove move;
readonly CPos targetCell; readonly CPos targetCell;
public HarvestResource(Actor self, CPos targetcell) public HarvestResource(Actor self, CPos targetCell)
{ {
harv = self.Trait<Harvester>(); harv = self.Trait<Harvester>();
harvInfo = self.Info.TraitInfo<HarvesterInfo>(); harvInfo = self.Info.TraitInfo<HarvesterInfo>();
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Activities
move = self.Trait<IMove>(); move = self.Trait<IMove>();
claimLayer = self.World.WorldActor.Trait<ResourceClaimLayer>(); claimLayer = self.World.WorldActor.Trait<ResourceClaimLayer>();
resLayer = self.World.WorldActor.Trait<ResourceLayer>(); resLayer = self.World.WorldActor.Trait<ResourceLayer>();
this.targetCell = targetcell; this.targetCell = targetCell;
} }
protected override void OnFirstRun(Actor self) protected override void OnFirstRun(Actor self)

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Graphics
this.pos = pos; this.pos = pos;
this.zOffset = zOffset; this.zOffset = zOffset;
this.railgun = railgun; this.railgun = railgun;
this.info = railgunInfo; info = railgunInfo;
this.ticks = ticks; this.ticks = ticks;
helixRadius = info.HelixRadius + new WDist(ticks * info.HelixRadiusDeltaPerTick); helixRadius = info.HelixRadius + new WDist(ticks * info.HelixRadiusDeltaPerTick);
@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Graphics
var screenWidth = wr.ScreenVector(new WVec(info.HelixThickness.Length, 0, 0))[0]; var screenWidth = wr.ScreenVector(new WVec(info.HelixThickness.Length, 0, 0))[0];
// Move forward from self to target to draw helix // Move forward from self to target to draw helix
var centerPos = this.pos; var centerPos = pos;
var points = new float3[railgun.CycleCount * info.QuantizationCount]; var points = new float3[railgun.CycleCount * info.QuantizationCount];
for (var i = points.Length - 1; i >= 0; i--) for (var i = points.Length - 1; i >= 0; i--)
{ {

View File

@@ -125,8 +125,8 @@ namespace OpenRA.Mods.Common.Projectiles
this.info = info; this.info = info;
target = args.PassiveTarget; target = args.PassiveTarget;
this.BeamColor = beamColor; BeamColor = beamColor;
this.HelixColor = helixColor; HelixColor = helixColor;
if (!string.IsNullOrEmpty(info.HitAnim)) if (!string.IsNullOrEmpty(info.HitAnim))
hitanim = new Animation(args.SourceActor.World, info.HitAnim); hitanim = new Animation(args.SourceActor.World, info.HitAnim);

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
public AttackFrontal(Actor self, AttackFrontalInfo info) public AttackFrontal(Actor self, AttackFrontalInfo info)
: base(self, info) : base(self, info)
{ {
this.Info = info; Info = info;
} }
protected override bool CanAttack(Actor self, Target target) protected override bool CanAttack(Actor self, Target target)

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
public GrantExternalConditionToCrusher(Actor self, GrantExternalConditionToCrusherInfo info) public GrantExternalConditionToCrusher(Actor self, GrantExternalConditionToCrusherInfo info)
{ {
this.Info = info; Info = info;
} }
void INotifyCrushed.OnCrush(Actor self, Actor crusher, BitSet<CrushClass> crushClasses) void INotifyCrushed.OnCrush(Actor self, Actor crusher, BitSet<CrushClass> crushClasses)

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits
public ModularBot(ModularBotInfo info, ActorInitializer init) public ModularBot(ModularBotInfo info, ActorInitializer init)
{ {
this.info = info; this.info = info;
this.world = init.World; world = init.World;
} }
// Called by the host's player creation code // Called by the host's player creation code

View File

@@ -50,8 +50,8 @@ namespace OpenRA.Mods.Common.Traits.Render
centerPosition, centerPosition,
range.Value, range.Value,
0, 0,
this.Color, Color,
this.BorderColor); BorderColor);
var otherRanges = w.ActorsWithTrait<RenderRangeCircle>() var otherRanges = w.ActorsWithTrait<RenderRangeCircle>()
.Where(a => a.Trait.Info.RangeCircleType == RangeCircleType) .Where(a => a.Trait.Info.RangeCircleType == RangeCircleType)

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
void INotifyCreated.Created(Actor self) void INotifyCreated.Created(Actor self)
{ {
this.worldNotifySelection = self.TraitsImplementing<INotifySelection>().ToArray(); worldNotifySelection = self.TraitsImplementing<INotifySelection>().ToArray();
} }
void UpdateHash() void UpdateHash()

View File

@@ -35,9 +35,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public CommonSelectorLogic(Widget widget, World world, WorldRenderer worldRenderer, string templateListId, string previewTemplateId) public CommonSelectorLogic(Widget widget, World world, WorldRenderer worldRenderer, string templateListId, string previewTemplateId)
{ {
this.Widget = widget; Widget = widget;
this.World = world; World = world;
this.WorldRenderer = worldRenderer; WorldRenderer = worldRenderer;
Editor = widget.Parent.Get<EditorViewportControllerWidget>("MAP_EDITOR"); Editor = widget.Parent.Get<EditorViewportControllerWidget>("MAP_EDITOR");
Panel = widget.Get<ScrollPanelWidget>(templateListId); Panel = widget.Get<ScrollPanelWidget>(templateListId);
ItemTemplate = Panel.Get<ScrollItemWidget>(previewTemplateId); ItemTemplate = Panel.Get<ScrollItemWidget>(previewTemplateId);

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public IngameChatLogic(Widget widget, OrderManager orderManager, World world, ModData modData, bool isMenuChat, Dictionary<string, MiniYaml> logicArgs) public IngameChatLogic(Widget widget, OrderManager orderManager, World world, ModData modData, bool isMenuChat, Dictionary<string, MiniYaml> logicArgs)
{ {
this.orderManager = orderManager; this.orderManager = orderManager;
this.modRules = modData.DefaultRules; modRules = modData.DefaultRules;
chatTraits = world.WorldActor.TraitsImplementing<INotifyChat>().ToArray(); chatTraits = world.WorldActor.TraitsImplementing<INotifyChat>().ToArray();

View File

@@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
this.skirmishMode = skirmishMode; this.skirmishMode = skirmishMode;
// TODO: This needs to be reworked to support per-map tech levels, bots, etc. // TODO: This needs to be reworked to support per-map tech levels, bots, etc.
this.modRules = modData.DefaultRules; modRules = modData.DefaultRules;
shellmapWorld = worldRenderer.World; shellmapWorld = worldRenderer.World;
services = modData.Manifest.Get<WebServices>(); services = modData.Manifest.Get<WebServices>();

View File

@@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Widgets
[ObjectCreator.UseCtor] [ObjectCreator.UseCtor]
public ScrollPanelWidget(ModData modData) public ScrollPanelWidget(ModData modData)
{ {
this.modRules = modData.DefaultRules; modRules = modData.DefaultRules;
Layout = new ListLayout(this); Layout = new ListLayout(this);
} }