GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


A Paste by Anonymous
1
 
CResource* CResourceMgr::getResource( std::string name ) {
    // Check if resource already exists
    if( m_ResourceList.find( name ) != m_ResourceList.end() )
        return m_Resource[name];

    // Resource not loaded, so load it
    CResource* tempRes = new CResource;

    // Search preset directoriess for file
    if( m_SearchDirs.size() ) {
        std::vector<std::string>::iterator it = m_SearchDirs.begin();
        for( ; it != m_SearchDirs.end(); ++it) {
            if( tempRes->load( *it, name ) )
                return tempRes[name];
        }
    }
    // No preset search directories, so search current
    else {
        return tempRes->load( "", name );
    }
    // How the f could code get here?
    return 0;
}