Esempio n. 1
0
STATIC const char *doOutput( const char * str ) {

/**/myassert( str != NULL );
    if( *str != '=' && *str != '#' ) unrecognized( 'o' );
    ++str;
    getAct( 1 );
    if( curAct->output != NULL ) {
        MemFree( curAct->output );
    }
    if( isBreakChar( *str ) ) unrecognized( 'o' );
    curAct->output = getFile( &str );
    return( str );
}
Esempio n. 2
0
STATIC const char *doInclude( const char *str ) {

    int     fh;
    char    *file;
    char    *file_name;
    const char *env_var;

/**/myassert( str != NULL );
    if( isBreakChar( *str ) ) unrecognized( '@' );
    file_name = getFile( &str );
    env_var = getenv( file_name );
    if( env_var != NULL ) {
        MemFree( file_name );
        parseString( env_var );
    } else {
        /* both these functions use a lot of stack, so we separate them */
        fh = openIncludeFile( file_name );
        MemFree( file_name );
        file = readIncludeFile( fh );
        if( file != NULL ) {
            parseString( file );
            MemFree( file );
        }
    }
    return( str );
}
Esempio n. 3
0
void protect_goal::on_create()
{
	goal::on_create();
	if (!cfg_["engine"].empty() && cfg_["engine"] != "cpp") {
		unrecognized();
		value_ = 0;
		return;
	}
	if (const config::attribute_value *v = cfg_.get("value")) {
		value_ = v->to_double(0);
	}
	if (const config::attribute_value *v = cfg_.get("protect_radius")) {
		radius_ = (*v).to_int(1);
	}

	if (radius_<1) {
		radius_=20;
	}
	const config &criteria = cfg_.child("criteria");
	if (criteria) {
		filter_ptr_.reset(new terrain_filter(vconfig(criteria),resources::filter_con));
	}


}
Esempio n. 4
0
STATIC const char *doParse( const char *str ) {

/**/myassert( str != NULL );
    getAct( 1 );
    switch( tolower( *str ) ) {
    case 'w':   curAct->dbg_parser = PARSE_WATCOM;      break;
    case '7':   curAct->dbg_parser = PARSE_WATCOM_70;   break;
    case '-':   curAct->dbg_parser = PARSE_NULL;        break;
    default:    unrecognized( 'p' );
    }
    return( str + 1 );
}
Esempio n. 5
0
void target_unit_goal::on_create()
{
	goal::on_create();
	if (!cfg_["engine"].empty() && cfg_["engine"] != "cpp") {
		unrecognized();
		value_ = 0;
		return;
	}
	if (const config::attribute_value *v = cfg_.get("value")) {
		value_ = v->to_double(0);
	}
}
Esempio n. 6
0
STATIC const char *doToggle( const char *str ) {

/**/myassert( str != NULL );
    getAct( 1 );
    switch( tolower( str[-1] ) ) {
    case 'q':   curAct->quiet = ! curAct->quiet;        break;
#if 0
    case 'l':   curAct->deflib = ! curAct->deflib;      break;
#endif
    case 'b':   curAct->batch = ! curAct->batch;        break;
    default:    unrecognized( str[-1] );                break;
    }
    return( str );
}
Esempio n. 7
0
STATIC const char *doDebug( const char *str ) {

/**/myassert( str != NULL );
    getAct( 1 );
    switch( tolower( *str ) ) {
    case 'm':   curAct->dbg_generator = DGEN_MICROSOFT; break;
    case 'p':   curAct->dbg_generator = DGEN_METAWARE;  break;
    case 't':   curAct->dbg_generator = DGEN_TURBO;     break;
    case 'x':   curAct->dbg_generator = DGEN_TXT;       break;
    case '-':   curAct->dbg_generator = DGEN_NULL;      break;
    default:    unrecognized( 'd' );
    }
    return( str + 1 );
}
Esempio n. 8
0
void target_location_goal::on_create()
{
	goal::on_create();
	if (!cfg_["engine"].empty() && cfg_["engine"] != "cpp") {
		unrecognized();
		value_ = 0;
		return;
	}
	if (cfg_.has_attribute("value")) {
		value_ = cfg_["value"].to_double(0);
	}
	const config &criteria = cfg_.child("criteria");
	if (criteria) {
		filter_ptr_.reset(new terrain_filter(vconfig(criteria),resources::filter_con));
	}
}
Esempio n. 9
0
bool callFunction(std::string get, int scramblers[3+1][26], int shift[3], int rotor[3]){

    // make input string lower case
    for(size_t i = 0, n = get.length(); i < n; i++)
        get[i] = tolower(get[i]);

    if(get.compare("end") == 0)
        return false;
    if(get.compare("help") == 0)
        help();
    else if(get.compare("generate_key") == 0 or get.compare("gk") == 0)
        generateKey();
    else if(get.compare("generate_scrambler") == 0 or get.compare("gs") == 0)
        generateScrambler(scramblers);
    else if(get.compare("set_key") == 0 or get.compare("sk") == 0)
        setKey(scramblers);
    else if(get.compare("encrypt") == 0 or get.compare("e") == 0)
        encrypt(scramblers, shift, rotor);
    else if(get.compare("set_shift") == 0 or get.compare("ss") == 0)
        setShift(shift);
    else if(get.compare("set_rotor") == 0 or get.compare("sr") == 0)
        setRotor(rotor);
    else if(get.compare("reset_shift") == 0 or get.compare("rs") == 0)
        resetShift(shift);
    else if(get.compare("print_shift") == 0 or get.compare("ps") == 0)
        printShift(shift);
    else if(get.compare("print_rotor") == 0 or get.compare("pr") == 0)
        printRotor(rotor);
    else if(get.compare("encrypt_file") == 0 or get.compare("ef") == 0)
        encryptFile(scramblers, shift, rotor);
    else if(get.compare("capitalize") == 0 or get.compare("c") == 0)
        capitalize();
    else if(get.compare("set_plugboard") == 0 or get.compare("sp") == 0)
        setPlugboard();
    else if(get.compare("save") == 0 or get.compare("s") == 0)
        save(scramblers, shift, rotor);
    else if(get.compare("load") == 0 or get.compare("l") == 0)
        load(scramblers, shift, rotor);
    else
        unrecognized();


    return true;
}
Esempio n. 10
0
STATIC const char *doFile( const char *str ) {

/**/myassert( str != NULL );
    getAct( 1 );
    switch( tolower( *str ) ) {
    case 'm':
        curAct->omf_generator = OGEN_MICROSOFT;
        if( str[1] == '2' ) {
            curAct->omf_generator = OGEN_MICROSOFT_OS2;
            ++str;
        }
        break;
    case 'p':
        curAct->omf_generator = OGEN_PHARLAP;
        break;
    case '-':
        curAct->omf_generator = OGEN_NULL;
        break;
    default:
        unrecognized( 'f' );
    }
    return( str + 1 );
}
Esempio n. 11
0
void goal::on_create(std::shared_ptr<ai::lua_ai_context>)
{
	unrecognized();
}