16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 06:39:18 +02:00

build 180404. optional scenario clock sync with current local time, keyboard input for the ui layer

This commit is contained in:
tmj-fstate
2018-04-06 01:12:15 +02:00
parent 07f14381a8
commit 87f078925c
12 changed files with 898 additions and 796 deletions

View File

@@ -539,6 +539,17 @@ state_manager::deserialize_time( cParser &Input, scene::scratch_data &Scratchpad
>> time.wHour
>> time.wMinute;
if( true == Global.ScenarioTimeCurrent ) {
// calculate time shift required to match scenario time with local clock
auto timenow = std::time( 0 );
auto *localtime = std::localtime( &timenow );
Global.ScenarioTimeOffset =
clamp_circular(
( localtime->tm_hour * 60 + localtime->tm_min ) - ( time.wHour * 60 + time.wMinute ),
24 * 60 )
/ 60.f;
}
// remaining sunrise and sunset parameters are no longer used, as they're now calculated dynamically
// anything else left in the section has no defined meaning
skip_until( Input, "endtime" );