Fixes the staged POWERSUB.HPP base (HeatableSubsystem -> HeatSink, the real hierarchy) and reconstructs PoweredSubsystem: a HeatSink that draws electrical power. Added members (voltageSource = SubsystemConnection, electricalStateAlarm = AlarmIndicator(5), modeAlarm = AlarmIndicator(3), input/output/ratedVoltage) and corrected the resource struct (voltageSourceIndex + thermalResistivityCoefficient + startTime). Ctor chains HeatSink and primes the electrical state; statics, dtor, ResetToInitialState, TestClass/TestInstance real. The voltage-source resolution (indexing the owner mech's subsystem ROSTER for the powering generator) + master-instance electrical sim + AttachToVoltageSource are deferred to the segment-walk phase (phase 4) where the roster is populated -- the subsystem constructs with no attached source until then. Verified slice now: MechSubsystem -> HeatableSubsystem -> HeatSink -> PoweredSubsystem. Compile-verified (BT: 26 ok); tree links clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
114 lines
3.6 KiB
C++
114 lines
3.6 KiB
C++
//===========================================================================//
|
|
// File: powersub.hpp //
|
|
// Project: BattleTech //
|
|
// Contents: Implementation details for powered subsystems //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#if !defined(POWERSUB_HPP)
|
|
# define POWERSUB_HPP
|
|
|
|
# if !defined(HEAT_HPP)
|
|
# include <heat.hpp>
|
|
# endif
|
|
|
|
//##################### Forward Class Declarations #######################
|
|
class Mech;
|
|
|
|
//###########################################################################
|
|
//################### PoweredSubsystem Model Resource ###################
|
|
//###########################################################################
|
|
|
|
struct PoweredSubsystem__SubsystemResource:
|
|
public HeatSink::SubsystemResource
|
|
{
|
|
int voltageSourceIndex;
|
|
Scalar thermalResistivityCoefficient;
|
|
int auxScreenNumber;
|
|
int auxScreenPlacement;
|
|
char auxScreenLabel[64];
|
|
char engScreenLabel[64];
|
|
Scalar startTime;
|
|
};
|
|
|
|
//###########################################################################
|
|
//######################### PoweredSubsystem ############################
|
|
//###########################################################################
|
|
|
|
class PoweredSubsystem:
|
|
public HeatSink
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Shared Data Support
|
|
//
|
|
public:
|
|
static Derivation ClassDerivations;
|
|
static SharedData DefaultData;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Test Class Support
|
|
//
|
|
public:
|
|
static Logical
|
|
TestClass(Mech &);
|
|
Logical
|
|
TestInstance() const;
|
|
void
|
|
ResetToInitialState(Logical powered);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Power support
|
|
//
|
|
public:
|
|
Subsystem*
|
|
ResolveVoltageSource() { return voltageSource.Resolve(); }
|
|
void
|
|
AttachToVoltageSource(Subsystem *source);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Construction and Destruction
|
|
//
|
|
public:
|
|
typedef PoweredSubsystem__SubsystemResource SubsystemResource;
|
|
|
|
PoweredSubsystem(
|
|
Mech *owner,
|
|
int subsystem_ID,
|
|
SubsystemResource *subsystem_resource,
|
|
SharedData &shared_data = DefaultData
|
|
);
|
|
|
|
~PoweredSubsystem();
|
|
|
|
static int
|
|
CreateStreamedSubsystem(
|
|
NotationFile *model_file,
|
|
const char *model_name,
|
|
const char *subsystem_name,
|
|
SubsystemResource *subsystem_resource,
|
|
NotationFile *subsystem_file,
|
|
const ResourceDirectories *directories,
|
|
int passes = 1
|
|
);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Local Data
|
|
//
|
|
protected:
|
|
Scalar inputVoltage;
|
|
Scalar outputVoltage;
|
|
Scalar ratedVoltage;
|
|
SubsystemConnection voltageSource;
|
|
AlarmIndicator electricalStateAlarm;
|
|
AlarmIndicator modeAlarm;
|
|
};
|
|
|
|
#endif
|