| 178 | // Load extensions to the template (usually coming from other mods) |
| 179 | VfsPaths fileNames; |
| 180 | |
| 181 | if (vfs::GetPathnames(g_VFS, VfsPath(TEMPLATE_ROOT), wstring_from_utf8(templateName + ".EXTENDS.*.xml").c_str(), fileNames) != INFO::OK) |
| 182 | return true; // No extensions found -> use regular data |
| 183 | |
| 184 | for (const VfsPath& fileName : fileNames) |
| 185 | { |
| 186 | CXeromyces xero; |
| 187 | PSRETURN ok = xero.Load(g_VFS, fileName); |
| 188 | if (ok != PSRETURN_OK) |
| 189 | return false; // (Xeromyces already logged an error with the full filename) |
| 190 | CStr parentName = xero.GetRoot().GetAttributes().GetNamedItem(attr_parent); |
| 191 | if (!parentName.empty()) |
| 192 | { |
| 193 | LOGERROR("Failed to load %s. Extended templates can't redefine template parents.", fileName.string().c_str()); |
| 194 | return false; |
| 195 | } |
| 196 | CParamNode::LoadXML(m_TemplateFileData[templateName], xero, fileName.string().c_str()); |
| 197 | } |
| 198 | |