1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-26 08:41:13 +02:00

Random template format change:

Tempaltes now can have optional "name" parameter for different names than identifier.
This commit is contained in:
DjWarmonger 2016-06-06 11:30:51 +02:00
parent 201ed26795
commit cfacd1adc3

View File

@ -39,8 +39,11 @@ void CRmgTemplateStorage::loadObject(std::string scope, std::string name, const
auto tpl = new CRmgTemplate(); auto tpl = new CRmgTemplate();
try try
{ {
tpl->setName(name); //TODO?
const auto & templateNode = data; const auto & templateNode = data;
if (!templateNode["name"].isNull())
tpl->setName(templateNode["name"].String()); //name can be customised. Allow duplicated names for different template versions.
else
tpl->setName(name); //identifier becomes default name
// Parse main template data // Parse main template data
tpl->setMinSize(parseMapTemplateSize(templateNode["minSize"].String())); tpl->setMinSize(parseMapTemplateSize(templateNode["minSize"].String()));