fix small bug in BuildPaletteWidget - incorrectly used cash rather than cash+ore
This commit is contained in:
@@ -462,13 +462,14 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
pos.Y += 15;
|
pos.Y += 15;
|
||||||
|
|
||||||
|
var pl = world.LocalPlayer;
|
||||||
var p = pos.ToFloat2() - new float2(297, -3);
|
var p = pos.ToFloat2() - new float2(297, -3);
|
||||||
|
|
||||||
var info = Rules.Info[unit];
|
var info = Rules.Info[unit];
|
||||||
var buildable = info.Traits.Get<BuildableInfo>();
|
var buildable = info.Traits.Get<BuildableInfo>();
|
||||||
|
|
||||||
var buildings = Rules.TechTree.GatherBuildings( world.LocalPlayer );
|
var buildings = Rules.TechTree.GatherBuildings( pl );
|
||||||
var canBuildThis = Rules.TechTree.CanBuild(info, world.LocalPlayer, buildings);
|
var canBuildThis = Rules.TechTree.CanBuild(info, pl, buildings);
|
||||||
|
|
||||||
var longDescSize = Game.chrome.renderer.RegularFont.Measure(buildable.LongDesc.Replace("\\n", "\n")).Y;
|
var longDescSize = Game.chrome.renderer.RegularFont.Measure(buildable.LongDesc.Replace("\\n", "\n")).Y;
|
||||||
if (!canBuildThis) longDescSize += 8;
|
if (!canBuildThis) longDescSize += 8;
|
||||||
@@ -479,19 +480,20 @@ namespace OpenRA.Widgets
|
|||||||
buildable.Description + ((buildable.Hotkey != null)? " ({0})".F(buildable.Hotkey.ToUpper()) : ""),
|
buildable.Description + ((buildable.Hotkey != null)? " ({0})".F(buildable.Hotkey.ToUpper()) : ""),
|
||||||
p.ToInt2() + new int2(5, 5), Color.White);
|
p.ToInt2() + new int2(5, 5), Color.White);
|
||||||
|
|
||||||
DrawRightAligned("${0}".F(buildable.Cost), pos + new int2(-5, 5),
|
var resources = pl.PlayerActor.traits.Get<PlayerResources>();
|
||||||
(world.LocalPlayer.PlayerActor.traits.Get<PlayerResources>().DisplayCash >= buildable.Cost)? Color.White: Color.Red);
|
|
||||||
|
|
||||||
var lowpower = world.LocalPlayer.PlayerActor.traits.Get<PlayerResources>().GetPowerState() != PowerState.Normal;
|
DrawRightAligned("${0}".F(buildable.Cost), pos + new int2(-5, 5),
|
||||||
var time = ProductionQueue.GetBuildTime(world.LocalPlayer.PlayerActor, info.Name)
|
(resources.DisplayCash + resources.DisplayOre >= buildable.Cost ? Color.White : Color.Red ));
|
||||||
* ((lowpower)? world.LocalPlayer.PlayerActor.Info.Traits.Get<ProductionQueueInfo>().LowPowerSlowdown : 1);
|
|
||||||
DrawRightAligned(WorldUtils.FormatTime(time), pos + new int2(-5, 35), (lowpower)? Color.Red: Color.White);
|
var lowpower = resources.GetPowerState() != PowerState.Normal;
|
||||||
|
var time = ProductionQueue.GetBuildTime(pl.PlayerActor, info.Name)
|
||||||
|
* ((lowpower)? pl.PlayerActor.Info.Traits.Get<ProductionQueueInfo>().LowPowerSlowdown : 1);
|
||||||
|
DrawRightAligned(WorldUtils.FormatTime(time), pos + new int2(-5, 35), lowpower ? Color.Red: Color.White);
|
||||||
|
|
||||||
var bi = info.Traits.GetOrDefault<BuildingInfo>();
|
var bi = info.Traits.GetOrDefault<BuildingInfo>();
|
||||||
var playerres = world.LocalPlayer.PlayerActor.traits.Get<PlayerResources>();
|
|
||||||
if (bi != null)
|
if (bi != null)
|
||||||
DrawRightAligned("{1}{0}".F(bi.Power, bi.Power > 0 ? "+" : ""), pos + new int2(-5, 20),
|
DrawRightAligned("{1}{0}".F(bi.Power, bi.Power > 0 ? "+" : ""), pos + new int2(-5, 20),
|
||||||
((playerres.PowerProvided - playerres.PowerDrained) >= -bi.Power || bi.Power > 0)? Color.White: Color.Red);
|
((resources.PowerProvided - resources.PowerDrained) >= -bi.Power || bi.Power > 0)? Color.White: Color.Red);
|
||||||
|
|
||||||
p += new int2(5, 35);
|
p += new int2(5, 35);
|
||||||
if (!canBuildThis)
|
if (!canBuildThis)
|
||||||
|
|||||||
Reference in New Issue
Block a user