pavg0 / pavg1 properties can be set through the console and prop

This commit is contained in:
jacob1 2014-10-26 18:11:46 -04:00
parent 7582acfb5c
commit ca0eecee80
3 changed files with 14 additions and 0 deletions

View File

@ -74,6 +74,12 @@ int CommandInterface::GetPropertyOffset(std::string key_, FormatType & format)
} else if (strcmp(key, "dcolor")==0){
offset = offsetof(Particle, dcolour);
format = FormatInt;
} else if (!strcmp(key, "pavg0")){
offset = offsetof(Particle, pavg[0]);
format = FormatFloat;
} else if (!strcmp(key, "pavg1")){
offset = offsetof(Particle, pavg[1]);
format = FormatFloat;
} else {
offset = -1;
}

View File

@ -146,6 +146,12 @@ int luacon_particle_getproperty(const char * key, int * format)
} else if (!strcmp(key, "dcolor")) {
offset = offsetof(Particle, dcolour);
*format = 0;
} else if (!strcmp(key, "pavg0")) {
offset = offsetof(Particle, pavg[0]);
*format = 1;
} else if (!strcmp(key, "pavg1")) {
offset = offsetof(Particle, pavg[1]);
*format = 1;
} else {
offset = -1;
}

View File

@ -16,5 +16,7 @@ std::vector<StructProperty> Particle::GetProperties()
properties.push_back(StructProperty("tmp", StructProperty::Integer, offsetof(Particle, tmp)));
properties.push_back(StructProperty("tmp2", StructProperty::Integer, offsetof(Particle, tmp2)));
properties.push_back(StructProperty("dcolour", StructProperty::UInteger, offsetof(Particle, dcolour)));
properties.push_back(StructProperty("pavg0", StructProperty::Float, offsetof(Particle, pavg[0])));
properties.push_back(StructProperty("pavg1", StructProperty::Float, offsetof(Particle, pavg[1])));
return properties;
}