the-butterfly-effect / tbe

The Butterfly Effect, a realistic physics simulation game
http://the-butterfly-effect.org
GNU General Public License v2.0
95 stars 13 forks source link

Clean up visible properties in editor #290

Closed Wuzzy2 closed 8 years ago

Wuzzy2 commented 8 years ago

I noticed the list of available properties in the editor are pretty chaotic: Key properties were missing from many objects, while other objects had properties available which don't make sense for that object.

This PR aims to fix this by making sure the available properties make more or less sense. The properties were chosen by technical feasability, i.e. they have to work in the first place, not whether if it always make sense to use them.

But please check for yourself together with the objects test level test-objects.xml.

kaa-ching commented 8 years ago

I see this pattern twice:

float myFriction = 0.0;
if(!theProps.property2Float(Property::FRICTION_STRING, &myFriction))
    theProps.setDefaultPropertiesString(Property::FRICTION_STRING + QString(":/"));

Please use this member of the PropertyList class instead:

 bool doesPropertyExists(const QString &aKey) const;

It keeps our code cleaner and performs less operations.

kaa-ching commented 8 years ago

Ehm. No. Please take another look at your logic. I think you're introducing an interesting bug.