]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/Interpreter.cpp
initialize objects after loading
[l2e.git] / src / loader / Interpreter.cpp
index fc428cd8365e998ea37128ef23adf2ede9dbb716..ecbb076224e225bad82cd92017c4db9d5caa33fc 100644 (file)
@@ -332,6 +332,7 @@ void Interpreter::ReadObject(int typeId, int id, char *object, const PropertyLis
                                int arraySize(i->second->GetLiteral().ArraySize());
                                size_t memberSize = fd.IsReferenced() ? sizeof(char *) : fieldType.Size();
                                Array array;
+                               array.typeId = fd.TypeId();
                                array.size = arraySize * memberSize;
                                array.data = alloc.Alloc(array.size);
                                array.ref = fd.IsReferenced();
@@ -905,6 +906,17 @@ SDL_Surface *Interpreter::GetImage(const string &path) {
        }
 }
 
+const string &Interpreter::FindImage(SDL_Surface *img) const {
+       for (std::map<string, SDL_Surface *>::const_iterator
+                       i(imageCache.begin()), end(imageCache.end());
+                       i != end; ++i) {
+               if (i->second == img) {
+                       return i->first;
+               }
+       }
+       throw Error("unable to locate image");
+}
+
 
 bool Interpreter::CanLink(const Value &v) const {
        return v.IsLiteral() || source.IsDefined(v.GetIdentifier());