Skip to content

Commit

Permalink
Lines: adjust behavior of Lines_Get_Parent when the compat flag is …
Browse files Browse the repository at this point in the history
…off.
  • Loading branch information
PMeira committed Feb 23, 2024
1 parent d8710bf commit c87fb07
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 3 additions & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@

## Version 0.14.2 (to be released)

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

## Version 0.14.1 (2024-02-16)

Expand Down
11 changes: 8 additions & 3 deletions src/CAPI/CAPI_Lines.pas
Original file line number Diff line number Diff line change
Expand Up @@ -840,17 +840,22 @@ function Lines_Get_Parent(): Integer; CDECL;
// Returns line index or 0 if it fails or no more lines
var
pLine: TLineObj;
other: TDSSCktElement;
begin
Result := 0;
if not _activeObj(DSSPrime, pLine) then
Exit;

if pLine.ParentPDelement = NIL then
other := pLine.ParentPDElement;
if other = NIL then
Exit;

if (pLine.ParentPDelement.Enabled and ((pLine.ParentPDelement.DssObjtype and CLASSMASK) = LINE_ELEMENT)) then
if (other.Enabled and ((other.DssObjtype and CLASSMASK) = LINE_ELEMENT)) then
begin
DSSPrime.ActiveCircuit.ActiveCktElement := pLine.ParentPDElement;
DSSPrime.ActiveCircuit.ActiveCktElement := other;
if ((DSS_EXTENSIONS_COMPAT and ord(DSSCompatFlag.ActiveLine)) = 0) then
DSSPrime.ActiveCircuit.Lines.Get(other.ClassIndex);

Result := DSSPrime.ActiveCircuit.Lines.ActiveIndex;
end;
end;
Expand Down

0 comments on commit c87fb07

Please sign in to comment.