Formatted all files.
Automatically formatted all files via VS. This generally corrects indentation, removes trailing whitespace and corrects misplaced tabs or spaces. Manually tweaked a few files where required.
This commit is contained in:
@@ -334,7 +334,8 @@ namespace OpenRA.Editor
|
|||||||
{
|
{
|
||||||
var vX = (int)Math.Floor((mousePos.X - Offset.X) / Zoom);
|
var vX = (int)Math.Floor((mousePos.X - Offset.X) / Zoom);
|
||||||
var vY = (int)Math.Floor((mousePos.Y - Offset.Y) / Zoom);
|
var vY = (int)Math.Floor((mousePos.Y - Offset.Y) / Zoom);
|
||||||
return new CPos((vX + TileSetRenderer.TileSize - 1) / TileSetRenderer.TileSize,
|
return new CPos(
|
||||||
|
(vX + TileSetRenderer.TileSize - 1) / TileSetRenderer.TileSize,
|
||||||
(vY + TileSetRenderer.TileSize - 1) / TileSetRenderer.TileSize);
|
(vY + TileSetRenderer.TileSize - 1) / TileSetRenderer.TileSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -390,7 +390,8 @@ namespace OpenRA.FileFormats
|
|||||||
MulBignumWord(esi, globOne, tmp, 2 * len);
|
MulBignumWord(esi, globOne, tmp, 2 * len);
|
||||||
if ((*edi & 0x8000) == 0)
|
if ((*edi & 0x8000) == 0)
|
||||||
{
|
{
|
||||||
if (0 != SubBigNum((uint*)esi, (uint*)esi, g1, 0, (int)len))(*edi)--;
|
if (0 != SubBigNum((uint*)esi, (uint*)esi, g1, 0, (int)len))
|
||||||
|
(*edi)--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ namespace OpenRA
|
|||||||
if (constructOrderCache != null)
|
if (constructOrderCache != null)
|
||||||
return constructOrderCache;
|
return constructOrderCache;
|
||||||
|
|
||||||
var source = Traits.WithInterface<ITraitInfo>().Select(i => new {
|
var source = Traits.WithInterface<ITraitInfo>().Select(i => new
|
||||||
|
{
|
||||||
Trait = i,
|
Trait = i,
|
||||||
Type = i.GetType(),
|
Type = i.GetType(),
|
||||||
Dependencies = PrerequisitesOf(i).ToList()
|
Dependencies = PrerequisitesOf(i).ToList()
|
||||||
|
|||||||
@@ -77,7 +77,8 @@ namespace OpenRA.Graphics
|
|||||||
shader.SetMatrix("View", view);
|
shader.SetMatrix("View", view);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VoxelRenderProxy RenderAsync(WorldRenderer wr, IEnumerable<VoxelAnimation> voxels, WRot camera, float scale,
|
public VoxelRenderProxy RenderAsync(
|
||||||
|
WorldRenderer wr, IEnumerable<VoxelAnimation> voxels, WRot camera, float scale,
|
||||||
float[] groundNormal, WRot lightSource, float[] lightAmbientColor, float[] lightDiffuseColor,
|
float[] groundNormal, WRot lightSource, float[] lightAmbientColor, float[] lightDiffuseColor,
|
||||||
PaletteReference color, PaletteReference normals, PaletteReference shadowPalette)
|
PaletteReference color, PaletteReference normals, PaletteReference shadowPalette)
|
||||||
{
|
{
|
||||||
@@ -249,13 +250,15 @@ namespace OpenRA.Graphics
|
|||||||
return tVec;
|
return tVec;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Render(VoxelRenderData renderData,
|
void Render(
|
||||||
|
VoxelRenderData renderData,
|
||||||
float[] t, float[] lightDirection,
|
float[] t, float[] lightDirection,
|
||||||
float[] ambientLight, float[] diffuseLight,
|
float[] ambientLight, float[] diffuseLight,
|
||||||
int colorPalette, int normalsPalette)
|
int colorPalette, int normalsPalette)
|
||||||
{
|
{
|
||||||
shader.SetTexture("DiffuseTexture", renderData.Sheet.GetTexture());
|
shader.SetTexture("DiffuseTexture", renderData.Sheet.GetTexture());
|
||||||
shader.SetVec("PaletteRows", (colorPalette + 0.5f) / HardwarePalette.MaxPalettes,
|
shader.SetVec("PaletteRows",
|
||||||
|
(colorPalette + 0.5f) / HardwarePalette.MaxPalettes,
|
||||||
(normalsPalette + 0.5f) / HardwarePalette.MaxPalettes);
|
(normalsPalette + 0.5f) / HardwarePalette.MaxPalettes);
|
||||||
shader.SetMatrix("TransformMatrix", t);
|
shader.SetMatrix("TransformMatrix", t);
|
||||||
shader.SetVec("LightDirection", lightDirection, 4);
|
shader.SetVec("LightDirection", lightDirection, 4);
|
||||||
|
|||||||
@@ -270,8 +270,7 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (throwErrors)
|
if (throwErrors && noInherit.ContainsValue(false))
|
||||||
if (noInherit.ContainsValue(false))
|
|
||||||
throw new YamlException("Bogus yaml removals: {0}".F(
|
throw new YamlException("Bogus yaml removals: {0}".F(
|
||||||
noInherit.Where(x => !x.Value).JoinWith(", ")));
|
noInherit.Where(x => !x.Value).JoinWith(", ")));
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,10 @@ namespace OpenRA
|
|||||||
public static WRot operator -(WRot a, WRot b) { return new WRot(a.Roll - b.Roll, a.Pitch - b.Pitch, a.Yaw - b.Yaw); }
|
public static WRot operator -(WRot a, WRot b) { return new WRot(a.Roll - b.Roll, a.Pitch - b.Pitch, a.Yaw - b.Yaw); }
|
||||||
public static WRot operator -(WRot a) { return new WRot(-a.Roll, -a.Pitch, -a.Yaw); }
|
public static WRot operator -(WRot a) { return new WRot(-a.Roll, -a.Pitch, -a.Yaw); }
|
||||||
|
|
||||||
public static bool operator ==(WRot me, WRot other) { return me.Roll == other.Roll &&
|
public static bool operator ==(WRot me, WRot other)
|
||||||
me.Pitch == other.Pitch && me.Yaw == other.Yaw; }
|
{
|
||||||
|
return me.Roll == other.Roll && me.Pitch == other.Pitch && me.Yaw == other.Yaw;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool operator !=(WRot me, WRot other) { return !(me == other); }
|
public static bool operator !=(WRot me, WRot other) { return !(me == other); }
|
||||||
|
|
||||||
|
|||||||
@@ -197,8 +197,14 @@ namespace OpenRA.Widgets
|
|||||||
tooltipContainer.Value.RemoveTooltip();
|
tooltipContainer.Value.RemoveTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int2 ChildOrigin { get { return RenderOrigin +
|
public override int2 ChildOrigin
|
||||||
(Depressed ? new int2(VisualHeight, VisualHeight) : new int2(0, 0)); } }
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return RenderOrigin +
|
||||||
|
(Depressed ? new int2(VisualHeight, VisualHeight) : new int2(0, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -101,8 +101,7 @@ namespace OpenRA.Widgets
|
|||||||
public void ShowDropDown<T>(string panelTemplate, int maxHeight, IEnumerable<T> options, Func<T, ScrollItemWidget, ScrollItemWidget> setupItem)
|
public void ShowDropDown<T>(string panelTemplate, int maxHeight, IEnumerable<T> options, Func<T, ScrollItemWidget, ScrollItemWidget> setupItem)
|
||||||
{
|
{
|
||||||
var substitutions = new Dictionary<string, int>() { { "DROPDOWN_WIDTH", Bounds.Width } };
|
var substitutions = new Dictionary<string, int>() { { "DROPDOWN_WIDTH", Bounds.Width } };
|
||||||
var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs()
|
var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs() { { "substitutions", substitutions } });
|
||||||
{ { "substitutions", substitutions } });
|
|
||||||
|
|
||||||
var itemTemplate = panel.Get<ScrollItemWidget>("TEMPLATE");
|
var itemTemplate = panel.Get<ScrollItemWidget>("TEMPLATE");
|
||||||
panel.RemoveChildren();
|
panel.RemoveChildren();
|
||||||
@@ -124,8 +123,7 @@ namespace OpenRA.Widgets
|
|||||||
public void ShowDropDown<T>(string panelTemplate, int height, Dictionary<string, IEnumerable<T>> groups, Func<T, ScrollItemWidget, ScrollItemWidget> setupItem)
|
public void ShowDropDown<T>(string panelTemplate, int height, Dictionary<string, IEnumerable<T>> groups, Func<T, ScrollItemWidget, ScrollItemWidget> setupItem)
|
||||||
{
|
{
|
||||||
var substitutions = new Dictionary<string, int>() { { "DROPDOWN_WIDTH", Bounds.Width } };
|
var substitutions = new Dictionary<string, int>() { { "DROPDOWN_WIDTH", Bounds.Width } };
|
||||||
var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs()
|
var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs() { { "substitutions", substitutions } });
|
||||||
{ { "substitutions", substitutions } });
|
|
||||||
|
|
||||||
var headerTemplate = panel.GetOrNull<ScrollItemWidget>("HEADER");
|
var headerTemplate = panel.GetOrNull<ScrollItemWidget>("HEADER");
|
||||||
var itemTemplate = panel.Get<ScrollItemWidget>("TEMPLATE");
|
var itemTemplate = panel.Get<ScrollItemWidget>("TEMPLATE");
|
||||||
|
|||||||
@@ -268,7 +268,8 @@ namespace OpenRA.Widgets
|
|||||||
Bounds.Width - LeftMargin - RightMargin, Bounds.Bottom));
|
Bounds.Width - LeftMargin - RightMargin, Bounds.Bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
var color = disabled ? TextColorDisabled
|
var color =
|
||||||
|
disabled ? TextColorDisabled
|
||||||
: IsValid() ? TextColor
|
: IsValid() ? TextColor
|
||||||
: TextColorInvalid;
|
: TextColorInvalid;
|
||||||
font.DrawText(apparentText, textPos, color);
|
font.DrawText(apparentText, textPos, color);
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ namespace OpenRA.Mods.Cnc.Activities
|
|||||||
state = State.Dock;
|
state = State.Dock;
|
||||||
return Util.SequenceActivities(new Drag(self, startDock, endDock, 12), this);
|
return Util.SequenceActivities(new Drag(self, startDock, endDock, 12), this);
|
||||||
case State.Dock:
|
case State.Dock:
|
||||||
ru.PlayCustomAnimation(self, "dock", () => {
|
ru.PlayCustomAnimation(self, "dock", () =>
|
||||||
|
{
|
||||||
ru.PlayCustomAnimRepeating(self, "dock-loop");
|
ru.PlayCustomAnimRepeating(self, "dock-loop");
|
||||||
if (proc.IsInWorld && !proc.IsDead)
|
if (proc.IsInWorld && !proc.IsDead)
|
||||||
foreach (var nd in proc.TraitsImplementing<INotifyDocking>())
|
foreach (var nd in proc.TraitsImplementing<INotifyDocking>())
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ namespace OpenRA.Mods.Common.Commands
|
|||||||
{
|
{
|
||||||
case "pause":
|
case "pause":
|
||||||
world.IssueOrder(new Order("PauseGame", null, false)
|
world.IssueOrder(new Order("PauseGame", null, false)
|
||||||
{ TargetString = world.Paused ? "UnPause" : "Pause" });
|
{
|
||||||
|
TargetString = world.Paused ? "UnPause" : "Pause"
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case "surrender":
|
case "surrender":
|
||||||
world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false));
|
world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false));
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
// Generated at render-time
|
// Generated at render-time
|
||||||
VoxelRenderProxy renderProxy;
|
VoxelRenderProxy renderProxy;
|
||||||
|
|
||||||
public VoxelRenderable(IEnumerable<VoxelAnimation> voxels, WPos pos, int zOffset, WRot camera, float scale,
|
public VoxelRenderable(
|
||||||
|
IEnumerable<VoxelAnimation> voxels, WPos pos, int zOffset, WRot camera, float scale,
|
||||||
WRot lightSource, float[] lightAmbientColor, float[] lightDiffuseColor,
|
WRot lightSource, float[] lightAmbientColor, float[] lightDiffuseColor,
|
||||||
PaletteReference color, PaletteReference normals, PaletteReference shadow)
|
PaletteReference color, PaletteReference normals, PaletteReference shadow)
|
||||||
{
|
{
|
||||||
@@ -58,28 +59,32 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
|
|
||||||
public IRenderable WithScale(float newScale)
|
public IRenderable WithScale(float newScale)
|
||||||
{
|
{
|
||||||
return new VoxelRenderable(voxels, pos, zOffset, camera, newScale,
|
return new VoxelRenderable(
|
||||||
|
voxels, pos, zOffset, camera, newScale,
|
||||||
lightSource, lightAmbientColor, lightDiffuseColor,
|
lightSource, lightAmbientColor, lightDiffuseColor,
|
||||||
palette, normalsPalette, shadowPalette);
|
palette, normalsPalette, shadowPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRenderable WithPalette(PaletteReference newPalette)
|
public IRenderable WithPalette(PaletteReference newPalette)
|
||||||
{
|
{
|
||||||
return new VoxelRenderable(voxels, pos, zOffset, camera, scale,
|
return new VoxelRenderable(
|
||||||
|
voxels, pos, zOffset, camera, scale,
|
||||||
lightSource, lightAmbientColor, lightDiffuseColor,
|
lightSource, lightAmbientColor, lightDiffuseColor,
|
||||||
newPalette, normalsPalette, shadowPalette);
|
newPalette, normalsPalette, shadowPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRenderable WithZOffset(int newOffset)
|
public IRenderable WithZOffset(int newOffset)
|
||||||
{
|
{
|
||||||
return new VoxelRenderable(voxels, pos, newOffset, camera, scale,
|
return new VoxelRenderable(
|
||||||
|
voxels, pos, newOffset, camera, scale,
|
||||||
lightSource, lightAmbientColor, lightDiffuseColor,
|
lightSource, lightAmbientColor, lightDiffuseColor,
|
||||||
palette, normalsPalette, shadowPalette);
|
palette, normalsPalette, shadowPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRenderable OffsetBy(WVec vec)
|
public IRenderable OffsetBy(WVec vec)
|
||||||
{
|
{
|
||||||
return new VoxelRenderable(voxels, pos + vec, zOffset, camera, scale,
|
return new VoxelRenderable(
|
||||||
|
voxels, pos + vec, zOffset, camera, scale,
|
||||||
lightSource, lightAmbientColor, lightDiffuseColor,
|
lightSource, lightAmbientColor, lightDiffuseColor,
|
||||||
palette, normalsPalette, shadowPalette);
|
palette, normalsPalette, shadowPalette);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
public class MapGlobal : ScriptGlobal
|
public class MapGlobal : ScriptGlobal
|
||||||
{
|
{
|
||||||
SpawnMapActors sma;
|
SpawnMapActors sma;
|
||||||
public MapGlobal(ScriptContext context) : base(context)
|
public MapGlobal(ScriptContext context)
|
||||||
|
: base(context)
|
||||||
{
|
{
|
||||||
sma = context.World.WorldActor.Trait<SpawnMapActors>();
|
sma = context.World.WorldActor.Trait<SpawnMapActors>();
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
public class MediaGlobal : ScriptGlobal
|
public class MediaGlobal : ScriptGlobal
|
||||||
{
|
{
|
||||||
World world;
|
World world;
|
||||||
public MediaGlobal(ScriptContext context) : base(context)
|
public MediaGlobal(ScriptContext context)
|
||||||
|
: base(context)
|
||||||
{
|
{
|
||||||
world = context.World;
|
world = context.World;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,11 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Scripting
|
namespace OpenRA.Mods.Common.Scripting
|
||||||
{
|
{
|
||||||
public enum Trigger { OnIdle, OnDamaged, OnKilled, OnProduction, OnOtherProduction, OnPlayerWon, OnPlayerLost,
|
public enum Trigger
|
||||||
OnObjectiveAdded, OnObjectiveCompleted, OnObjectiveFailed, OnCapture, OnInfiltrated, OnAddedToWorld, OnRemovedFromWorld }
|
{
|
||||||
|
OnIdle, OnDamaged, OnKilled, OnProduction, OnOtherProduction, OnPlayerWon, OnPlayerLost,
|
||||||
|
OnObjectiveAdded, OnObjectiveCompleted, OnObjectiveFailed, OnCapture, OnInfiltrated, OnAddedToWorld, OnRemovedFromWorld
|
||||||
|
}
|
||||||
|
|
||||||
[Desc("Allows map scripts to attach triggers to this actor via the Triggers global.")]
|
[Desc("Allows map scripts to attach triggers to this actor via the Triggers global.")]
|
||||||
public class ScriptTriggersInfo : ITraitInfo
|
public class ScriptTriggersInfo : ITraitInfo
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
{
|
{
|
||||||
public class MasterServerPinger : ServerTrait, ITick, INotifySyncLobbyInfo, IStartGame, IEndGame
|
public class MasterServerPinger : ServerTrait, ITick, INotifySyncLobbyInfo, IStartGame, IEndGame
|
||||||
{
|
{
|
||||||
const int MasterPingInterval = 60 * 3; // 3 minutes. server has a 5 minute TTL for games, so give ourselves a bit
|
// 3 minutes. Server has a 5 minute TTL for games, so give ourselves a bit of leeway.
|
||||||
// of leeway.
|
const int MasterPingInterval = 60 * 3;
|
||||||
public int TickTimeout { get { return MasterPingInterval * 10000; } }
|
public int TickTimeout { get { return MasterPingInterval * 10000; } }
|
||||||
|
|
||||||
public void Tick(S server)
|
public void Tick(S server)
|
||||||
|
|||||||
@@ -33,8 +33,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public override string[] TargetTypes
|
public override string[] TargetTypes
|
||||||
{
|
{
|
||||||
get { return (self.CenterPosition.Z > 0) ? info.TargetTypes
|
get
|
||||||
: info.GroundedTargetTypes; }
|
{
|
||||||
|
return (self.CenterPosition.Z > 0) ? info.TargetTypes
|
||||||
|
: info.GroundedTargetTypes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,10 +40,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
// the one we're playing in.
|
// the one we're playing in.
|
||||||
return new DisposableAction(
|
return new DisposableAction(
|
||||||
() => { reservedFor = null; reservedForAircraft = null; },
|
() => { reservedFor = null; reservedForAircraft = null; },
|
||||||
() => Game.RunAfterTick(
|
() => Game.RunAfterTick(() =>
|
||||||
() => { if (Game.IsCurrentWorld(self.World)) throw new InvalidOperationException(
|
{
|
||||||
"Attempted to finalize an undisposed DisposableAction. {0} ({1}) reserved {2} ({3})"
|
if (Game.IsCurrentWorld(self.World))
|
||||||
.F(forActor.Info.Name, forActor.ActorID, self.Info.Name, self.ActorID)); }));
|
throw new InvalidOperationException(
|
||||||
|
"Attempted to finalize an undisposed DisposableAction. {0} ({1}) reserved {2} ({3})".F(
|
||||||
|
forActor.Info.Name, forActor.ActorID, self.Info.Name, self.ActorID));
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsReserved(Actor a)
|
public static bool IsReserved(Actor a)
|
||||||
|
|||||||
@@ -38,9 +38,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
anim = new Animation(self.World, rs.GetImage(self));
|
anim = new Animation(self.World, rs.GetImage(self));
|
||||||
anim.PlayFetchIndex(info.Sequence,
|
anim.PlayFetchIndex(info.Sequence,
|
||||||
() => playerResources.ResourceCapacity != 0
|
() =>
|
||||||
? ((10 * anim.CurrentSequence.Length - 1) * playerResources.Resources) / (10 * playerResources.ResourceCapacity)
|
playerResources.ResourceCapacity != 0 ?
|
||||||
: 0);
|
((10 * anim.CurrentSequence.Length - 1) * playerResources.Resources) / (10 * playerResources.ResourceCapacity) :
|
||||||
|
0);
|
||||||
|
|
||||||
rs.Add("resources_{0}".F(info.Sequence), new AnimationWithOffset(
|
rs.Add("resources_{0}".F(info.Sequence), new AnimationWithOffset(
|
||||||
anim, null, () => !buildComplete, 1024));
|
anim, null, () => !buildComplete, 1024));
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
// Select only the tiles that are within range from the requested SubCell
|
// Select only the tiles that are within range from the requested SubCell
|
||||||
// This assumes that the SubCell does not change during the path traversal
|
// This assumes that the SubCell does not change during the path traversal
|
||||||
var tilesInRange = world.Map.FindTilesInCircle(targetCell, range.Range / 1024 + 1)
|
var tilesInRange = world.Map.FindTilesInCircle(targetCell, range.Range / 1024 + 1)
|
||||||
.Where(t => (world.Map.CenterOfCell(t) - target).LengthSquared <= rangeSquared
|
.Where(t => (world.Map.CenterOfCell(t) - target).LengthSquared <= rangeSquared &&
|
||||||
&& mi.CanEnterCell(self.World, self, t));
|
mi.CanEnterCell(self.World, self, t));
|
||||||
|
|
||||||
// See if there is any cell within range that does not involve a cross-domain request
|
// See if there is any cell within range that does not involve a cross-domain request
|
||||||
// Really, we only need to check the circle perimeter, but it's not clear that would be a performance win
|
// Really, we only need to check the circle perimeter, but it's not clear that would be a performance win
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
* available to you under the terms of the GNU General Public License
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
* see COPYING.
|
* see COPYING.
|
||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -96,7 +96,8 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Game.Renderer.LineRenderer.FillRect(new Rectangle(b.X, (int)float2.Lerp(b.Bottom, b.Top, providedFrac),
|
Game.Renderer.LineRenderer.FillRect(new Rectangle(
|
||||||
|
b.X, (int)float2.Lerp(b.Bottom, b.Top, providedFrac),
|
||||||
b.Width, (int)(providedFrac * b.Height)), color);
|
b.Width, (int)(providedFrac * b.Height)), color);
|
||||||
|
|
||||||
var x = (b.Left + b.Right - indicator.Size.X) / 2;
|
var x = (b.Left + b.Right - indicator.Size.X) / 2;
|
||||||
|
|||||||
@@ -914,8 +914,7 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
{
|
{
|
||||||
BotDebug("Bot noticed damage {0} {1}->{2}, repairing.",
|
BotDebug("Bot noticed damage {0} {1}->{2}, repairing.",
|
||||||
self, e.PreviousDamageState, e.DamageState);
|
self, e.PreviousDamageState, e.DamageState);
|
||||||
World.IssueOrder(new Order("RepairBuilding", self.Owner.PlayerActor, false)
|
World.IssueOrder(new Order("RepairBuilding", self.Owner.PlayerActor, false) { TargetActor = self });
|
||||||
{ TargetActor = self });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ namespace OpenRA.Mods.RA
|
|||||||
state = State.Dock;
|
state = State.Dock;
|
||||||
return Util.SequenceActivities(new Turn(self, angle), this);
|
return Util.SequenceActivities(new Turn(self, angle), this);
|
||||||
case State.Dock:
|
case State.Dock:
|
||||||
ru.PlayCustomAnimation(self, "dock", () => {
|
ru.PlayCustomAnimation(self, "dock", () =>
|
||||||
|
{
|
||||||
ru.PlayCustomAnimRepeating(self, "dock-loop");
|
ru.PlayCustomAnimRepeating(self, "dock-loop");
|
||||||
if (proc.IsInWorld && !proc.IsDead)
|
if (proc.IsInWorld && !proc.IsDead)
|
||||||
foreach (var nd in proc.TraitsImplementing<INotifyDocking>())
|
foreach (var nd in proc.TraitsImplementing<INotifyDocking>())
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
* available to you under the terms of the GNU General Public License
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
* see COPYING.
|
* see COPYING.
|
||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ using OpenRA.Mods.Common;
|
|||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA.Traits
|
namespace OpenRA.Mods.RA.Traits
|
||||||
|
|
||||||
{
|
{
|
||||||
[Desc("Attach this to the player actor to allow building repair by team mates.")]
|
[Desc("Attach this to the player actor to allow building repair by team mates.")]
|
||||||
class AllyRepairInfo : TraitInfo<AllyRepair> { }
|
class AllyRepairInfo : TraitInfo<AllyRepair> { }
|
||||||
|
|||||||
@@ -40,8 +40,11 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
|
|
||||||
public IEnumerable<IOrderTargeter> Orders
|
public IEnumerable<IOrderTargeter> Orders
|
||||||
{
|
{
|
||||||
get { yield return new EnterAlliedActorTargeter<Building>("Repair", 5,
|
get
|
||||||
target => CanRepairAt(target), _ => CanRepair()); }
|
{
|
||||||
|
yield return new EnterAlliedActorTargeter<Building>("Repair", 5,
|
||||||
|
target => CanRepairAt(target), _ => CanRepair());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
* available to you under the terms of the GNU General Public License
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
* see COPYING.
|
* see COPYING.
|
||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@@ -74,7 +74,8 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
{
|
{
|
||||||
s.First.Activate(crusher);
|
s.First.Activate(crusher);
|
||||||
return;
|
return;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
n -= s.Second;
|
n -= s.Second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
{
|
{
|
||||||
GpsWatcher owner;
|
GpsWatcher owner;
|
||||||
|
|
||||||
public GpsPower(Actor self, GpsPowerInfo info) : base(self, info)
|
public GpsPower(Actor self, GpsPowerInfo info)
|
||||||
|
: base(self, info)
|
||||||
{
|
{
|
||||||
owner = self.Owner.PlayerActor.Trait<GpsWatcher>();
|
owner = self.Owner.PlayerActor.Trait<GpsWatcher>();
|
||||||
owner.GpsAdd(self);
|
owner.GpsAdd(self);
|
||||||
|
|||||||
@@ -32,8 +32,10 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
|
|
||||||
public override string[] TargetTypes
|
public override string[] TargetTypes
|
||||||
{
|
{
|
||||||
get { return cloak.Cloaked ? info.CloakedTargetTypes
|
get
|
||||||
: info.TargetTypes; }
|
{
|
||||||
|
return cloak.Cloaked ? info.CloakedTargetTypes : info.TargetTypes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,8 @@ namespace OpenRA.Mods.TS.Traits
|
|||||||
initializePalettes = false;
|
initializePalettes = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
yield return new VoxelRenderable(components, self.CenterPosition, 0, camera, info.Scale,
|
yield return new VoxelRenderable(
|
||||||
|
components, self.CenterPosition, 0, camera, info.Scale,
|
||||||
lightSource, info.LightAmbientColor, info.LightDiffuseColor,
|
lightSource, info.LightAmbientColor, info.LightDiffuseColor,
|
||||||
colorPalette, normalsPalette, shadowPalette);
|
colorPalette, normalsPalette, shadowPalette);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,14 +22,16 @@ namespace OpenRA.Test
|
|||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUp()
|
public void SetUp()
|
||||||
{
|
{
|
||||||
order = new Order("TestOrder", null, false) {
|
order = new Order("TestOrder", null, false)
|
||||||
|
{
|
||||||
TargetString = "TestTarget",
|
TargetString = "TestTarget",
|
||||||
TargetLocation = new CPos(1234, 5678),
|
TargetLocation = new CPos(1234, 5678),
|
||||||
ExtraData = 1234,
|
ExtraData = 1234,
|
||||||
ExtraLocation = new CPos(555, 555)
|
ExtraLocation = new CPos(555, 555)
|
||||||
};
|
};
|
||||||
|
|
||||||
immediateOrder = new Order("TestOrderImmediate", null, false) {
|
immediateOrder = new Order("TestOrderImmediate", null, false)
|
||||||
|
{
|
||||||
IsImmediate = true,
|
IsImmediate = true,
|
||||||
TargetString = "TestTarget"
|
TargetString = "TestTarget"
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user