Mess up with node definitions to make CONTENT_IGNORE be correctly interpreted when creating meshes

This commit is contained in:
Perttu Ahola 2011-11-19 19:06:19 +02:00
parent 901d98b687
commit 811ac5ac3a

@ -347,13 +347,13 @@ public:
ContentFeatures f; ContentFeatures f;
f.name = "ignore"; f.name = "ignore";
f.drawtype = NDT_AIRLIKE; f.drawtype = NDT_AIRLIKE;
f.param_type = CPT_LIGHT; /*f.param_type = CPT_LIGHT;
f.light_propagates = true; f.light_propagates = true;
f.sunlight_propagates = true; f.sunlight_propagates = true;*/
f.walkable = false; f.walkable = false;
f.pointable = false; f.pointable = false;
f.diggable = false; f.diggable = false;
f.buildable_to = true; f.buildable_to = false;
f.air_equivalent = true; f.air_equivalent = true;
set(CONTENT_IGNORE, f); set(CONTENT_IGNORE, f);
} }
@ -424,6 +424,15 @@ public:
infostream<<"registerNode: registering content id \""<<c infostream<<"registerNode: registering content id \""<<c
<<"\": name=\""<<def.name<<"\""<<std::endl; <<"\": name=\""<<def.name<<"\""<<std::endl;
assert(c <= MAX_CONTENT); assert(c <= MAX_CONTENT);
// Check that the special contents are not redefined as different id
// because it would mess up everything
if((def.name == "ignore" && c != CONTENT_IGNORE) ||
(def.name == "air" && c != CONTENT_AIR)){
errorstream<<"registerNode: IGNORING ERROR: "
<<"trying to register built-in type \""
<<def.name<<"\" as different id"<<std::endl;
return;
}
m_content_features[c] = def; m_content_features[c] = def;
if(def.name != "") if(def.name != "")
m_name_id_mapping.set(c, def.name); m_name_id_mapping.set(c, def.name);
@ -615,6 +624,9 @@ public:
<<"Too large content id: "<<i<<std::endl; <<"Too large content id: "<<i<<std::endl;
continue; continue;
} }
/*// Do not deserialize special types
if(i == CONTENT_IGNORE || i == CONTENT_AIR)
continue;*/
ContentFeatures *f = &m_content_features[i]; ContentFeatures *f = &m_content_features[i];
f->deSerialize(tmp_is, gamedef); f->deSerialize(tmp_is, gamedef);
if(f->name != "") if(f->name != "")