TakeImpactDamage event in DH_ROWheeledVehicle spams "accessed none" errors to log

Issue #91 resolved
Matt Hands created an issue

Simple accessed none error & fix, by moving the offending line under an existing 'if'.

There isn't always an ImpactInfo.Other (Other being the actor we have collided with). Presumably because vehicle may have collided with something static. This spams lots of accessed none errors to the log, e.g. when vehicle is careering over bumpy terrain - think repeated bumps & sparks in half-track.

Affects subclasses of DH_ROWheeledVehicle, which means all infantry vehicles.

Comments (2)

  1. Matt Hands reporter

    Overridden event goes in DH_ROWheeledVehicle:

    event TakeImpactDamage(float AccelMag)
    {
        local  int  Damage;
    
        if (Vehicle(ImpactInfo.Other) != none)
        {
            Damage = Int(VSize(ImpactInfo.Other.Velocity) * 20.0 * ImpactDamageModifier()); // Matt: moved under this 'if' to avoid "accessed none" errors
            TakeDamage(Damage, Vehicle(ImpactInfo.Other), ImpactInfo.Pos, vect(0.0,0.0,0.0), class'DH_VehicleCollisionDamType');
        }
        else
        {
            TakeDamage(Int(AccelMag * ImpactDamageModifier()) / ObjectCollisionResistance, self, ImpactInfo.Pos, vect(0.0,0.0,0.0), class'DH_VehicleCollisionDamType');
        }
    
        // FIXME - scale sound volume to damage amount
        if (ImpactDamageSounds.Length > 0)
        {
            PlaySound(ImpactDamageSounds[Rand(ImpactDamageSounds.Length - 1)], , TransientSoundVolume * 2.5);
        }
    
        if (Health < 0 && (Level.TimeSeconds - LastImpactExplosionTime) > TimeBetweenImpactExplosions)
        {
            VehicleExplosion(Normal(ImpactInfo.ImpactNorm), 0.5);
            LastImpactExplosionTime = Level.TimeSeconds;
        }
    }
    
  2. Log in to comment