gauges: colorMapperMultiArmor (worst-of-8-zones) + fix the interpreterTable overflow [widget recon 4]

Reconstructs colorMapperMultiArmor -- tints one schematic colour (a whole torso
section) by the WORST of up to 8 damage zones:
- MultiArmorConnection (@004c346c/@004c34f4): scans 8 zones via
  entity->damageZones[idx], keeps the max damageLevel, count==0 ? 100 :
  Round(worst*100).
- ColorMapperMultiArmor::Make/ctor (@004c3c48/@004c3d60): resolves 8 named
  zones to indices via Entity::GetDamageZoneIndex (13-param methodDescription).

ALSO fixes a latent HEAP CORRUPTION that registering this widget exposed (and
that would have blocked every further widget): GaugeInterpreter's bytecode
buffer is a fixed interpreterTableSize=46864 (GAUGREND.h) tuned for RP's config,
and its Insert() bounds guard is a Verify() that compiles out at DEBUG_LEVEL 0.
As each BT gauge widget is registered, more of BT's larger L4GAUGE.CFG resolves
into bytecode (vs being parse-skipped); colorMapperMultiArmor's 13 params x
hundreds of calls pushed the total past 46864 -> silent overflow past the char[]
-> heap smash detected later in mission bitmap loading (not the gauge code).
Fix: interpreterTableSize -> 262144 (sized for BT's full config).

Verified: parses, builds, all zones resolve, no /FORCE unresolved, combat
un-regressed (TARGET DESTROYED, 0 crashes), stable. Details: docs/GAUGE_COMPOSITE.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-06 16:56:13 -05:00
co-authored by Claude Opus 4.8
parent 1d2ddd8399
commit fb8c1d6ace
5 changed files with 191 additions and 11 deletions
+8 -1
View File
@@ -206,7 +206,14 @@ protected:
enum
{
interpreterTableSize = 46864
// The original (RP) value 46864 is too small for BattleTech's larger
// gauge config: as more BT gauge widgets are registered, more of
// L4GAUGE.CFG resolves into interpreter bytecode instead of being
// parse-skipped, overflowing the fixed table. The Insert() bounds guard
// is a Verify() that compiles out at DEBUG_LEVEL 0, so the overflow was
// a SILENT heap corruption (detected later in mission bitmap loading).
// Sized generously for BT's full config. (was 46864)
interpreterTableSize = 262144
};
enum