Problem in Distro Attackhook

Open discussion forum. For topics that do not fit anywhere else.
Locked
User avatar
Yazaki
New User
Posts: 4
Joined: Sun Mar 18, 2007 1:23 pm

Problem in Distro Attackhook

Post by Yazaki »

In the distro 097 combat package, there's the combatHook.src script.

Within is the function GetArmorHit (Line 260 ->), where a conditional is comparing a struct member .ar, even though the variable itself is still an integer, resulting in comparison of an uninit. object.

Code: Select all

	var best_armor := 0;
	foreach item in ( armor_hit )
		if ( item.ar > best_armor.ar )
			best_armor := item;
		endif
		SleepMS(2);
	endforeach
I fixed this by changing it to:

Code: Select all

	var best_armor := struct;
	best_armor.ar := 0;
	foreach item in ( armor_hit )
		if ( item.ar > best_armor.ar )
			best_armor := item;
		endif
		SleepMS(2);
	endforeach
Without the fix, this function always returned 0, resulting in worn armor being ignored.
User avatar
tekproxy
Forum Regular
Posts: 352
Joined: Thu Apr 06, 2006 5:11 pm

Post by tekproxy »

Thanks for the tip, I'm about to commit this fix. I used a 1-liner to declare and initialize that struct:

Code: Select all

var best_armor := struct{"ar" := 0};
Locked