Skip to content

nightly

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 04 Nov 11:14
ad9b81a
Make the active character index 0-based (#2739)

* Make the active character index 0-based

Party stores the active character as a 0-based index now, with -1 for no active character, so the "- 1" at every reader is gone. The turn engine, the portrait buttons and the test tapes pass the index through as is, and the two sentinels that shared the old zero, enchantingActiveCharacter and dword_507CC0_activ_ch, moved to -1 as well.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Review follow-up for the 0-based active character index

The two Party docs that named the private member now describe the effect for callers, and the member line lost its redundant trailing comment. The dead decompiler comments that still spelled the old expression are gone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Make the test controller index and SpellBuff::caster 0-based too

With the active character index 0-based, the two remaining 1-based character indexes in the engine read as traps. EngineController::goToInventory, castSpell and castQuickSpell now take the same 0-based index as everything else and add one only where they press the digit key, and every test call site shifted down by one. SpellBuff::caster is a 0-based index as well, with -1 for a buff that came from a potion or an npc, so its readers index the party directly. The save format is unchanged, the snapshot code adds one on the way out and subtracts one on the way in, the same way the lich jar index is handled.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Assert the caster index in the Splitter explosion helper

The guard that used to sit in _42FA66_do_explosive_impact was a tautology, so the function never checked its character index. It now asserts the index is a valid party slot before building the caster pid, which is where a stray -1 would otherwise surface.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Document that activeCharacterIndex() needs an active character

The accessor asserts hasActiveCharacter(), so a caller that has not checked gets an assert failure rather than -1. The doc now says so and points at the check to make first.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Shift the #1301 test expectations to the 0-based index

The two tests from #2671 landed on master after this branch was cut and still read the active character tape as 1-based, with zero for no one selected. The first character is 0 and no selection is -1 now.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>