Fix: guiBaseJA2Clock overflow (by MH17)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8932 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2021-02-12 05:31:14 +00:00
parent 18dcced82a
commit 39776dc569
+15
View File
@@ -139,6 +139,8 @@ extern INT32 giFlashContractBaseTime;
extern UINT32 guiFlashCursorBaseTime;
extern INT32 giPotCharPathBaseTime;
// sevenfm: display overflow detection
extern void MapScreenMessage(UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ...);
typedef void (*TIMER_NOTIFY_CALLBACK) ( INT32 timer, PTR state );
struct TIMER_NOTIFY_ITEM
@@ -203,8 +205,21 @@ void CALLBACK TimeProc( UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2
if ( !gfPauseClock )
{
UINT32 uiOldClock = guiBaseJA2Clock;
guiBaseJA2Clock += BASETIMESLICE;
// detect overflow
if (uiOldClock > guiBaseJA2Clock)
{
MapScreenMessage(162, 0, L"guiBaseJA2Clock overflow detected!");
for (gCNT = 0; gCNT < TOTAL_SOLDIERS; gCNT++)
{
if (MercPtrs[gCNT])
MercPtrs[gCNT]->ResetSoldierChangeStatTimer();
}
}
for ( gCNT = 0; gCNT < NUMTIMERS; gCNT++ )
{
timerDone |= UpdateCounter( gCNT, iTimeLeft );