當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetInstanceId函數代碼示例

本文整理匯總了C++中GetInstanceId函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetInstanceId函數的具體用法?C++ GetInstanceId怎麽用?C++ GetInstanceId使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetInstanceId函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: UnloadIfEmpty

/* true if the instance save is still valid */
bool InstanceSave::UnloadIfEmpty()
{
    if (m_playerList.empty() && m_groupList.empty())
    {
        if (!sInstanceSaveMgr->lock_instLists)
            sInstanceSaveMgr->RemoveInstanceSave(GetInstanceId());

        return false;
    }
    else
        return true;
}
開發者ID:mynew2,項目名稱:trinitycore-1,代碼行數:13,代碼來源:InstanceSaveMgr.cpp

示例2: ShapeLibGetMesh

// push Renderable nodes
//virtual
bool ControlPointGob::GetRenderables(RenderableNodeCollector* collector, RenderContext* context)
{
  
    Mesh* mesh = ShapeLibGetMesh(RenderShape::QuadLineStrip);
    m_localBounds = mesh->bounds;

    const float pointSize = 8; // control point size in pixels
    float upp = context->Cam().ComputeUnitPerPixel(float3(&m_world.M41),
        context->ViewPort().y);
    float scale = pointSize * upp;        
    Matrix scaleM = Matrix::CreateScale(scale);
    float3 objectPos = float3(m_world.M41,m_world.M42,m_world.M43);
    Matrix b = Matrix::CreateBillboard(objectPos,context->Cam().CamPos(),context->Cam().CamUp(),context->Cam().CamLook());
    Matrix billboard = scaleM * b;

    // calculate bounds for screen facing quad
    float3 transformed, min, max;
    transformed = mesh->pos[0];
    transformed.Transform(billboard);
    min = max = transformed;
    for (auto it = mesh->pos.begin(); it != mesh->pos.end(); ++it)
    {
        transformed = (*it);
        transformed.Transform(billboard);
        min = minimize(min, transformed);
        max = maximize(max, transformed);
    }
    m_bounds = AABB(min,max);

    // give it same color as curve
    int color = 0xFFFF0000;
    CurveGob* curve = (CurveGob*)m_parent;
    if(curve != NULL)
    {
        color = curve->GetColor();
    }

    // set renderable
    RenderableNode r;
    r.mesh = mesh;
    ConvertColor(color, &r.diffuse);
    r.objectId = GetInstanceId();
    r.bounds = m_bounds;
    r.WorldXform = billboard;
    r.SetFlag(RenderableNode::kTestAgainstBBoxOnly, true);
    r.SetFlag(RenderableNode::kShadowCaster, false);
    r.SetFlag(RenderableNode::kShadowReceiver, false);
    
    collector->Add(r, RenderFlags::None, Shaders::BasicShader);
    return true;
}
開發者ID:macressler,項目名稱:LevelEditor,代碼行數:53,代碼來源:ControlPointGob.cpp

示例3: DEBUG_LOG

DungeonPersistentState::~DungeonPersistentState()
{
    DEBUG_LOG("Unloading DungeonPersistantState of map %u instance %u", GetMapId(), GetInstanceId());
    while (!m_playerList.empty())
    {
        Player* player = *(m_playerList.begin());
        player->UnbindInstance(GetMapId(), true);
    }
    while (!m_groupList.empty())
    {
        Group* group = *(m_groupList.begin());
        group->UnbindInstance(GetMapId(), true);
    }
}
開發者ID:249CAAFE40,項目名稱:mangos-classic,代碼行數:14,代碼來源:MapPersistentStateMgr.cpp

示例4: DeleteFromDB

void Corpse::SaveToDB()
{
    // prevent DB data inconsistance problems and duplicates
    CharacterDatabase.BeginTransaction();
    DeleteFromDB();

    std::ostringstream ss;
    ss  << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,data,time,corpse_type,instance) VALUES ("
        << GetGUIDLow() << ", " << GUID_LOPART(GetOwnerGUID()) << ", " << GetPositionX() << ", " << GetPositionY() << ", " << GetPositionZ() << ", "
        << GetOrientation() << ", "  << GetZoneId() << ", "  << GetMapId() << ", '";
    for(uint16 i = 0; i < m_valuesCount; i++ )
        ss << GetUInt32Value(i) << " ";
    ss << "'," << uint64(m_time) <<", " << uint32(GetType()) << ", " << int(GetInstanceId()) << ")";
    CharacterDatabase.Execute( ss.str().c_str() );
    CharacterDatabase.CommitTransaction();
}
開發者ID:Anderss,項目名稱:mangos,代碼行數:16,代碼來源:Corpse.cpp

示例5: assert

bool Renderer::AddTexture(const char * filename, TextureCategory category, TextureWrap wrapS, TextureWrap wrapT, bool invertY)
{
	assert(filename != nullptr);

	uint32_t width = 128;
	uint32_t height = 128;

	TextureManager::GetTiffImageSize(filename, width, height);

	uint16_t rendererId = (uint16_t)GetInstanceId();

	TextureInfo textureInfo(filename, rendererId, category, (GLsizei)width, (GLsizei)height, wrapS, wrapT, invertY);

	mTextureInfoList.push_back(textureInfo);

	return true;
}
開發者ID:doodoonovitch,項目名稱:GameTech,代碼行數:17,代碼來源:Renderer.cpp

示例6: ShapeLibGetMesh

    void SkyDome::Render( RenderContext* context)
    {
        if(IsVisible() == false) 
            return;
       
        RenderableNode r;        
        r.mesh = ShapeLibGetMesh(RenderShape::Sphere);
        r.objectId = GetInstanceId();    
        r.textures[TextureType::Cubemap] = m_texture ? m_texture : TextureLib::Inst()->GetDefault(TextureType::Cubemap);       
        r.SetFlag( RenderableNode::kShadowCaster, false );
        r.SetFlag( RenderableNode::kShadowReceiver, false );

        SkyDomeShader* pShader =(SkyDomeShader*) ShaderLib::Inst()->GetShader(Shaders::SkyDomeShader); 
        pShader->Begin( context);
        pShader->SetRenderFlag( RenderFlags::None );   // call this *after* Begin()        
        pShader->Draw(r);
        
        pShader->End();
    }
開發者ID:Anters,項目名稱:LevelEditor,代碼行數:19,代碼來源:SkyDome.cpp

示例7: StartBullet

void FastProjectile::StartBullet(float muzzle_velocity) {
	const bool is_synchronized = !GetManager()->IsLocalGameObjectId(GetInstanceId());
	const bool has_barrel = (GetOwnerInstanceId() != 0);
	ProjectileUtil::StartBullet(this, muzzle_velocity, !is_synchronized && has_barrel);

	if (is_synchronized && has_barrel) {
		// Move mesh to muzzle and let it lerp towards object.
		xform transform;
		vec3 velocity;
		ProjectileUtil::GetBarrel(this, transform, velocity);
		for (size_t x = 0; x < mesh_resource_array_.size(); ++x) {
			UiCure::UserGeometryReferenceResource* resource = mesh_resource_array_[x];
			tbc::GeometryBase* gfx_geometry = resource->GetRamData();
			gfx_geometry->SetTransformation(transform);
		}
		EnableMeshSlide(true);
		ActivateLerp();
	}
}
開發者ID:highfestiva,項目名稱:life,代碼行數:19,代碼來源:fastprojectile.cpp

示例8: GetDifficulty

void DungeonPersistentState::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit* source)
{
    DungeonEncounterList const* encounters = sObjectMgr.GetDungeonEncounterList(GetInstanceId(), GetDifficulty());
    if (!encounters)
        return;

    uint32 dungeonId = 0;
    for (DungeonEncounterList::const_iterator itr = encounters->begin(); itr != encounters->end(); ++itr)
    {
        DungeonEncounter const* encounter = *itr;
        if (encounter->creditType == type && encounter->creditEntry == creditEntry &&
            encounter->difficulty == -1 || (encounter->difficulty == GetDifficulty()))
        {
            m_completedEncountersMask |= 1 << encounter->dbcEntry->encounterIndex;
            if (encounter->lastEncounterDungeon)
            {
                dungeonId = encounter->lastEncounterDungeon;
                sLog.outDebug("UpdateEncounterState: Instance %s (instanceId %u) completed encounter %s. Credit Dungeon: %u", GetMap()->GetMapName(), GetInstanceId(), encounter->dbcEntry->encounterName[0], dungeonId);
                break;
            }
        }
    }

    if (dungeonId)
    {
        Map::PlayerList const& players = GetMap()->GetPlayers();
        for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
        {
            if (Player* player = i->getSource())
            {
                if (Group* grp = player->GetGroup())
                {
                    if (grp->isLFGGroup())
                    {
                        sLFGMgr.FinishDungeon(grp->GetObjectGuid(), dungeonId);
                        return;
                    }
                }
            }
        }
    }
}
開發者ID:Calixa,項目名稱:murlocs_434,代碼行數:42,代碼來源:MapPersistentStateMgr.cpp

示例9: assert

    void Locator::BuildRenderables()
    {
        m_renderables.clear();
        Model* model = NULL;
        assert(m_resource);
        model = (Model*)m_resource->GetTarget();
        
        assert(model && model->IsReady());

        const NodeDict& nodes = model->Nodes();
        for(auto nodeIt = nodes.begin(); nodeIt != nodes.end(); ++nodeIt)
        {
            Node* node = nodeIt->second;
            assert(m_modelTransforms.size() >= node->index);
            const Matrix& world = m_modelTransforms[node->index]; // transform array holds world matricies already, not local
            for(auto geoIt = node->geometries.begin(); geoIt != node->geometries.end(); ++geoIt)
            {
                Geometry* geo = (*geoIt);
                Material * mat = geo->material;
                RenderableNode renderNode;
                renderNode.mesh = geo->mesh;
                renderNode.WorldXform = world;
                renderNode.bounds = geo->mesh->bounds;
                renderNode.bounds.Transform(renderNode.WorldXform);
                renderNode.objectId = GetInstanceId();
                renderNode.diffuse =  mat->diffuse;
                renderNode.specular = mat->specular.xyz();
                renderNode.specPower = mat->power;
                renderNode.SetFlag( RenderableNode::kShadowCaster, GetCastsShadows() );
                renderNode.SetFlag( RenderableNode::kShadowReceiver, GetReceivesShadows() );

                LightingState::Inst()->UpdateLightEnvironment(renderNode);

                for(unsigned int i = TextureType::MIN; i < TextureType::MAX; ++i)
                {
                    renderNode.textures[i] = geo->material->textures[i];
                }
                m_renderables.push_back(renderNode);
            }
        }
    }
開發者ID:Averroes,項目名稱:LevelEditor,代碼行數:41,代碼來源:Locator.cpp

示例10: lock

std::string ResourceUIScriptRuntime::AddCallbackRef(ResUIResultCallback resultCallback)
{
	std::unique_lock<std::recursive_mutex> lock(m_refMutex);

	// add the ref to the list
	int32_t idx = m_refIdx;
	m_refs[idx] = resultCallback;

	m_refIdx++;

	// canonicalize the ref
	char* refString;
	m_scriptHost->CanonicalizeRef(idx, GetInstanceId(), &refString);

	// turn into a std::string and free
	std::string retval = refString;
	fwFree(refString);

	// return the value
	return retval;
}
開發者ID:ghost30812,項目名稱:client,代碼行數:21,代碼來源:ResourceUICallbacks.cpp

示例11: DeleteFromDB

void Corpse::SaveToDB()
{
    // prevent DB data inconsistence problems and duplicates
    SQLTransaction trans = CharacterDatabase.BeginTransaction();
    DeleteFromDB(trans);

    uint16 index = 0;
    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE);
    stmt->setUInt64(index++, GetGUID().GetCounter());                                 // corpseGuid
    stmt->setUInt64(index++, GetOwnerGUID().GetCounter());                            // guid
    stmt->setFloat (index++, GetPositionX());                                         // posX
    stmt->setFloat (index++, GetPositionY());                                         // posY
    stmt->setFloat (index++, GetPositionZ());                                         // posZ
    stmt->setFloat (index++, GetOrientation());                                       // orientation
    stmt->setUInt16(index++, GetMapId());                                             // mapId
    stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID));                // displayId
    stmt->setString(index++, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END));   // itemCache
    stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_1));                   // bytes1
    stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_2));                   // bytes2
    stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_FLAGS));                     // flags
    stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS));             // dynFlags
    stmt->setUInt32(index++, uint32(m_time));                                         // time
    stmt->setUInt8 (index++, GetType());                                              // corpseType
    stmt->setUInt32(index++, GetInstanceId());                                        // instanceId
    trans->Append(stmt);

    for (uint32 phaseId : GetPhases())
    {
        index = 0;
        stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE_PHASES);
        stmt->setUInt32(index++, GetGUID().GetCounter());                                       // Guid (corpse's)
        stmt->setUInt32(index++, phaseId);                                            // PhaseId
        stmt->setUInt32(index++, GetOwnerGUID().GetCounter());                        // OwnerGuid
        stmt->setUInt32(index++, uint32(m_time));                                     // Time
        stmt->setUInt8(index++, GetType());                                           // CorpseType
        trans->Append(stmt);
    }

    CharacterDatabase.CommitTransaction(trans);
}
開發者ID:DrYaling,項目名稱:eluna-wod,代碼行數:40,代碼來源:Corpse.cpp

示例12: ConvertColor

//-----------------------------------------------------------------------------------------------------------------------------------
// push Renderable nodes
//virtual
void CurveGob::GetRenderables(RenderableNodeCollector* collector, RenderContext* context)
{
	if (!IsVisible(context->Cam().GetFrustum()) || m_points.size() < 2)
		return;
    
	super::GetRenderables(collector, context);
    
    RenderableNode r;
    r.mesh = &m_mesh;
    ConvertColor(m_color, &r.diffuse);
    r.objectId = GetInstanceId();
    r.SetFlag( RenderableNode::kShadowCaster, false );
    r.SetFlag( RenderableNode::kShadowReceiver, false );
    r.bounds = m_bounds;
    r.WorldXform = m_world;       
    collector->Add( r, RenderFlags::None, Shaders::BasicShader );

    // draw control points.
    for( auto it = m_points.begin(); it != m_points.end(); ++it)
    {
        (*it)->GetRenderables(collector,context);
    }
}
開發者ID:Anters,項目名稱:LevelEditor,代碼行數:26,代碼來源:CurveGob.cpp

示例13: Win32ReleaseAllDhcp9x

// Release the DHCP addresses of all virtual LAN cards
void Win32ReleaseAllDhcp9x(bool wait)
{
	TOKEN_LIST *t;
	UINT i;

	t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD);
	if (t == NULL)
	{
		return;
	}

	for (i = 0;i < t->NumTokens;i++)
	{
		char *name = t->Token[i];
		UINT id = GetInstanceId(name);
		if (id != 0)
		{
			Win32ReleaseDhcp9x(id, wait);
		}
	}

	FreeToken(t);
}
開發者ID:RexSi,項目名稱:SoftEtherVPN,代碼行數:24,代碼來源:VLanWin32.c

示例14: VALUES

/*
    Called from AddPersistentState
*/
void DungeonPersistentState::SaveToDB()
{
    // state instance data too
    std::string data;

    if (Map* map = GetMap())
    {
        InstanceData* iData = map->GetInstanceData();
        if (iData && iData->Save())
        {
            data = iData->Save();
            CharacterDatabase.escape_string(data);
        }
    }

    CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '" UI64FMTD "', '%u', '%u', '%s')", GetInstanceId(), GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), GetCompletedEncountersMask(), data.c_str());
}
開發者ID:krullgor,項目名稱:mangos-tbc,代碼行數:20,代碼來源:MapPersistentStateMgr.cpp

示例15: DEBUG_LOG

DungeonPersistentState::~DungeonPersistentState()
{
    DEBUG_LOG("Unloading DungeonPersistantState of map %u instance %u", GetMapId(), GetInstanceId());
    UnbindThisState();
}
開發者ID:krullgor,項目名稱:mangos-tbc,代碼行數:5,代碼來源:MapPersistentStateMgr.cpp


注:本文中的GetInstanceId函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。