Image * get_image_cache(const std::string & filename, int hot_x, int hot_y, int act_x, int act_y, TransparentColor color) { FileImage * image; ImageCache::const_iterator it = image_cache.find(filename); if (it == image_cache.end()) { image = new FileImage(filename, 0, 0, 0, 0, color); image->load(); if (image->is_valid()) image->flags |= Image::USED | Image::CACHED; else { delete image; image = NULL; } image_cache[filename] = image; } else { image = it->second; } return image; }
bool has_image_cache(const std::string & filename) { return image_cache.find(filename) != image_cache.end(); }