Files
arcattackandClaude Fable 5 0d032029a0 Fix 2 (Gitea #12): gauge tree survives the in-session mech re-stream
The pre-launch host drop/rejoin re-stream re-creates every mech at mission
launch; the LOBBY-built gauge tree kept attribute pointers into the freed
first-stream mechs, every widget Execute AV'd, and the BT_DEV_GAUGES SEH
guard (Gauge::GuardedExecute, GAUGE.cpp:618) disabled each one PERMANENTLY
(rate=0, no rebind) -- the frozen dev-gauges window of incident #12.  The
authentic engine flow only tears the tree down at mission transitions
(Application::Shutdown -> gaugeRenderer->Shutdown() -> ShutdownImplementation
-> Remove(0), APP.cpp:787 / GAUGREND.cpp:3264); the re-stream bypassed it.

Fix: BTL4GaugeRenderer::TearDownForViewpointRestream() performs the
ENTITY-BOUND half of that same ShutdownImplementation sequence, in order
(gaugeAlarmManager->RemoveAllAlarms() -> Remove(0) -> moving/static entity
grid Clear), keeping the mission-scoped state (warehouse, graphics ports,
interpreter, controls-owned L4Lamps -- RemoveAllLamps would delete them
behind the buttonGroup's &lamp->automaticValue registrations).  Called from
BTL4Application::MakeViewpointEntity before ConfigureForModel("Init") on any
viewpoint RE-make -- that handler runs once per stream (the incident log's
[ctrlmap] installing x2) -- so the tree rebuilds bound to the NEW mech via
the renderer's existing lazy build.  Sentinel: "[gauge] viewpoint re-stream:
tearing the gauge tree down for rebuild".

Verified with the 2-instance relay harness (port 15600, MP_RELAY.EGG,
the incident sequence): join A (dev gauges) + B, kill B by exact PID at
WAITING FOR OPERATOR LAUNCH, rejoin B, operator launch.  Pod A re-streamed
(2x ctrlmap install, 4x zonebuild), logged the sentinel, and post-launch the
docked composite is fully live (mission clock/heading/radar advancing between
BT_SHOT frames) with ZERO [gauge-fault] DISABLED lines (the incident had 11).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 23:30:43 -05:00

78 lines
3.1 KiB
C++

//===========================================================================//
// File: btl4grnd.hpp //
// Project: BattleTech Brick: Gauge Renderer Manager //
// Contents: //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 02/13/95 CPB Initial coding. //
//---------------------------------------------------------------------------//
// Copyright (C) 1994, Virtual World Entertainment, Inc. All rights reserved //
// PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
//
// SURVIVING HEADER (ground truth -- reproduced verbatim from
// 410SRC/.../BT_L4/BTL4GRND.HPP). Only the File:/Brick: banner above was
// corrected from the original (which carried a stale "rpl4grnd.hh" copy of
// the Red Planet sibling's comment). The class declaration is unchanged.
//
// Implementation reconstructed in btl4grnd.cpp from the shipped binary:
// BTL4GaugeRenderer ctor @004cbea0 (vtable 0051cebc)
// ~BTL4GaugeRenderer @004cbf40 (vtable slot 0)
// TestInstance @004cbf90
// NotifyOfNewInterestingEntity @004cbfa0 (vtable slot 9)
// NotifyOfBecomingUninterestingEntity @004cc028 (vtable slot 10)
//
#if !defined(BTL4GRND_HPP)
# define BTL4GRND_HPP
# if !defined(L4GREND_HPP)
# include <l4grend.hpp>
# endif
//~~~~~~~~~~~~~~~~~~~~~~~~~~ BTL4GaugeRenderer ~~~~~~~~~~~~~~~~~~~~~~~~~~
class BTL4GaugeRenderer:
public L4GaugeRenderer
{
public:
//
//--------------------------------------------------------------------
// Construction, Destruction, Testing
//--------------------------------------------------------------------
//
BTL4GaugeRenderer();
~BTL4GaugeRenderer();
Logical
TestInstance() const;
void
NotifyOfNewInterestingEntity(Entity *entity);
void
NotifyOfBecomingUninterestingEntity(Entity *entity);
//
// PORT FIX (Gitea #12 -- NOT in the surviving 1995 header): tear the
// built gauge tree down when the viewpoint mech is RE-STREAMED
// in-session (pre-launch host drop/rejoin re-creates every mech; the
// lobby-built tree's attribute pointers dangle and each widget is
// permanently DISABLED by the BT_DEV_GAUGES SEH guard, GAUGE.cpp:618).
// Performs the entity-bound half of the engine's mission-transition
// teardown (GaugeRenderer::ShutdownImplementation, GAUGREND.cpp:3264):
// alarms + all gauges + the entity grids. Warehouse / graphics ports /
// interpreter / controls lamps stay -- entity-independent, reused by
// the immediate ConfigureForModel rebuild. Called from
// BTL4Application::MakeViewpointEntity before ConfigureForModel;
// a no-op on the first (lobby) build.
//
void
TearDownForViewpointRestream();
};
#endif