inline Vertex::vertex_set Vertex::vertices() const { return vertex_set(vertex_it(data.mesh,data.mesh->data.vtov,ID())); }
daeMetaElement * domLinestrips::registerElement(DAE& dae) { daeMetaElement* meta = dae.getMeta(ID()); if ( meta != NULL ) return meta; meta = new daeMetaElement(dae); dae.setMeta(ID(), *meta); meta->setName( "linestrips" ); meta->registerClass(domLinestrips::create); daeMetaCMPolicy *cm = NULL; daeMetaElementAttribute *mea = NULL; cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 0, -1 ); mea->setName( "input" ); mea->setOffset( daeOffsetOf(domLinestrips,elemInput_array) ); mea->setElementType( domInputLocalOffset::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 1, 0, -1 ); mea->setName( "p" ); mea->setOffset( daeOffsetOf(domLinestrips,elemP_array) ); mea->setElementType( domP::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 ); mea->setName( "extra" ); mea->setOffset( daeOffsetOf(domLinestrips,elemExtra_array) ); mea->setElementType( domExtra::registerElement(dae) ); cm->appendChild( mea ); cm->setMaxOrdinal( 2 ); meta->setCMRoot( cm ); // Add attribute: name { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "name" ); ma->setType( dae.getAtomicTypes().get("xsNCName")); ma->setOffset( daeOffsetOf( domLinestrips , attrName )); ma->setContainer( meta ); meta->appendAttribute(ma); } // Add attribute: count { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "count" ); ma->setType( dae.getAtomicTypes().get("Uint")); ma->setOffset( daeOffsetOf( domLinestrips , attrCount )); ma->setContainer( meta ); ma->setIsRequired( true ); meta->appendAttribute(ma); } // Add attribute: material { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "material" ); ma->setType( dae.getAtomicTypes().get("xsNCName")); ma->setOffset( daeOffsetOf( domLinestrips , attrMaterial )); ma->setContainer( meta ); meta->appendAttribute(ma); } meta->setElementSize(sizeof(domLinestrips)); meta->validate(); return meta; }
} #endif /* CONFIG_PM */ /* must be the same order as name table above */ static const struct pci_device_id agp_via_pci_table[] = { #define ID(x) \ { \ .class = (PCI_CLASS_BRIDGE_HOST << 8), \ .class_mask = ~0, \ .vendor = PCI_VENDOR_ID_VIA, \ .device = x, \ .subvendor = PCI_ANY_ID, \ .subdevice = PCI_ANY_ID, \ } ID(PCI_DEVICE_ID_VIA_82C597_0), ID(PCI_DEVICE_ID_VIA_82C598_0), ID(PCI_DEVICE_ID_VIA_8501_0), ID(PCI_DEVICE_ID_VIA_8601_0), ID(PCI_DEVICE_ID_VIA_82C691_0), ID(PCI_DEVICE_ID_VIA_8371_0), ID(PCI_DEVICE_ID_VIA_8633_0), ID(PCI_DEVICE_ID_VIA_XN266), ID(PCI_DEVICE_ID_VIA_8361), ID(PCI_DEVICE_ID_VIA_8363_0), ID(PCI_DEVICE_ID_VIA_8753_0), ID(PCI_DEVICE_ID_VIA_8367_0), ID(PCI_DEVICE_ID_VIA_8653_0), ID(PCI_DEVICE_ID_VIA_XM266), ID(PCI_DEVICE_ID_VIA_862X_0), ID(PCI_DEVICE_ID_VIA_8377_0),
bool CUISoundsResource::IsInUse() const { return CSettings::Get().GetString("lookandfeel.soundskin") == ID(); }
void CGameObject::OnEvent (NET_Packet& P, u16 type) { switch (type) { case GE_HIT: case GE_HIT_STATISTIC: { /* u16 id,weapon_id; Fvector dir; float power, impulse; s16 element; Fvector position_in_bone_space; u16 hit_type; float ap = 0.0f; P.r_u16 (id); P.r_u16 (weapon_id); P.r_dir (dir); P.r_float (power); P.r_s16 (element); P.r_vec3 (position_in_bone_space); P.r_float (impulse); P.r_u16 (hit_type); //hit type if ((ALife::EHitType)hit_type == ALife::eHitTypeFireWound) { P.r_float (ap); } CObject* Hitter = Level().Objects.net_Find(id); CObject* Weapon = Level().Objects.net_Find(weapon_id); SHit HDS = SHit(power, dir, Hitter, element, position_in_bone_space, impulse, (ALife::EHitType)hit_type, ap); */ SHit HDS; HDS.PACKET_TYPE = type; HDS.Read_Packet_Cont(P); // Msg("Hit received: %d[%d,%d]", HDS.whoID, HDS.weaponID, HDS.BulletID); CObject* Hitter = Level().Objects.net_Find(HDS.whoID); CObject* Weapon = Level().Objects.net_Find(HDS.weaponID); HDS.who = Hitter; if (!HDS.who) { Msg("! ERROR: hitter object [%d] is NULL on client.", HDS.whoID); } //------------------------------------------------------- switch (HDS.PACKET_TYPE) { case GE_HIT_STATISTIC: { if (GameID() != eGameIDSingle) Game().m_WeaponUsageStatistic->OnBullet_Check_Request(&HDS); }break; default: { }break; } SetHitInfo(Hitter, Weapon, HDS.bone(), HDS.p_in_bone_space, HDS.dir); Hit (&HDS); //--------------------------------------------------------------------------- if (GameID() != eGameIDSingle) { Game().m_WeaponUsageStatistic->OnBullet_Check_Result(false); game_cl_mp* mp_game = smart_cast<game_cl_mp*>(&Game()); if (mp_game->get_reward_generator()) mp_game->get_reward_generator()->OnBullet_Hit(Hitter, this, Weapon, HDS.boneID); } //--------------------------------------------------------------------------- } break; case GE_DESTROY: { if ( H_Parent() ) { Msg( "! ERROR (GameObject): GE_DESTROY arrived to object[%d][%s], that has parent[%d][%s], frame[%d]", ID(), cNameSect().c_str(), H_Parent()->ID(), H_Parent()->cName().c_str(), Device.dwFrame ); // This object will be destroy on call function <H_Parent::Destroy> // or it will be call <H_Parent::Reject> ==> H_Parent = NULL // !!! ___ it is necessary to be check! break; } #ifdef MP_LOGGING Msg("--- Object: GE_DESTROY of [%d][%s]", ID(), cNameSect().c_str()); #endif // MP_LOGGING setDestroy (TRUE); // MakeMeCrow (); } break; } }
daeMetaElement * domGl_samplerRECT::registerElement(DAE& dae) { daeMetaElement* meta = dae.getMeta(ID()); if ( meta != NULL ) return meta; meta = new daeMetaElement(dae); dae.setMeta(ID(), *meta); meta->setName( "gl_samplerRECT" ); meta->registerClass(domGl_samplerRECT::create); daeMetaCMPolicy *cm = NULL; daeMetaElementAttribute *mea = NULL; cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 ); mea->setName( "source" ); mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemSource) ); mea->setElementType( domSource::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 1, 0, 1 ); mea->setName( "wrap_s" ); mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemWrap_s) ); mea->setElementType( domWrap_s::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 2, 0, 1 ); mea->setName( "wrap_t" ); mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemWrap_t) ); mea->setElementType( domWrap_t::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 3, 0, 1 ); mea->setName( "minfilter" ); mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemMinfilter) ); mea->setElementType( domMinfilter::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 4, 0, 1 ); mea->setName( "magfilter" ); mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemMagfilter) ); mea->setElementType( domMagfilter::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 5, 0, 1 ); mea->setName( "mipfilter" ); mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemMipfilter) ); mea->setElementType( domMipfilter::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 6, 0, 1 ); mea->setName( "border_color" ); mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemBorder_color) ); mea->setElementType( domBorder_color::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 7, 0, 1 ); mea->setName( "mipmap_maxlevel" ); mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemMipmap_maxlevel) ); mea->setElementType( domMipmap_maxlevel::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 8, 0, 1 ); mea->setName( "mipmap_bias" ); mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemMipmap_bias) ); mea->setElementType( domMipmap_bias::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 9, 0, -1 ); mea->setName( "extra" ); mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemExtra_array) ); mea->setElementType( domExtra::registerElement(dae) ); cm->appendChild( mea ); cm->setMaxOrdinal( 9 ); cm->getParent()->appendChild( cm ); cm = cm->getParent(); cm->setMaxOrdinal( 9 ); meta->setCMRoot( cm ); meta->setElementSize(sizeof(domGl_samplerRECT)); meta->validate(); return meta; }
void FontPage::Load( FontPageSettings cfg ) { m_sTexturePath = cfg.m_sTexturePath; // load texture RageTextureID ID( m_sTexturePath ); if( cfg.m_sTextureHints != "default" ) ID.AdditionalTextureHints = cfg.m_sTextureHints; else ID.AdditionalTextureHints = "16bpp"; m_pTexture = TEXTUREMAN->LoadTexture( ID ); ASSERT( m_pTexture != NULL ); // load character widths vector<int> aiFrameWidths; int default_width = m_pTexture->GetSourceFrameWidth(); if( cfg.m_iDefaultWidth != -1 ) default_width = cfg.m_iDefaultWidth; // Assume each character is the width of the frame by default. for( int i=0; i<m_pTexture->GetNumFrames(); i++ ) { map<int,int>::const_iterator it = cfg.m_mapGlyphWidths.find(i); if( it != cfg.m_mapGlyphWidths.end() ) aiFrameWidths.push_back( it->second ); else aiFrameWidths.push_back( default_width ); } if( cfg.m_iAddToAllWidths ) { for( int i=0; i<m_pTexture->GetNumFrames(); i++ ) aiFrameWidths[i] += cfg.m_iAddToAllWidths; } if( cfg.m_fScaleAllWidthsBy != 1 ) { for( int i=0; i<m_pTexture->GetNumFrames(); i++ ) aiFrameWidths[i] = int(roundf( aiFrameWidths[i] * cfg.m_fScaleAllWidthsBy )); } m_iCharToGlyphNo = cfg.CharToGlyphNo; m_iLineSpacing = cfg.m_iLineSpacing; if( m_iLineSpacing == -1 ) m_iLineSpacing = m_pTexture->GetSourceFrameHeight(); int iBaseline=0; /* If we don't have a top and/or baseline, assume we're centered in the * frame, and that LineSpacing is the total height. */ if( cfg.m_iBaseline == -1 ) { float center = m_pTexture->GetSourceFrameHeight()/2.0f; cfg.m_iBaseline = int( center + m_iLineSpacing/2 ); } if( cfg.m_iTop == -1 ) { float center = m_pTexture->GetSourceFrameHeight()/2.0f; cfg.m_iTop = int( center - m_iLineSpacing/2 ); } iBaseline = cfg.m_iBaseline; m_iHeight = iBaseline - cfg.m_iTop; m_iDrawExtraPixelsLeft = cfg.m_iDrawExtraPixelsLeft; m_iDrawExtraPixelsRight = cfg.m_iDrawExtraPixelsRight; /* Shift the character up so the top will be rendered at the baseline. */ m_fVshift = (float) -iBaseline; SetTextureCoords( aiFrameWidths, cfg.m_iAdvanceExtraPixels ); SetExtraPixels( cfg.m_iDrawExtraPixelsLeft, cfg.m_iDrawExtraPixelsRight ); // LOG->Trace("Font %s: height %i, baseline %i ( == top %i)", // m_sTexturePath.c_str(), height, baseline, baseline-height); }
// Process the given capture and create the AST for the corresponding field. // Returns the create field AST, which must be freed by the caller. // Returns NULL on error. static ast_t* make_capture_field(pass_opt_t* opt, ast_t* capture) { assert(capture != NULL); AST_GET_CHILDREN(capture, id_node, type, value); const char* name = ast_name(id_node); // There are 3 varieties of capture: // x -> capture variable x, type from defn of x // x = y -> capture expression y, type inferred from expression type // x: T = y -> capture expression y, type T if(ast_id(value) == TK_NONE) { // Variable capture assert(ast_id(type) == TK_NONE); ast_t* def = ast_get(capture, name, NULL); if(def == NULL) { ast_error(id_node, "cannot capture \"%s\", variable not defined", name); return NULL; } token_id def_id = ast_id(def); if(def_id != TK_ID && def_id != TK_FVAR && def_id != TK_FLET && def_id != TK_PARAM) { ast_error(id_node, "cannot capture \"%s\", can only capture fields, " "parameters and local variables", name); return NULL; } BUILD(capture_rhs, id_node, NODE(TK_REFERENCE, ID(name))); type = ast_type(def); value = capture_rhs; } else { // Expression capture if(ast_id(type) == TK_NONE) { // No type specified, use type of the captured expression type = ast_type(value); } else { // Type given, infer literals if(!coerce_literals(&value, type, opt)) return NULL; } } if(is_typecheck_error(type)) return NULL; type = sanitise_type(type); BUILD(field, id_node, NODE(TK_FLET, TREE(id_node) TREE(type) TREE(value) NONE)); // Delegate type return field; }
bool expr_lambda(pass_opt_t* opt, ast_t** astp) { assert(astp != NULL); ast_t* ast = *astp; assert(ast != NULL); AST_GET_CHILDREN(ast, cap, t_params, params, captures, ret_type, raises, body); ast_t* members = ast_from(ast, TK_MEMBERS); ast_t* last_member = NULL; bool failed = false; // Process captures for(ast_t* p = ast_child(captures); p != NULL; p = ast_sibling(p)) { ast_t* field = make_capture_field(opt, p); if(field != NULL) ast_list_append(members, &last_member, field); else // An error occurred, just keep going to potentially find more errors failed = true; } if(failed) { ast_free(members); return false; } // Stop the various elements being marked as preserve ast_clearflag(t_params, AST_FLAG_PRESERVE); ast_clearflag(params, AST_FLAG_PRESERVE); ast_clearflag(ret_type, AST_FLAG_PRESERVE); ast_clearflag(body, AST_FLAG_PRESERVE); // Make the apply function BUILD(apply, ast, NODE(TK_FUN, AST_SCOPE TREE(cap) ID("apply") TREE(t_params) TREE(params) TREE(ret_type) TREE(raises) TREE(body) NONE // Doc string NONE)); // Guard ast_list_append(members, &last_member, apply); // Replace lambda with object literal REPLACE(astp, NODE(TK_OBJECT, NONE NONE // Provides list TREE(members))); // Catch up passes return ast_passes_subtree(astp, opt, PASS_EXPR); }
int Type (void) { return (ID ()); }
void Type (int value) { ID (value); }
daeMetaElement * domCg_newarray_type::registerElement(DAE& dae) { daeMetaElement* meta = dae.getMeta(ID()); if ( meta != NULL ) return meta; meta = new daeMetaElement(dae); dae.setMeta(ID(), *meta); meta->setName( "cg_newarray_type" ); meta->registerClass(domCg_newarray_type::create); daeMetaCMPolicy *cm = NULL; daeMetaElementAttribute *mea = NULL; cm = new daeMetaChoice( meta, cm, 0, 0, 0, -1 ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); mea->setName( "cg_param_type" ); mea->setOffset( daeOffsetOf(domCg_newarray_type,elemCg_param_type_array) ); mea->setElementType( domCg_param_type::registerElement(dae) ); cm->appendChild( new daeMetaGroup( mea, meta, cm, 0, 1, 1 ) ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); mea->setName( "array" ); mea->setOffset( daeOffsetOf(domCg_newarray_type,elemArray_array) ); mea->setElementType( domCg_newarray_type::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); mea->setName( "usertype" ); mea->setOffset( daeOffsetOf(domCg_newarray_type,elemUsertype_array) ); mea->setElementType( domCg_setuser_type::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); mea->setName( "connect_param" ); mea->setOffset( daeOffsetOf(domCg_newarray_type,elemConnect_param_array) ); mea->setElementType( domCg_connect_param::registerElement(dae) ); cm->appendChild( mea ); cm->setMaxOrdinal( 3000 ); meta->setCMRoot( cm ); // Ordered list of sub-elements meta->addContents(daeOffsetOf(domCg_newarray_type,_contents)); meta->addContentsOrder(daeOffsetOf(domCg_newarray_type,_contentsOrder)); meta->addCMDataArray(daeOffsetOf(domCg_newarray_type,_CMData), 1); // Add attribute: length { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "length" ); ma->setType( dae.getAtomicTypes().get("xsPositiveInteger")); ma->setOffset( daeOffsetOf( domCg_newarray_type , attrLength )); ma->setContainer( meta ); ma->setIsRequired( true ); meta->appendAttribute(ma); } meta->setElementSize(sizeof(domCg_newarray_type)); meta->validate(); return meta; }
BOOL CHelicopter::net_Spawn(CSE_Abstract* DC) { SetfHealth(100.0f); setState(CHelicopter::eAlive); m_flame_started =false; m_light_started =false; m_exploded =false; m_ready_explode =false; m_dead =false; if (!inherited::net_Spawn(DC)) return (FALSE); CPHSkeleton::Spawn((CSE_Abstract*)(DC)); for(u32 i=0; i<4; ++i) CRocketLauncher::SpawnRocket(*m_sRocketSection, smart_cast<CGameObject*>(this)); // assigning m_animator here CSE_Abstract *abstract =(CSE_Abstract*)(DC); CSE_ALifeHelicopter *heli = smart_cast<CSE_ALifeHelicopter*>(abstract); VERIFY (heli); R_ASSERT (Visual()&&smart_cast<IKinematics*>(Visual())); IKinematics* K = smart_cast<IKinematics*>(Visual()); CInifile* pUserData = K->LL_UserData(); m_rotate_x_bone = K->LL_BoneID (pUserData->r_string("helicopter_definition","wpn_rotate_x_bone")); m_rotate_y_bone = K->LL_BoneID (pUserData->r_string("helicopter_definition","wpn_rotate_y_bone")); m_fire_bone = K->LL_BoneID (pUserData->r_string("helicopter_definition","wpn_fire_bone")); m_death_bones_to_hide = pUserData->r_string("on_death_mode","scale_bone"); m_left_rocket_bone = K->LL_BoneID (pUserData->r_string("helicopter_definition","left_rocket_bone")); m_right_rocket_bone = K->LL_BoneID (pUserData->r_string("helicopter_definition","right_rocket_bone")); m_smoke_bone = K->LL_BoneID (pUserData->r_string("helicopter_definition","smoke_bone")); m_light_bone = K->LL_BoneID (pUserData->r_string("helicopter_definition","light_bone")); CExplosive::Load (pUserData,"explosion"); CExplosive::SetInitiator(ID()); LPCSTR s = pUserData->r_string("helicopter_definition","hit_section"); if( pUserData->section_exist(s) ) { int lc = pUserData->line_count(s); LPCSTR name; LPCSTR value; s16 boneID; for (int i=0 ; i<lc; ++i) { pUserData->r_line( s, i, &name, &value); boneID =K->LL_BoneID(name); m_hitBones.insert( std::make_pair(boneID, (float)atof(value)) ); } } CBoneInstance& biX = smart_cast<IKinematics*>(Visual())->LL_GetBoneInstance(m_rotate_x_bone); biX.set_callback (bctCustom,BoneMGunCallbackX,this); CBoneInstance& biY = smart_cast<IKinematics*>(Visual())->LL_GetBoneInstance(m_rotate_y_bone); biY.set_callback (bctCustom,BoneMGunCallbackY,this); CBoneData& bdX = K->LL_GetData(m_rotate_x_bone); VERIFY(bdX.IK_data.type==jtJoint); m_lim_x_rot.set (bdX.IK_data.limits[0].limit.x,bdX.IK_data.limits[0].limit.y); CBoneData& bdY = K->LL_GetData(m_rotate_y_bone); VERIFY(bdY.IK_data.type==jtJoint); m_lim_y_rot.set (bdY.IK_data.limits[1].limit.x,bdY.IK_data.limits[1].limit.y); xr_vector<Fmatrix> matrices; K->LL_GetBindTransform (matrices); m_i_bind_x_xform.invert (matrices[m_rotate_x_bone]); m_i_bind_y_xform.invert (matrices[m_rotate_y_bone]); m_bind_rot.x = matrices[m_rotate_x_bone].k.getP(); m_bind_rot.y = matrices[m_rotate_y_bone].k.getH(); m_bind_x.set (matrices[m_rotate_x_bone].c); m_bind_y.set (matrices[m_rotate_y_bone].c); IKinematicsAnimated *A = smart_cast<IKinematicsAnimated*>(Visual()); if (A) { A->PlayCycle (*heli->startup_animation); K->CalculateBones (TRUE); } m_engineSound.create (*heli->engine_sound,st_Effect,sg_SourceType); m_engineSound.play_at_pos (0,XFORM().c,sm_Looped); CShootingObject::Light_Create (); setVisible (TRUE); setEnabled (TRUE); m_stepRemains = 0.0f; //lighting m_light_render = ::Render->light_create(); m_light_render->set_shadow (false); m_light_render->set_type (IRender_Light::POINT); m_light_render->set_range (m_light_range); m_light_render->set_color (m_light_color); if(g_Alive())processing_activate (); TurnEngineSound(false); if(pUserData->section_exist("destroyed")) CPHDestroyable::Load(pUserData,"destroyed"); #ifdef DEBUG Device.seqRender.Add(this,REG_PRIORITY_LOW-1); #endif return TRUE; }
daeMetaElement * domLibrary_lights::registerElement(DAE& dae) { daeMetaElement* meta = dae.getMeta(ID()); if ( meta != NULL ) return meta; meta = new daeMetaElement(dae); dae.setMeta(ID(), *meta); meta->setName( "library_lights" ); meta->registerClass(domLibrary_lights::create); daeMetaCMPolicy *cm = NULL; daeMetaElementAttribute *mea = NULL; cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); mea = new daeMetaElementAttribute( meta, cm, 0, 0, 1 ); mea->setName( "asset" ); mea->setOffset( daeOffsetOf(domLibrary_lights,elemAsset) ); mea->setElementType( domAsset::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 1, 1, -1 ); mea->setName( "light" ); mea->setOffset( daeOffsetOf(domLibrary_lights,elemLight_array) ); mea->setElementType( domLight::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 ); mea->setName( "extra" ); mea->setOffset( daeOffsetOf(domLibrary_lights,elemExtra_array) ); mea->setElementType( domExtra::registerElement(dae) ); cm->appendChild( mea ); cm->setMaxOrdinal( 2 ); meta->setCMRoot( cm ); // Add attribute: id { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "id" ); ma->setType( dae.getAtomicTypes().get("xsID")); ma->setOffset( daeOffsetOf( domLibrary_lights , attrId )); ma->setContainer( meta ); meta->appendAttribute(ma); } // Add attribute: name { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "name" ); ma->setType( dae.getAtomicTypes().get("xsNCName")); ma->setOffset( daeOffsetOf( domLibrary_lights , attrName )); ma->setContainer( meta ); meta->appendAttribute(ma); } meta->setElementSize(sizeof(domLibrary_lights)); meta->validate(); return meta; }
daeMetaElement * domPhysics_model::registerElement(DAE& dae) { daeMetaElement* meta = dae.getMeta(ID()); if ( meta != NULL ) return meta; meta = new daeMetaElement(dae); dae.setMeta(ID(), *meta); meta->setName( "physics_model" ); meta->registerClass(domPhysics_model::create); daeMetaCMPolicy *cm = NULL; daeMetaElementAttribute *mea = NULL; cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); mea = new daeMetaElementAttribute( meta, cm, 0, 0, 1 ); mea->setName( "asset" ); mea->setOffset( daeOffsetOf(domPhysics_model,elemAsset) ); mea->setElementType( domAsset::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 1, 0, -1 ); mea->setName( "rigid_body" ); mea->setOffset( daeOffsetOf(domPhysics_model,elemRigid_body_array) ); mea->setElementType( domRigid_body::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 ); mea->setName( "rigid_constraint" ); mea->setOffset( daeOffsetOf(domPhysics_model,elemRigid_constraint_array) ); mea->setElementType( domRigid_constraint::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 3, 0, -1 ); mea->setName( "instance_physics_model" ); mea->setOffset( daeOffsetOf(domPhysics_model,elemInstance_physics_model_array) ); mea->setElementType( domInstance_physics_model::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 4, 0, -1 ); mea->setName( "extra" ); mea->setOffset( daeOffsetOf(domPhysics_model,elemExtra_array) ); mea->setElementType( domExtra::registerElement(dae) ); cm->appendChild( mea ); cm->setMaxOrdinal( 4 ); meta->setCMRoot( cm ); // Add attribute: id { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "id" ); ma->setType( dae.getAtomicTypes().get("xsID")); ma->setOffset( daeOffsetOf( domPhysics_model , attrId )); ma->setContainer( meta ); meta->appendAttribute(ma); } // Add attribute: name { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "name" ); ma->setType( dae.getAtomicTypes().get("xsNCName")); ma->setOffset( daeOffsetOf( domPhysics_model , attrName )); ma->setContainer( meta ); meta->appendAttribute(ma); } meta->setElementSize(sizeof(domPhysics_model)); meta->validate(); return meta; }
void CMMDesktopHandler::EventHandler(CGUIEvent *event) { if(!event || !MMDesktop) return; if(event->eventID == EClicked ) { if(event->sender==exit) { eventServer->SendPriorityEvent(ECommand,GetID(),mainGUI->handler->GetID(),4); }else if(event->sender==editlevel) { MMDesktop->EditLevel(); } else if(event->sender==editscript) { //MMdesktop->GetSelectedLevel(); eventServer->SendPriorityEvent(ECommand,GetID(),mainGUI->handler->GetID(),1); } else if(event->sender==play) { MMDesktop->PlayLevel(0); } else if(event->sender==restartlevel) { MMDesktop->PlayLevel(1); } else if(event->sender==help) { MMDesktop->ShowHelp(); } else if(event->sender==about) { MMDesktop->ShowCredits(); } else if (event->sender == donate) { CGUIMessageBox *dlgd = GUIMessageBoxOkCancel("en{{Open Danate PDF?}}cs{{Otevøít Donate PDF?}}", "en{{Do you want to open external document?}}cs{{Chceš otevøít externí dokument?}}", 1); donateOpen = dlgd->GetID(); dlgd->AcceptEvent(GetID(), EOk); } else if (event->sender == cfg) { CGUIMessageBox *dlgd = GUIMessageBoxOkCancel("en{{Restart and Edit Configuration?}}cs{{Restartovat a Editovat Konfiguraci?}}", "en{{Do you want to edit game's configuration file?\nWhen you close the editor, Krkal will start again.}}cs{{Chceš editovat konfiguraèní soubor hry?\nKrkal se poté, co zavøeš editor, opìt nastartuje.}}", 1); cfgOpen = dlgd->GetID(); dlgd->AcceptEvent(GetID(), EOk); } else if(event->sender==mmLeft) { MMDesktop->levBrowser->MoveLeft(); } else if(event->sender==mmRight) { MMDesktop->levBrowser->MoveRight(); } } if (event->eventID == EOk && event->sender == donateOpen) { KRKAL->SetFullscreen(0); char *fullPath; if (KRKAL->cfg.lang == langEN) FS->ParseString("$KRKAL$\\Documentation.EN\\Donate.pdf", &fullPath); else FS->ParseString("$KRKAL$\\Dokumentace.CS\\Donate.pdf", &fullPath); char *cmd = new char[strlen(fullPath) + 30]; sprintf(cmd, "start cmd /c \"%s\"", fullPath); system(cmd); SAFE_DELETE_ARRAY(fullPath); SAFE_DELETE_ARRAY(cmd); } if (event->eventID == EOk && event->sender == cfgOpen) { FS->ChangeDir("$cfg$"); char *fullPath; FS->ParseString("$KRKAL$/krkal.cfg", &fullPath); char *cmd = new char[strlen(fullPath) + 64]; sprintf(cmd, "start cmd /c \"notepad \"%s\" && krkal.exe\"", fullPath); system(cmd); SAFE_DELETE_ARRAY(fullPath); SAFE_DELETE_ARRAY(cmd); eventServer->SendPriorityEvent(ECommand, GetID(), mainGUI->handler->GetID(), 4); } if(event->eventID == EList ) { CGUIListItem* ID(it,event->pID); if(it){ MMDesktop->PlayLevel(it->GetData(),mainGUI->key_ctrl); } } if(event->eventID == ETree) { if(event->sender==regbrow) RegBrowEvent(event); } delete event; }
daeMetaElement * domAsset::registerElement(DAE& dae) { daeMetaElement* meta = dae.getMeta(ID()); if ( meta != NULL ) return meta; meta = new daeMetaElement(dae); dae.setMeta(ID(), *meta); meta->setName( "asset" ); meta->registerClass(domAsset::create); daeMetaCMPolicy *cm = NULL; daeMetaElementAttribute *mea = NULL; cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 0, -1 ); mea->setName( "contributor" ); mea->setOffset( daeOffsetOf(domAsset,elemContributor_array) ); mea->setElementType( domAsset::domContributor::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 1, 1, 1 ); mea->setName( "created" ); mea->setOffset( daeOffsetOf(domAsset,elemCreated) ); mea->setElementType( domAsset::domCreated::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 2, 0, 1 ); mea->setName( "keywords" ); mea->setOffset( daeOffsetOf(domAsset,elemKeywords) ); mea->setElementType( domAsset::domKeywords::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 3, 1, 1 ); mea->setName( "modified" ); mea->setOffset( daeOffsetOf(domAsset,elemModified) ); mea->setElementType( domAsset::domModified::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 4, 0, 1 ); mea->setName( "revision" ); mea->setOffset( daeOffsetOf(domAsset,elemRevision) ); mea->setElementType( domAsset::domRevision::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 5, 0, 1 ); mea->setName( "subject" ); mea->setOffset( daeOffsetOf(domAsset,elemSubject) ); mea->setElementType( domAsset::domSubject::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 6, 0, 1 ); mea->setName( "title" ); mea->setOffset( daeOffsetOf(domAsset,elemTitle) ); mea->setElementType( domAsset::domTitle::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 7, 0, 1 ); mea->setName( "unit" ); mea->setOffset( daeOffsetOf(domAsset,elemUnit) ); mea->setElementType( domAsset::domUnit::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 8, 0, 1 ); mea->setName( "up_axis" ); mea->setOffset( daeOffsetOf(domAsset,elemUp_axis) ); mea->setElementType( domAsset::domUp_axis::registerElement(dae) ); cm->appendChild( mea ); cm->setMaxOrdinal( 8 ); meta->setCMRoot( cm ); meta->setElementSize(sizeof(domAsset)); meta->validate(); return meta; }
QString PeerID::identifyClient() const { if (!client_name.isNull()) return client_name; QString peer_id = toString(); // we only need to create this map once // so make it static static QMap<QString, QString> Map; static bool first = true; if (first) { // Keep things a bit alphabetic to make it easier add new ones //AZUREUS STYLE Map[QStringLiteral("AG")] = QStringLiteral("Ares"); Map[QStringLiteral("A~")] = QStringLiteral("Ares"); Map[QStringLiteral("AT")] = QStringLiteral("Artemis"); Map[QStringLiteral("AV")] = QStringLiteral("Avicora"); Map[QStringLiteral("AX")] = QStringLiteral("BitPump"); Map[QStringLiteral("AR")] = QStringLiteral("Arctic"); Map[QStringLiteral("AZ")] = QStringLiteral("Azureus"); Map[QStringLiteral("BB")] = QStringLiteral("BitBuddy"); Map[QStringLiteral("BC")] = QStringLiteral("BitComet"); Map[QStringLiteral("BF")] = QStringLiteral("Bitflu"); Map[QStringLiteral("BG")] = QStringLiteral("BTGetit"); Map[QStringLiteral("BL")] = QStringLiteral("BitBlinder"); Map[QStringLiteral("BM")] = QStringLiteral("BitMagnet"); Map[QStringLiteral("BO")] = QStringLiteral("BitsOnWheels"); Map[QStringLiteral("BP")] = QStringLiteral("BitTorrent Pro"); Map[QStringLiteral("BR")] = QStringLiteral("BitRocket"); Map[QStringLiteral("BS")] = QStringLiteral("BTSlave"); Map[QStringLiteral("BW")] = QStringLiteral("BitWombat"); Map[QStringLiteral("BX")] = QStringLiteral("BitTorrent X"); Map[QStringLiteral("CD")] = QStringLiteral("Enhanced CTorrent"); Map[QStringLiteral("CS")] = QStringLiteral("SpywareTerminator"); Map[QStringLiteral("CT")] = QStringLiteral("CTorrent"); Map[QStringLiteral("DE")] = QStringLiteral("DelugeTorrent"); Map[QStringLiteral("DP")] = QStringLiteral("Propagate Data Client"); Map[QStringLiteral("EB")] = QStringLiteral("EBit"); Map[QStringLiteral("ES")] = QStringLiteral("electric sheep"); Map[QStringLiteral("FC")] = QStringLiteral("FileCroc"); Map[QStringLiteral("FT")] = QStringLiteral("FoxTorrent"); Map[QStringLiteral("GS")] = QStringLiteral("GSTorrent"); Map[QStringLiteral("G3")] = QStringLiteral("G3 Torrent"); Map[QStringLiteral("HK")] = QStringLiteral("Hekate"); Map[QStringLiteral("HL")] = QStringLiteral("Halite"); Map[QStringLiteral("HN")] = QStringLiteral("Hydranode"); Map[QStringLiteral("KG")] = QStringLiteral("KGet"); Map[QStringLiteral("KT")] = QStringLiteral("KTorrent"); // lets not forget our own client Map[QStringLiteral("LC")] = QStringLiteral("LeechCraft"); Map[QStringLiteral("LH")] = QStringLiteral("LH-ABC"); Map[QStringLiteral("lt")] = QStringLiteral("libTorrent"); Map[QStringLiteral("LT")] = QStringLiteral("libtorrent"); Map[QStringLiteral("LP")] = QStringLiteral("Lphant"); Map[QStringLiteral("LW")] = QStringLiteral("LimeWire"); Map[QStringLiteral("MK")] = QStringLiteral("Meerkat"); Map[QStringLiteral("ML")] = QStringLiteral("MLDonkey"); Map[QStringLiteral("MO")] = QStringLiteral("MonoTorrent"); Map[QStringLiteral("MP")] = QStringLiteral("MooPolice"); Map[QStringLiteral("MT")] = QStringLiteral("MoonLight"); Map[QStringLiteral("NE")] = QStringLiteral("BT Next Evolution"); Map[QStringLiteral("NX")] = QStringLiteral("Net Transport"); Map[QStringLiteral("OS")] = QStringLiteral("OneSwarm"); Map[QStringLiteral("OT")] = QStringLiteral("OmegaTorrent"); Map[QStringLiteral("PD")] = QStringLiteral("Pando"); Map[QStringLiteral("qB")] = QStringLiteral("qBittorrent"); Map[QStringLiteral("QD")] = QStringLiteral("QQDownload"); Map[QStringLiteral("QT")] = QStringLiteral("Qt 4 Torrent example"); Map[QStringLiteral("RT")] = QStringLiteral("Retriever"); Map[QStringLiteral("RZ")] = QStringLiteral("RezTorrent"); Map[QStringLiteral("S~")] = QStringLiteral("Shareaza alpha/beta"); Map[QStringLiteral("SB")] = QStringLiteral("Swiftbit"); Map[QStringLiteral("SD")] = QStringLiteral("Thunder"); Map[QStringLiteral("SM")] = QStringLiteral("SoMud"); Map[QStringLiteral("SS")] = QStringLiteral("SwarmScope"); Map[QStringLiteral("ST")] = QStringLiteral("SymTorrent"); Map[QStringLiteral("st")] = QStringLiteral("sharktorrent"); Map[QStringLiteral("SZ")] = QStringLiteral("Shareaza"); Map[QStringLiteral("TN")] = QStringLiteral("Torrent .NET"); Map[QStringLiteral("TR")] = QStringLiteral("Transmission"); Map[QStringLiteral("TS")] = QStringLiteral("Torrent Storm"); Map[QStringLiteral("TT")] = QStringLiteral("TuoTu"); Map[QStringLiteral("UL")] = QStringLiteral("uLeecher!"); Map[QStringLiteral("UM")] = QStringLiteral("%1Torrent for Mac").arg(QChar(0x00B5)); // µTorrent, 0x00B5 is unicode for µ Map[QStringLiteral("UT")] = QStringLiteral("%1Torrent").arg(QChar(0x00B5)); // µTorrent, 0x00B5 is unicode for µ Map[QStringLiteral("VG")] = QStringLiteral("Vagaa"); Map[QStringLiteral("WT")] = QStringLiteral("BitLet"); Map[QStringLiteral("WY")] = QStringLiteral("FireTorrent"); Map[QStringLiteral("XL")] = QStringLiteral("Xunlei"); Map[QStringLiteral("XS")] = QStringLiteral("XSwifter"); Map[QStringLiteral("XT")] = QStringLiteral("Xan Torrent"); Map[QStringLiteral("XX")] = QStringLiteral("Xtorrent"); Map[QStringLiteral("ZT")] = QStringLiteral("Zip Torrent"); //SHADOWS STYLE Map[QStringLiteral("A")] = QStringLiteral("ABC"); Map[QStringLiteral("O")] = QStringLiteral("Osprey Permaseed"); Map[QStringLiteral("Q")] = QStringLiteral("BTQueue"); Map[QStringLiteral("R")] = QStringLiteral("Tribler"); Map[QStringLiteral("S")] = QStringLiteral("Shadow's"); Map[QStringLiteral("T")] = QStringLiteral("BitTornado"); Map[QStringLiteral("U")] = QStringLiteral("UPnP NAT BitTorrent"); //OTHER Map[QStringLiteral("Plus")] = QStringLiteral("Plus! II"); Map[QStringLiteral("OP")] = QStringLiteral("Opera"); Map[QStringLiteral("BOW")] = QStringLiteral("Bits on Wheels"); Map[QStringLiteral("M")] = QStringLiteral("BitTorrent"); Map[QStringLiteral("exbc")] = QStringLiteral("BitComet"); Map[QStringLiteral("Mbrst")] = QStringLiteral("Burst!"); Map[QStringLiteral("XBT")] = QStringLiteral("XBT Client"); Map[QStringLiteral("SP")] = QStringLiteral("BitSpirit"); Map[QStringLiteral("FG")] = QStringLiteral("FlashGet"); Map[QStringLiteral("RS")] = QStringLiteral("Rufus"); Map[QStringLiteral("Q1")] = QStringLiteral("Queen Bee"); Map[QStringLiteral("AP")] = QStringLiteral("AllPeers"); Map[QStringLiteral("QVOD")] = QStringLiteral("Qvod"); first = false; } QString name = i18n("Unknown client"); if (peer_id.at(0) == '-' && peer_id.at(1).isLetter() && peer_id.at(2).isLetter() ) //AZ style { QString ID(peer_id.mid(1,2)); if (Map.contains(ID)) name = Map[ID] + ' ' + peer_id.at(3) + '.' + peer_id.at(4) + '.' + peer_id.at(5) + '.' + peer_id.at(6); } else if (peer_id.at(0).isLetter() && peer_id.at(1).isDigit() && peer_id.at(2).isDigit() ) //Shadow's style { QString ID = QString(peer_id.at(0)); if (Map.contains(ID)) name = Map[ID] + ' ' + peer_id.at(1) + '.' + peer_id.at(2) + '.' + peer_id.at(3); } else if (peer_id.at(0) == 'M' && peer_id.at(2) == '-' && (peer_id.at(4) == '-' || peer_id.at(5) == '-')) { name = Map[QStringLiteral("M")] + ' ' + peer_id.at(1) + '.' + peer_id.at(3); if(peer_id.at(4) == '-') name += QStringLiteral(".%1").arg(peer_id.at(5)); else name += QStringLiteral("%1.%2").arg(peer_id.at(4)).arg(peer_id.at(6)); } else if (peer_id.startsWith(QLatin1String("OP"))) { name = Map[QStringLiteral("OP")]; } else if (peer_id.startsWith(QLatin1String("exbc"))) { name = Map[QStringLiteral("exbc")]; } else if (peer_id.mid(1,3) == QLatin1String("BOW")) { name = Map[QStringLiteral("BOW")]; } else if (peer_id.startsWith(QLatin1String("Plus"))) { name = Map[QStringLiteral("Plus")]; } else if (peer_id.startsWith(QLatin1String("Mbrst"))) { name = Map[QStringLiteral("Mbrst")] + ' ' + peer_id.at(5) + '.' + peer_id.at(7); } else if (peer_id.startsWith(QLatin1String("XBT"))) { name = Map[QStringLiteral("XBT")] + ' ' + peer_id.at(3) + '.' + peer_id.at(4) + '.' + peer_id.at(5); } else if (peer_id.startsWith(QLatin1String("SP"))) { name = Map[QStringLiteral("SP")] + ' ' + peer_id.at(2) + '.' + peer_id.at(3) + '.' + peer_id.at(4) + '.' + peer_id.at(5); } else if (peer_id.startsWith(QLatin1String("FG"))) { name = Map[QStringLiteral("FG")] + ' ' + peer_id.at(2) + '.' + peer_id.at(3) + '.' + peer_id.at(4) + '.' + peer_id.at(5); } else if (peer_id.midRef(2,2) == QLatin1String("RS")) { name = Map[QStringLiteral("RS")]; } else if (peer_id.startsWith(QLatin1String("Q1"))) { name = Map[QStringLiteral("Q1")]; } else if (peer_id.startsWith(QLatin1String("AP"))) { name = Map[QStringLiteral("AP")]; } else if (peer_id.startsWith(QLatin1String("QVOD"))) { name = Map[QStringLiteral("QVOD")]; } return name; }
daeMetaElement * domKinematics_model::registerElement(DAE& dae) { daeMetaElement* meta = dae.getMeta(ID()); if ( meta != NULL ) return meta; meta = new daeMetaElement(dae); dae.setMeta(ID(), *meta); meta->setName( "kinematics_model" ); meta->registerClass(domKinematics_model::create); daeMetaCMPolicy *cm = NULL; daeMetaElementAttribute *mea = NULL; cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); mea = new daeMetaElementAttribute( meta, cm, 0, 0, 1 ); mea->setName( "asset" ); mea->setOffset( daeOffsetOf(domKinematics_model,elemAsset) ); mea->setElementType( domAsset::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 1, 1, 1 ); mea->setName( "technique_common" ); mea->setOffset( daeOffsetOf(domKinematics_model,elemTechnique_common) ); mea->setElementType( domKinematics_model_technique::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 ); mea->setName( "technique" ); mea->setOffset( daeOffsetOf(domKinematics_model,elemTechnique_array) ); mea->setElementType( domTechnique::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 3, 0, -1 ); mea->setName( "extra" ); mea->setOffset( daeOffsetOf(domKinematics_model,elemExtra_array) ); mea->setElementType( domExtra::registerElement(dae) ); cm->appendChild( mea ); cm->setMaxOrdinal( 3 ); meta->setCMRoot( cm ); // Add attribute: id { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "id" ); ma->setType( dae.getAtomicTypes().get("xsID")); ma->setOffset( daeOffsetOf( domKinematics_model , attrId )); ma->setContainer( meta ); meta->appendAttribute(ma); } // Add attribute: name { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "name" ); ma->setType( dae.getAtomicTypes().get("xsToken")); ma->setOffset( daeOffsetOf( domKinematics_model , attrName )); ma->setContainer( meta ); meta->appendAttribute(ma); } meta->setElementSize(sizeof(domKinematics_model)); meta->validate(); return meta; }
daeMetaElement * domParam::registerElement(DAE& dae) { daeMetaElement* meta = dae.getMeta(ID()); if ( meta != NULL ) return meta; meta = new daeMetaElement(dae); dae.setMeta(ID(), *meta); meta->setName( "param" ); meta->registerClass(domParam::create); // Add attribute: _value { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "_value" ); ma->setType( dae.getAtomicTypes().get("xsString")); ma->setOffset( daeOffsetOf( domParam , _value )); ma->setContainer( meta ); meta->appendAttribute(ma); } // Add attribute: name { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "name" ); ma->setType( dae.getAtomicTypes().get("xsNCName")); ma->setOffset( daeOffsetOf( domParam , attrName )); ma->setContainer( meta ); meta->appendAttribute(ma); } // Add attribute: sid { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "sid" ); ma->setType( dae.getAtomicTypes().get("xsNCName")); ma->setOffset( daeOffsetOf( domParam , attrSid )); ma->setContainer( meta ); meta->appendAttribute(ma); } // Add attribute: semantic { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "semantic" ); ma->setType( dae.getAtomicTypes().get("xsNMTOKEN")); ma->setOffset( daeOffsetOf( domParam , attrSemantic )); ma->setContainer( meta ); meta->appendAttribute(ma); } // Add attribute: type { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "type" ); ma->setType( dae.getAtomicTypes().get("xsNMTOKEN")); ma->setOffset( daeOffsetOf( domParam , attrType )); ma->setContainer( meta ); ma->setIsRequired( true ); meta->appendAttribute(ma); } meta->setElementSize(sizeof(domParam)); meta->validate(); return meta; }
void CMultiXL2Link::OnCloseCompleted() { CMultiXL2Event *Event = new CMultiXL2Event(CMultiXEvent::L2CloseCompleted,Owner(),Owner()->UpperLayer()); Event->L2LinkID() = ID(); Owner()->MultiX().QueueEvent(Event); }
// Add eq() and ne() functions to the given entity. static bool add_comparable(ast_t* ast, pass_opt_t* options) { assert(ast != NULL); AST_GET_CHILDREN(ast, id, typeparams, defcap, traits, members); ast_t* typeargs = ast_from(typeparams, TK_NONE); bool r = true; for(ast_t* p = ast_child(typeparams); p != NULL; p = ast_sibling(p)) { ast_t* p_id = ast_child(p); BUILD(type, p_id, NODE(TK_NOMINAL, NONE TREE(p_id) NONE NONE NONE)); ast_append(typeargs, type); ast_setid(typeargs, TK_TYPEARGS); } if(!has_member(members, "eq")) { BUILD(eq, members, NODE(TK_FUN, AST_SCOPE NODE(TK_BOX) ID("eq") NONE NODE(TK_PARAMS, NODE(TK_PARAM, ID("that") NODE(TK_NOMINAL, NONE TREE(id) TREE(typeargs) NONE NONE) NONE)) NODE(TK_NOMINAL, NONE ID("Bool") NONE NONE NONE) NONE NODE(TK_SEQ, NODE(TK_IS, NODE(TK_THIS) NODE(TK_REFERENCE, ID("that")))) NONE NONE)); // Need to set function data field to point to originating type, ie ast. // This won't be done when we catch up the passes since we've already // processed that type. ast_setdata(eq, ast); ast_append(members, eq); ast_set(ast, stringtab("eq"), eq, SYM_DEFINED, false); if(!ast_passes_subtree(&eq, options, PASS_TRAITS)) r = false; } if(!has_member(members, "ne")) { BUILD(ne, members, NODE(TK_FUN, AST_SCOPE NODE(TK_BOX) ID("ne") NONE NODE(TK_PARAMS, NODE(TK_PARAM, ID("that") NODE(TK_NOMINAL, NONE TREE(id) TREE(typeargs) NONE NONE) NONE)) NODE(TK_NOMINAL, NONE ID("Bool") NONE NONE NONE) NONE NODE(TK_SEQ, NODE(TK_ISNT, NODE(TK_THIS) NODE(TK_REFERENCE, ID("that")))) NONE NONE)); // Need to set function data field to point to originating type, ie ast. // This won't be done when we catch up the passes since we've already // processed that type. ast_setdata(ne, ast); ast_append(members, ne); ast_set(ast, stringtab("ne"), ne, SYM_DEFINED, false); if(!ast_passes_subtree(&ne, options, PASS_TRAITS)) r = false; } ast_free_unattached(typeargs); return r; }
daeMetaElement * domInstance_force_field::registerElement(DAE& dae) { daeMetaElement* meta = dae.getMeta(ID()); if ( meta != NULL ) return meta; meta = new daeMetaElement(dae); dae.setMeta(ID(), *meta); meta->setName( "instance_force_field" ); meta->registerClass(domInstance_force_field::create); daeMetaCMPolicy *cm = NULL; daeMetaElementAttribute *mea = NULL; cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 0, -1 ); mea->setName( "extra" ); mea->setOffset( daeOffsetOf(domInstance_force_field,elemExtra_array) ); mea->setElementType( domExtra::registerElement(dae) ); cm->appendChild( mea ); cm->setMaxOrdinal( 0 ); meta->setCMRoot( cm ); // Add attribute: url { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "url" ); ma->setType( dae.getAtomicTypes().get("xsAnyURI")); ma->setOffset( daeOffsetOf( domInstance_force_field , attrUrl )); ma->setContainer( meta ); ma->setIsRequired( true ); meta->appendAttribute(ma); } // Add attribute: sid { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "sid" ); ma->setType( dae.getAtomicTypes().get("xsNCName")); ma->setOffset( daeOffsetOf( domInstance_force_field , attrSid )); ma->setContainer( meta ); meta->appendAttribute(ma); } // Add attribute: name { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "name" ); ma->setType( dae.getAtomicTypes().get("xsNCName")); ma->setOffset( daeOffsetOf( domInstance_force_field , attrName )); ma->setContainer( meta ); meta->appendAttribute(ma); } meta->setElementSize(sizeof(domInstance_force_field)); meta->validate(); return meta; }
daeMetaElement * domMesh::registerElement(DAE& dae) { daeMetaElement* meta = dae.getMeta(ID()); if ( meta != NULL ) return meta; meta = new daeMetaElement(dae); dae.setMeta(ID(), *meta); meta->setName( "mesh" ); meta->registerClass(domMesh::create); daeMetaCMPolicy *cm = NULL; daeMetaElementAttribute *mea = NULL; cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, -1 ); mea->setName( "source" ); mea->setOffset( daeOffsetOf(domMesh,elemSource_array) ); mea->setElementType( domSource::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementAttribute( meta, cm, 1, 1, 1 ); mea->setName( "vertices" ); mea->setOffset( daeOffsetOf(domMesh,elemVertices) ); mea->setElementType( domVertices::registerElement(dae) ); cm->appendChild( mea ); cm = new daeMetaChoice( meta, cm, 0, 2, 0, -1 ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); mea->setName( "lines" ); mea->setOffset( daeOffsetOf(domMesh,elemLines_array) ); mea->setElementType( domLines::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); mea->setName( "linestrips" ); mea->setOffset( daeOffsetOf(domMesh,elemLinestrips_array) ); mea->setElementType( domLinestrips::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); mea->setName( "polygons" ); mea->setOffset( daeOffsetOf(domMesh,elemPolygons_array) ); mea->setElementType( domPolygons::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); mea->setName( "polylist" ); mea->setOffset( daeOffsetOf(domMesh,elemPolylist_array) ); mea->setElementType( domPolylist::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); mea->setName( "triangles" ); mea->setOffset( daeOffsetOf(domMesh,elemTriangles_array) ); mea->setElementType( domTriangles::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); mea->setName( "trifans" ); mea->setOffset( daeOffsetOf(domMesh,elemTrifans_array) ); mea->setElementType( domTrifans::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); mea->setName( "tristrips" ); mea->setOffset( daeOffsetOf(domMesh,elemTristrips_array) ); mea->setElementType( domTristrips::registerElement(dae) ); cm->appendChild( mea ); cm->setMaxOrdinal( 0 ); cm->getParent()->appendChild( cm ); cm = cm->getParent(); mea = new daeMetaElementArrayAttribute( meta, cm, 3003, 0, -1 ); mea->setName( "extra" ); mea->setOffset( daeOffsetOf(domMesh,elemExtra_array) ); mea->setElementType( domExtra::registerElement(dae) ); cm->appendChild( mea ); cm->setMaxOrdinal( 3003 ); meta->setCMRoot( cm ); // Ordered list of sub-elements meta->addContents(daeOffsetOf(domMesh,_contents)); meta->addContentsOrder(daeOffsetOf(domMesh,_contentsOrder)); meta->addCMDataArray(daeOffsetOf(domMesh,_CMData), 1); meta->setElementSize(sizeof(domMesh)); meta->validate(); return meta; }
void CGameObject::spawn_supplies() { if (!spawn_ini() || ai().get_alife()) return; if (!spawn_ini()->section_exist("spawn")) return; LPCSTR N,V; float p; bool bScope = false; bool bSilencer = false; bool bLauncher = false; for (u32 k = 0, j; spawn_ini()->r_line("spawn",k,&N,&V); k++) { VERIFY (xr_strlen(N)); j = 1; p = 1.f; float f_cond = 1.0f; if (V && xr_strlen(V)) { int n = _GetItemCount(V); string16 temp; if (n > 0) j = atoi(_GetItem(V,0,temp)); //count if(NULL!=strstr(V,"prob=")) p =(float)atof(strstr(V,"prob=")+5); if (fis_zero(p))p = 1.f; if (!j) j = 1; if(NULL!=strstr(V,"cond=")) f_cond = (float)atof(strstr(V,"cond=")+5); bScope = (NULL!=strstr(V,"scope")); bSilencer = (NULL!=strstr(V,"silencer")); bLauncher = (NULL!=strstr(V,"launcher")); } for (u32 i=0; i<j; ++i) if (::Random.randF(1.f) < p){ CSE_Abstract* A=Level().spawn_item (N,Position(),ai_location().level_vertex_id(),ID(),true); CSE_ALifeInventoryItem* pSE_InventoryItem = smart_cast<CSE_ALifeInventoryItem*>(A); if(pSE_InventoryItem) pSE_InventoryItem->m_fCondition = f_cond; CSE_ALifeItemWeapon* W = smart_cast<CSE_ALifeItemWeapon*>(A); if (W) { if (W->m_scope_status == ALife::eAddonAttachable) W->m_addon_flags.set(CSE_ALifeItemWeapon::eWeaponAddonScope, bScope); if (W->m_silencer_status == ALife::eAddonAttachable) W->m_addon_flags.set(CSE_ALifeItemWeapon::eWeaponAddonSilencer, bSilencer); if (W->m_grenade_launcher_status == ALife::eAddonAttachable) W->m_addon_flags.set(CSE_ALifeItemWeapon::eWeaponAddonGrenadeLauncher, bLauncher); } NET_Packet P; A->Spawn_Write (P,TRUE); Level().Send (P,net_flags(TRUE)); F_entity_Destroy (A); } } }
void te_update_diff(const char *event, xmlNode * msg) { int rc = -1; const char *op = NULL; xmlNode *diff = NULL; xmlXPathObject *xpathObj = NULL; int diff_add_updates = 0; int diff_add_epoch = 0; int diff_add_admin_epoch = 0; int diff_del_updates = 0; int diff_del_epoch = 0; int diff_del_admin_epoch = 0; CRM_CHECK(msg != NULL, return); crm_element_value_int(msg, F_CIB_RC, &rc); if (transition_graph == NULL) { crm_trace("No graph"); return; } else if (rc < cib_ok) { crm_trace("Filter rc=%d (%s)", rc, cib_error2string(rc)); return; } else if (transition_graph->complete == TRUE && fsa_state != S_IDLE && fsa_state != S_TRANSITION_ENGINE && fsa_state != S_POLICY_ENGINE) { crm_trace("Filter state=%s, complete=%d", fsa_state2string(fsa_state), transition_graph->complete); return; } op = crm_element_value(msg, F_CIB_OPERATION); diff = get_message_xml(msg, F_CIB_UPDATE_RESULT); cib_diff_version_details(diff, &diff_add_admin_epoch, &diff_add_epoch, &diff_add_updates, &diff_del_admin_epoch, &diff_del_epoch, &diff_del_updates); crm_debug("Processing diff (%s): %d.%d.%d -> %d.%d.%d (%s)", op, diff_del_admin_epoch, diff_del_epoch, diff_del_updates, diff_add_admin_epoch, diff_add_epoch, diff_add_updates, fsa_state2string(fsa_state)); log_cib_diff(LOG_DEBUG_2, diff, op); if (cib_config_changed(NULL, NULL, &diff)) { abort_transition(INFINITY, tg_restart, "Non-status change", diff); goto bail; /* configuration changed */ } /* Tickets Attributes - Added/Updated */ xpathObj = xpath_search(diff, "//" F_CIB_UPDATE_RESULT "//" XML_TAG_DIFF_ADDED "//" XML_CIB_TAG_TICKETS); if (xpathObj && xpathObj->nodesetval->nodeNr > 0) { xmlNode *aborted = getXpathResult(xpathObj, 0); abort_transition(INFINITY, tg_restart, "Ticket attribute: update", aborted); goto bail; } else if (xpathObj) { xmlXPathFreeObject(xpathObj); } /* Tickets Attributes - Removed */ xpathObj = xpath_search(diff, "//" F_CIB_UPDATE_RESULT "//" XML_TAG_DIFF_REMOVED "//" XML_CIB_TAG_TICKETS); if (xpathObj && xpathObj->nodesetval->nodeNr > 0) { xmlNode *aborted = getXpathResult(xpathObj, 0); abort_transition(INFINITY, tg_restart, "Ticket attribute: removal", aborted); goto bail; } else if (xpathObj) { xmlXPathFreeObject(xpathObj); } /* Transient Attributes - Added/Updated */ xpathObj = xpath_search(diff, "//" F_CIB_UPDATE_RESULT "//" XML_TAG_DIFF_ADDED "//" XML_TAG_TRANSIENT_NODEATTRS "//" XML_CIB_TAG_NVPAIR); if (xpathObj && xpathObj->nodesetval->nodeNr > 0) { int lpc; for (lpc = 0; lpc < xpathObj->nodesetval->nodeNr; lpc++) { xmlNode *attr = getXpathResult(xpathObj, lpc); const char *name = crm_element_value(attr, XML_NVPAIR_ATTR_NAME); const char *value = NULL; if (safe_str_eq(CRM_OP_PROBED, name)) { value = crm_element_value(attr, XML_NVPAIR_ATTR_VALUE); } if (crm_is_true(value) == FALSE) { abort_transition(INFINITY, tg_restart, "Transient attribute: update", attr); crm_log_xml_trace(attr, "Abort"); goto bail; } } } else if (xpathObj) { xmlXPathFreeObject(xpathObj); } /* Transient Attributes - Removed */ xpathObj = xpath_search(diff, "//" F_CIB_UPDATE_RESULT "//" XML_TAG_DIFF_REMOVED "//" XML_TAG_TRANSIENT_NODEATTRS); if (xpathObj && xpathObj->nodesetval->nodeNr > 0) { xmlNode *aborted = getXpathResult(xpathObj, 0); abort_transition(INFINITY, tg_restart, "Transient attribute: removal", aborted); goto bail; } else if (xpathObj) { xmlXPathFreeObject(xpathObj); } /* Check for node state updates... possibly from a shutdown we requested */ xpathObj = xpath_search(diff, "//" F_CIB_UPDATE_RESULT "//" XML_TAG_DIFF_ADDED "//" XML_CIB_TAG_STATE); if (xpathObj) { int lpc = 0, max = xpathObj->nodesetval->nodeNr; for (lpc = 0; lpc < max; lpc++) { xmlNode *node = getXpathResult(xpathObj, lpc); const char *event_node = crm_element_value(node, XML_ATTR_ID); const char *ccm_state = crm_element_value(node, XML_CIB_ATTR_INCCM); const char *ha_state = crm_element_value(node, XML_CIB_ATTR_HASTATE); const char *shutdown_s = crm_element_value(node, XML_CIB_ATTR_SHUTDOWN); const char *crmd_state = crm_element_value(node, XML_CIB_ATTR_CRMDSTATE); if (safe_str_eq(ccm_state, XML_BOOLEAN_FALSE) || safe_str_eq(ha_state, DEADSTATUS) || safe_str_eq(crmd_state, CRMD_JOINSTATE_DOWN)) { crm_action_t *shutdown = match_down_event(0, event_node, NULL); if (shutdown != NULL) { const char *task = crm_element_value(shutdown->xml, XML_LRM_ATTR_TASK); if (safe_str_neq(task, CRM_OP_FENCE)) { /* Wait for stonithd to tell us it is complete via tengine_stonith_callback() */ crm_debug("Confirming %s op %d", task, shutdown->id); /* match->confirmed = TRUE; */ stop_te_timer(shutdown->timer); update_graph(transition_graph, shutdown); trigger_graph(); } } else { crm_info("Stonith/shutdown of %s not matched", event_node); abort_transition(INFINITY, tg_restart, "Node failure", node); } fail_incompletable_actions(transition_graph, event_node); } if (shutdown_s) { int shutdown = crm_parse_int(shutdown_s, NULL); if (shutdown > 0) { crm_info("Aborting on " XML_CIB_ATTR_SHUTDOWN " attribute for %s", event_node); abort_transition(INFINITY, tg_restart, "Shutdown request", node); } } } xmlXPathFreeObject(xpathObj); } /* * Check for and fast-track the processing of LRM refreshes * In large clusters this can result in _huge_ speedups * * Unfortunately we can only do so when there are no pending actions * Otherwise we could miss updates we're waiting for and stall * */ xpathObj = NULL; if (transition_graph->pending == 0) { xpathObj = xpath_search(diff, "//" F_CIB_UPDATE_RESULT "//" XML_TAG_DIFF_ADDED "//" XML_LRM_TAG_RESOURCE); } if (xpathObj) { int updates = xpathObj->nodesetval->nodeNr; if (updates > 1) { /* Updates by, or in response to, TE actions will never contain updates * for more than one resource at a time */ crm_debug("Detected LRM refresh - %d resources updated: Skipping all resource events", updates); crm_log_xml_trace(diff, "lrm-refresh"); abort_transition(INFINITY, tg_restart, "LRM Refresh", NULL); goto bail; } xmlXPathFreeObject(xpathObj); } /* Process operation updates */ xpathObj = xpath_search(diff, "//" F_CIB_UPDATE_RESULT "//" XML_TAG_DIFF_ADDED "//" XML_LRM_TAG_RSC_OP); if (xpathObj) { process_resource_updates(xpathObj); xmlXPathFreeObject(xpathObj); } /* Detect deleted (as opposed to replaced or added) actions - eg. crm_resource -C */ xpathObj = xpath_search(diff, "//" XML_TAG_DIFF_REMOVED "//" XML_LRM_TAG_RSC_OP); if (xpathObj) { int lpc = 0, max = xpathObj->nodesetval->nodeNr; for (lpc = 0; lpc < max; lpc++) { int max = 0; const char *op_id = NULL; char *rsc_op_xpath = NULL; xmlXPathObject *op_match = NULL; xmlNode *match = getXpathResult(xpathObj, lpc); CRM_CHECK(match != NULL, continue); op_id = ID(match); max = strlen(rsc_op_template) + strlen(op_id) + 1; crm_malloc0(rsc_op_xpath, max); snprintf(rsc_op_xpath, max, rsc_op_template, op_id); op_match = xpath_search(diff, rsc_op_xpath); if (op_match == NULL || op_match->nodesetval->nodeNr == 0) { /* Prevent false positives by matching cancelations too */ const char *node = get_node_id(match); crm_action_t *cancelled = get_cancel_action(op_id, node); if (cancelled == NULL) { crm_debug("No match for deleted action %s (%s on %s)", rsc_op_xpath, op_id, node); abort_transition(INFINITY, tg_restart, "Resource op removal", match); if (op_match) { xmlXPathFreeObject(op_match); } crm_free(rsc_op_xpath); goto bail; } else { crm_debug("Deleted lrm_rsc_op %s on %s was for graph event %d", op_id, node, cancelled->id); } } if (op_match) { xmlXPathFreeObject(op_match); } crm_free(rsc_op_xpath); } } bail: if (xpathObj) { xmlXPathFreeObject(xpathObj); } }
daeMetaElement * domPolygons::registerElement(DAE& dae) { daeMetaElement* meta = dae.getMeta(ID()); if ( meta != NULL ) return meta; meta = new daeMetaElement(dae); dae.setMeta(ID(), *meta); meta->setName( "polygons" ); meta->registerClass(domPolygons::create); daeMetaCMPolicy *cm = NULL; daeMetaElementAttribute *mea = NULL; cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 0, -1 ); mea->setName( "input" ); mea->setOffset( daeOffsetOf(domPolygons,elemInput_array) ); mea->setElementType( domInputLocalOffset::registerElement(dae) ); cm->appendChild( mea ); cm = new daeMetaChoice( meta, cm, 0, 1, 0, -1 ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); mea->setName( "p" ); mea->setOffset( daeOffsetOf(domPolygons,elemP_array) ); mea->setElementType( domP::registerElement(dae) ); cm->appendChild( mea ); mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); mea->setName( "ph" ); mea->setOffset( daeOffsetOf(domPolygons,elemPh_array) ); mea->setElementType( domPolygons::domPh::registerElement(dae) ); cm->appendChild( mea ); cm->setMaxOrdinal( 0 ); cm->getParent()->appendChild( cm ); cm = cm->getParent(); mea = new daeMetaElementArrayAttribute( meta, cm, 3002, 0, -1 ); mea->setName( "extra" ); mea->setOffset( daeOffsetOf(domPolygons,elemExtra_array) ); mea->setElementType( domExtra::registerElement(dae) ); cm->appendChild( mea ); cm->setMaxOrdinal( 3002 ); meta->setCMRoot( cm ); // Ordered list of sub-elements meta->addContents(daeOffsetOf(domPolygons,_contents)); meta->addContentsOrder(daeOffsetOf(domPolygons,_contentsOrder)); meta->addCMDataArray(daeOffsetOf(domPolygons,_CMData), 1); // Add attribute: name { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "name" ); ma->setType( dae.getAtomicTypes().get("xsNCName")); ma->setOffset( daeOffsetOf( domPolygons , attrName )); ma->setContainer( meta ); meta->appendAttribute(ma); } // Add attribute: count { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "count" ); ma->setType( dae.getAtomicTypes().get("Uint")); ma->setOffset( daeOffsetOf( domPolygons , attrCount )); ma->setContainer( meta ); ma->setIsRequired( true ); meta->appendAttribute(ma); } // Add attribute: material { daeMetaAttribute *ma = new daeMetaAttribute; ma->setName( "material" ); ma->setType( dae.getAtomicTypes().get("xsNCName")); ma->setOffset( daeOffsetOf( domPolygons , attrMaterial )); ma->setContainer( meta ); meta->appendAttribute(ma); } meta->setElementSize(sizeof(domPolygons)); meta->validate(); return meta; }
void CBlackGraviArtefact::GraviStrike() { xr_list<s16> elements_list; xr_list<Fvector> bone_position_list; Fvector object_pos ; Fvector strike_dir ; rq_storage.r_clear (); for(GAME_OBJECT_LIST_it it = m_GameObjectList.begin(); m_GameObjectList.end() != it; ++it) { CPhysicsShellHolder* pGameObject = *it; if(pGameObject->Visual()) pGameObject->Center(object_pos); else object_pos.set(pGameObject->Position()); strike_dir.sub(object_pos, Position()); float distance = strike_dir.magnitude(); float impulse = 100.f*m_fStrikeImpulse * (1.f - (distance/m_fRadius)* (distance/m_fRadius)); if(impulse > .001f) { //? BOOL enabled = getEnabled(); //? setEnabled (FALSE); impulse *= CExplosive::ExplosionEffect (rq_storage,NULL,pGameObject, Position(),m_fRadius); //? setEnabled (enabled); } float hit_power ; CEntityAlive* pEntityAlive = smart_cast<CEntityAlive*>(pGameObject); if(pGameObject->m_pPhysicsShell) hit_power = 0; else if(pEntityAlive && pEntityAlive->g_Alive() && pEntityAlive->character_physics_support()->movement()->CharacterExist()) hit_power = 0; else hit_power = impulse; if(impulse > .001f) { while(!elements_list.empty()) { s16 element = elements_list.front(); Fvector bone_pos = bone_position_list.front(); NET_Packet P; SHit HS; HS.GenHeader(GE_HIT, pGameObject->ID()); // u_EventGen (P,GE_HIT, pGameObject->ID()); HS.whoID =ID(); // P.w_u16 (ID()); HS.weaponID = ID(); // P.w_u16 (ID()); HS.dir = strike_dir; // P.w_dir (strike_dir); HS.power = hit_power; // P.w_float (hit_power); HS.boneID = element; // P.w_s16 (element); HS.p_in_bone_space = bone_pos; // P.w_vec3 (bone_pos); HS.impulse = impulse; // P.w_float (impulse); HS.hit_type = (ALife::eHitTypeWound); // P.w_u16 (u16(ALife::eHitTypeWound)); HS.Write_Packet(P); u_EventSend (P); elements_list.pop_front(); bone_position_list.pop_front(); } } } }
int main(int argc, char **argv) { uint32 merSize = 16; char *merylFile = 0L; char *fastaFile = 0L; bool beVerbose = false; uint32 loCount = 0; uint32 hiCount = ~uint32ZERO; uint32 windowsize = 0; uint32 skipsize = 0; int arg=1; while (arg < argc) { if (strcmp(argv[arg], "-m") == 0) { merSize = strtouint32(argv[++arg]); } else if (strcmp(argv[arg], "-mers") == 0) { merylFile = argv[++arg]; } else if (strcmp(argv[arg], "-seq") == 0) { fastaFile = argv[++arg]; } else if (strcmp(argv[arg], "-v") == 0) { beVerbose = true; } else if (strcmp(argv[arg], "-lo") == 0) { loCount = strtouint32(argv[++arg]); } else if (strcmp(argv[arg], "-hi") == 0) { hiCount = strtouint32(argv[++arg]); } else if (strcmp(argv[arg], "-w") == 0) { windowsize = strtouint32(argv[++arg]); } else if (strcmp(argv[arg], "-s") == 0) { skipsize = strtouint32(argv[++arg]); } else { fprintf(stderr, "unknown option '%s'\n", argv[arg]); } arg++; } if ((merylFile == 0L) || (fastaFile == 0L)) { fprintf(stderr, "usage: %s -m mersize -mers mers -seq fasta > output\n", argv[0]); exit(1); } existDB *E = new existDB(merylFile, merSize, existDBcounts | existDBcompressCounts | existDBcompressBuckets, loCount, hiCount); seqCache *F = new seqCache(fastaFile); for (uint32 Sid=0; Sid < F->getNumberOfSequences(); Sid++) { seqInCore *S = F->getSequenceInCore(Sid); merStream *MS = new merStream(new kMerBuilder(merSize), new seqStream(S->sequence(), S->sequenceLength()), true, true); uint32 idlen = 0; intervalDepthRegions<uint64> *id = new intervalDepthRegions<uint64> [S->sequenceLength() * 2 + 2]; while (MS->nextMer()) { int32 cnt = (int32)E->count(MS->theFMer()) + (int32)E->count(MS->theRMer()); // Old intervalDepth was to add 'cnt' in the first and subtract 'cnt' in the second. // Then to use the 'ct' field below. // New intervalDepth is the same, but uses the value field. // Count is now the number of intervals that are represented in this block. id[idlen].pos = MS->thePositionInSequence(); id[idlen].change = cnt; id[idlen].open = true; idlen++; id[idlen].pos = MS->thePositionInSequence() + merSize; id[idlen].change = cnt; id[idlen].open = false; idlen++; } intervalList<uint64> ID(id, idlen); uint32 x = 0; uint32 len = S->sequenceLength(); // Default case, report un-averaged depth at every single location. // if ((windowsize == 0) && (skipsize == 0)) { for (uint32 i=0; i < ID.numberOfIntervals(); i++) { for (; x < ID.lo(i); x++) fprintf(stdout, uint32FMTW(7)"\t"uint32FMTW(6)"\n", x, 0); for (; x < ID.hi(i); x++) fprintf(stdout, uint32FMTW(7)"\t"uint32FMTW(6)"\n", x, ID.value(i)); } for (; x < len; x++) fprintf(stdout, uint32FMTW(7)"\t"uint32FMTW(6)"\n", x, 0); } else { uint32 *depth = new uint32 [len]; for (x=0; x < len; x++) depth[x] = 0; for (uint32 i=0; i < ID.numberOfIntervals(); i++) for (x=ID.lo(i); x < ID.hi(i); x++) depth[x] = ID.count(i); uint32 avedepth = 0; for (x=0; x < windowsize; x++) avedepth += depth[x]; while (x < len) { uint32 avepos = (x - 1) - (windowsize - 1) / 2; if ((avepos % skipsize) == 0) fprintf(stdout, uint32FMT"\t%.4f\n", avepos, (double)avedepth / (double)windowsize); avedepth = avedepth + depth[x] - depth[x-windowsize]; x++; } delete [] depth; } delete [] id; delete MS; delete S; } delete F; delete E; }
inline Vertex::cell_set Vertex::cells() const { return cell_set(cell_it(data.mesh,data.mesh->data.vtoc,ID())); }