#include "testbt.hpp" #include "projweap.hpp" //############################################################################# // Missile Test Class // Logical Missile::TestClass(Mech &mech) { ProjectileWeapon *gun; Missile *missile; MissileThruster *thruster; Seeker *seeker; Scalar time_slice =0.5f; gun = (ProjectileWeapon*) mech.GetSubsystem(ProjectileWeaponSubsystemID); gun->triggerState = 1; MemoryStream stream(NULL, 0); gun->ProjectileWeaponSimulation(time_slice, stream); gun->triggerState = -1; missile = (Missile*) gun->currentProjectile; // BAD!!! Check(missile); thruster = (MissileThruster*) missile->GetSubsystem(Missile::MissileThrusterSubsystem); seeker = (Seeker*) missile->GetSubsystem(Missile::SeekerSubsystem); Check(thruster); Check(seeker); seeker->FindTarget(time_slice, stream); thruster->MissileThrusterSimulation(time_slice, stream); missile->MoveAndCollide(time_slice, stream); time_slice = 5.0f; gun->ProjectileWeaponSimulation(time_slice, stream); seeker->FindTarget(time_slice, stream); thruster->MissileThrusterSimulation(time_slice, stream); missile->MoveAndCollide(time_slice, stream); return True; }