From dd8c70d3c22f8f7ef970e1e7f038b9f7d688290d Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 23 Oct 2009 21:26:45 +1300 Subject: [PATCH] fixing z-order; generalized the 1x1 placement fix to handle nx1 (which were ALL wrong) --- OpenRa.Game/GameRules/Footprint.cs | 5 +---- OpenRa.Game/Graphics/WorldRenderer.cs | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/OpenRa.Game/GameRules/Footprint.cs b/OpenRa.Game/GameRules/Footprint.cs index cb02f9b823..efd384b35e 100644 --- a/OpenRa.Game/GameRules/Footprint.cs +++ b/OpenRa.Game/GameRules/Footprint.cs @@ -57,10 +57,7 @@ namespace OpenRa.Game.GameRules public static int2 AdjustForBuildingSize( UnitInfo.BuildingInfo unitInfo ) { var dim = unitInfo.Dimensions; - if (dim.X == 1 && dim.Y == 1) - return int2.Zero; /* otherwise 1x1 buildings look stupid */ - - return new int2( dim.X / 2, ( dim.Y + 1 ) / 2 ); + return new int2( dim.X / 2, dim.Y > 1 ? ( dim.Y + 1 ) / 2 : 0 ); } } } diff --git a/OpenRa.Game/Graphics/WorldRenderer.cs b/OpenRa.Game/Graphics/WorldRenderer.cs index 643a84ccf7..e784d6c730 100644 --- a/OpenRa.Game/Graphics/WorldRenderer.cs +++ b/OpenRa.Game/Graphics/WorldRenderer.cs @@ -51,7 +51,7 @@ namespace OpenRa.Game.Graphics var rect = new RectangleF((region.Position + Game.viewport.Location).ToPointF(), region.Size.ToSizeF()); - foreach (Actor a in Game.world.Actors) + foreach (Actor a in Game.world.Actors.OrderBy( u => u.CenterLocation.Y )) DrawSpriteList(a.Owner, rect, a.Render()); foreach (IEffect e in Game.world.Effects)