fCraft.PrepareParametrizedManifold.SetParamIteration C# (CSharp) Method

SetParamIteration() public static method

public static SetParamIteration ( Player p, Command cmd ) : void
p Player
cmd Command
return void
        public static void SetParamIteration( Player p, Command cmd )
        {
            string strParam = cmd.Next();
            if ( string.IsNullOrWhiteSpace( strParam ) ) {
                p.Message( "Error: missing param variable name" );
                return;
            }

            strParam = strParam.ToLower();

            try {
                CheckParamVar( strParam );

                double from = ReadDoubleParam( cmd, "lower bound" );
                double to = ReadDoubleParam( cmd, "upper bound" );
                double step = ReadDoubleParam( cmd, "step" );

                if ( step == 0 ||
                    ( to - from ) / step < 0 )
                    throw new ArgumentException( "wrong iteration bounds/step combination" );

                p.Message( "Iteration for " + strParam + " from " + from + " to " + to + " with step " + step + ". " +
                          ( ( to - from ) / step + 1 ) + " steps." );

                GetPlayerParametrizationParamsStorage( p )[VarNameToIdx( strParam[0] )] = new double[] { from, to, step };
            } catch ( Exception e ) {
                p.Message( "Error: " + e.Message );
            }
        }