Skip to content

Commit bff4e51

Browse files
CopilotLeftofZen
andcommitted
Add effective cost properties to all remaining object ViewModels
Co-authored-by: LeftofZen <7483209+LeftofZen@users.noreply.github.com>
1 parent b603f70 commit bff4e51

11 files changed

Lines changed: 238 additions & 0 deletions

Gui/ViewModels/LocoTypes/Objects/AirportViewModel.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,26 @@ public int16_t SellCostFactor
8282
set => Model.SellCostFactor = value;
8383
}
8484

85+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Build Cost"), Description("The inflation-adjusted build cost for the year specified in settings")]
86+
public int EffectiveBuildCost
87+
{
88+
get
89+
{
90+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
91+
return Common.Economy.GetInflationAdjustedCost(Model.BuildCostFactor, Model.CostIndex, year);
92+
}
93+
}
94+
95+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Sell Cost"), Description("The inflation-adjusted sell cost for the year specified in settings")]
96+
public int EffectiveSellCost
97+
{
98+
get
99+
{
100+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
101+
return Common.Economy.GetInflationAdjustedCost(Model.SellCostFactor, Model.CostIndex, year);
102+
}
103+
}
104+
85105
[Category("Building")]
86106
[Length(1, AirportObjectLoader.Constants.BuildingVariationCount)]
87107
public BindingList<BindingList<uint8_t>> BuildingVariations { get; init; } = new(model.BuildingComponents.BuildingVariations.Select(x => x.ToBindingList()).ToBindingList());

Gui/ViewModels/LocoTypes/Objects/DockViewModel.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,26 @@ public int16_t SellCostFactor
5959
set => Model.SellCostFactor = value;
6060
}
6161

62+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Build Cost"), Description("The inflation-adjusted build cost for the year specified in settings")]
63+
public int EffectiveBuildCost
64+
{
65+
get
66+
{
67+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
68+
return Common.Economy.GetInflationAdjustedCost(Model.BuildCostFactor, Model.CostIndex, year);
69+
}
70+
}
71+
72+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Sell Cost"), Description("The inflation-adjusted sell cost for the year specified in settings")]
73+
public int EffectiveSellCost
74+
{
75+
get
76+
{
77+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
78+
return Common.Economy.GetInflationAdjustedCost(Model.SellCostFactor, Model.CostIndex, year);
79+
}
80+
}
81+
6282
[Category("Building")]
6383
[Length(1, DockObjectLoader.Constants.BuildingVariationCount)]
6484
public BindingList<BindingList<uint8_t>> BuildingVariations { get; init; } = new(model.BuildingComponents.BuildingVariations.Select(x => x.ToBindingList()).ToBindingList());

Gui/ViewModels/LocoTypes/Objects/IndustryViewModel.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,26 @@ public int16_t SellCostFactor
9393
set => Model.SellCostFactor = value;
9494
}
9595

96+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Build Cost"), Description("The inflation-adjusted build cost for the year specified in settings")]
97+
public int EffectiveBuildCost
98+
{
99+
get
100+
{
101+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
102+
return Common.Economy.GetInflationAdjustedCost(Model.BuildCostFactor, Model.CostIndex, year);
103+
}
104+
}
105+
106+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Sell Cost"), Description("The inflation-adjusted sell cost for the year specified in settings")]
107+
public int EffectiveSellCost
108+
{
109+
get
110+
{
111+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
112+
return Common.Economy.GetInflationAdjustedCost(Model.SellCostFactor, Model.CostIndex, year);
113+
}
114+
}
115+
96116
[Category("Farm")]
97117
public uint8_t FarmTileNumImageAngles
98118
{

Gui/ViewModels/LocoTypes/Objects/RoadExtraViewModel.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Definitions.ObjectModels.Objects.Road;
22
using Definitions.ObjectModels.Objects.RoadExtra;
33
using PropertyModels.ComponentModel.DataAnnotations;
4+
using System.ComponentModel;
45

56
namespace Gui.ViewModels;
67

@@ -20,21 +21,44 @@ public uint8_t PaintStyle
2021
set => Model.PaintStyle = value;
2122
}
2223

24+
[Category("Cost")]
2325
public uint8_t CostIndex
2426
{
2527
get => Model.CostIndex;
2628
set => Model.CostIndex = value;
2729
}
2830

31+
[Category("Cost")]
2932
public int16_t BuildCostFactor
3033
{
3134
get => Model.BuildCostFactor;
3235
set => Model.BuildCostFactor = value;
3336
}
3437

38+
[Category("Cost")]
3539
public int16_t SellCostFactor
3640
{
3741
get => Model.SellCostFactor;
3842
set => Model.SellCostFactor = value;
3943
}
44+
45+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Build Cost"), Description("The inflation-adjusted build cost for the year specified in settings")]
46+
public int EffectiveBuildCost
47+
{
48+
get
49+
{
50+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
51+
return Common.Economy.GetInflationAdjustedCost(Model.BuildCostFactor, Model.CostIndex, year);
52+
}
53+
}
54+
55+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Sell Cost"), Description("The inflation-adjusted sell cost for the year specified in settings")]
56+
public int EffectiveSellCost
57+
{
58+
get
59+
{
60+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
61+
return Common.Economy.GetInflationAdjustedCost(Model.SellCostFactor, Model.CostIndex, year);
62+
}
63+
}
4064
}

Gui/ViewModels/LocoTypes/Objects/RoadStationViewModel.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,26 @@ public uint8_t CostIndex
7070
set => Model.CostIndex = value;
7171
}
7272

73+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Build Cost"), Description("The inflation-adjusted build cost for the year specified in settings")]
74+
public int EffectiveBuildCost
75+
{
76+
get
77+
{
78+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
79+
return Common.Economy.GetInflationAdjustedCost(Model.BuildCostFactor, Model.CostIndex, year);
80+
}
81+
}
82+
83+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Sell Cost"), Description("The inflation-adjusted sell cost for the year specified in settings")]
84+
public int EffectiveSellCost
85+
{
86+
get
87+
{
88+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
89+
return Common.Economy.GetInflationAdjustedCost(Model.SellCostFactor, Model.CostIndex, year);
90+
}
91+
}
92+
7393
[Category("Cargo")]
7494
public ObjectModelHeader? CargoType
7595
{

Gui/ViewModels/LocoTypes/Objects/RoadViewModel.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,36 @@ public uint8_t CostIndex
7575
set => Model.CostIndex = value;
7676
}
7777

78+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Build Cost"), Description("The inflation-adjusted build cost for the year specified in settings")]
79+
public int EffectiveBuildCost
80+
{
81+
get
82+
{
83+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
84+
return Common.Economy.GetInflationAdjustedCost(Model.BuildCostFactor, Model.CostIndex, year);
85+
}
86+
}
87+
88+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Sell Cost"), Description("The inflation-adjusted sell cost for the year specified in settings")]
89+
public int EffectiveSellCost
90+
{
91+
get
92+
{
93+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
94+
return Common.Economy.GetInflationAdjustedCost(Model.SellCostFactor, Model.CostIndex, year);
95+
}
96+
}
97+
98+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Tunnel Cost"), Description("The inflation-adjusted tunnel cost for the year specified in settings")]
99+
public int EffectiveTunnelCost
100+
{
101+
get
102+
{
103+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
104+
return Common.Economy.GetInflationAdjustedCost(Model.TunnelCostFactor, Model.CostIndex, year);
105+
}
106+
}
107+
78108
[Category("Compatible Objects")]
79109
public ObjectModelHeader Tunnel
80110
{

Gui/ViewModels/LocoTypes/Objects/TrackExtraViewModel.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Definitions.ObjectModels.Objects.Track;
22
using Definitions.ObjectModels.Objects.TrackExtra;
33
using PropertyModels.ComponentModel.DataAnnotations;
4+
using System.ComponentModel;
45

56
namespace Gui.ViewModels;
67

@@ -20,21 +21,44 @@ public uint8_t PaintStyle
2021
set => Model.PaintStyle = value;
2122
}
2223

24+
[Category("Cost")]
2325
public uint8_t CostIndex
2426
{
2527
get => Model.CostIndex;
2628
set => Model.CostIndex = value;
2729
}
2830

31+
[Category("Cost")]
2932
public int16_t BuildCostFactor
3033
{
3134
get => Model.BuildCostFactor;
3235
set => Model.BuildCostFactor = value;
3336
}
3437

38+
[Category("Cost")]
3539
public int16_t SellCostFactor
3640
{
3741
get => Model.SellCostFactor;
3842
set => Model.SellCostFactor = value;
3943
}
44+
45+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Build Cost"), Description("The inflation-adjusted build cost for the year specified in settings")]
46+
public int EffectiveBuildCost
47+
{
48+
get
49+
{
50+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
51+
return Common.Economy.GetInflationAdjustedCost(Model.BuildCostFactor, Model.CostIndex, year);
52+
}
53+
}
54+
55+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Sell Cost"), Description("The inflation-adjusted sell cost for the year specified in settings")]
56+
public int EffectiveSellCost
57+
{
58+
get
59+
{
60+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
61+
return Common.Economy.GetInflationAdjustedCost(Model.SellCostFactor, Model.CostIndex, year);
62+
}
63+
}
4064
}

Gui/ViewModels/LocoTypes/Objects/TrackSignalViewModel.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,26 @@ public int16_t SellCostFactor
5050
set => Model.SellCostFactor = value;
5151
}
5252

53+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Build Cost"), Description("The inflation-adjusted build cost for the year specified in settings")]
54+
public int EffectiveBuildCost
55+
{
56+
get
57+
{
58+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
59+
return Common.Economy.GetInflationAdjustedCost(Model.BuildCostFactor, Model.CostIndex, year);
60+
}
61+
}
62+
63+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Sell Cost"), Description("The inflation-adjusted sell cost for the year specified in settings")]
64+
public int EffectiveSellCost
65+
{
66+
get
67+
{
68+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
69+
return Common.Economy.GetInflationAdjustedCost(Model.SellCostFactor, Model.CostIndex, year);
70+
}
71+
}
72+
5373
[Category("Stats")]
5474
public uint16_t DesignedYear
5575
{

Gui/ViewModels/LocoTypes/Objects/TrackStationViewModel.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,26 @@ public uint8_t CostIndex
6969
set => Model.CostIndex = value;
7070
}
7171

72+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Build Cost"), Description("The inflation-adjusted build cost for the year specified in settings")]
73+
public int EffectiveBuildCost
74+
{
75+
get
76+
{
77+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
78+
return Common.Economy.GetInflationAdjustedCost(Model.BuildCostFactor, Model.CostIndex, year);
79+
}
80+
}
81+
82+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Sell Cost"), Description("The inflation-adjusted sell cost for the year specified in settings")]
83+
public int EffectiveSellCost
84+
{
85+
get
86+
{
87+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
88+
return Common.Economy.GetInflationAdjustedCost(Model.SellCostFactor, Model.CostIndex, year);
89+
}
90+
}
91+
7292
[Category("<unknown>")]
7393
public uint8_t var_0B
7494
{

Gui/ViewModels/LocoTypes/Objects/TreeViewModel.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,26 @@ public int16_t ClearCostFactor
6565
set => Model.ClearCostFactor = value;
6666
}
6767

68+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Build Cost"), Description("The inflation-adjusted build cost for the year specified in settings")]
69+
public int EffectiveBuildCost
70+
{
71+
get
72+
{
73+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
74+
return Common.Economy.GetInflationAdjustedCost(Model.BuildCostFactor, Model.CostIndex, year);
75+
}
76+
}
77+
78+
[Category("Cost"), ReadOnly(true), DisplayName("Effective Clear Cost"), Description("The inflation-adjusted clear cost for the year specified in settings")]
79+
public int EffectiveClearCost
80+
{
81+
get
82+
{
83+
var year = GlobalSettings.CurrentSettings?.InflationYear ?? 1950;
84+
return Common.Economy.GetInflationAdjustedCost(Model.ClearCostFactor, Model.CostIndex, year);
85+
}
86+
}
87+
6888
[Category("Building")]
6989
public uint8_t InitialHeight
7090
{

0 commit comments

Comments
 (0)