The death-row page fault was the THIRD strike of the uninitialized zone-array trap: the staged spawn rides the mech family's resourceID, whose DamageZoneStream makes the Entity base ctor allocate the 20-pointer damageZones[] array with UNINITIALIZED slots -- the Missile never fills it, and ~Entity's teardown deleted 20 garbage pointers through trash vtables (the dtor-chain bisect showed every dtor completing, then EIP-in-heap). Fix: the Projectile ctor NULLs every inherited zone slot. RULE, now three-crashes-proven: any entity subclass that does not FILL the allocated zone array must NULL it -- the engine never initializes the slots, on construction OR destruction. Missiles are now the default SRM delivery (BT_MISSILE_INSTANT=1 = the 5.3.18a instant-hit as an A/B opt-out). Verified: 20 launches -> 20 detonations -> 20 clean death-row teardowns over a 110s mutual fight, zero faults; smoke + novice regressions green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
85 lines
2.6 KiB
C++
85 lines
2.6 KiB
C++
//===========================================================================//
|
|
// File: projtile.cpp //
|
|
// Project: BattleTech Brick: Mech weapons //
|
|
// Contents: Projectile -- the flying-round entity base (Missile derives) //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
//
|
|
// PARTIAL (binary ctor @004be1bc, vtable @00512a5c, 0x340 bytes): the base
|
|
// chains the Mover make path -- the MakeMessage's resourceID is the
|
|
// projectile GameModel, so the Mover ctor streams the authored mass / drag /
|
|
// inertia. The tracer/ballistic body (the unguided MoveAndCollide, smoke
|
|
// trail, PROJTILE.TCP surface) joins the autocannon wave; the Missile
|
|
// subclass carries the only flying rounds in the 4.10 pod content.
|
|
//
|
|
|
|
#include <bt.hpp>
|
|
#pragma hdrstop
|
|
|
|
#if !defined(PROJTILE_HPP)
|
|
# include <projtile.hpp>
|
|
#endif
|
|
|
|
Derivation
|
|
Projectile::ClassDerivations(
|
|
Mover::ClassDerivations,
|
|
"Projectile"
|
|
);
|
|
|
|
Projectile::SharedData
|
|
Projectile::DefaultData(
|
|
Projectile::ClassDerivations,
|
|
Mover::MessageHandlers,
|
|
Mover::AttributeIndex,
|
|
1,
|
|
(Entity::MakeHandler)Projectile::Make
|
|
);
|
|
|
|
Projectile*
|
|
Projectile::Make(MakeMessage *creation_message)
|
|
{
|
|
return new Projectile(creation_message);
|
|
}
|
|
|
|
Projectile::Projectile(
|
|
MakeMessage *creation_message,
|
|
SharedData &shared_data
|
|
):
|
|
Mover(creation_message, shared_data)
|
|
{
|
|
Check(creation_message);
|
|
|
|
//
|
|
// LOAD-BEARING: the Entity base ctor ALLOCATES the raw damage-zone
|
|
// pointer array whenever the resource family carries a DamageZoneStream
|
|
// (entity.cpp:1032) and leaves the slots UNINITIALIZED -- filling them
|
|
// is the derived entity's job (the Mech's Pass 3). A projectile has no
|
|
// zones, so NULL every slot; otherwise ~Entity's teardown walks the
|
|
// array and deletes 20 garbage pointers (virtual dtor calls through
|
|
// trash vtables -- the 5.3.18 death-row page fault, EIP-in-heap after
|
|
// the subsystem dtors completed).
|
|
//
|
|
if (damageZones != NULL)
|
|
{
|
|
for (int dz = 0; dz < damageZoneCount; ++dz)
|
|
{
|
|
damageZones[dz] = NULL;
|
|
}
|
|
}
|
|
|
|
Check_Fpu();
|
|
}
|
|
|
|
Projectile::~Projectile()
|
|
{
|
|
}
|
|
|
|
Logical
|
|
Projectile::TestInstance() const
|
|
{
|
|
return IsDerivedFrom(ClassDerivations);
|
|
}
|