Changeset View
Changeset View
Standalone View
Standalone View
source/ps/TemplateLoader.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | if (pos != std::string::npos) | ||||
CXeromyces xero; | CXeromyces xero; | ||||
PSRETURN ok = xero.Load(g_VFS, path); | PSRETURN ok = xero.Load(g_VFS, path); | ||||
if (ok != PSRETURN_OK) | if (ok != PSRETURN_OK) | ||||
return false; // (Xeromyces already logged an error with the full filename) | return false; // (Xeromyces already logged an error with the full filename) | ||||
m_TemplateFileData[templateName] = m_TemplateFileData[baseName]; | m_TemplateFileData[templateName] = m_TemplateFileData[baseName]; | ||||
CParamNode::LoadXML(m_TemplateFileData[templateName], xero, path.string().c_str()); | CParamNode::LoadXML(m_TemplateFileData[templateName], xero, path.string().c_str()); | ||||
// TODO only temporary hack, for test purposes | |||||
// Initialise Max health to the initial health of base entity (useful for foundation) | |||||
if (prefix == "foundation" && | |||||
m_TemplateFileData[baseName].GetChild("Entity").GetChild("Health").GetChild("Initial").IsOk()) | |||||
CParamNode::LoadXMLString(m_TemplateFileData[templateName], ("<Entity><Health><Max>"+utf8_from_wstring(m_TemplateFileData[baseName].GetChild("Entity").GetChild("Health").GetChild("Initial").ToString())+"</Max></Health></Entity>").c_str()); | |||||
return true; | return true; | ||||
} | } | ||||
// Normal case: templateName is an XML file: | // Normal case: templateName is an XML file: | ||||
VfsPath path = VfsPath(TEMPLATE_ROOT) / wstring_from_utf8(templateName + ".xml"); | VfsPath path = VfsPath(TEMPLATE_ROOT) / wstring_from_utf8(templateName + ".xml"); | ||||
CXeromyces xero; | CXeromyces xero; | ||||
PSRETURN ok = xero.Load(g_VFS, path); | PSRETURN ok = xero.Load(g_VFS, path); | ||||
▲ Show 20 Lines • Show All 204 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator