Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 10-14-2006, 03:26 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default A crash, a terrible crash!

I >>believe<< I've found the crash that has plagued the poor 60+ EQemu monks of Norrath.

Took me forever to reproduced it under my own compile and pinpoint it.. yet now it seems so utterly obvious, and I'm kicking myself for skipping over it so many times.

Little background on the bug, sometimes when a monk kills something the zone will crash, only happens to monks with triple attack aka 60+.

What I believe is happening is the target is dying betweek the normal attacks and the triple attacks and so attack is getting called with a null pointer. What's also happening is mlog COMBAT__ATTACKS is on when this happens.

Here's the code that I think needs fixed:
Code:
bool Client::Attack(Mob* other, int Hand, bool bRiposte)
{
	mlog(COMBAT__ATTACKS, "Attacking %s with hand %d %s", other->GetName(), Hand, bRiposte?"(this is a riposte)":"");
	
	//SetAttackTimer();
	if (
		   (IsCasting() && GetClass() != BARD)
		|| other == NULL
		|| ((IsClient() && CastToClient()->dead) || (other->IsClient() && other->CastToClient()->dead))
		|| (GetHP() < 0)
		|| (!IsAttackAllowed(other))
		) {
		mlog(COMBAT__ATTACKS, "Attack canceled, invalid circumstances.");
		return false; // Only bards can attack while casting
	}
Notice how mlog is being called BEFORE we check if other is NULL. And acting on null like it exists.. ie potential crash.

Change the first mlog to:
Code:
mlog(COMBAT__ATTACKS, "Attacking %s with hand %d %s", other?other->GetName():"NOBODY", Hand, bRiposte?"(this is a riposte)":"");
or move it below the check if the pointer is NULL

Thanks to John for telling me about it and giving me the info to fix it. Haven't crashed since I changed that line of code, so hopefully this fixes the problem.

And yeah pretty sure it solved something, an excerpt from my console after I applied this fix.
Code:
[Debug] [COMBAT__ATTACKS] Sara: Attacking froglok_jin_shaman08 with hand 13
[Debug] [COMBAT__ATTACKS] Sara: Attacking with weapon: Big Soul Devourer (11000)

[Debug] [COMBAT__ATTACKS] Sara: Attacking with Big Soul Devourer in slot 13 usin
g skill 1
[Debug] [COMBAT__ATTACKS] Sara: Attacking froglok_jin_shaman07 with hand 13
[Debug] [COMBAT__ATTACKS] Sara: Attacking with weapon: Big Soul Devourer (11000)

[Debug] [COMBAT__ATTACKS] Sara: Attacking with Big Soul Devourer in slot 13 usin
g skill 1
[Debug] [COMBAT__ATTACKS] Sara: Attacking froglok_jin_shaman07 with hand 13 (thi
s is a riposte)
[Debug] [COMBAT__ATTACKS] Sara: Attacking with weapon: Big Soul Devourer (11000)

[Debug] [COMBAT__ATTACKS] Sara: Attacking with Big Soul Devourer in slot 13 usin
g skill 1
[Debug] [COMBAT__ATTACKS] Sara: Attacking NOBODY with hand 13...

Last edited by KLS; 10-14-2006 at 11:35 PM..
Reply With Quote
  #2  
Old 10-17-2006, 12:44 AM
John Adams
Demi-God
 
Join Date: Jul 2006
Posts: 1,552
Default

If this is the fix, I will need a photo of you to put on my wall to worship. Thanks for taking the time to look into it. I can't wait to try it out!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 03:18 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3