private int InternalDraw( ref int arg1, ref int arg2, ref int val, int min1, int max1, int min2, int max2, int minV, int maxV, int maxBlocksToDraw )
{
Count = 0;
int exCount = 0;
DrawFasePrepare( min1, max1, min2, max2 );
for ( arg1 = min1; arg1 <= max1 && MathCommands.MaxCalculationExceptions >= exCount; ++arg1 ) {
for ( arg2 = min2; arg2 <= max2; ++arg2 ) {
try {
int fval =
_scaler.FromFuncResult(
_expression.Evaluate( _scaler.ToFuncParam( arg1, min1, max1 ),
_scaler.ToFuncParam( arg2, min2, max2 ) ),
minV, maxV );
DrawFase1( fval, ref arg1, ref arg2, ref val, min1, max1, min2, max2, minV, maxV, maxBlocksToDraw );
//if (TimeToEndBatch)
// return _count;
} catch ( Exception ) {
//the exception here is kinda of normal, for functions (especially interesting ones)
//may have eg punctured points; we just have to keep an eye on the number, since producing 10000
//exceptions in the multiclient application is not the best idea
if ( ++exCount > MathCommands.MaxCalculationExceptions ) {
Player.Message( "Function drawing is interrupted: too many (>" + MathCommands.MaxCalculationExceptions + ") calculation exceptions." );
break;
}
}
}
}
//the real drawing for the surface variant
DrawFase2( ref arg1, ref arg2, ref val, min1, max1, min2, max2, minV, maxV, maxBlocksToDraw );
return Count;
}