Skip to content

Instantly share code, notes, and snippets.

@fireundubh
Last active May 30, 2016 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fireundubh/6a25558a9ab1a54f35dc608fbb40cee1 to your computer and use it in GitHub Desktop.
Save fireundubh/6a25558a9ab1a54f35dc608fbb40cee1 to your computer and use it in GitHub Desktop.
function CompareFlags(asTag: String; e, m: IInterface; sPath, sFlagName: String; bAddTag, bOperation: Boolean): Boolean;
var
x, y, a, b: IInterface;
sa, sb, sTestName: String;
bResult: Boolean;
begin
if TagExists(asTag) then
exit;
Result := False;
// flags arrays
x := ElementByPath(e, sPath);
y := ElementByPath(m, sPath);
// individual flags
a := ElementByName(x, sFlagName);
b := ElementByName(y, sFlagName);
// individual flag edit values
sa := GetEditValue(a);
sb := GetEditValue(b);
if bOperation then
bResult := StrToBool(sa) <> StrToBool(sb) // only used for Behave Like Exterior, Use Sky Lighting, and Has Water
else
bResult := StrToBool(sa) or StrToBool(sb);
if bAddTag and bResult then
begin
if bOperation then
sTestName := '[CompareFlags:NOT]'
else
sTestName := '[CompareFlags:OR]';
AddLogEntry(asTag, sTestName, x, y);
AddTag(asTag);
end;
Result := bResult;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment