Bug: Error in expression.

Krixes

Moderator
Staff member
Hey Sarge,

Was unsure where to put this but I have came across a bug and thought I would let you know about it. Basicly it was a zero divisor error meaning that all of the units had died and it was trying to divide 360 by 0.

This is the RPT log.
Code:
 8:18:05 Error in expression <_units;
 
if(_defend) then {
_angle = 360/(_count-1);
}else{
_angle = 360/(_count>
8:18:05  Error position: </(_count-1);
}else{
_angle = 360/(_count>
8:18:05  Error Zero divisor
8:18:05 File mpmissions\__cur_mp.cmr_ovaron\addons\SARGE\SAR_functions.sqf, line 469

The code I found here related to this was...
Code:
if(_defend) then {
    _angle = 360/(_count-1);
}else{
    _angle = 360/(_count);
};

The fix I used was this...
Code:
if((_count - 1) >= 1)
{
    if(_defend) then {
        _angle = 360/(_count-1);
    }else{
        _angle = 360/(_count);
    };
} else {
    _angle = 360;
};

Not sure what you intended here but just thought I would let you know of this error and show you a fix I used that worked just fine.

Thanks for your time Sarge,
-Krix
 
Hi Krix,

thx for that one, it is fixed in my latest release already (1.5.1 and 1.5.2)

cheers, Sarge
 
Back
Top