AleksandarMIlenkovic / quickb2

Automatically exported from code.google.com/p/quickb2
0 stars 0 forks source link

Bug on TopDown CarBody code #30

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Version: 2.0.6

File: tdCarBody.as
Line: from 286 to 302
Error type: copy/paste mistake

Actual version:

if ( !axle.numBot )
{
    axle.numBot = 1;
    axle.numBot = centroid.y - (axle.avgTop - centroid.y);
}

if ( !axle.numLeft )
{
    axle.numLeft = 1;
    axle.numLeft = centroid.x - (axle.avgRight - centroid.x);
}

if ( !axle.numRight )
{
    axle.numRight = 1;
    axle.numRight = centroid.x - (axle.avgLeft - centroid.x);
}

Corrected version:
if ( !axle.numBot )
{
    axle.numBot = 1;
    axle.avgBot= centroid.y - (axle.avgTop - centroid.y);
}

if ( !axle.numLeft )
{
    axle.numLeft = 1;
    axle.avgLeft= centroid.x - (axle.avgRight - centroid.x);
}

if ( !axle.numRight )
{
    axle.numRight = 1;
    axle.avgRight= centroid.x - (axle.avgLeft - centroid.x);
}

Original issue reported on code.google.com by magi...@gmail.com on 17 Jul 2011 at 9:12

GoogleCodeExporter commented 8 years ago
or, if it was correct the actual version, then you should remove the double 
assignment, of the same variables, inside the if.

Original comment by magi...@gmail.com on 17 Jul 2011 at 9:14

GoogleCodeExporter commented 8 years ago
Sweet, thanks!

Out of curiosity, how did you spot this?  Were your cars behaving strangely or 
something?

Odd that I haven't seen problems from this yet.

Original comment by doug...@gmail.com on 18 Jul 2011 at 2:46

GoogleCodeExporter commented 8 years ago
I'm looking how your code works. It's the best way to learn.

Original comment by magi...@gmail.com on 18 Jul 2011 at 7:18