| 195 | } |
| 196 | |
| 197 | bool DebrisData::onAdd() |
| 198 | { |
| 199 | if(!Parent::onAdd()) |
| 200 | return false; |
| 201 | |
| 202 | for( S32 i=0; i<DDC_NUM_EMITTERS; i++ ) |
| 203 | { |
| 204 | if( !emitterList[i] && emitterIDList[i] != 0 ) |
| 205 | { |
| 206 | if( Sim::findObject( emitterIDList[i], emitterList[i] ) == false) |
| 207 | { |
| 208 | Con::errorf( ConsoleLogEntry::General, "DebrisData::onAdd: Invalid packet, bad datablockId(emitter): 0x%x", emitterIDList[i]); |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | if (!explosion && explosionId != 0) |
| 214 | { |
| 215 | if (!Sim::findObject( SimObjectId( explosionId ), explosion )) |
| 216 | Con::errorf( ConsoleLogEntry::General, "DebrisData::onAdd: Invalid packet, bad datablockId(particle emitter): 0x%x", explosionId); |
| 217 | } |
| 218 | |
| 219 | // validate data |
| 220 | |
| 221 | if( velocityVariance > velocity ) |
| 222 | { |
| 223 | Con::warnf(ConsoleLogEntry::General, "DebrisData(%s)::onAdd: velocityVariance invalid", getName()); |
| 224 | velocityVariance = velocity; |
| 225 | } |
| 226 | if( friction < -10.0f || friction > 10.0f ) |
| 227 | { |
| 228 | Con::warnf(ConsoleLogEntry::General, "DebrisData(%s)::onAdd: friction invalid", getName()); |
| 229 | friction = 0.2f; |
| 230 | } |
| 231 | if( elasticity < -10.0f || elasticity > 10.0f ) |
| 232 | { |
| 233 | Con::warnf(ConsoleLogEntry::General, "DebrisData(%s)::onAdd: elasticity invalid", getName()); |
| 234 | elasticity = 0.2f; |
| 235 | } |
| 236 | if( lifetime < 0.0f || lifetime > 1000.0f ) |
| 237 | { |
| 238 | Con::warnf(ConsoleLogEntry::General, "DebrisData(%s)::onAdd: lifetime invalid", getName()); |
| 239 | lifetime = 3.0f; |
| 240 | } |
| 241 | if( lifetimeVariance < 0.0f || lifetimeVariance > lifetime ) |
| 242 | { |
| 243 | Con::warnf(ConsoleLogEntry::General, "DebrisData(%s)::onAdd: lifetimeVariance invalid", getName()); |
| 244 | lifetimeVariance = 0.0f; |
| 245 | } |
| 246 | if( numBounces < 0 || numBounces > 10000 ) |
| 247 | { |
| 248 | Con::warnf(ConsoleLogEntry::General, "DebrisData(%s)::onAdd: numBounces invalid", getName()); |
| 249 | numBounces = 3; |
| 250 | } |
| 251 | if( bounceVariance < 0 || bounceVariance > numBounces ) |
| 252 | { |
| 253 | Con::warnf(ConsoleLogEntry::General, "DebrisData(%s)::onAdd: bounceVariance invalid", getName()); |
| 254 | bounceVariance = 0; |
nothing calls this directly
no test coverage detected