diff options
author | Johannes Schickel | 2006-10-08 18:22:28 +0000 |
---|---|---|
committer | Johannes Schickel | 2006-10-08 18:22:28 +0000 |
commit | 3a81941981a6ca5fab229ff9aeb6b05b94a444bc (patch) | |
tree | 66499d32b6889b6645f97597e4d63c5cc8cde3d7 /graphics | |
parent | 4524b49872b238db92922dbe961a8f1aa8430178 (diff) | |
download | scummvm-rg350-3a81941981a6ca5fab229ff9aeb6b05b94a444bc.tar.gz scummvm-rg350-3a81941981a6ca5fab229ff9aeb6b05b94a444bc.tar.bz2 scummvm-rg350-3a81941981a6ca5fab229ff9aeb6b05b94a444bc.zip |
- Added dialog for selecting the theme to use
- Added runtime theme switching
svn-id: r24213
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/imageman.cpp | 29 | ||||
-rw-r--r-- | graphics/imageman.h | 18 |
2 files changed, 37 insertions, 10 deletions
diff --git a/graphics/imageman.cpp b/graphics/imageman.cpp index 6139159c56..d4fc9da72d 100644 --- a/graphics/imageman.cpp +++ b/graphics/imageman.cpp @@ -43,7 +43,7 @@ ImageManager::~ImageManager() { _surfaces.clear(); #ifdef USE_ZLIB for (ZipIterator pos2 = _archives.begin(); pos2 != _archives.end(); ++pos2) { - unzClose(*pos2); + unzClose(pos2->file); } _archives.clear(); #endif @@ -54,11 +54,26 @@ bool ImageManager::addArchive(const Common::String &name) { unzFile newFile = unzOpen(name.c_str()); if (!newFile) return false; - _archives.push_back(newFile); + Archive arch; + arch.file = newFile; + arch.filename = name; + _archives.push_back(arch); #endif return true; } +void ImageManager::remArchive(const Common::String &name) { +#ifdef USE_ZLIB + for (ZipIterator pos = _archives.begin(); pos != _archives.end(); ++pos) { + if (pos->filename.compareToIgnoreCase(name) == 0) { + unzClose(pos->file); + _archives.erase(pos); + break; + } + } +#endif +} + bool ImageManager::registerSurface(const Common::String &name, Surface *surf) { if (getSurface(name)) { return false; @@ -74,7 +89,7 @@ bool ImageManager::registerSurface(const Common::String &name, Surface *surf) { #ifdef USE_ZLIB ZipIterator file = _archives.end(); for (ZipIterator pos = _archives.begin(); pos != _archives.end(); ++pos) { - if (unzLocateFile(*pos, name.c_str(), 2) == UNZ_OK) { + if (unzLocateFile(pos->file, name.c_str(), 2) == UNZ_OK) { file = pos; break; } @@ -84,12 +99,12 @@ bool ImageManager::registerSurface(const Common::String &name, Surface *surf) { return false; unz_file_info fileInfo; - unzOpenCurrentFile(*file); - unzGetCurrentFileInfo(*file, &fileInfo, NULL, 0, NULL, 0, NULL, 0); + unzOpenCurrentFile(file->file); + unzGetCurrentFileInfo(file->file, &fileInfo, NULL, 0, NULL, 0, NULL, 0); uint8 *buffer = new uint8[fileInfo.uncompressed_size]; assert(buffer); - unzReadCurrentFile(*file, buffer, fileInfo.uncompressed_size); - unzCloseCurrentFile(*file); + unzReadCurrentFile(file->file, buffer, fileInfo.uncompressed_size); + unzCloseCurrentFile(file->file); Common::MemoryReadStream stream(buffer, fileInfo.uncompressed_size); surf = ImageDecoder::loadFile(stream); delete [] buffer; diff --git a/graphics/imageman.h b/graphics/imageman.h index 6f682c1646..a5fe8f131d 100644 --- a/graphics/imageman.h +++ b/graphics/imageman.h @@ -37,7 +37,7 @@ public: ~ImageManager(); /** - * adds an .zip archive to the pool there the ImagaManager searches + * adds an .zip archive to the pool where the ImageManager searches * for image files * * @param name the name of the archive @@ -45,6 +45,14 @@ public: */ bool addArchive(const Common::String &name); + /** + * deletes an .zip archive from the pool where the Image Manager searches + * for image files + * + * @param name the name of the archive + */ + void remArchive(const Common::String &name); + /** * registers a surface to the ImageManager. * surf->free(), also delete surf, will be called when the ImageManager will @@ -84,14 +92,18 @@ private: }; typedef Common::List<Entry*>::iterator Iterator; #ifdef USE_ZLIB - typedef Common::List<unzFile>::iterator ZipIterator; + struct Archive { + unzFile file; + Common::String filename; + }; + typedef Common::List<Archive>::iterator ZipIterator; #endif Iterator searchHandle(const Common::String &name); Common::List<Entry*> _surfaces; #ifdef USE_ZLIB - Common::List<unzFile> _archives; + Common::List<Archive> _archives; #endif }; |