text_property r_language_rep::advance (tree t, int& pos) { string s= t->label; if (pos==N(s)) { return &tp_normal_rep; } char c= s[pos]; if (c == ' ') { pos++; return &tp_space_rep; } if ( is_number_start(c) ) { int opos =pos ; parse_number (s, pos); if( opos != pos ) return &tp_normal_rep; } if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || is_in_str( c, "_." ) //|| (c == '$') // For some reason, when this is uncommented, TeXmacs gets stuck on entering $. ) { parse_alpha (s, pos); return &tp_normal_rep; } tm_char_forwards (s, pos); return &tp_normal_rep; }
Unit* Mission::call_unit_launch( CreateFlightgroup *fg, int type, const string &destinations ) { int faction_nr = FactionUtil::GetFactionIndex( fg->fg->faction ); Unit **units = new Unit*[fg->nr_ships]; int u; Unit *par = _Universe->AccessCockpit()->GetParent(); CollideMap::iterator metahint[2] = { _Universe->scriptStarSystem()->collidemap[Unit::UNIT_ONLY]->begin(), _Universe->scriptStarSystem()->collidemap[Unit::UNIT_BOLT]->begin() }; CollideMap::iterator *hint = metahint; if ( par && !is_null( par->location[Unit::UNIT_ONLY] ) && !is_null( par->location[Unit::UNIT_BOLT] ) && par->activeStarSystem == _Universe->scriptStarSystem() ) hint = par->location; for (u = 0; u < fg->nr_ships; u++) { Unit *my_unit; if (type == PLANETPTR) { float radius = 1; char *tex = strdup( fg->fg->type.c_str() ); char *nam = strdup( fg->fg->type.c_str() ); char *bsrc = strdup( fg->fg->type.c_str() ); char *bdst = strdup( fg->fg->type.c_str() ); char *citylights = strdup( fg->fg->type.c_str() ); tex[0] = '\0'; bsrc[0] = '\0'; //have at least 1 char bdst[0] = '\0'; citylights[0] = '\0'; GFXMaterial mat; GFXGetMaterial( 0, mat ); BLENDFUNC s = ONE; BLENDFUNC d = ZERO; if (bdst[0] != '\0') d = parse_alpha( bdst ); if (bsrc[0] != '\0') s = parse_alpha( bsrc ); my_unit = UnitFactory::createPlanet( QVector( 0, 0, 0 ), QVector( 0, 0, 0 ), 0, Vector( 0, 0, 0 ), 0, 0, radius, tex, "", "", s, d, ParseDestinations( destinations ), QVector( 0, 0, 0 ), NULL, mat, vector< GFXLightLocal > (), faction_nr, nam, getUniqueSerial() ); free( bsrc ); free( bdst ); free( tex ); free( nam ); free( citylights ); } else if (type == NEBULAPTR) { my_unit = UnitFactory::createNebula( fg->fg->type.c_str(), false, faction_nr, fg->fg, u+fg->fg->nr_ships-fg->nr_ships, getUniqueSerial() ); } else if (type == ASTEROIDPTR) { my_unit = UnitFactory::createAsteroid( fg->fg->type.c_str(), faction_nr, fg->fg, u+fg->fg->nr_ships-fg->nr_ships, .01, getUniqueSerial() ); } else { my_unit = UnitFactory::createUnit( fg->fg->type.c_str(), false, faction_nr, string( "" ), fg->fg, u+fg->fg->nr_ships-fg->nr_ships, NULL, getUniqueSerial() ); } units[u] = my_unit; } float fg_radius = units[0]->rSize(); Unit *my_unit; for (u = 0; u < fg->nr_ships; u++) { my_unit = units[u]; QVector pox; pox.i = fg->fg->pos.i+u*fg_radius*3; pox.j = fg->fg->pos.j+u*fg_radius*3; pox.k = fg->fg->pos.k+u*fg_radius*3; my_unit->SetPosAndCumPos( pox ); if (type == ASTEROIDPTR || type == NEBULAPTR) { my_unit->PrimeOrders(); } else { my_unit->LoadAIScript( fg->fg->ainame ); my_unit->SetTurretAI(); } _Universe->scriptStarSystem()->AddUnit( my_unit ); my_unit->UpdateCollideQueue( _Universe->scriptStarSystem(), hint ); if ( !is_null( my_unit->location[Unit::UNIT_ONLY] ) && !is_null( my_unit->location[Unit::UNIT_BOLT] ) ) hint = my_unit->location; my_unit->Target( NULL ); } my_unit = units[0]; if ( !_Universe->isPlayerStarship( fg->fg->leader.GetUnit() ) ) fg->fg->leader.SetUnit( my_unit ); delete[] units; return my_unit; }
//scheme = ALPHA *scheme_element TextCursor parse_scheme(TextCursor cursor) { cursor = parse_alpha(cursor); REPEAT_IGNORING(parse_scheme_element, cursor); }