Skip to content

Commit 1cb8d7a

Browse files
committed
DSSObj, LineGeometry: add array shortcuts for Wire; use the array shortcuts more.
1 parent a7ddb42 commit 1cb8d7a

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

docs/changelog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ This version should match OpenDSS v9.8.0.1 (SVN r3723). Remember to check the co
6868
- AutoTrans: fix `DumpProperties`, readd `bank` property (unused internally).
6969
- Commands/Save: add version and timestamp to master file.
7070
- DynamicExp and DynEqPCE: fix `DumpProperties`; extend to support JSON in/out.
71-
- Generator: fix default value for `D` (as DSS property); previously, the value was left uninitialized. It seems to only affect user models, so it doesn't seem like a big issue. Explicitly providing a value would also work fine as a workaround.
71+
- Generator: fix default value for `D` (as DSS property); previously, the value was left uninitialized. It seems to only affect user models, so it doesn't seem like a big issue. Explicitly providing a value would also works fine as a workaround.
7272
- Line and LineCode: fix formatting issues in `DumpProperties`
7373
- LoadShape: fix some issues when copying/saving data when using float32 data (which users need to explicitly opt-in).
7474
- PriceShape/TempShape: adjust setters for mean/stddev properties

src/General/DSSObjectHelper.pas

+26-2
Original file line numberDiff line numberDiff line change
@@ -2578,9 +2578,19 @@ procedure TDSSClassHelper.SetObjObjects(ptr: Pointer;Index: Integer; Value: TDSS
25782578
begin
25792579
Obj := TDSSObject(ptr);
25802580
flags := PropertyFlags[Index];
2581-
25822581
if TPropertyType.DSSObjectReferenceArrayProperty <> PropertyType[Index] then
2583-
Exit;
2582+
begin
2583+
if (PropertyArrayAlternative[Index] = 0) then
2584+
begin
2585+
Exit;
2586+
end;
2587+
2588+
Index := PropertyArrayAlternative[Index];
2589+
if TPropertyType.DSSObjectReferenceArrayProperty <> PropertyType[Index] then
2590+
begin
2591+
Exit;
2592+
end;
2593+
end;
25842594

25852595
if TPropertyFlag.WriteByFunction in flags then
25862596
begin
@@ -3354,6 +3364,10 @@ procedure TDSSClassHelper.SetObjIntegers(ptr: Pointer; Index: Integer; Value: PI
33543364
end;
33553365

33563366
begin
3367+
if (PropertyArrayAlternative[Index] <> 0) then
3368+
begin
3369+
Index := PropertyArrayAlternative[Index];
3370+
end;
33573371
Obj := TDSSObject(ptr);
33583372
flags := PropertyFlags[Index];
33593373
case PropertyType[Index] of
@@ -3506,6 +3520,10 @@ procedure TDSSClassHelper.SetObjDoubles(ptr: Pointer; Index: Integer; Value: PDo
35063520
Result := true;
35073521
end;
35083522
begin
3523+
if (PropertyArrayAlternative[Index] <> 0) then
3524+
begin
3525+
Index := PropertyArrayAlternative[Index];
3526+
end;
35093527
Obj := TDSSObject(ptr);
35103528
ptype := PropertyType[Index];
35113529
flags := PropertyFlags[Index];
@@ -3883,6 +3901,12 @@ procedure TDSSClassHelper.SetObjStrings(ptr: Pointer; Index: Integer; Value: PPA
38833901

38843902
begin
38853903
Obj := TDSSObject(ptr);
3904+
3905+
if (PropertyArrayAlternative[Index] <> 0) then
3906+
begin
3907+
Index := PropertyArrayAlternative[Index];
3908+
end;
3909+
38863910
flags := PropertyFlags[Index];
38873911
case PropertyType[Index] of
38883912
TPropertyType.DSSObjectReferenceArrayProperty:

src/General/LineGeometry.pas

+1-2
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,7 @@ procedure TLineGeometry.DefineProperties;
295295
// PropertyRedundantWith[ord(TProp.wires)] := ord(TProp.wire);
296296
PropertyNameJSON[ord(TProp.wires)] := 'Conductors';
297297

298-
299-
// PropertyArrayAlternative[ord(TProp.wire)] := ord(TProp.wires);
298+
PropertyArrayAlternative[ord(TProp.wire)] := ord(TProp.wires);
300299

301300
// enums
302301
PropertyType[ord(TProp.units)] := TPropertyType.MappedStringEnumProperty;

0 commit comments

Comments
 (0)