Skip to content

Commit

Permalink
Display design combat speed with two decimal places instead of zero (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ekolis committed Jan 21, 2023
1 parent 1c1bac6 commit b86808c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions FrEee.WinForms/Controls/DesignReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void Bind()
resMaintMin.Amount = Design.MaintenanceCost[Resource.Minerals];
resMaintOrg.Amount = Design.MaintenanceCost[Resource.Organics];
resMaintRad.Amount = Design.MaintenanceCost[Resource.Radioactives];
txtSpeed.Text = Design.StrategicSpeed.ToString() + " sec/turn; " + Design.CombatSpeed.ToString() + "km/s";
txtSpeed.Text = Design.StrategicSpeed.ToString() + " sec/turn; " + Design.CombatSpeed.ToString("f2") + "km/s";
var genPerTurn = Design.GetAbilityValue("Supply Generation Per Turn").ToInt();
var genPerStar = Design.GetAbilityValue("Solar Supply Generation").ToInt();
txtSupplyStorage.Text = "Cap. " + Design.SupplyStorage.ToUnitString(true) + ", " + genPerTurn.ToUnitString(true) + "/turn, " + genPerStar.ToUnitString(true) + "/star, -" + Design.SupplyUsagePerSector + "/sector";
Expand Down Expand Up @@ -137,4 +137,4 @@ private void picPortrait_Click(object sender, System.EventArgs e)
picPortrait.ShowFullSize(Design.Name);
}
}
}
}
6 changes: 3 additions & 3 deletions FrEee.WinForms/Forms/VehicleDesignForm.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using FrEee.Game.Interfaces;
using FrEee.Game.Interfaces;
using FrEee.Game.Objects.Civilization;
using FrEee.Game.Objects.Space;
using FrEee.Game.Objects.Technology;
Expand Down Expand Up @@ -177,7 +177,7 @@ private void BindDesignData()
resCostMin.Amount = Design.Cost[Resource.Minerals];
resCostOrg.Amount = Design.Cost[Resource.Organics];
resCostRad.Amount = Design.Cost[Resource.Radioactives];
txtSpeed.Text = Design.StrategicSpeed.ToString() + " sec/turn; " + Design.CombatSpeed;
txtSpeed.Text = Design.StrategicSpeed.ToString() + " sec/turn; " + Design.CombatSpeed.ToString("f2");

var genPerTurn = Design.GetAbilityValue("Supply Generation Per Turn").ToInt();
var genPerStar = Design.GetAbilityValue("Solar Supply Generation").ToInt();
Expand Down Expand Up @@ -563,4 +563,4 @@ public MountInfo(Mount mount)
public string ShortName { get { return Mount == null ? "(No Mount)" : Mount.ShortName.Value; } }
}
}
}
}
2 changes: 1 addition & 1 deletion FrEee/Game/Interfaces/IDesign.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public interface IDesign : INamed, IPictorial, IOwnableAbilityObject, IConstruct
/// <summary>
/// The movement speed of the design in combat.
/// </summary>
int CombatSpeed { get; }
double CombatSpeed { get; }

/// <summary>
/// The vehicle's components.
Expand Down
6 changes: 4 additions & 2 deletions FrEee/Game/Objects/Vehicles/Design.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using FrEee.Game.Enumerations;
using FrEee.Game.Enumerations;
using FrEee.Game.Interfaces;
using FrEee.Game.Objects.Abilities;
using FrEee.Game.Objects.Civilization;
Expand Down Expand Up @@ -178,7 +178,9 @@ public IEnumerable<IAbilityObject> Children
get { return new IAbilityObject[] { Hull }.Concat(Components); }
}

public int CombatSpeed => Mod.Current.Settings.CombatSpeedPercentPerStrategicSpeed.PercentOfRounded(StrategicSpeed) + this.GetAbilityValue("Combat Movement").ToInt();
public double CombatSpeed
=> Mod.Current.Settings.CombatSpeedPercentPerStrategicSpeed.PercentOf(StrategicSpeed)
+ this.GetAbilityValue("Combat Movement").ToDouble();

/// <summary>
/// The components used in this design.
Expand Down

0 comments on commit b86808c

Please sign in to comment.