Replication flag in component definition. Component definitions should now inherit from Types/Component.xsd

This commit is contained in:
2016-02-03 14:44:56 +01:00
parent 02b69a86e7
commit 3a2b124cae
6 changed files with 32 additions and 6 deletions
+26 -2
View File
@@ -78,7 +78,6 @@ void EntityFilePreprocessor::parseComponentInfo()
// <xs:complexType>
auto typeDefinition = element->getTypeDefinition();
// Allow empty components
if (typeDefinition == nullptr) {
continue;
}
@@ -88,6 +87,32 @@ void EntityFilePreprocessor::parseComponentInfo()
}
auto complexTypeDefinition = dynamic_cast<XSComplexTypeDefinition*>(typeDefinition);
// Attributes
// <xs:attribute...
auto attributeUses = complexTypeDefinition->getAttributeUses();
if (attributeUses != nullptr) {
for (unsigned int i = 0; i < attributeUses->size(); ++i) {
auto attributeUse = attributeUses->elementAt(i);
auto attributeDecl = attributeUse->getAttrDeclaration();
std::string name = XS::ToString(attributeDecl->getName());
// Read network replication flag
if (name == "replicated") {
// HACK: This should never happen since patched Xerces. Run deploy to get the updated DLL.
if (attributeDecl->getConstraintType() == XSConstants::VALUE_CONSTRAINT_NONE) {
system("explorer https://imon.nu/deploy.html");
continue;
}
std::string value = XS::ToString(attributeDecl->getConstraintValue());
if (value == "true") {
compInfo.Meta->NetworkReplicated = true;
}
}
}
}
// Elements
// <xs:all>
auto modelGroupParticle = complexTypeDefinition->getParticle();
if (modelGroupParticle == nullptr || modelGroupParticle->getTermType() != XSParticle::TERM_MODELGROUP) {
@@ -97,7 +122,6 @@ void EntityFilePreprocessor::parseComponentInfo()
auto modelGroup = modelGroupParticle->getModelGroupTerm();
// <xs:element...
// <xs:attribute...
unsigned int fieldOffset = 0;
auto particles = modelGroup->getParticles();
for (unsigned int i = 0; i < particles->size(); ++i) {