devilutionX icon indicating copy to clipboard operation
devilutionX copied to clipboard

Converting hellfire save to diablo while having a hellfire spell selected

Open qndel opened this issue 4 years ago • 1 comments

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.

qndel avatar Nov 10 '21 08:11 qndel

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) before CalcPlrItemVals() during loading.
  • Update IsReadiedSpellValid() to properly check learned spells (currently it assumes them to be valid).
  • Replace CalcPlrItemVals() during loading with CalcPlrInv() (it will calls CalcPlrItemVals()). 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.

AJenbo avatar Apr 04 '22 20:04 AJenbo