]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/TypeDescription.cpp
new object file format in compiler
[l2e.git] / src / loader / TypeDescription.cpp
index c6e5d7e876498bf5a7c0aae6713ce148f956dfaf..1bb6c6505309117000822b92135c616cfb1d92a3 100644 (file)
@@ -23,6 +23,9 @@ void TypeDescription::AddField(const std::string &n, const FieldDescription &f)
        } else {
                fields.insert(std::make_pair(n, f));
        }
+       if (f.IsReferenced() || f.IsAggregate()) {
+               link = true;
+       }
 }
 
 bool TypeDescription::HasField(const std::string &name) const {
@@ -107,6 +110,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) {