@@ -12,7 +12,20 @@ public enum TrainStationObjectFlags : uint8_t
1212 None = 0 ,
1313 Recolourable = 1 << 0 ,
1414 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+ }
1629
1730 [ TypeConverter ( typeof ( ExpandableObjectConverter ) ) ]
1831 [ LocoStructSize ( 0xAE ) ]
@@ -30,9 +43,9 @@ public record TrainStationObject(
3043 [ property: LocoStructOffset ( 0x0C ) ] TrainStationObjectFlags Flags ,
3144 [ property: LocoStructOffset ( 0x0D ) ] uint8_t var_0D ,
3245 [ 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 ,
3447 [ 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'
3649 [ property: LocoStructOffset ( 0x2A ) ] uint16_t DesignedYear ,
3750 [ property: LocoStructOffset ( 0x2C ) ] uint16_t ObsoleteYear ,
3851 [ property: LocoStructOffset ( 0x2E ) , LocoStructVariableLoad , LocoArrayLength ( TrainStationObject . CargoOffsetBytesSize ) , Browsable ( false ) ] uint8_t [ ] _CargoOffsetBytes ,
@@ -45,10 +58,14 @@ public record TrainStationObject(
4558 public const int MaxNumCompatible = 7 ;
4659 public const int ManualPowerLength = 16 ;
4760 public const int CargoOffsetBytesSize = 16 ;
61+ public const int MaxStationCargoDensity = 15 ;
62+
4863 public uint8_t [ ] [ ] [ ] CargoOffsetBytes { get ; set ; }
4964
5065 public uint8_t [ ] [ ] ManualPower { get ; set ; }
5166
67+ public CargoOffset [ ] CargoOffsets { get ; init ; } = Enumerable . Repeat ( new CargoOffset ( ) , 15 ) . ToArray ( ) ;
68+
5269 public ReadOnlySpan < byte > Load ( ReadOnlySpan < byte > remainingData )
5370 {
5471 // compatible
@@ -104,7 +121,7 @@ public ReadOnlySpan<byte> Save()
104121 {
105122 using ( var ms = new MemoryStream ( ) )
106123 {
107- // compatible
124+ // compatible track objects
108125 foreach ( var co in CompatibleTrackObjects )
109126 {
110127 ms . Write ( co . Write ( ) ) ;
0 commit comments