Core/Pet: Attempt to fix assertions triggered when summoning pets#26501
Conversation
…hile in a vehicle
|
Thanks @Jildor for the clear and easy How To Reproduce steps 👍 |
|
thanks ;) I'm not sure but maybe HandleStableSwapPet needs the same as HandleStablePet? |
|
get a hunter with a tamed pet I don't know how many more cases there may be, can't we look for a more generic solution? |
|
I don't have a generic solution, I'm just trying to fix the crashes quite fast so worldserver can stay alive. |
@Jildor to me this is a bug in spell 6962 that it doesn't do the same checks that "Call Pet" does, saying "You do not have a pet to summon" |
…nd casting spell 6962
@Jildor this case has been fixed, now no pet is summoned if it's stabled |
…62 while being dead
@Jildor this case has been fixed too. Maybe someone with more knowledge about the code could find a different fix but at least we have some workarounds to avoid the crashes |
|
yep, nice 👍 get a warlock and summon a pet (by example imp) It's too hard to find more ways to reproduce these crashes |
|
@Jildor well the first step is to fix fast the obvious ones, then find a more generic solution that still works with all the cases we found (and ofc remove the fast temporary fix) |
…while on vehicle 34775
this is fixed now with a more generic "when loading a pet from PET_SAVE_NOT_IN_SLOT and CurrentPet is not empty, remove the CurrentPet". got a strange behavior now:
but I guess summoning the wrong pet is better than triggering an assert |
|
@Jildor I changed the fix for Case 1 to be more generic, moving the check in Pet.cpp . |
This case is now handled in a generic way, unstabling the pet and updating the required variables to avoid any assert. If this is not the desired behavior, just return false in Pet::LoadFromDB() in the "if" case I added (I'm not caring at all for blizzlikeness right now, just fixing asserts) |
|
Case 2 now works with the same fix as Case 3, even if ingame it looks a bit strange. When dismounting, the stable pet will become current and the stable interface shows the pet duplicated until Call Stable is called again. I removed the change added in 6052cdf which can be added again if needed (no idea if returnReagents parameter should be false or true in that case) |
|
Case 4 now works with the same fix as Case 5. This means we have 5 different cases fixed by 3 different changes, all done in Pet::LoadPetFromDB() :
These are fallback checks that kick in only when the caller has not taken care already of these scenarios. For example Call Pet will still show the ingame message "You don't have an active pet" when the pet is stabled. @Jildor could you please test latest version of this PR, running once more through the cases you reported and maybe some more that didn't crash before but that you tested already ? I hope the current code looks more promising to you 🤞 |
|
this case continue crashing: |
…while on vehicle 34775 with a new character
@Jildor case 6 fixed too |
|
tested all cases, I can't reproduce the crashes 👍 |
|
Thank you for the PR! 😄 |
|
A new case:
|
|
@shenhuyong did that case happen before this PR too ? Edit: nvm, found the issue from this PR |
fixed by 22a5b0f , caused by a missing change from this PR in Pet Swap opcode |
…6501) * Core/Pet: Attempt to fix an assertion triggered when re-summoning the current pet * Core/Pet: Attempt to fix an assertion triggered when stabling a pet while in a vehicle * Core/Pet: Attempt to fix an assertion triggered when stabling a pet and casting spell 6962 * Core/Pet: Attempt to fix an assertion triggered when casting spell 6962 while being dead * Core/Pet: Attempt to fix an assertion triggered when summoning a pet while on vehicle 34775 * Handle cases in a generic way * Code cleanup * Core/Pet: Attempt to fix an assertion triggered when summoning a pet while on vehicle 34775 with a new character (cherry picked from commit e203ecd)
Changes proposed:
Target branch(es): 3.3.5/master
Issues addressed:
Closes # (insert issue tracker number)
#26491
Tests performed:
Known issues and TODO list: (add/remove lines as needed)