Changeset 3661


Ignore:
Timestamp:
06/01/11 04:43:27 (3 years ago)
Author:
vtchill
Message:

Removed the need to add the map file directory to the VFS as a source to search. Instead the loader now prepends the map file directory to any import being loaded from the map file since the map saver stores the filename relative to the map file directory. The saver could be changed in the future to not save relative to map file if needed. The AnimationLoader? constructor no longer takes the map file path as it was not being used at all by the class. [t:491]

Location:
branches/active/0.3.3dev/engine/core/loaders/native/map
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/active/0.3.3dev/engine/core/loaders/native/map/animationloader.cpp

    r3660 r3661  
    4747    static Logger _log(LM_NATIVE_LOADERS); 
    4848 
    49     AnimationLoader::AnimationLoader(VFS* vfs, ImageManager* imageManager, const std::string& mapDirectory) 
    50     : m_vfs(vfs), m_imageManager(imageManager), m_mapDirectory(mapDirectory) { 
     49    AnimationLoader::AnimationLoader(VFS* vfs, ImageManager* imageManager) 
     50    : m_vfs(vfs), m_imageManager(imageManager) { 
    5151 
    5252    } 
  • branches/active/0.3.3dev/engine/core/loaders/native/map/animationloader.h

    r3660 r3661  
    4242    class AnimationLoader : public IAnimationLoader { 
    4343    public: 
    44         AnimationLoader(VFS* vfs, ImageManager* imageManager, const std::string& mapDirectory); 
     44        AnimationLoader(VFS* vfs, ImageManager* imageManager); 
    4545 
    4646        /**  
     
    5757        VFS* m_vfs; 
    5858        ImageManager* m_imageManager; 
    59         std::string m_mapDirectory; 
    6059    }; 
    6160} 
  • branches/active/0.3.3dev/engine/core/loaders/native/map/maploader.cpp

    r3660 r3661  
    8686 
    8787                // create a new animation loader 
    88                 m_animationLoader.reset(new AnimationLoader(m_vfs, m_imageManager, m_mapDirectory)); 
    89  
    90                             m_vfs->addSource(new VFSDirectory(m_vfs, mapPath.branch_path().directory_string())); 
     88                m_animationLoader.reset(new AnimationLoader(m_vfs, m_imageManager)); 
    9189            } 
    9290                } 
     
    171169 
    172170                        if (importDir && !importFile) { 
    173                             loadImportDirectory(directory); 
     171                            fs::path fullPath(m_mapDirectory); 
     172                            fullPath /= directory; 
     173                            loadImportDirectory(fullPath.directory_string()); 
    174174                        } 
    175175                        else if (importFile) { 
    176                             loadImportFile(file, directory); 
     176                            fs::path fullFilePath(file); 
     177                            fs::path fullDirPath(directory); 
     178                            if (importDir) { 
     179                                fullDirPath = fs::path(m_mapDirectory); 
     180                                fullDirPath /= directory; 
     181                            } 
     182                            else { 
     183                                fullFilePath = fs::path(m_mapDirectory); 
     184                                fullFilePath /= file; 
     185                            } 
     186                            loadImportFile(fullFilePath.file_string(), fullDirPath.directory_string()); 
    177187                        } 
    178188                                        } 
Note: See TracChangeset for help on using the changeset viewer.