vehicleSubSystems: reconstruct the stubbed connection helpers from decomp

Replace the return-0 stubs with the real functions:
- ResolveLink (FUN_00417ab4) = SubsystemConnection::Resolve (two-level deref of the
  plug's bound link); an unbound plug resolves to 0, the authentic no-source branch.
- FindLinkedSubsystem (FUN_0041bf44) = GetAttributePointer(index) via the engine
  Simulation attribute-index system (the cooling-loop master at slot 3).
- IsGeneratorDerived (FUN_0041a1a4) = the real IsDerivedFrom(PoweredSubsystem
  ClassDerivations 0x50f4bc) via a new powersub.cpp bridge BTIsPoweredSubsystem
  (shared with the aux-screen filter) -> the generator stateLamp now builds.

So the cooling/power/voltage connections resolve real data when the plug is bound,
instead of always reading 0.  Build clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-07 07:45:57 -05:00
co-authored by Claude Opus 4.8
parent 8a31abb07d
commit dc6af8cef6
2 changed files with 43 additions and 19 deletions
+8 -3
View File
@@ -1269,11 +1269,16 @@ Subsystem *CreatePoweredSubsystem(Mech *owner, int id, void *seg)
// non-PoweredSubsystem-derived subsystems (== the FUN_0041a1a4 / 0x50f4bc type
// filter the vehicleSubSystems Make applies before dispatch).
//
// FUN_0041a1a4(sub->classDerivations, 0x50f4bc) -- is the subsystem PoweredSubsystem-
// derived? (The vehicleSubSystems type filter + the generator stateLamp gate.)
bool BTIsPoweredSubsystem(Subsystem *sub)
{
return sub != NULL && sub->IsDerivedFrom(*PoweredSubsystem::GetClassDerivations());
}
bool BTGetSubsystemAuxScreen(Subsystem *sub, int *screen, int *placement, char *label64)
{
if (sub == NULL)
return false;
if (!sub->IsDerivedFrom(*PoweredSubsystem::GetClassDerivations())) // FUN_0041a1a4(...,0x50f4bc)
if (!BTIsPoweredSubsystem(sub)) // FUN_0041a1a4(...,0x50f4bc)
return false;
PoweredSubsystem *ps = (PoweredSubsystem *)sub;
if (screen != NULL) *screen = ps->auxScreenNumber; // +0x104