mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Merge branch 'tmj-dev' into milek-dev
This commit is contained in:
13
EvLaunch.cpp
13
EvLaunch.cpp
@@ -74,8 +74,17 @@ bool TEventLauncher::Load(cParser *parser)
|
||||
iMinute = int(DeltaTime) % 100; // minuty są najmłodszymi cyframi dziesietnymi
|
||||
iHour = int(DeltaTime - iMinute) / 100; // godzina to setki
|
||||
DeltaTime = 0; // bez powtórzeń
|
||||
WriteLog("EventLauncher at " + std::to_string(iHour) + ":" +
|
||||
std::to_string(iMinute)); // wyświetlenie czasu
|
||||
// potentially shift the provided time by requested offset
|
||||
auto const timeoffset { static_cast<int>( Global.ScenarioTimeOffset * 60 ) };
|
||||
if( timeoffset != 0 ) {
|
||||
auto const adjustedtime { clamp_circular( iHour * 60 + iMinute + timeoffset, 24 * 60 ) };
|
||||
iHour = ( adjustedtime / 60 ) % 60;
|
||||
iMinute = adjustedtime % 60;
|
||||
}
|
||||
WriteLog(
|
||||
"EventLauncher at "
|
||||
+ std::to_string( iHour ) + ":"
|
||||
+ ( iMinute < 10 ? "0" : "" ) + to_string( iMinute ) ); // wyświetlenie czasu
|
||||
}
|
||||
parser->getTokens();
|
||||
*parser >> token;
|
||||
|
||||
@@ -3165,8 +3165,10 @@ void TMoverParameters::CompressorCheck(double dt)
|
||||
if( Compressor > MaxCompressor ) {
|
||||
// wyłącznik ciśnieniowy jest niezależny od sposobu zasilania
|
||||
// TBD, TODO: don't operate the lock without battery power?
|
||||
if( ( CompressorPower == 0 )
|
||||
|| ( CompressorPower == 3 ) ) {
|
||||
if( ( ( CompressorPower == 0 )
|
||||
|| ( CompressorPower == 3 ) )
|
||||
&& ( ( EngineType == DieselEngine )
|
||||
|| ( EngineType == DieselElectric ) ) ) {
|
||||
// if the compressor is powered directly by the engine the lock can't turn it off and instead just changes the output
|
||||
if( false == CompressorGovernorLock ) {
|
||||
// emit relay sound when the lock engages (the state change itself is below) and presumably changes where the air goes
|
||||
|
||||
@@ -417,7 +417,9 @@ void TTrack::Load(cParser *parser, Math3D::vector3 pOrigin)
|
||||
>> fSoundDistance;
|
||||
fTrackWidth2 = fTrackWidth; // rozstaw/szerokość w punkcie 2, na razie taka sama
|
||||
parser->getTokens(2);
|
||||
*parser >> iQualityFlag >> iDamageFlag;
|
||||
*parser
|
||||
>> iQualityFlag
|
||||
>> iDamageFlag;
|
||||
if (iDamageFlag & 128)
|
||||
iAction |= 0x80; // flaga wykolejania z powodu uszkodzenia
|
||||
parser->getTokens();
|
||||
|
||||
@@ -65,7 +65,7 @@ simulation_time::init() {
|
||||
::memcpy( m_monthdaycounts, monthdaycounts, sizeof( monthdaycounts ) );
|
||||
|
||||
// potentially adjust scenario clock
|
||||
auto const requestedtime { clamp_circular<int>( m_time.wHour * 60 + m_time.wMinute + Global.ScenarioTimeOffset * 60, 1440 ) };
|
||||
auto const requestedtime { clamp_circular<int>( m_time.wHour * 60 + m_time.wMinute + Global.ScenarioTimeOffset * 60, 24 * 60 ) };
|
||||
auto const requestedhour { ( requestedtime / 60 ) % 60 };
|
||||
auto const requestedminute { requestedtime % 60 };
|
||||
// cache requested elements, if any
|
||||
|
||||
19
mtable.cpp
19
mtable.cpp
@@ -229,8 +229,6 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax)
|
||||
std::ifstream fin;
|
||||
bool EndTable;
|
||||
double vActual;
|
||||
int i;
|
||||
int time; // do zwiększania czasu
|
||||
|
||||
int ConversionError = 0;
|
||||
EndTable = false;
|
||||
@@ -522,22 +520,23 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax)
|
||||
/* TTVmax:=TimeTable[1].vmax; */
|
||||
}
|
||||
auto const timeoffset { static_cast<int>( Global.ScenarioTimeOffset * 60 ) + iPlus };
|
||||
if( timeoffset != 0.0 ) // jeżeli jest przesunięcie rozkładu
|
||||
if( timeoffset != 0 ) // jeżeli jest przesunięcie rozkładu
|
||||
{
|
||||
long i_end = StationCount + 1;
|
||||
for (i = 1; i < i_end; ++i) // bez with, bo ciężko się przenosi na C++
|
||||
int adjustedtime; // do zwiększania czasu
|
||||
for (auto i = 1; i < i_end; ++i) // bez with, bo ciężko się przenosi na C++
|
||||
{
|
||||
if ((TimeTable[i].Ah >= 0))
|
||||
{
|
||||
time = clamp_circular( TimeTable[i].Ah * 60 + TimeTable[i].Am + timeoffset, 1440 ); // nowe minuty
|
||||
TimeTable[i].Am = time % 60;
|
||||
TimeTable[i].Ah = (time /*div*/ / 60) % 60;
|
||||
adjustedtime = clamp_circular( TimeTable[i].Ah * 60 + TimeTable[i].Am + timeoffset, 24 * 60 ); // nowe minuty
|
||||
TimeTable[i].Am = adjustedtime % 60;
|
||||
TimeTable[i].Ah = (adjustedtime /*div*/ / 60) % 60;
|
||||
}
|
||||
if ((TimeTable[i].Dh >= 0))
|
||||
{
|
||||
time = clamp_circular( TimeTable[i].Dh * 60 + TimeTable[i].Dm + timeoffset, 1440 ); // nowe minuty
|
||||
TimeTable[i].Dm = time % 60;
|
||||
TimeTable[i].Dh = (time /*div*/ / 60) % 60;
|
||||
adjustedtime = clamp_circular( TimeTable[i].Dh * 60 + TimeTable[i].Dm + timeoffset, 24 * 60 ); // nowe minuty
|
||||
TimeTable[i].Dm = adjustedtime % 60;
|
||||
TimeTable[i].Dh = (adjustedtime /*div*/ / 60) % 60;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user