Use the correct CenterPosition for PBOG overlays.
This commit is contained in:
@@ -148,12 +148,12 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
{
|
{
|
||||||
var xy = wr.Viewport.ViewToWorld(Viewport.LastMousePos);
|
var xy = wr.Viewport.ViewToWorld(Viewport.LastMousePos);
|
||||||
var topLeft = xy - FootprintUtils.AdjustForBuildingSize(buildingInfo);
|
var topLeft = xy - FootprintUtils.AdjustForBuildingSize(buildingInfo);
|
||||||
|
var offset = world.Map.CenterOfCell(topLeft) + FootprintUtils.CenterOffset(world, buildingInfo);
|
||||||
var rules = world.Map.Rules;
|
var rules = world.Map.Rules;
|
||||||
|
|
||||||
var actorInfo = rules.Actors[building];
|
var actorInfo = rules.Actors[building];
|
||||||
foreach (var dec in actorInfo.TraitInfos<IPlaceBuildingDecorationInfo>())
|
foreach (var dec in actorInfo.TraitInfos<IPlaceBuildingDecorationInfo>())
|
||||||
foreach (var r in dec.Render(wr, world, actorInfo, world.Map.CenterOfCell(xy)))
|
foreach (var r in dec.Render(wr, world, actorInfo, offset))
|
||||||
yield return r;
|
yield return r;
|
||||||
|
|
||||||
var cells = new Dictionary<CPos, bool>();
|
var cells = new Dictionary<CPos, bool>();
|
||||||
@@ -194,7 +194,6 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var offset = world.Map.CenterOfCell(topLeft) + FootprintUtils.CenterOffset(world, buildingInfo);
|
|
||||||
var previewRenderables = preview
|
var previewRenderables = preview
|
||||||
.SelectMany(p => p.Render(wr, offset))
|
.SelectMany(p => p.Render(wr, offset))
|
||||||
.OrderBy(WorldRenderer.RenderableScreenZPositionComparisonKey);
|
.OrderBy(WorldRenderer.RenderableScreenZPositionComparisonKey);
|
||||||
|
|||||||
Reference in New Issue
Block a user