Skip to content

Commit c87fb07

Browse files
committed
Lines: adjust behavior of Lines_Get_Parent when the compat flag is off.
1 parent d8710bf commit c87fb07

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

docs/changelog.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919

2020
## Version 0.14.2 (to be released)
2121

22-
- Alt/CE: Fix `RegisterValues` in the C header.
22+
- Alt/CE: Fix `Alt_CE_Get_RegisterValues` in the C header.
2323
- Alt/PDE: Check for missing solution in a few functions.
2424
- Commands/`CalcLaplacian`: Give proper error message instead of crashing or giving "access violation" messages.
25-
- `Circuit_Save`: check if there is circuit to save.
25+
- Circuit/API: check if there is a circuit in `Circuit_Save`.
26+
- Lines/API: adjust behavior of `Lines_Get_Parent` when the compat flag is off.
2627

2728
## Version 0.14.1 (2024-02-16)
2829

src/CAPI/CAPI_Lines.pas

+8-3
Original file line numberDiff line numberDiff line change
@@ -840,17 +840,22 @@ function Lines_Get_Parent(): Integer; CDECL;
840840
// Returns line index or 0 if it fails or no more lines
841841
var
842842
pLine: TLineObj;
843+
other: TDSSCktElement;
843844
begin
844845
Result := 0;
845846
if not _activeObj(DSSPrime, pLine) then
846847
Exit;
847848

848-
if pLine.ParentPDelement = NIL then
849+
other := pLine.ParentPDElement;
850+
if other = NIL then
849851
Exit;
850852

851-
if (pLine.ParentPDelement.Enabled and ((pLine.ParentPDelement.DssObjtype and CLASSMASK) = LINE_ELEMENT)) then
853+
if (other.Enabled and ((other.DssObjtype and CLASSMASK) = LINE_ELEMENT)) then
852854
begin
853-
DSSPrime.ActiveCircuit.ActiveCktElement := pLine.ParentPDElement;
855+
DSSPrime.ActiveCircuit.ActiveCktElement := other;
856+
if ((DSS_EXTENSIONS_COMPAT and ord(DSSCompatFlag.ActiveLine)) = 0) then
857+
DSSPrime.ActiveCircuit.Lines.Get(other.ClassIndex);
858+
854859
Result := DSSPrime.ActiveCircuit.Lines.ActiveIndex;
855860
end;
856861
end;

0 commit comments

Comments
 (0)