MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / LoadGroupDescriptionFromXML

Function LoadGroupDescriptionFromXML

Source/Game/EntityDescription.cpp:824–872  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

822}
823
824void LoadGroupDescriptionFromXML(EntityDescription& desc, const TiXmlElement* el) {
825 desc.AddEntityType(EDF_ENTITY_TYPE, _group);
826 const char* ename = el->Attribute("name");
827 if (ename) {
828 desc.AddString(EDF_NAME, ename);
829 }
830 GetTSRIinfo(desc, el);
831
832 int ival;
833 int using_imposter = 0;
834 if (el->QueryIntAttribute("uses_imposter", &ival) == TIXML_SUCCESS) {
835 using_imposter = ival != 0;
836 }
837 desc.AddInt(EDF_USING_IMPOSTER, using_imposter);
838
839 if (el->QueryIntAttribute("version", &ival) == TIXML_SUCCESS) {
840 desc.AddInt(EDF_VERSION, ival);
841 }
842
843 vec3 dims;
844 char name[3];
845 double dval;
846 for (int i = 0; i < 3; i++) {
847 name[0] = 'd';
848 name[1] = '0' + i;
849 name[2] = '\0';
850 if (el->QueryDoubleAttribute(name, &dval) == TIXML_SUCCESS) {
851 dims[i] = (float)dval;
852 } else {
853 dims[i] = 1;
854 }
855 }
856 desc.AddVec3(EDF_DIMENSIONS, dims);
857
858 vec3 color;
859 for (int i = 0; i < 3; i++) {
860 name[0] = 'c';
861 name[1] = '0' + i;
862 name[2] = '\0';
863 if (el->QueryDoubleAttribute(name, &dval) == TIXML_SUCCESS) {
864 color[i] = (float)dval;
865 } else {
866 color[i] = 0;
867 }
868 }
869 desc.AddVec3(EDF_COLOR, color);
870
871 LoadEntityDescriptionListFromXML(desc.children, el);
872}
873
874void LoadPrefabDescriptionFromXML(EntityDescription& desc, const TiXmlElement* el) {
875 desc.AddEntityType(EDF_ENTITY_TYPE, _prefab);

Callers 1

Calls 9

GetTSRIinfoFunction · 0.85
AddEntityTypeMethod · 0.80
QueryIntAttributeMethod · 0.80
AddIntMethod · 0.80
QueryDoubleAttributeMethod · 0.80
AddVec3Method · 0.80
AttributeMethod · 0.45
AddStringMethod · 0.45

Tested by

no test coverage detected