Mech phase 4: non-NULL default roster slots -- boot reaches the attribute binding
Unrecognised subsystem classIDs now get a base MechSubsystem (Laser/ParticleCannon -> Emitter) so control/damage bindings that resolve a subsystemID find a real subsystem, not a NULL plug. This moved the boot PAST the first Link::AddToPlug NULL-deref; it now runs to Simulation::GetAttributePointer -- the subsystem ATTRIBUTE system. Each reconstructed subsystem currently reuses the base Subsystem::AttributeIndex, but the streamed control-mapping / gauge bindings reference subsystem-specific published attributes (Sensor RadarPercent, Generator OutputVoltage, Emitter ChargeLevel, ...) that aren't in the base index -> the attribute lookup walks off the end. Reconstructing each subsystem's AttributeIndex (+ plug/capability-chain wiring) is the phase-5 integration. BT: 42 ok. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -274,14 +274,25 @@ Mech::Mech(
|
||||
case MechTechClassID:
|
||||
made = new MechTech(this, id, (MechTech::SubsystemResource *)seg);
|
||||
break;
|
||||
case EmitterClassID + 1: // LaserClassID -- an Emitter energy weapon
|
||||
case EmitterClassID + 2: // ParticleCannonClassID -- an Emitter energy weapon
|
||||
made = new Emitter(this, id, (Emitter::SubsystemResource *)seg);
|
||||
++weaponCount;
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// Unrecognised / not-yet-reconstructed subsystem class (e.g.
|
||||
// Laser, ParticleCannon, Capacitor, AmmoFeeder, Radar, Turret):
|
||||
// leave the slot NULL so the roster stays aligned rather than
|
||||
// aborting the whole mech.
|
||||
// Unrecognised / not-yet-reconstructed subsystem class (Capacitor,
|
||||
// AmmoFeeder, Radar, Turret, ...): give the slot a base
|
||||
// MechSubsystem so control/damage bindings that resolve this
|
||||
// subsystemID find a real (if generic) subsystem rather than a NULL
|
||||
// plug. The roster stays aligned.
|
||||
//
|
||||
made = NULL;
|
||||
made = new MechSubsystem(
|
||||
this, id,
|
||||
(MechSubsystem::SubsystemResource *)seg,
|
||||
MechSubsystem::DefaultData
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user