+void Loader::LoadImages(char *src, Image *begin, Image *end) {
+ for (Image *i = begin; i != end; ++i) {
+ const string path(src + i->pathOffset);
+ SDL_Surface **dest = reinterpret_cast<SDL_Surface **>(src + i->destOffset);
+ std::map<string, SDL_Surface *>::const_iterator
+ found(images.find(path));
+ if (found != images.end()) {
+ *dest = found->second;
+ } else {
+ SDL_Surface *loaded = IMG_Load(path.c_str());
+ images.insert(make_pair(path, loaded));
+ *dest = loaded;
+ }
+ }
+}
+