[Scummvm-cvs-logs] SF.net SVN: scummvm: [20900] residual/trunk/resource.cpp
marcus_c at users.sourceforge.net
marcus_c at users.sourceforge.net
Sat Feb 25 15:02:05 CET 2006
Revision: 20900
Author: marcus_c
Date: 2006-02-25 15:00:09 -0800 (Sat, 25 Feb 2006)
ViewCVS: http://svn.sourceforge.net/scummvm?rev=20900&view=rev
Log Message:
-----------
For caching purposes, append the colormap filename to the filename of
materials. The old scheme of removing the entry from the cache when a
"new" colormap is used did not work well, since derefing the old material
(which was removed from the cache) would cause the new material to be
purged from the cache instead. Hilarity ensues.
Modified Paths:
--------------
residual/trunk/resource.cpp
Modified: residual/trunk/resource.cpp
===================================================================
--- residual/trunk/resource.cpp 2006-02-25 21:43:23 UTC (rev 20899)
+++ residual/trunk/resource.cpp 2006-02-25 23:00:09 UTC (rev 20900)
@@ -254,22 +254,17 @@
}
Material *ResourceLoader::loadMaterial(const char *filename, const CMap &c) {
- std::string fname = filename;
+ std::string fname = std::string(filename) + "@" + c.filename();
makeLower(fname);
CacheType::iterator i = _cache.find(fname);
if (i != _cache.end()) {
- Material *material = dynamic_cast<Material *>(i->second);
-
- // if the colormap has changed then we need to reload the material!
- if (material->_cmap == &c)
- return material;
- _cache.erase(i, i);
+ return dynamic_cast<Material *>(i->second);
}
Block *b = getFileBlock(filename);
if (b == NULL)
error("Could not find material %s\n", filename);
- Material *result = new Material(filename, b->data(), b->len(), c);
+ Material *result = new Material(fname.c_str(), b->data(), b->len(), c);
delete b;
_cache[fname] = result;
return result;
More information about the Scummvm-git-logs
mailing list