PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
Problem in Distro Attackhook

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> Development Discussion
Display posts from previous:   

Author Message
Yazaki



Joined: 18 Mar 2007
Posts: 4

PostPosted: Thu Mar 29, 2007 1:30 pm    Post subject: Problem in Distro Attackhook Reply with quote

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:
   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:

   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.

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Thu Mar 29, 2007 3:00 pm    Post subject: Reply with quote

Thanks for the tip, I'm about to commit this fix. I used a 1-liner to declare and initialize that struct:
Code:
var best_armor := struct{"ar" := 0};

Post new topic   Reply to topic    PenUltima Online Forum Index -> Development Discussion All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty