Page 1 of 1

World Crash starting combat - double-click?

Posted: Sat Jul 27, 2013 12:52 am
by John Adams
Jab/Foof,

Noticed twice now when I double-clicked an Orc to attack, the world crashes here:

Code: Select all

 	ntdll.dll!774315de()	Unknown
 	[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]	
>	EQ2World__Debug.exe!ZoneServer::CombatProcess() Line 958	C++
 	EQ2World__Debug.exe!ZoneServer::SpawnProcess() Line 1009	C++
 	EQ2World__Debug.exe!SpawnLoop(void * tmp) Line 4933	C++
 	EQ2World__Debug.exe!_callthreadstart() Line 255	C
 	EQ2World__Debug.exe!_threadstart(void * ptd) Line 239	C
 	kernel32.dll!765d33aa()	Unknown
 	ntdll.dll!77449ef2()	Unknown
 	ntdll.dll!77449ec5()	Unknown
Here: ((Entity*)itr->value)->ProcessCombat();

If I use the ~ or 1 buttons to attack, or click the hotbar, things seem okay.

Re: World Crash starting combat - double-click?

Posted: Sat Jul 27, 2013 3:13 pm
by John Adams
I think the problem is in this block of code -

Code: Select all

	if (target->HasTarget()) {
		if (target->IsPlayer() || (target->IsNPC() && target->IsPet() && !((NPC*)target)->GetOwner()->IsNPC())){
			Spawn* secondary_target = target->GetTarget();
			if (secondary_target->IsEntity()) {
				if (!secondary_target->IsPlayer()) {
					if (secondary_target->IsNPC()) {
						if (secondary_target->appearance.attackable) {
							if (!secondary_target->IsPet() || (secondary_target->IsPet() && ((NPC*)secondary_target)->GetOwner()->IsNPC())) {
								combat_target = secondary_target;
							}
						}
					}
				}
			}
		}
	}
	else
		combat_target = target;
			
	float distance = GetDistance(combat_target);
	distance -= combat_target->appearance.pos.collision_radius / 10;
	distance -= appearance.pos.collision_radius / 10;                            <-- crashed here this time
Double-click is definitely causing it, 100% reproducible.

I think it is because I do not have the spawn targetted, then double-click to target and attack, and BOOM.
combat_target.jpg

Re: World Crash starting combat - double-click?

Posted: Sat Jul 27, 2013 4:46 pm
by xinux
Yup reproduceable every time

Re: World Crash starting combat - double-click?

Posted: Sat Jul 27, 2013 4:47 pm
by John Adams
Trying this for now:

Code: Select all

	float distance = 0;
	if( combat_target )
	{
		distance = GetDistance(combat_target);
		distance -= combat_target->appearance.pos.collision_radius / 10;
		distance -= appearance.pos.collision_radius / 10;
	}

Re: World Crash starting combat - double-click?

Posted: Sat Jul 27, 2013 4:49 pm
by Jabantiz
I'll see if I can look into this tonight, hopefully it will be a simple issue.

Also does right click attack result in the same behavior or is it just double left click?

Re: World Crash starting combat - double-click?

Posted: Sat Jul 27, 2013 5:02 pm
by John Adams
Jab, that code I added fixes the crash. And no, all other forms of attack seem to be fine. Right-click Attack, pressing Ranged, or Melee, or using the ` key.

It is only double-click.

Re: World Crash starting combat - double-click?

Posted: Sat Jul 27, 2013 5:33 pm
by Jabantiz
Well no surprise I can't reproduce it, works fine for me and checked the code don't have your changes, I am running on a local server not sure if it matters. Since your code fixes it will look into the wrong version crashing the world.

Re: World Crash starting combat - double-click?

Posted: Sat Jul 27, 2013 6:05 pm
by John Adams
I actually found this on my local server first, so no that isn't the issue. You can clearly see by my screen grab that the combat_target is invalid, no? That's why I changed what I did. Wasn't sure it was right, but if it passes your QA, I'm good with it.

I'm thinking the worse case is double-clicking something you are OOR on, the distance calcs will be wrong.

Re: World Crash starting combat - double-click?

Posted: Sat Jul 27, 2013 6:33 pm
by Jabantiz
yea combat_target is invalid in your pic. No clue why I don't have this issue and you and xinux do. oh well your fix should work.