Skip to content

Commit

Permalink
Fix hidespl tobex (#126)
Browse files Browse the repository at this point in the history
* Fix tobex check

* Improve column number sanitization

* Alter changelog line
  • Loading branch information
lambda-dom authored Jul 30, 2023
1 parent d5ad2b2 commit e18ca45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spell_rev/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The most salient ones are:
23. [Fix displayed strings in spells](https://github.com/Gibberlings3/SpellRevisions/pull/107):
24. [Fixes to Elemental Prince HLA](https://github.com/Gibberlings3/SpellRevisions/pull/114):
25. [Missing projectile in Avenger's chromatic orb](https://github.com/Gibberlings3/SpellRevisions/pull/117): patch by mercurier.
26. [Patching hidespl.2da instead of overriding](https://github.com/Gibberlings3/SpellRevisions/pull/116): as the name says; instead of overwriting `hidespl.2da` tables, patch them.
26. [Patching hidespl.2da instead of overriding](https://github.com/Gibberlings3/SpellRevisions/pull/116): as the name says; instead of overwriting `hidespl.2da` tables, patch them. Subsequently refined in [Fix hidespl.2da patching in tobex](https://github.com/Gibberlings3/SpellRevisions/pull/126).
27. [Imprisonment vs. Freedom patches](https://github.com/Gibberlings3/SpellRevisions/pull/118):
28. [Patch inquisitor true seeing](https://github.com/Gibberlings3/SpellRevisions/pull/119):
29. [Wrong dice in Talos' Lightning Bolt](https://github.com/Gibberlings3/SpellRevisions/pull/124): a sleuth of fixes to the Cleric of Talos' version of Lightning Bolt (more than the title suggests).
Expand Down
5 changes: 3 additions & 2 deletions spell_rev/lib/hidespl_patching.tph
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ DEFINE_ACTION_FUNCTION hide_spells_from_array STR_VAR engine = "ee" BEGIN
//Patch table.
COPY_EXISTING ~hidespl.2da~ ~override~
COUNT_2DA_COLS cols
PATCH_IF NOT ((2 <= cols) AND (cols <= 4)) BEGIN
PATCH_IF NOT ((cols = 2) OR (cols = 4)) BEGIN
//Sanitize columns value. tobex has 2 columns, others have 4.
PATCH_FAIL "hide_spells_from_array: unexpected number of columns '%cols%'."
END
Expand Down Expand Up @@ -98,7 +98,8 @@ DEFINE_ACTION_FUNCTION hide_spells BEGIN
ACTION_IF GAME_IS "iwdee" BEGIN
OUTER_TEXT_SPRINT engine "iwdee"
END ELSE BEGIN
ACTION_IF GAME_IS "tobex" BEGIN
//Not an ee. Check for tobex by a simple file check.
ACTION_IF (FILE_EXISTS "tobex_ini/tobexcore.ini") AND (FILE_EXISTS_IN_GAME "hidespl.2da") BEGIN
OUTER_TEXT_SPRINT engine "tobex"
END ELSE BEGIN
WARN "hide_spells: unhandled case; no patching will be done."
Expand Down

0 comments on commit e18ca45

Please sign in to comment.