]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/Loader.cpp
non-reference type array relocation
[l2e.git] / src / loader / Loader.cpp
index 9c8739aabee00191584852973971f203fc8afa5e..1e0050dbc022a64c1d7896428caad0b152dac2f0 100644 (file)
@@ -120,13 +120,18 @@ void Loader::LoadObject(char *src, char *object, const TypeDescription &td) {
 
 void Loader::LoadArrays(char *src, Array *begin, Array *end) {
        for (Array *i = begin; i < end; i = i->Next()) {
-               if (!i->ref) {
-                       continue;
-               }
-               for (char *j = i->Data(), *end = i->Data() + i->size;
-                               j < end; j += sizeof(void *)) {
-                       *reinterpret_cast<char **>(j) =
-                                       src + *reinterpret_cast<unsigned int *>(j);
+               if (i->ref) {
+                       for (char *j = i->Data(), *end = i->Data() + i->size;
+                                       j < end; j += sizeof(void *)) {
+                               *reinterpret_cast<char **>(j) =
+                                               src + *reinterpret_cast<unsigned int *>(j);
+                       }
+               } else {
+                       const TypeDescription &td = TypeDescription::Get(i->typeId);
+                       for (char *j = i->Data(), *end = i->Data() + i->size;
+                                       j < end; j += td.Size()) {
+                               LoadObject(src, j, td);
+                       }
                }
        }
 }