cysun / Heroes3Editor

Heroes of Might and Magic 3 (HoMM3) Savegame Editor
44 stars 20 forks source link

Heros3Editor Crash #11

Open giovino opened 2 years ago

giovino commented 2 years ago

Editing the hero Deemer in the attached saved game will crash Heros3Editor. This crash is repeatable in roughly 1 in 8 games.

AUTOSAVE.GM1 https://drive.google.com/file/d/1T26tIP8qQYbdmdySUlZ6hFpekFGB5YBa/view?usp=sharing

As a fan of HOMM3, I am very thankful for this saved game editor.

cysun commented 2 years ago

I think it's because Deemer has several spell scrolls in his item slots. Right now the editor does not handle spell scrolls.

Happy New Year!

AlexSnowLeo commented 2 years ago

Cannot reproduce this bug on current version on master branch. @cysun maybe you should close it? image

cysun commented 2 years ago

I was able to reproduce it. I don't plan to add spell scroll support myself, though by leaving this issue open, I hope someone will send in a PR to fix it. :-)

AlexSnowLeo commented 2 years ago

I was able to reproduce it. I don't plan to add spell scroll support myself, though by leaving this issue open, I hope someone will send in a PR to fix it. :-)

I didn't understand what the bug is, can you explain in more detail about "spell scroll support".

cysun commented 2 years ago

There are two ways a hero can cast a spell - either the hero already learned the spell from a mage guild, or the hero equipped a spell scroll (e.g. Scroll of Haste). Currently the editor does not recognize the code of any spell scroll (you can see there's no spell scroll in the Items class). Opening a hero with spell scrolls equipped in the item slots may crash the editor.

To support spell scrolls in the editor, we first need to add scrolls to Items. This is not difficult as long as we can find the names and codes of all the valid scrolls somewhere. The part that's unclear to me is how to decide if a spell in the spell book comes from a scroll or not. For example, if we unequip a scroll from a hero in the editor, shall we remove the spell from the spell book (assuming the hero only knows the spell from the scroll) or keep the spell in the spell book (assuming the hero already knows the spell without the scroll)?

Since we can already edit the spell book, I feel handling spell scrolls is not too important. A PR is always welcome though.