Mech milestone phase 2: reconstruct HeatableSubsystem + map the roster hierarchy

HeatableSubsystem (HEAT.CPP) reconstructed + compile-verified (BT: 25 ok):
statics, ctor (chains MechSubsystem resource form + ResetToInitialState ->
currentTemperature=300, heatLoad=0), dtor, TestClass/TestInstance,
CreateStreamedSubsystem staged. Verified slice now: Subsystem -> MechSubsystem
-> HeatableSubsystem.

Also mapped the roster hierarchy from BT411, which is DEEPER than the staged
headers (recorded in MECHSUB.NOTES.md):
  MechSubsystem -> HeatableSubsystem -> HeatSink -> PoweredSubsystem -> {Sensor,
  Generator, ...}
Findings for the next steps: (1) HeatSink is MISSING entirely from the staged
tree and must be added between HeatableSubsystem and PoweredSubsystem;
(2) staged POWERSUB.HPP wrongly derives PoweredSubsystem from HeatableSubsystem
(real base = HeatSink) -- fix it; (3) PoweredSubsystem has inter-subsystem wiring
(resolves its voltage-source generator from the owner mech's subsystem roster),
imposing a segment-walk ordering constraint for the phase-4 ctor.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-19 23:14:49 -05:00
co-authored by Claude Fable 5
parent 0e274d3dde
commit 82de438dfb
2 changed files with 156 additions and 0 deletions
+120
View File
@@ -0,0 +1,120 @@
//===========================================================================//
// File: heat.cpp //
// Project: BattleTech Brick: Mech subsystems //
// Contents: HeatableSubsystem -- a MechSubsystem with a thermal state //
//---------------------------------------------------------------------------//
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include <bt.hpp>
#pragma hdrstop
#if !defined(HEAT_HPP)
# include <heat.hpp>
#endif
#if !defined(MECH_HPP)
# include <mech.hpp>
#endif
//
//#############################################################################
// Shared data support -- reuses the base Subsystem sets (no boot-critical
// handlers / attributes of its own).
//#############################################################################
//
Derivation
HeatableSubsystem::ClassDerivations(
MechSubsystem::ClassDerivations,
"HeatableSubsystem"
);
HeatableSubsystem::SharedData
HeatableSubsystem::DefaultData(
HeatableSubsystem::ClassDerivations,
Subsystem::MessageHandlers,
Subsystem::AttributeIndex,
Subsystem::StateCount
);
//
//#############################################################################
//#############################################################################
//
HeatableSubsystem::HeatableSubsystem(
Mech *owner,
int subsystem_ID,
SubsystemResource *subsystem_resource,
SharedData &shared_data
):
MechSubsystem(
owner,
subsystem_ID,
(MechSubsystem::SubsystemResource *)subsystem_resource,
shared_data
)
{
Check(owner);
Check_Pointer(subsystem_resource);
ResetToInitialState();
Check_Fpu();
}
//
//#############################################################################
//#############################################################################
//
HeatableSubsystem::~HeatableSubsystem()
{
}
//
//#############################################################################
//#############################################################################
//
void
HeatableSubsystem::ResetToInitialState()
{
Check(this);
currentTemperature = 300.0f;
heatLoad = 0.0f;
}
//
//#############################################################################
//#############################################################################
//
Logical
HeatableSubsystem::TestClass(Mech &)
{
return True;
}
Logical
HeatableSubsystem::TestInstance() const
{
return IsDerivedFrom(ClassDerivations);
}
//
//#############################################################################
// CreateStreamedSubsystem Model-load-time construction (thermal resource +
// damage-zone stream). Not yet reconstructed (see MECHSUB.NOTES.md).
//#############################################################################
//
int
HeatableSubsystem::CreateStreamedSubsystem(
NotationFile *,
const char *,
const char *,
SubsystemResource *,
NotationFile *,
const ResourceDirectories *,
int
)
{
Fail("HeatableSubsystem::CreateStreamedSubsystem -- heat.cpp not yet reconstructed");
return 0;
}
+36
View File
@@ -69,3 +69,39 @@ MechSubsystem must let the base Subsystem + DamageZone stream ctor handle armour
Analysis complete; step 2 is the next code to write. This worksheet is the Analysis complete; step 2 is the next code to write. This worksheet is the
deliverable that keeps the subsystem foundation on the 4.10 damage model rather deliverable that keeps the subsystem foundation on the 4.10 damage model rather
than BT411's divergent one. than BT411's divergent one.
## Progress + roster hierarchy findings (2026-07-19)
**DONE:** `MechSubsystem` base (MECHSUB.HPP/.CPP) and `HeatableSubsystem`
(HEAT.HPP/.CPP) reconstructed + compile-verified. Verified vertical slice so far:
`Subsystem → MechSubsystem → HeatableSubsystem`.
**The subsystem hierarchy is DEEPER than the staged headers show.** From BT411:
```
MechSubsystem (done)
└ HeatableSubsystem (done; ctor chains MechSubsystem + ResetToInitialState
-> currentTemperature=300, heatLoad=0)
└ HeatSink (MISSING from the staged tree -- not in source410 nor
CODE; VDATA HeatSinkClassID=0xBC5. Must be added.)
└ PoweredSubsystem (staged POWERSUB.HPP wrongly derives it from
HeatableSubsystem -- real base is HeatSink; FIX the
staged header. Also its ctor has embedded AlarmIndicators
(electricalStateAlarm 5-level, modeAlarm 3-level) and a
voltageSource SlotOf.)
└ Sensor (surviving header CODE/BT/BT/SENSOR.HPP; leaf)
└ Generator, ... (other leaves)
```
**PoweredSubsystem has inter-subsystem wiring** — its ctor resolves a voltage
source (generator) by indexing the OWNER MECH's subsystem roster
(`owner->GetSubsystem(res->voltageSourceIndex)`), not the skeleton. So powered
subsystems must be created AFTER the generator in the segment-walk order, and the
Mech must expose GetSubsystemCount()/GetSubsystem(). This ordering constraint is
a segment-walk (phase-4 ctor) concern; note it there.
**Next roster steps:** add the missing HeatSink class (between HeatableSubsystem
and PoweredSubsystem), fix POWERSUB.HPP's base, reconstruct PoweredSubsystem
(with its alarms + voltage-source slot), then the leaves (Sensor first — its
interface survives). Condenser/HeatWatcher (VDATA 0xBC6/0xBC7) are siblings in
the heat family.