Added ComponentInfo::FieldsInOrder to be able to loop through component fields in a consistent order based on the component XSD definition

This commit is contained in:
2016-01-11 14:56:53 +01:00
parent 21aea6f31d
commit 4a516a4d86
2 changed files with 6 additions and 3 deletions
+1
View File
@@ -21,6 +21,7 @@ struct ComponentInfo
std::string Name;
std::unordered_map<std::string, Field_t> Fields;
std::vector<const Field_t*> FieldsInOrder;
Meta_t Meta;
std::shared_ptr<char> Defaults = nullptr;
};
+5 -3
View File
@@ -143,9 +143,11 @@ void EntityFilePreprocessor::parseComponentInfo()
continue;
}
compInfo.Fields[name].Type = type;
compInfo.Fields[name].Offset = fieldOffset;
compInfo.Fields[name].Stride = stride;
auto& field = compInfo.Fields[name];
field.Type = type;
field.Offset = fieldOffset;
field.Stride = stride;
compInfo.FieldsInOrder.push_back(&field);
fieldOffset += stride;
}