Prerequisites
Game Version
Bug Description
When a structure has no power it is drawn dark grey and shows the low power lightning bolt icon. Saving the game makes that dark grey drawing fade away within a few seconds, while the structure is still unpowered and still shows the lightning bolt. It keeps looking normal until its status changes.
The same applies to everything else that is drawn dark indefinitely: EMP'd or otherwise disabled objects, subdual damaged objects, and frenzied objects.
Cause: TintEnvelope::m_sustainCounter became a Real in #1651, but the retail compatible save path still round-trips it through an UnsignedInt:
if (version <= 1)
{
UnsignedInt sustainCounter = (UnsignedInt)m_sustainCounter;
xfer->xferUnsignedInt( &sustainCounter );
m_sustainCounter = (Real)sustainCounter;
}
SUSTAIN_INDEFINITELY is 0xfffffffe, and (Real)0xfffffffe rounds up to 4294967296, which is out of range for UnsignedInt — so converting it back is undefined, and on MSVC it yields 0 (checked on both x86 and x64). Because that value is assigned back into m_sustainCounter, this fires while saving, not only on load: the counter becomes 0, the envelope leaves its sustain phase and calls release(), and the dark drawing decays away. Application is edge triggered, so it is not re-established while the status stays the same.
RETAIL_COMPATIBLE_XFER_SAVE defaults to 1, so this is the shipping path. It also writes 0x00000000 where retail wrote 0xfffffffe.
Loading a save is not affected — Drawable::xfer deliberately resets m_prevTintStatus on load, which re-triggers the drawing.
Reproduction Steps
- Start a Skirmish as USA (set the opponent slot to Closed so nothing interferes).
- With the starting Dozer, build a Cold Fusion Reactor, then a Patriot Missile System (it needs 3 power; the reactor supplies 5).
- Select the Cold Fusion Reactor and sell it. The Patriot is now unpowered — it turns dark grey and shows the low power lightning bolt. It stays dark for as long as you watch.
- Open the in-game menu, choose SAVE/LOAD, save the game, and return to the game.
- Within a few seconds the Patriot goes back to its normal colours, while still unpowered and still showing the lightning bolt.
Expected: it stays dark until power is restored.
Prerequisites
Game Version
Bug Description
When a structure has no power it is drawn dark grey and shows the low power lightning bolt icon. Saving the game makes that dark grey drawing fade away within a few seconds, while the structure is still unpowered and still shows the lightning bolt. It keeps looking normal until its status changes.
The same applies to everything else that is drawn dark indefinitely: EMP'd or otherwise disabled objects, subdual damaged objects, and frenzied objects.
Cause:
TintEnvelope::m_sustainCounterbecame aRealin #1651, but the retail compatible save path still round-trips it through anUnsignedInt:SUSTAIN_INDEFINITELYis0xfffffffe, and(Real)0xffffffferounds up to4294967296, which is out of range forUnsignedInt— so converting it back is undefined, and on MSVC it yields 0 (checked on both x86 and x64). Because that value is assigned back intom_sustainCounter, this fires while saving, not only on load: the counter becomes 0, the envelope leaves its sustain phase and callsrelease(), and the dark drawing decays away. Application is edge triggered, so it is not re-established while the status stays the same.RETAIL_COMPATIBLE_XFER_SAVEdefaults to 1, so this is the shipping path. It also writes0x00000000where retail wrote0xfffffffe.Loading a save is not affected —
Drawable::xferdeliberately resetsm_prevTintStatuson load, which re-triggers the drawing.Reproduction Steps
Expected: it stays dark until power is restored.