- f->deSerialize(wrapper_is);
- verbosestream<<"deserialized "<<f->name<<std::endl;
- if(f->name != "")
- addNameIdMapping(i, f->name);
+ f.deSerialize(wrapper_is);
+
+ // Check error conditions
+ if(i == CONTENT_IGNORE || i == CONTENT_AIR
+ || i == CONTENT_UNKNOWN){
+ infostream<<"NodeDefManager::deSerialize(): WARNING: "
+ <<"not changing builtin node "<<i
+ <<std::endl;
+ continue;
+ }
+ if(f.name == ""){
+ infostream<<"NodeDefManager::deSerialize(): WARNING: "
+ <<"received empty name"<<std::endl;
+ continue;
+ }
+ u16 existing_id;
+ bool found = m_name_id_mapping.getId(f.name, existing_id); // ignore aliases
+ if(found && i != existing_id){
+ infostream<<"NodeDefManager::deSerialize(): WARNING: "
+ <<"already defined with different ID: "
+ <<f.name<<std::endl;
+ continue;
+ }
+
+ // All is ok, add node definition with the requested ID
+ if(i >= m_content_features.size())
+ m_content_features.resize((u32)(i) + 1);
+ m_content_features[i] = f;
+ addNameIdMapping(i, f.name);
+ verbosestream<<"deserialized "<<f.name<<std::endl;