Fixed form comparison
This commit is contained in:
parent
06c6dd1c6b
commit
daab017fbd
@ -55,7 +55,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// Refs referencing themselves do not require the flag
|
// Refs referencing themselves do not require the flag
|
||||||
if not Equals(rec, referencingRecord) then begin
|
if not SameRecord(rec, referencingRecord) then begin
|
||||||
result := True;
|
result := True;
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
@ -64,6 +64,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function SameRecord(ref: IwbMainRecord; otherRef: IwbMainRecord): boolean;
|
||||||
|
begin
|
||||||
|
// 'Equals' does not fit here
|
||||||
|
result := Assigned(ref) and (GetLoadOrderFormID(ref) = GetLoadOrderFormID(otherRef));
|
||||||
|
end;
|
||||||
|
|
||||||
function InSameCell(ref: IwbMainRecord; otherRef: IwbMainRecord): boolean;
|
function InSameCell(ref: IwbMainRecord; otherRef: IwbMainRecord): boolean;
|
||||||
var
|
var
|
||||||
cell, otherCell, worldspace, otherWorldspace: IwbMainRecord;
|
cell, otherCell, worldspace, otherWorldspace: IwbMainRecord;
|
||||||
@ -76,14 +82,14 @@ begin
|
|||||||
|
|
||||||
// Interior cell
|
// Interior cell
|
||||||
if (GetElementNativeValues(cell, 'DATA') and 1) > 0 then begin
|
if (GetElementNativeValues(cell, 'DATA') and 1) > 0 then begin
|
||||||
result := Equals(cell, otherCell);
|
result := SameRecord(cell, otherCell);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
worldspace := LinksTo(ElementByPath(cell, 'Worldspace'));
|
worldspace := LinksTo(ElementByPath(cell, 'Worldspace'));
|
||||||
otherWorldspace := LinksTo(ElementByPath(otherCell, 'Worldspace'));
|
otherWorldspace := LinksTo(ElementByPath(otherCell, 'Worldspace'));
|
||||||
|
|
||||||
if not Equals(worldspace, otherWorldspace) then begin
|
if not SameRecord(worldspace, otherWorldspace) then begin
|
||||||
result := false;
|
result := false;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -97,6 +103,8 @@ begin
|
|||||||
// Persistent refs are located in 0,0 so we detect their original grid position via their position
|
// Persistent refs are located in 0,0 so we detect their original grid position via their position
|
||||||
coords := wbPositionToGridCell(GetPosition(ref));
|
coords := wbPositionToGridCell(GetPosition(ref));
|
||||||
otherCoords := wbPositionToGridCell(GetPosition(otherRef));
|
otherCoords := wbPositionToGridCell(GetPosition(otherRef));
|
||||||
|
//AddMessage(IntToStr(coords.x) + ' ' + IntToStr(otherCoords.x));
|
||||||
|
//AddMessage(IntToStr(coords.y) + ' ' + IntToStr(otherCoords.y));
|
||||||
|
|
||||||
result := (coords.x = otherCoords.x) and (coords.y = otherCoords.y);
|
result := (coords.x = otherCoords.x) and (coords.y = otherCoords.y);
|
||||||
end;
|
end;
|
||||||
@ -123,7 +131,7 @@ function MarkPersistent(e: IwbMainRecord): boolean;
|
|||||||
begin
|
begin
|
||||||
AddMessage(' + Marking as persistent: ' + GetElementEditValues(e, 'NAME') + ' - (' + Name(e) + ')');
|
AddMessage(' + Marking as persistent: ' + GetElementEditValues(e, 'NAME') + ' - (' + Name(e) + ')');
|
||||||
Inc(flaggedCount);
|
Inc(flaggedCount);
|
||||||
SetIsPersistent(e, True);
|
//SetIsPersistent(e, True);
|
||||||
CheckNonPersistentOverride(e);
|
CheckNonPersistentOverride(e);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -159,7 +167,7 @@ begin
|
|||||||
linkedCount := ElementCount(linkedRefs);
|
linkedCount := ElementCount(linkedRefs);
|
||||||
for i := 0 to Pred(linkedCount) do begin
|
for i := 0 to Pred(linkedCount) do begin
|
||||||
currentItem := ElementByIndex(linkedRefs, i);
|
currentItem := ElementByIndex(linkedRefs, i);
|
||||||
if Equals(LinksTo(ElementByPath(currentItem, 'Keyword/Ref')), keyword) then begin
|
if SameRecord(LinksTo(ElementByPath(currentItem, 'Keyword/Ref')), keyword) then begin
|
||||||
result := LinksTo(ElementByPath(currentItem, 'Ref'));
|
result := LinksTo(ElementByPath(currentItem, 'Ref'));
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
@ -321,7 +329,7 @@ begin
|
|||||||
else if (packageLoc = 'In cell') then begin
|
else if (packageLoc = 'In cell') then begin
|
||||||
refCell := LinksTo(ElementByPath(ElementByIndex(ElementByPath(package, 'Package Data\Data Input Values'), 0), 'PLDT\Cell'));
|
refCell := LinksTo(ElementByPath(ElementByIndex(ElementByPath(package, 'Package Data\Data Input Values'), 0), 'PLDT\Cell'));
|
||||||
if Assigned(refCell) then begin
|
if Assigned(refCell) then begin
|
||||||
if Equals(refCell, LinksTo(ElementByPath(e, 'Cell'))) then continue;
|
if SameRecord(refCell, LinksTo(ElementByPath(e, 'Cell'))) then continue;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else if (packageLoc = 'Near linked reference') then begin
|
else if (packageLoc = 'Near linked reference') then begin
|
||||||
|
Loading…
Reference in New Issue
Block a user