Apply consistent formatting to PBOG (no code changes).

This commit is contained in:
Paul Chote
2013-02-26 09:32:16 +13:00
parent 6fc4807a10
commit ce39c79477

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA.Orders
if (mi.Button == MouseButton.Right) if (mi.Button == MouseButton.Right)
world.CancelInputMode(); world.CancelInputMode();
var ret = InnerOrder( world, xy, mi ).ToList(); var ret = InnerOrder(world, xy, mi).ToList();
if (ret.Count > 0) if (ret.Count > 0)
world.CancelInputMode(); world.CancelInputMode();
@@ -52,26 +52,26 @@ namespace OpenRA.Mods.RA.Orders
{ {
if (mi.Button == MouseButton.Left) if (mi.Button == MouseButton.Left)
{ {
var topLeft = xy - FootprintUtils.AdjustForBuildingSize( BuildingInfo ); var topLeft = xy - FootprintUtils.AdjustForBuildingSize(BuildingInfo);
if (!world.CanPlaceBuilding( Building, BuildingInfo, topLeft, null) if (!world.CanPlaceBuilding(Building, BuildingInfo, topLeft, null)
|| !BuildingInfo.IsCloseEnoughToBase(world, Producer.Owner, Building, topLeft)) || !BuildingInfo.IsCloseEnoughToBase(world, Producer.Owner, Building, topLeft))
{ {
Sound.PlayNotification(Producer.Owner, "Speech", "BuildingCannotPlaceAudio", Producer.Owner.Country.Race); Sound.PlayNotification(Producer.Owner, "Speech", "BuildingCannotPlaceAudio", Producer.Owner.Country.Race);
yield break; yield break;
} }
var isLineBuild = Rules.Info[ Building ].Traits.Contains<LineBuildInfo>(); var isLineBuild = Rules.Info[Building].Traits.Contains<LineBuildInfo>();
yield return new Order(isLineBuild ? "LineBuild" : "PlaceBuilding", yield return new Order(isLineBuild ? "LineBuild" : "PlaceBuilding",
Producer.Owner.PlayerActor, false) { TargetLocation = topLeft, TargetString = Building }; Producer.Owner.PlayerActor, false) { TargetLocation = topLeft, TargetString = Building };
} }
} }
public void Tick( World world ) {} public void Tick(World world) {}
public void RenderAfterWorld( WorldRenderer wr, World world ) {} public void RenderAfterWorld(WorldRenderer wr, World world) {}
public void RenderBeforeWorld( WorldRenderer wr, World world ) public void RenderBeforeWorld(WorldRenderer wr, World world)
{ {
var position = Game.viewport.ViewToWorld(Viewport.LastMousePos); var position = Game.viewport.ViewToWorld(Viewport.LastMousePos);
var topLeft = position - FootprintUtils.AdjustForBuildingSize( BuildingInfo ); var topLeft = position - FootprintUtils.AdjustForBuildingSize(BuildingInfo);
var actorInfo = Rules.Info[Building]; var actorInfo = Rules.Info[Building];
foreach (var dec in actorInfo.Traits.WithInterface<IPlaceBuildingDecoration>()) foreach (var dec in actorInfo.Traits.WithInterface<IPlaceBuildingDecoration>())
@@ -82,8 +82,8 @@ namespace OpenRA.Mods.RA.Orders
// Assumes a 1x1 footprint; weird things will happen for other footprints // Assumes a 1x1 footprint; weird things will happen for other footprints
if (Rules.Info[Building].Traits.Contains<LineBuildInfo>()) if (Rules.Info[Building].Traits.Contains<LineBuildInfo>())
{ {
foreach( var t in BuildingUtils.GetLineBuildCells( world, topLeft, Building, BuildingInfo ) ) foreach (var t in BuildingUtils.GetLineBuildCells(world, topLeft, Building, BuildingInfo))
cells.Add( t, BuildingInfo.IsCloseEnoughToBase( world, world.LocalPlayer, Building, t ) ); cells.Add(t, BuildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, Building, t));
} }
else else
{ {
@@ -105,11 +105,11 @@ namespace OpenRA.Mods.RA.Orders
var res = world.WorldActor.Trait<ResourceLayer>(); var res = world.WorldActor.Trait<ResourceLayer>();
var isCloseEnough = BuildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, Building, topLeft); var isCloseEnough = BuildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, Building, topLeft);
foreach (var t in FootprintUtils.Tiles(Building, BuildingInfo, topLeft)) foreach (var t in FootprintUtils.Tiles(Building, BuildingInfo, topLeft))
cells.Add( t, isCloseEnough && world.IsCellBuildable(t, BuildingInfo) && res.GetResource(t) == null ); cells.Add(t, isCloseEnough && world.IsCellBuildable(t, BuildingInfo) && res.GetResource(t) == null);
} }
foreach( var c in cells ) foreach (var c in cells)
( c.Value ? buildOk : buildBlocked ).DrawAt(wr, c.Key.ToPPos().ToFloat2(), "terrain" ); (c.Value ? buildOk : buildBlocked).DrawAt(wr, c.Key.ToPPos().ToFloat2(), "terrain");
} }
public string GetCursor(World world, CPos xy, MouseInput mi) { return "default"; } public string GetCursor(World world, CPos xy, MouseInput mi) { return "default"; }