Repository navigation
Commit caf9800
committed
Fix: prevent monsters from changing gear while reading a spellbook.
A spellcasting monster's multi-turn spellbook read should be a focused
activity, but its gear-management machinery could fire mid-read. In
movemon(), the I_SPECIAL gear handler (re-equip armor, re-eval weapon)
runs before dochug()/use_misc() advances the read, so a pet that picked
up or was handed better gear would swap it and burn the turn, delaying
the read by a round. Throwing gear directly at a tame monster took the
gear immediately by a separate route. Enforce mutual exclusion: while
a read is in progress, defer the gear change until it finishes or is
interrupted, reusing the existing I_SPECIAL deferral path.
* src/mon.c: gate the I_SPECIAL gear handler on the monster not
currently reading (msp_reading != 0). The test sits before the
I_SPECIAL clear, so the flag stays set and the deferred wear/wield
resumes once the read completes.
* src/dothrow.c: when a tame monster catches thrown gear mid-read,
pocket the item and call check_gear_next_turn() instead of
wielding/wearing immediately, so the gated movemon() handler equips
it after the read.1 parent 06b7606 commit caf9800
3 files changed
Lines changed: 19 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5488 | 5488 | | |
5489 | 5489 | | |
5490 | 5490 | | |
| 5491 | + | |
5491 | 5492 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2123 | 2123 | | |
2124 | 2124 | | |
2125 | 2125 | | |
2126 | | - | |
2127 | | - | |
2128 | | - | |
2129 | | - | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
2130 | 2137 | | |
2131 | | - | |
2132 | 2138 | | |
2133 | 2139 | | |
2134 | 2140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1606 | 1606 | | |
1607 | 1607 | | |
1608 | 1608 | | |
1609 | | - | |
1610 | | - | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
1611 | 1616 | | |
1612 | 1617 | | |
1613 | 1618 | | |
| |||
0 commit comments