More timer-related tweaks

Got rid of the Overflow() function, which no longer serves a purpose after timers have been upgraded from uint32_t to uint64_t
Unified usage of TIMERVAL (UI64) and TVAL (also UI64) across code base; now only TIMERVAL is used
Updated BuildTimeValue() function parameter from R32 to R64
Updated casting of values passed into BuildTimeValue() across source base
Updated JS Timers and Temp Effects to support starting, saving and loading very long term effect timers; no more 49 days upper limit
Ninja fix for new items added to a container appearing underneath other items in the container instead of over
This commit is contained in:
Xoduz 2025-05-31 01:47:47 +08:00
parent 390280b892
commit dcf10ed540
38 changed files with 405 additions and 396 deletions

View file

@ -30,12 +30,12 @@ cHTMLTemplate::~cHTMLTemplate()
std::string GetUptime( void )
{
UI32 total = (cwmWorldState->GetUICurrentTime() - cwmWorldState->GetStartTime() ) / 1000;
UI32 ho = total / 3600;
UI64 total = (cwmWorldState->GetUICurrentTime() - cwmWorldState->GetStartTime() ) / 1000;
UI64 ho = total / 3600;
total -= ho * 3600;
UI32 mi = total / 60;
UI64 mi = total / 60;
total -= mi * 60;
UI32 se = total;
UI64 se = total;
total = 0;
std::string builtString = "";
if( ho < 10 )
@ -594,7 +594,7 @@ void cHTMLTemplate::Poll( void )
if( scheduledUpdate < cwmWorldState->GetUICurrentTime() || !cwmWorldState->GetKeepRun() )
{
Process();
scheduledUpdate = BuildTimeValue( static_cast<R32>( updateTimer ));
scheduledUpdate = BuildTimeValue( updateTimer );
}
}
@ -660,7 +660,7 @@ void cHTMLTemplate::Load( CScriptSection *found )
if( UTag == "UPDATE" )
{
updateTimer = static_cast<TVAL>( std::stoul( data, nullptr, 0 ));
updateTimer = static_cast<TIMERVAL>( std::stoull( data, nullptr, 0 ));
}
else if( UTag == "TYPE" )
{
@ -868,7 +868,7 @@ std::string cHTMLTemplate::GetInput( void ) const
//o------------------------------------------------------------------------------------------------o
//| Purpose - Gets the next scheduled Update time
//o------------------------------------------------------------------------------------------------o
TVAL cHTMLTemplate::GetScheduledUpdate( void ) const
TIMERVAL cHTMLTemplate::GetScheduledUpdate( void ) const
{
return scheduledUpdate;
}
@ -878,7 +878,7 @@ TVAL cHTMLTemplate::GetScheduledUpdate( void ) const
//o------------------------------------------------------------------------------------------------o
//| Purpose - Gets the Update timer
//o------------------------------------------------------------------------------------------------o
TVAL cHTMLTemplate::GetUpdateTimer( void ) const
TIMERVAL cHTMLTemplate::GetUpdateTimer( void ) const
{
return updateTimer;
}