Continious integration for IE mods. See it in action here. Happy IE suite is also discussed in this forum.
Post Reply
igi
Posts: 4
Joined: Thu May 19, 2022 7:28 pm

Suppression file

Post by igi » Sat May 21, 2022 4:51 pm

I'd like to use a suppression file to eliminate the false positives golem can give. My current thinking is that each mod create an IDS for each warning, list files which should be suppressed in that IDS, and then amend the checking code to ignore the check if the current source_res is listed in the IDS named after the current check, e.g. for HI61 amend fix_enchantment.tpp to the below.

Code: Select all


SET ignore = IDS_OF_SYMBOL("h161" ~%SOURCE_RES%~)

PATCH_IF enchantment = 0
  AND magic_flag != 0
  AND VARIABLE_IS_SET $item_type(~%type%~)
  AND NOT (~%SOURCE_FILE%~ STR_EQ ~aegis.itm~)
  AND NOT (~%SOURCE_FILE%~ STR_EQ ~aegis2.itm~) // skip aegis for now, see https://github.com/Gibberlings3/BG2-Fixpack/pull/7
  AND ~%ignore%~ = ~-1~
BEGIN
  PATCH_PRINT ~HI61: %SOURCE_FILE% - magic flag %magic_flag% and enchantment level %enchantment% are inconsistent.~
END
Are you open to a pull request along these lines?

User avatar
Magus
Site Admin
Posts: 379
Joined: Mon Nov 21, 2016 9:13 am
Contact:

Re: Suppression file

Post by Magus » Sat May 21, 2022 5:24 pm

Not sure if it's going to be convenient to have it split over multiple IDS.
Maybe a single 2DA instead? Read all rows, assign values to an array construct, then use VARIABLE_IS_SET to check for exceptions.

Also, HI61 = hi61 (happy-info-61), not h161.
 
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.

igi
Posts: 4
Joined: Thu May 19, 2022 7:28 pm

Re: Suppression file

Post by igi » Sun May 22, 2022 8:09 pm

I put a little time into this, working on the basis of using three 2da files (one each for info, warning and error), with each column being a check and each row being a file. The code currently looks like this:

General function

Code: Select all

// Function to determine if a given Hx check (h_check) should be ignored for the specified file (source_res)
DEFINE_PATCH_FUNCTION get_suppression
  INT_VAR h_check = 0
  STR_VAR twodafile = ~~
  RET suppression
BEGIN
  SET suppression = 0

  PATCH_IF FILE_EXISTS_IN_GAME ~%twodafile%~
  BEGIN
    TEXT_SPRINT sf ~%SOURCE_RES%~
    INNER_ACTION BEGIN
      COPY_EXISTING ~%twodafile%~ ~override~
      COUNT_2DA_ROWS 1 num_rows
      COUNT_2DA_COLS num_cols
      READ_2DA_ENTRIES_NOW supression 1
      FOR (row = 3; row < num_rows; ++row) BEGIN
        READ_2DA_ENTRY_FORMER supression row 0 filename
        PATCH_IF ~%filename%~ STRING_EQUAL ~%sf%~ BEGIN
          READ_2DA_ENTRY_FORMER supression row h_check supressthis
          SET suppression = ~%supressthis%~
        END
      END
    END
  END
END

Function call prior to making the existing checks (which are then amended with "AND supression = 0").

Code: Select all

TEXT_SPRINT sf ~%SOURCE_RES%~
LAUNCH_PATCH_FUNCTION get_suppression INT_VAR h_check = 61 STR_VAR twodafile = ~hpysupi.2da~ RET suppression = suppression END

If you're ok with this approach I'll finish it off and send a pull request.

User avatar
Magus
Site Admin
Posts: 379
Joined: Mon Nov 21, 2016 9:13 am
Contact:

Re: Suppression file

Post by Magus » Sun May 22, 2022 9:02 pm

But why copy it for each and every file? Isn't it simpler to do something like this? (might need some care with case, though)
 
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.

Post Reply