]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/TypeDescription.cpp
initialize objects after loading
[l2e.git] / src / loader / TypeDescription.cpp
index f7c849be71a56ae9ecb45bf0de2c078dca37bcf2..bd63d70137b5f0a27c2f6939a6bc14e11d05d692 100644 (file)
@@ -1,10 +1,3 @@
-/*
- * TypeDescription.cpp
- *
- *  Created on: Sep 4, 2012
- *      Author: holy
- */
-
 #include "TypeDescription.h"
 
 #include <algorithm>
@@ -53,6 +46,12 @@ void TypeDescription::Construct(void *data) const {
        }
 }
 
+void TypeDescription::Init(void *data) const {
+       if (initializer) {
+               (*initializer)(data);
+       }
+}
+
 void TypeDescription::Load(void *data) const {
        if (loader) {
                (*loader)(data);
@@ -114,6 +113,20 @@ const TypeDescription &TypeDescription::Get(int id) {
 }
 
 
+int TypeDescription::GetMaxSize() {
+       int max = 0;
+       for (map<int, TypeDescription>::const_iterator
+                       i(typeDescriptions.begin()),
+                       end(typeDescriptions.end());
+                       i != end; ++i) {
+               if (i->second.Size() > max) {
+                       max = i->second.Size();
+               }
+       }
+       return max;
+}
+
+
 void TypeDescription::WriteSourceWiki(std::ostream &out) {
        vector<string> types;
        for (map<int, TypeDescription>::const_iterator i(typeDescriptions.begin()), end(typeDescriptions.end()); i != end; ++i) {