Example #1
0
///////////////////////////////////////////////////////////////
//
// CResourceChecker::GetLuaFunctionNameUpgradeInfo
//
//
//
///////////////////////////////////////////////////////////////
ECheckerWhatType CResourceChecker::GetLuaFunctionNameUpgradeInfo ( const string& strFunctionName, bool bClientScript, string& strOutHow, string& strOutVersion )
{
    static CHashMap < SString, SDeprecatedItem* > clientUpgradeInfoMap;
    static CHashMap < SString, SDeprecatedItem* > serverUpgradeInfoMap;

    if ( clientUpgradeInfoMap.size () == 0 )
    {
        // Make maps to speed things up
        for ( uint i = 0 ; i < NUMELMS( clientDeprecatedList ) ; i++ )
            clientUpgradeInfoMap[ clientDeprecatedList[i].strOldName ] = &clientDeprecatedList[i];

        for ( uint i = 0 ; i < NUMELMS( serverDeprecatedList ) ; i++ )
            serverUpgradeInfoMap[ serverDeprecatedList[i].strOldName ] = &serverDeprecatedList[i];
    }

    // Query the correct map
    SDeprecatedItem* pItem = MapFindRef ( bClientScript ? clientUpgradeInfoMap : serverUpgradeInfoMap, strFunctionName );
    if ( !pItem )
        return ECheckerWhat::NONE;     // Nothing found

    strOutHow = pItem->strNewName;
    strOutVersion = pItem->strVersion;
    if (!strOutVersion.empty())
    {
        // Function behaviour depends on min_mta_version setting
        const SString& strMinReqFromMetaXml = bClientScript ? m_strMinClientReqFromMetaXml : m_strMinServerReqFromMetaXml;
        if (strMinReqFromMetaXml < strOutVersion)
            return ECheckerWhat::MODIFIED;
        return ECheckerWhat::NONE;
    }
    return pItem->bRemoved ? ECheckerWhat::REMOVED : ECheckerWhat::REPLACED;
}
Example #2
0
///////////////////////////////////////////////////////////////
//
// CResourceChecker::GetLuaFunctionNameUpgradeInfo
//
//
//
///////////////////////////////////////////////////////////////
ECheckerWhatType CResourceChecker::GetLuaFunctionNameUpgradeInfo ( const string& strFunctionName, bool bClientScript, string& strOutHow )
{
    static CHashMap < SString, SDeprecatedItem* > clientUpgradeInfoMap;
    static CHashMap < SString, SDeprecatedItem* > serverUpgradeInfoMap;

    if ( clientUpgradeInfoMap.size () == 0 )
    {
        // Make maps to speed things up
        for ( uint i = 0 ; i < NUMELMS( clientDeprecatedList ) ; i++ )
            clientUpgradeInfoMap[ clientDeprecatedList[i].strOldName ] = &clientDeprecatedList[i];

        for ( uint i = 0 ; i < NUMELMS( serverDeprecatedList ) ; i++ )
            serverUpgradeInfoMap[ serverDeprecatedList[i].strOldName ] = &serverDeprecatedList[i];
    }

    // Query the correct map
    SDeprecatedItem* pItem = MapFindRef ( bClientScript ? clientUpgradeInfoMap : serverUpgradeInfoMap, strFunctionName );
    if ( !pItem )
        return ECheckerWhat::NONE;     // Nothing found

    strOutHow = pItem->strNewName;
    return pItem->bRemoved ? ECheckerWhat::REMOVED : ECheckerWhat::REPLACED;
}