@@ -12,7 +12,20 @@ public enum TrainStationObjectFlags : uint8_t
12
12
None = 0 ,
13
13
Recolourable = 1 << 0 ,
14
14
NoGlass = 1 << 1 ,
15
- } ;
15
+ }
16
+
17
+ [ TypeConverter ( typeof ( ExpandableObjectConverter ) ) ]
18
+ [ LocoStructSize ( 0x06 ) ]
19
+ public record CargoOffset (
20
+ [ property: LocoStructOffset ( 0x00 ) ] Pos3 A ,
21
+ [ property: LocoStructOffset ( 0x06 ) ] Pos3 B
22
+ ) : ILocoStruct
23
+ {
24
+ public CargoOffset ( ) : this ( new Pos3 ( ) , new Pos3 ( ) )
25
+ { }
26
+
27
+ public bool Validate ( ) => true ;
28
+ }
16
29
17
30
[ TypeConverter ( typeof ( ExpandableObjectConverter ) ) ]
18
31
[ LocoStructSize ( 0xAE ) ]
@@ -30,9 +43,9 @@ public record TrainStationObject(
30
43
[ property: LocoStructOffset ( 0x0C ) ] TrainStationObjectFlags Flags ,
31
44
[ property: LocoStructOffset ( 0x0D ) ] uint8_t var_0D ,
32
45
[ property: LocoStructOffset ( 0x0E ) , LocoStructVariableLoad , Browsable ( false ) ] image_id Image ,
33
- [ property: LocoStructOffset ( 0x12 ) , LocoArrayLength ( TrainStationObject . MaxImageOffsets ) ] uint32_t [ ] ImageOffsets ,
46
+ [ property: LocoStructOffset ( 0x12 ) , LocoArrayLength ( TrainStationObject . MaxImageOffsets ) , Browsable ( false ) ] uint32_t [ ] ImageOffsets ,
34
47
[ property: LocoStructOffset ( 0x22 ) ] uint8_t CompatibleTrackObjectCount ,
35
- [ property: LocoStructOffset ( 0x23 ) , LocoArrayLength ( TrainStationObject . MaxNumCompatible ) ] object_id [ ] _Compatible ,
48
+ [ property: LocoStructOffset ( 0x23 ) , LocoArrayLength ( TrainStationObject . MaxNumCompatible ) , Browsable ( false ) ] object_id [ ] _Compatible , // only used for runtime loco, this isn't part of object 'definition'
36
49
[ property: LocoStructOffset ( 0x2A ) ] uint16_t DesignedYear ,
37
50
[ property: LocoStructOffset ( 0x2C ) ] uint16_t ObsoleteYear ,
38
51
[ property: LocoStructOffset ( 0x2E ) , LocoStructVariableLoad , LocoArrayLength ( TrainStationObject . CargoOffsetBytesSize ) , Browsable ( false ) ] uint8_t [ ] _CargoOffsetBytes ,
@@ -45,10 +58,14 @@ public record TrainStationObject(
45
58
public const int MaxNumCompatible = 7 ;
46
59
public const int ManualPowerLength = 16 ;
47
60
public const int CargoOffsetBytesSize = 16 ;
61
+ public const int MaxStationCargoDensity = 15 ;
62
+
48
63
public uint8_t [ ] [ ] [ ] CargoOffsetBytes { get ; set ; }
49
64
50
65
public uint8_t [ ] [ ] ManualPower { get ; set ; }
51
66
67
+ public CargoOffset [ ] CargoOffsets { get ; init ; } = Enumerable . Repeat ( new CargoOffset ( ) , 15 ) . ToArray ( ) ;
68
+
52
69
public ReadOnlySpan < byte > Load ( ReadOnlySpan < byte > remainingData )
53
70
{
54
71
// compatible
@@ -104,7 +121,7 @@ public ReadOnlySpan<byte> Save()
104
121
{
105
122
using ( var ms = new MemoryStream ( ) )
106
123
{
107
- // compatible
124
+ // compatible track objects
108
125
foreach ( var co in CompatibleTrackObjects )
109
126
{
110
127
ms . Write ( co . Write ( ) ) ;
0 commit comments