-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix f_onchar_delete not launch when delete account #1031
Conversation
04f1ff5
to
56363a7
Compare
src/game/chars/CChar.cpp
Outdated
@@ -429,7 +429,7 @@ bool CChar::Delete(bool fForce) | |||
{ | |||
ADDTOCALLSTACK("CChar::Delete"); | |||
|
|||
if ((NotifyDelete() == false) && !fForce) | |||
if ((NotifyDelete(0) == false) && !fForce) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use false here
src/game/clients/CAccount.cpp
Outdated
@@ -593,8 +594,9 @@ void CAccount::DeleteChars() | |||
CChar * pChar = m_Chars.GetChar(--i).CharFind(); | |||
if (pChar != nullptr) | |||
{ | |||
pChar->NotifyDelete(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed, since it's already called by CChar::Delete, and you can pass fForce there
I tested for different way and seem work correctly. |
Issue #1029
Need to be review. DeleteChars() was already on this function:
CAccount::~CAccount()
But this function seem to never be use so I added the DeleteChars(); in the account delete function.
Since we want a notification in script, I mannualy add NotifyDelete(1) and add a bool value to block the return 1 function in the @f_onchar_delete or @destroy trigger. Without this check, If this return is present, we get an infinite while loop.