当前位置: 首页>>代码示例>>C++>>正文


C++ MapSet函数代码示例

本文整理汇总了C++中MapSet函数的典型用法代码示例。如果您正苦于以下问题:C++ MapSet函数的具体用法?C++ MapSet怎么用?C++ MapSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MapSet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MapFind

///////////////////////////////////////////////////////////////
//
// CClientPerfStatLuaTimingImpl::UpdateLuaTiming
//
//
//
///////////////////////////////////////////////////////////////
void CClientPerfStatLuaTimingImpl::UpdateLuaTiming ( CLuaMain* pLuaMain, const char* szEventName, TIMEUS timeUs )
{
    CLuaMainTiming* pLuaMainTiming = MapFind ( AllLuaTiming.LuaMainTimingMap, pLuaMain );
    if ( !pLuaMainTiming )
    {
        MapSet ( AllLuaTiming.LuaMainTimingMap, pLuaMain, CLuaMainTiming() );
        pLuaMainTiming = MapFind ( AllLuaTiming.LuaMainTimingMap, pLuaMain );
    }

    {
        CTiming& acc = pLuaMainTiming->ResourceTiming.s5.acc;
        acc.total_us += timeUs;
    }

    CTimingBlock* pEventTiming = MapFind ( pLuaMainTiming->EventTimingMap, szEventName );
    if ( !pEventTiming )
    {
        MapSet (pLuaMainTiming->EventTimingMap, szEventName, CTimingBlock() );
        pEventTiming = MapFind ( pLuaMainTiming->EventTimingMap, szEventName );
    }

    {
        CTiming& acc = pEventTiming->s5.acc;
        acc.calls++;
        acc.total_us += timeUs;
        acc.max_us = std::max ( acc.max_us, timeUs );
    }
}
开发者ID:Jusonex,项目名称:mtasa-blue,代码行数:35,代码来源:CClientPerfStat.LuaTiming.cpp

示例2: MapRemove

void CEntitySA::SetCollidableWith( CEntity *entity, bool enabled )
{
    CEntitySA *intEnt = dynamic_cast <CEntitySA*> ( entity );

    if ( intEnt == this )
        return;

    // quit if no change
    if ( MapContains( m_disabledColl, intEnt->GetInterface() ) != enabled )
        return;

    if ( enabled )
    {
        MapRemove( m_disabledColl, intEnt->GetInterface() );

        if ( m_disabledColl.empty() )
            MapRemove( pGame->m_disabledColl, this );
    }
    else
    {
        MapSet( m_disabledColl, intEnt->GetInterface(), true );
        MapSet( pGame->m_disabledColl, this, true );
    }

    // Set in the other entity as well
    intEnt->SetCollidableWith( this, enabled );
}
开发者ID:qaisjp,项目名称:green-candy,代码行数:27,代码来源:CEntitySA.cpp

示例3: assert

///////////////////////////////////////////////////////////////
//
// CGameEntityXRefManagerImpl::AddEntityXRef
//
// Add a new reference between a game entity and a client entity
//
///////////////////////////////////////////////////////////////
void CGameEntityXRefManagerImpl::AddEntityXRef ( CClientEntity* pEntity, CEntity* pEntitySA )
{
    CEntitySAInterface* pEntitySAInterface = pEntitySA->GetInterface ();

    assert ( !MapContains ( m_ClientToGameMap, pEntity ) );
    assert ( !MapContains ( m_GameToClientMap, pEntitySA ) );
    assert ( !MapContains ( m_InterfaceToClientMap, pEntitySAInterface ) );

    MapSet ( m_ClientToGameMap, pEntity, pEntitySA );
    MapSet ( m_GameToClientMap, pEntitySA, pEntity );
    MapSet ( m_InterfaceToClientMap, pEntitySAInterface, pEntity );
}
开发者ID:ntauthority,项目名称:openvice,代码行数:19,代码来源:CGameEntityXRefManager.cpp

示例4: MapFindRef

////////////////////////////////////////////////////////////////
//
// CEffectClonerImpl::CreateD3DEffect
//
//
//
////////////////////////////////////////////////////////////////
ID3DXEffect* CEffectClonerImpl::CreateD3DEffect ( const SString& strFilename, const SString& strRootPath, SString& strOutStatus, bool bDebug )
{
    // Do we have a match with the initial path
    CEffectTemplate* pEffectTemplate = MapFindRef ( m_ValidMap, ConformPathForSorting ( strFilename ) );
    if ( pEffectTemplate )
    {
        // Have files changed since create?
        if ( pEffectTemplate->HaveFilesChanged () )
        {
            // EffectTemplate is no good for cloning now, so move it to the old list 
            MapRemove ( m_ValidMap, ConformPathForSorting ( strFilename ) );
            m_OldList.push_back ( pEffectTemplate );
            pEffectTemplate = NULL;
        }
    }

    // Need to create new EffectTemplate?
    if ( !pEffectTemplate )
    {
        pEffectTemplate = NewEffectTemplate ( m_pManager, strFilename, strRootPath, strOutStatus, bDebug );
        if ( !pEffectTemplate->IsValid () )
        {
            SAFE_RELEASE( pEffectTemplate );
            return NULL;
        }

        OutputDebugLine ( SString ( "[Shader] CEffectClonerImpl::CreateD3DEffect - New EffectTemplate for %s", *strFilename ) );
        // Add to active map
        MapSet ( m_ValidMap, ConformPathForSorting ( strFilename ), pEffectTemplate );
    }


    //
    // Now we have a valid EffectTemplate to clone the effect from
    //

    // Clone D3DXEffect
    ID3DXEffect* pNewD3DEffect = pEffectTemplate->CloneD3DEffect ( &strOutStatus );

    if( !pNewD3DEffect )
    {
        if ( strOutStatus.empty () )
            strOutStatus = "Error: Clone failed";
        return NULL;
    }

    // Cross ref clone with original
    MapSet ( m_CloneMap, pNewD3DEffect, pEffectTemplate );

    // Return result
    return pNewD3DEffect;
}
开发者ID:EagleShen,项目名称:MTA,代码行数:59,代码来源:CRenderItem.EffectCloner.cpp

示例5: m_uiJobCountWarnThresh

///////////////////////////////////////////////////////////////
//
// CDatabaseJobQueueImpl::CDatabaseJobQueueImpl
//
// Init known database types and start the job service thread
//
///////////////////////////////////////////////////////////////
CDatabaseJobQueueImpl::CDatabaseJobQueueImpl ( void )
    : m_uiJobCountWarnThresh ( 200 )
    , m_uiConnectionCountWarnThresh ( 20 )
{
    // Add known database types
    CDatabaseType* pDatabaseTypeSqlite = NewDatabaseTypeSqlite ();
    MapSet ( m_DatabaseTypeMap, pDatabaseTypeSqlite->GetDataSourceTag (), pDatabaseTypeSqlite );

    // Add known database types
    CDatabaseType* pDatabaseTypeMySql = NewDatabaseTypeMySql ();
    MapSet ( m_DatabaseTypeMap, pDatabaseTypeMySql->GetDataSourceTag (), pDatabaseTypeMySql );

    // Start the job queue processing thread
    m_pServiceThreadHandle = new CThreadHandle ( CDatabaseJobQueueImpl::StaticThreadProc, this );
}
开发者ID:tousuke,项目名称:mtasa-blue,代码行数:22,代码来源:CDatabaseJobQueue.cpp

示例6: MapSet

//
// CHudSA::InitComponentList
//
void CHudSA::InitComponentList ( void )
{
    SHudComponent componentList[] = {
                { 1, HUD_AMMO, 1, FUNC_DrawAmmo, 1, 0xCC, 0xC3 },
                { 1, HUD_WEAPON, 1, FUNC_DrawWeaponIcon, 1, 0xCC, 0xC3 },
                { 1, HUD_HEALTH, 1, FUNC_PrintHealthForPlayer, 1, 0xCC, 0xC3 },
                { 1, HUD_BREATH, 1, FUNC_PrintBreathForPlayer, 1, 0xCC, 0xC3 },
                { 1, HUD_ARMOUR, 1, FUNC_PrintArmourForPlayer, 1, 0xCC, 0xC3 },
                { 1, HUD_MONEY, 1, CODE_ShowMoney, 2, 0xCCCC, 0xE990 },
                { 1, HUD_VEHICLE_NAME, 1, FUNC_DrawVehicleName, 1, 0xCC, 0xC3 },
                { 1, HUD_AREA_NAME, 1, FUNC_DrawAreaName, 1, 0xCC, 0xC3 },
                { 1, HUD_RADAR, 1, FUNC_DrawRadar, 1, 0xCC, 0xC3 },
                { 1, HUD_CLOCK, 0, VAR_DisableClock, 1, 1, 0 },
                { 1, HUD_RADIO, 1, FUNC_DrawRadioName, 1, 0xCC, 0xC3 },
                { 1, HUD_WANTED, 1, FUNC_DrawWantedLevel, 1, 0xCC, 0xC3 },
                { 1, HUD_CROSSHAIR, 1, FUNC_DrawCrosshair, 1, 0xCC, 0xC3 },
                { 1, HUD_VITAL_STATS, 1, FUNC_DrawVitalStats, 1, 0xCC, 0xC3 },
                { 0, HUD_HELP_TEXT, 1, FUNC_DrawHelpText, 1, 0xCC, 0xC3 },
            };

    for ( uint i = 0 ; i < NUMELMS( componentList ) ; i++ )
    {
        const SHudComponent& component = componentList[i]; 
        MapSet ( m_HudComponentMap, component.type, component );
    }
}
开发者ID:0x688,项目名称:gtasa_crashfix,代码行数:29,代码来源:CHudSA.cpp

示例7: ClearReadCache

bool CAccessControlListManager::CanObjectUseRight ( const char* szObjectName,
                                                    CAccessControlListGroupObject::EObjectType eObjectType,
                                                    const char* szRightName,
                                                    CAccessControlListRight::ERightType eRightType,
                                                    bool bDefaultAccessRight )
{
    // Clear cache if required
    if ( m_bReadCacheDirty )
        ClearReadCache ();

    // If object is resource, try cache
    if ( eObjectType == CAccessControlListGroupObject::OBJECT_TYPE_RESOURCE )
    {
        // Make unique key for this query
        SString strKey ( "%s %s %d %d", szObjectName, szRightName, eRightType, bDefaultAccessRight );
        // Check if this query has been done before
        bool* pResult = MapFind( m_ReadCacheMap, strKey );
        if ( !pResult )
        {
            // If not, do query now and add result to the cache
            bool bResult = InternalCanObjectUseRight ( szObjectName, eObjectType, szRightName, eRightType, bDefaultAccessRight );
            MapSet ( m_ReadCacheMap, strKey, bResult );
            pResult = MapFind( m_ReadCacheMap, strKey );
        }
        // Return cached result
        return *pResult;
    }
    return InternalCanObjectUseRight ( szObjectName, eObjectType, szRightName, eRightType, bDefaultAccessRight );
}
开发者ID:pombredanne,项目名称:openvice,代码行数:29,代码来源:CAccessControlListManager.cpp

示例8: dassert

void CPlayer::MovePlayerToFarList ( CPlayer* pOther )
{
    dassert ( MapContains ( m_NearPlayerList, pOther ) && !MapContains ( m_FarPlayerList, pOther ) );
    SNearInfo* pInfo = MapFind ( m_NearPlayerList, pOther );
    MapSet ( m_FarPlayerList, pOther, *pInfo );
    MapRemove ( m_NearPlayerList, pOther );
}
开发者ID:qaisjp,项目名称:green-candy,代码行数:7,代码来源:CPlayer.cpp

示例9: LokInsert

void LokInsert(LokStruct *Data, LokInfo *Lok)
{  char *Name;
   LokInfo *OldLok;

   Name = LokInfoGetName(Lok);
   if (strlen(Name) > 0)
   {
      OldLok = (LokInfo *)MapGet(LokGetLokDb(Data), (MapKeyType)Name);
      if (OldLok != (LokInfo *)NULL)
      {
         if (!LokIsEqual(OldLok, Lok))
         {
            LokSetIsChanged(Data, TRUE);
            memcpy(OldLok, Lok, sizeof(LokInfo));
         }
         LokInfoSetIsDeleted(OldLok, FALSE);
      }
      else
      {
         OldLok = (LokInfo *)malloc(sizeof(LokInfo));
         if (OldLok != (LokInfo *)NULL)
         {
            LokSetIsChanged(Data, TRUE);
            memcpy(OldLok, Lok, sizeof(LokInfo));
            LokInfoSetIsDeleted(OldLok, FALSE);
            MapSet(LokGetLokDb(Data),
                   (MapKeyType)LokInfoGetName(OldLok),
                   (MapDataType)OldLok);
            LokSetNumLoks(Data, LokGetNumLoks(Data) + 1);
         }
      }
   }
}
开发者ID:GBert,项目名称:railroad,代码行数:33,代码来源:lok.c

示例10: strKey

//
// CFunctionUseLogger::OnFunctionUse
//
void CFunctionUseLogger::OnFunctionUse( lua_State* luaVM, const char* szFunctionName, const char* szArgs, uint uiArgsSize )
{
    if ( m_strLogFilename.empty() )
        return;

    CResource* pResource = g_pGame->GetResourceManager()->GetResourceFromLuaState( luaVM );
    SString strResourceName = pResource ? pResource->GetName() : "Unknown";

    SString strKey( "%s-%s", szFunctionName, *strResourceName );

    SFuncCallRecord* pItem = MapFind( m_FuncCallRecordMap, strKey );
    if ( !pItem )
    {
        // Create new entry for this resource/function combo
        MapSet( m_FuncCallRecordMap, strKey, SFuncCallRecord() );
        pItem = MapFind( m_FuncCallRecordMap, strKey );
        pItem->strFunctionName = szFunctionName;
        pItem->strResourceName = strResourceName;
        pItem->uiCallCount = 0;
        pItem->timeFirstUsed = CTickCount::Now();
    }
    pItem->uiCallCount++;

    if ( pItem->strExampleArgs.empty() )
        pItem->strExampleArgs = SStringX( szArgs ).Left( 40 );
}
开发者ID:pombredanne,项目名称:openvice,代码行数:29,代码来源:CFunctionUseLogger.cpp

示例11: switch

/////////////////////////////////////////////////////////////
//
// CProxyDirect3DVertexDeclaration::CProxyDirect3DVertexDeclaration
//
//
//
/////////////////////////////////////////////////////////////
CProxyDirect3DVertexDeclaration::CProxyDirect3DVertexDeclaration ( IDirect3DDevice9* InD3DDevice9,IDirect3DVertexDeclaration9* pOriginal, CONST D3DVERTEXELEMENT9* pVertexElements )
{
	m_pOriginal = pOriginal;

    CProxyDirect3DDevice9::SD3DVertexDeclState info;

    // Calc and cache info
    for ( uint i = 0 ; i < MAXD3DDECLLENGTH ; i++ )
    {
        const D3DVERTEXELEMENT9& element = pVertexElements[ i ];
        if ( element.Stream == 0xFF )
            break;

        switch ( element.Stream)
        {
            case 0:        info.bUsesStreamAtIndex[0] = true;  break;
            case 1:        info.bUsesStreamAtIndex[1] = true;  break;
        }

        switch ( element.Usage + element.UsageIndex * 16 )
        {
            case D3DDECLUSAGE_POSITION:         info.Position = 1;   break;
            case D3DDECLUSAGE_POSITIONT:        info.PositionT = 1;  break;
            case D3DDECLUSAGE_NORMAL:           info.Normal = 1;     break;
            case D3DDECLUSAGE_COLOR:            info.Color0 = 1;     break;
            case D3DDECLUSAGE_COLOR + 16:       info.Color1 = 1;     break;
            case D3DDECLUSAGE_TEXCOORD:         info.TexCoord0 = 1;  break;
            case D3DDECLUSAGE_TEXCOORD + 16:    info.TexCoord1 = 1;  break;
        }
    }

    // Add to cached info map
    MapSet ( g_pProxyDevice->m_VertexDeclMap, this, info );
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:41,代码来源:CProxyDirect3DVertexDeclaration.cpp

示例12: RemoveData

// Return true if data was changed
bool CAccount::SetData(const std::string& strKey, const std::string& strValue, int iType)
{
    if (strValue == "false" && iType == LUA_TBOOLEAN)
    {
        if (HasData(strKey))
        {
            RemoveData(strKey);
            return true;
        }
    }
    else
    {
        CAccountData* pData = GetDataPointer(strKey);

        if (pData)
        {
            if (pData->GetType() != iType || pData->GetStrValue() != strValue)
            {
                pData->SetStrValue(strValue);
                pData->SetType(iType);
                return true;
            }
        }
        else
        {
            MapSet(m_Data, strKey, CAccountData(strKey, strValue, iType));
            return true;
        }
    }
    return false;
}
开发者ID:Audifire,项目名称:mtasa-blue,代码行数:32,代码来源:CAccount.cpp

示例13: GleisbildInsert

void GleisbildInsert(GleisbildStruct *Data, GleisbildInfo *Gleisbild)
{  int Id;
   GleisbildInfo *OldGleisbild;

   Id = GleisbildInfoGetId(Gleisbild);
   OldGleisbild = (GleisbildInfo *)MapGet(GleisbildGetGleisbildDb(Data),
                                          (MapKeyType)Id);
   if (OldGleisbild != (GleisbildInfo *)NULL)
   {
      GleisbildInfoSetId(OldGleisbild, GleisbildInfoGetId(Gleisbild));
      GleisbildInfoSetName(OldGleisbild, GleisbildInfoGetName(Gleisbild));
      GleisbildInfoSetZustand(OldGleisbild, GleisbildInfoGetZustand(Gleisbild));
   }
   else
   {
      OldGleisbild = (GleisbildInfo *)malloc(sizeof(GleisbildInfo));
      if (OldGleisbild != (GleisbildInfo *)NULL)
      {
         GleisbildInfoSetId(OldGleisbild, GleisbildInfoGetId(Gleisbild));
         GleisbildInfoSetName(OldGleisbild, GleisbildInfoGetName(Gleisbild));
         GleisbildInfoSetZustand(OldGleisbild,
	                         GleisbildInfoGetZustand(Gleisbild));
         MapSet(GleisbildGetGleisbildDb(Data),
                (MapKeyType)Id, (MapDataType)OldGleisbild);
      }
   }
}
开发者ID:GBert,项目名称:railroad,代码行数:27,代码来源:gleisbild.c

示例14: PathJoin

///////////////////////////////////////////////////////////////
//
// CServerIdManagerImpl::LoadServerIdMap
//
// Load server id data from xml file
//
///////////////////////////////////////////////////////////////
bool CServerIdManagerImpl::LoadServerIdMap ( void )
{
    // Load config XML file
    CXMLFile* pConfigFile = g_pCore->GetXML ()->CreateXML ( PathJoin ( g_pClientGame->GetFileCacheRoot(), MTA_SERVERID_LOOKUP_XML ) );
    if ( !pConfigFile )
        return false;
    pConfigFile->Parse ();

    CXMLNode* pRoot = pConfigFile->GetRootNode ();
    if ( !pRoot )
        pRoot = pConfigFile->CreateRootNode ( "root" );

    m_ServerIdMap.clear ();

    // Read each node
    for ( uint i = 0 ; i < pRoot->GetSubNodeCount () ; i++ )
    {
        CXMLNode* pSubNode = pRoot->GetSubNode ( i );

        CServerIdKey key;
        CServerIdInfo info;
        key.strId = pSubNode->GetTagContent ();
        if ( CXMLAttribute* pAttribute = pSubNode->GetAttributes().Find ( "dir" ) )
            info.strDir = pAttribute->GetValue ();

        if ( !info.strDir.empty () )
            MapSet ( m_ServerIdMap, key, info );
    }

    // Maybe one day remove unwanted directories

    delete pConfigFile;
    return true;
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:41,代码来源:CServerIdManager.cpp

示例15: luaM_toref

// Custom Lua stack argument->reference function
CLuaFunctionRef luaM_toref ( lua_State *luaVM, int iArgument )
{
    CLuaMain* pLuaMain = g_pGame->GetLuaManager ()->GetVirtualMachine ( luaVM );
    assert ( pLuaMain );

    const void* pFuncPtr = lua_topointer ( luaVM, iArgument );

    if ( CRefInfo* pInfo = MapFind ( pLuaMain->m_CallbackTable, pFuncPtr ) )
    {
        // Re-use the lua ref we already have to this function
        pInfo->ulUseCount++;
        return CLuaFunctionRef ( luaVM, pInfo->iFunction, pFuncPtr );
    }
    else
    {
        // Get a lua ref to this function
        lua_settop ( luaVM, iArgument );
        int ref = lua_ref ( luaVM, 1 );

        // Save ref info
        CRefInfo info;
        info.ulUseCount = 1;
        info.iFunction = ref;
        MapSet ( pLuaMain->m_CallbackTable, pFuncPtr, info );

        return CLuaFunctionRef ( luaVM, ref, pFuncPtr );
    }
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:29,代码来源:CLuaFunctionRef.cpp


注:本文中的MapSet函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。