Browse Source

Use attribute_class as fallback name

nosoop 1 year ago
parent
commit
31468e286b
1 changed files with 8 additions and 0 deletions
  1. 8 0
      econmanager.cpp

+ 8 - 0
econmanager.cpp

@@ -120,6 +120,14 @@ bool CEconManager::InsertOrReplaceAttribute(KeyValues *pAttribKV) {
 bool CEconManager::RegisterAttribute(KeyValues* pAttribKV) {
 	AutoKeyValues kv{pAttribKV->MakeCopy()};
 	std::string attrName = kv->GetString("name");
+	if (attrName.empty()) {
+		attrName = kv->GetString("attribute_class");
+		if (attrName.empty()) {
+			return false;
+		}
+		kv->SetString("name", attrName.c_str());
+	}
+	
 	this->m_RegisteredAttributes[attrName] = std::move(kv);
 	return true;
 }