Skip to content
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

Merged
merged 3 commits into from
Sep 23, 2023

Conversation

Jhobean
Copy link
Contributor

@Jhobean Jhobean commented Feb 12, 2023

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.

@Jhobean Jhobean marked this pull request as draft February 12, 2023 23:28
@Jhobean Jhobean marked this pull request as ready for review May 1, 2023 12:56
@cbnolok cbnolok force-pushed the master branch 12 times, most recently from 04f1ff5 to 56363a7 Compare May 13, 2023 13:43
@@ -429,7 +429,7 @@ bool CChar::Delete(bool fForce)
{
ADDTOCALLSTACK("CChar::Delete");

if ((NotifyDelete() == false) && !fForce)
if ((NotifyDelete(0) == false) && !fForce)
Copy link
Contributor

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

@@ -593,8 +594,9 @@ void CAccount::DeleteChars()
CChar * pChar = m_Chars.GetChar(--i).CharFind();
if (pChar != nullptr)
{
pChar->NotifyDelete(1);
Copy link
Contributor

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

@Jhobean Jhobean marked this pull request as draft September 23, 2023 12:11
@Jhobean Jhobean marked this pull request as ready for review September 23, 2023 12:52
@Jhobean
Copy link
Contributor Author

Jhobean commented Sep 23, 2023

I tested for different way and seem work correctly.

@cbnolok cbnolok merged commit 797ba28 into Sphereserver:master Sep 23, 2023
6 of 7 checks passed
@Jhobean Jhobean deleted the Deleteaccount branch September 23, 2023 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants