I was standing in the same square a Sun Scarab, and fired my Plasma Cannon. We each got hit 20 times, because SolveLine will happily return the same square for each range step from 1 to 20.
I propose solving this by adding the following line at the end of the while( t < rng ) loop:
I was standing in the same square a Sun Scarab, and fired my Plasma Cannon. We each got hit 20 times, because SolveLine will happily return the same square for each range step from 1 to 20.
I propose solving this by adding the following line at the end of the while( t < rng ) loop:
if (P1.X=P2.X) and (P1.Y=P2.Y) then T := rng;
I haven't tested this yet, so I don't know how well it works. (I'm worried about not hitting at all if the target is at a different altitude...)
BTW, I've made a few more tweaks to my AI code. If another release is coming up soon, I can make another patch. (Should I make a patch against the gh-1.002 source, or make it incremental wrt. my last patch?)