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

Function LoadHotspotFromXML

Source/Game/EntityDescription.cpp:1156–1195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1154}
1155
1156void LoadHotspotFromXML(EntityDescription& desc, const TiXmlElement* el) {
1157 desc.AddEntityType(EDF_ENTITY_TYPE, _hotspot_object);
1158 const char* name = el->Attribute("name");
1159 if (name) {
1160 desc.AddString(EDF_NAME, name);
1161 }
1162 std::string type_file = SanitizePath(el->Attribute("type_file"));
1163 desc.AddString(EDF_FILE_PATH, type_file);
1164 GetTSRIinfo(desc, el);
1165
1166 std::vector<int> connection_ids;
1167 const TiXmlElement* connections = el->FirstChildElement("Connections");
1168 if (connections) {
1169 const TiXmlElement* connection = connections->FirstChildElement("Connection");
1170
1171 int id;
1172 while (connection) {
1173 if (connection->QueryIntAttribute("id", &id) == TIXML_SUCCESS) {
1174 connection_ids.push_back(id);
1175 }
1176 connection = connection->NextSiblingElement();
1177 }
1178 }
1179 desc.AddIntVec(EDF_CONNECTIONS, connection_ids);
1180
1181 connection_ids.resize(0);
1182 connections = el->FirstChildElement("ConnectionsFrom");
1183 if (connections) {
1184 const TiXmlElement* connection = connections->FirstChildElement("Connection");
1185
1186 int id;
1187 while (connection) {
1188 if (connection->QueryIntAttribute("id", &id) == TIXML_SUCCESS) {
1189 connection_ids.push_back(id);
1190 }
1191 connection = connection->NextSiblingElement();
1192 }
1193 }
1194 desc.AddIntVec(EDF_CONNECTIONS_FROM, connection_ids);
1195}
1196
1197void LoadEntityDescriptionFromXML(EntityDescription& desc, const TiXmlElement* el) {
1198 const char* type = el->Value();

Callers 1

Calls 11

SanitizePathFunction · 0.85
GetTSRIinfoFunction · 0.85
AddEntityTypeMethod · 0.80
QueryIntAttributeMethod · 0.80
AddIntVecMethod · 0.80
AttributeMethod · 0.45
AddStringMethod · 0.45
FirstChildElementMethod · 0.45
push_backMethod · 0.45
NextSiblingElementMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected