devilutionX
devilutionX copied to clipboard
Converting hellfire save to diablo while having a hellfire spell selected
If you convert a hellfire spell to diablo while having a hellfire spell selected, it will still be selected in devilutionx but without icon and you can still cast it, which will probably crash. If you try to load such a save in vanilla, it will crash. Spell selection should be cleared while converting saves if it's a hellfire spell.
The hellfire spells are cleared is that every tick ValidatePlayer() will check against any invalid spell and remove them from the players learned spells. This is a bit late for what we need here.
A possible fix would be:
- Call
ValidatePlayer(player)beforeCalcPlrItemVals()during loading. - Update
IsReadiedSpellValid()to properly check learned spells (currently it assumes them to be valid). - Replace
CalcPlrItemVals()during loading withCalcPlrInv()(it will callsCalcPlrItemVals()). This will also update spells from scrolls, and after that check for an invalid readied spell and clear it.
We would need to also do something similar for when LoadHotkeys() is called.