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

build 190119. minor diagnostics enhancement, minor ai enhancement, minor bug fixes

This commit is contained in:
tmj-fstate
2019-01-19 14:33:39 +01:00
parent cfc35ee32e
commit 330e52d4fc
6 changed files with 40 additions and 27 deletions

View File

@@ -894,10 +894,9 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
// przy jakim dystansie (stanie licznika) ma przesunąć na następny postój // przy jakim dystansie (stanie licznika) ma przesunąć na następny postój
fLastStopExpDist = mvOccupied->DistCounter + 0.250 + 0.001 * fLength; fLastStopExpDist = mvOccupied->DistCounter + 0.250 + 0.001 * fLength;
TrainParams->UpdateMTable( simulation::Time, asNextStop ); TrainParams->UpdateMTable( simulation::Time, asNextStop );
UpdateDelayFlag();
TrainParams->StationIndexInc(); // przejście do następnej TrainParams->StationIndexInc(); // przejście do następnej
asNextStop = TrainParams->NextStop(); // pobranie kolejnego miejsca zatrzymania asNextStop = TrainParams->NextStop(); // pobranie kolejnego miejsca zatrzymania
// TableClear(); //aby od nowa sprawdziło W4 z inną nazwą już - to nie
// jest dobry pomysł
sSpeedTable[i].iFlags = 0; // nie liczy się już sSpeedTable[i].iFlags = 0; // nie liczy się już
continue; // nie analizować prędkości continue; // nie analizować prędkości
} }
@@ -972,21 +971,13 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
// also ignore any horn cue that may be potentially set below 1 km/h and before the actual full stop // also ignore any horn cue that may be potentially set below 1 km/h and before the actual full stop
iDrivigFlags &= ~( moveStartHorn | moveStartHornNow ); iDrivigFlags &= ~( moveStartHorn | moveStartHornNow );
} }
UpdateDelayFlag();
// perform loading/unloading // perform loading/unloading
auto const platformside = static_cast<int>( std::floor( std::abs( sSpeedTable[ i ].evEvent->input_value( 2 ) ) ) ) % 10; auto const platformside = static_cast<int>( std::floor( std::abs( sSpeedTable[ i ].evEvent->input_value( 2 ) ) ) ) % 10;
auto const exchangetime = simulation::Station.update_load( pVehicles[ 0 ], *TrainParams, platformside ); auto const exchangetime = simulation::Station.update_load( pVehicles[ 0 ], *TrainParams, platformside );
WaitingSet( exchangetime ); WaitingSet( exchangetime );
if( TrainParams->CheckTrainLatency() < 0.0 ) {
// odnotowano spóźnienie
iDrivigFlags |= moveLate;
}
else {
// przyjazd o czasie
iDrivigFlags &= ~moveLate;
}
if (TrainParams->DirectionChange()) { if (TrainParams->DirectionChange()) {
// jeśli "@" w rozkładzie, to wykonanie dalszych komend // jeśli "@" w rozkładzie, to wykonanie dalszych komend
// wykonanie kolejnej komendy, nie dotyczy ostatniej stacji // wykonanie kolejnej komendy, nie dotyczy ostatniej stacji
@@ -1914,11 +1905,14 @@ void TController::AutoRewident()
d = d->Next(); // kolejny pojazd, podłączony od tyłu (licząc od czoła) d = d->Next(); // kolejny pojazd, podłączony od tyłu (licząc od czoła)
} }
//ustawianie trybu pracy zadajnika hamulca, wystarczy raz po inicjalizacji AI //ustawianie trybu pracy zadajnika hamulca, wystarczy raz po inicjalizacji AI
if( true == AIControllFlag ) {
// if a human is in charge leave the brake mode up to them, otherwise do as you like
for( int i = 1; i <= 8; i *= 2 ) { for( int i = 1; i <= 8; i *= 2 ) {
if( ( mvOccupied->BrakeOpModes & i ) > 0 ) { if( ( mvOccupied->BrakeOpModes & i ) > 0 ) {
mvOccupied->BrakeOpModeFlag = i; mvOccupied->BrakeOpModeFlag = i;
} }
} }
}
// teraz zerujemy tabelkę opóźnienia hamowania // teraz zerujemy tabelkę opóźnienia hamowania
for (int i = 0; i < BrakeAccTableSize; ++i) for (int i = 0; i < BrakeAccTableSize; ++i)
@@ -6210,6 +6204,18 @@ std::string TController::NextStop() const
return nextstop; return nextstop;
}; };
void TController::UpdateDelayFlag() {
if( TrainParams->CheckTrainLatency() < 0.0 ) {
// odnotowano spóźnienie
iDrivigFlags |= moveLate;
}
else {
// przyjazd o czasie
iDrivigFlags &= ~moveLate;
}
}
//-----------koniec skanowania semaforow //-----------koniec skanowania semaforow
void TController::TakeControl(bool yes) void TController::TakeControl(bool yes)

View File

@@ -388,6 +388,8 @@ private:
int StationCount() const; int StationCount() const;
bool IsStop() const; bool IsStop() const;
std::string NextStop() const; std::string NextStop() const;
// tests whether the train is delayed and sets accordingly a driving flag
void UpdateDelayFlag();
// members // members
Mtable::TTrainParameters *TrainParams = nullptr; // rozkład jazdy zawsze jest, nawet jeśli pusty Mtable::TTrainParameters *TrainParams = nullptr; // rozkład jazdy zawsze jest, nawet jeśli pusty
std::string asNextStop; // nazwa następnego punktu zatrzymania wg rozkładu std::string asNextStop; // nazwa następnego punktu zatrzymania wg rozkładu

View File

@@ -4436,7 +4436,7 @@ void TDynamicObject::RenderSounds() {
// youBy: dzwiek ostrych lukow i ciasnych zwrotek // youBy: dzwiek ostrych lukow i ciasnych zwrotek
if( ( ts.R * ts.R > 1 ) if( ( ts.R * ts.R > 1 )
&& ( MoverParameters->Vel > 0 ) ) { && ( MoverParameters->Vel > 5.0 ) ) {
// scale volume with curve radius and vehicle speed // scale volume with curve radius and vehicle speed
volume = volume =
MoverParameters->AccN * MoverParameters->AccN MoverParameters->AccN * MoverParameters->AccN
@@ -4638,11 +4638,6 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
mdModel = TModelsManager::GetModel(asModel, true); mdModel = TModelsManager::GetModel(asModel, true);
if (ReplacableSkin != "none") if (ReplacableSkin != "none")
{ {
std::string nowheretexture = TextureTest( "nowhere" ); // na razie prymitywnie
if( false == nowheretexture.empty() ) {
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.Fetch_Material( nowheretexture );
}
if (m_materialdata.multi_textures > 0) { if (m_materialdata.multi_textures > 0) {
// jeśli model ma 4 tekstury // jeśli model ma 4 tekstury
// check for the pipe method first // check for the pipe method first
@@ -4679,6 +4674,10 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
else { else {
m_materialdata.replacable_skins[ 1 ] = GfxRenderer.Fetch_Material( ReplacableSkin ); m_materialdata.replacable_skins[ 1 ] = GfxRenderer.Fetch_Material( ReplacableSkin );
} }
// potentially set blank destination texture
DestinationSet( {}, {} );
if( GfxRenderer.Material( m_materialdata.replacable_skins[ 1 ] ).has_alpha ) { if( GfxRenderer.Material( m_materialdata.replacable_skins[ 1 ] ).has_alpha ) {
// tekstura -1 z kanałem alfa - nie renderować w cyklu nieprzezroczystych // tekstura -1 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
m_materialdata.textures_alpha = 0x31310031; m_materialdata.textures_alpha = 0x31310031;

View File

@@ -514,13 +514,19 @@ getvalues_event::deserialize_( cParser &Input, scene::scratch_data &Scratchpad )
void void
getvalues_event::run_() { getvalues_event::run_() {
WriteLog( "Type: GetValues" ); auto const *cell { m_input.data_cell() };
WriteLog( "Type: GetValues - "
+ cell->name() + " - ["
+ cell->Text() + "] ["
+ to_string( cell->Value1(), 2 ) + "] ["
+ to_string( cell->Value2(), 2 ) + "]" );
if( m_activator == nullptr ) { return; } if( m_activator == nullptr ) { return; }
m_input.data_cell()->PutCommand( cell->PutCommand(
m_activator->Mechanik, m_activator->Mechanik,
&( m_input.data_cell()->location() ) ); &( cell->location() ) );
// potwierdzenie wykonania dla serwera (odczyt semafora już tak nie działa) // potwierdzenie wykonania dla serwera (odczyt semafora już tak nie działa)
if( Global.iMultiplayer ) { if( Global.iMultiplayer ) {

View File

@@ -6433,7 +6433,7 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName)
rsRunningNoise.deserialize( parser, sound_type::single, sound_parameters::amplitude | sound_parameters::frequency, mvOccupied->Vmax ); rsRunningNoise.deserialize( parser, sound_type::single, sound_parameters::amplitude | sound_parameters::frequency, mvOccupied->Vmax );
rsRunningNoise.owner( DynamicObject ); rsRunningNoise.owner( DynamicObject );
rsRunningNoise.m_amplitudefactor /= ( 1 + mvOccupied->Vmax ); // rsRunningNoise.m_amplitudefactor /= ( 1 + mvOccupied->Vmax );
rsRunningNoise.m_frequencyfactor /= ( 1 + mvOccupied->Vmax ); rsRunningNoise.m_frequencyfactor /= ( 1 + mvOccupied->Vmax );
} }
else if( token == "huntingnoise:" ) { else if( token == "huntingnoise:" ) {
@@ -6441,7 +6441,7 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName)
rsHuntingNoise.deserialize( parser, sound_type::single, sound_parameters::amplitude | sound_parameters::frequency, mvOccupied->Vmax ); rsHuntingNoise.deserialize( parser, sound_type::single, sound_parameters::amplitude | sound_parameters::frequency, mvOccupied->Vmax );
rsHuntingNoise.owner( DynamicObject ); rsHuntingNoise.owner( DynamicObject );
rsHuntingNoise.m_amplitudefactor /= ( 1 + mvOccupied->Vmax ); // rsHuntingNoise.m_amplitudefactor /= ( 1 + mvOccupied->Vmax );
rsHuntingNoise.m_frequencyfactor /= ( 1 + mvOccupied->Vmax ); rsHuntingNoise.m_frequencyfactor /= ( 1 + mvOccupied->Vmax );
} }
@@ -7359,7 +7359,7 @@ void TTrain::set_cab_controls( int const Cab ) {
if (ggBrakeOperationModeCtrl.SubModel != nullptr) { if (ggBrakeOperationModeCtrl.SubModel != nullptr) {
ggBrakeOperationModeCtrl.PutValue( ggBrakeOperationModeCtrl.PutValue(
(mvOccupied->BrakeOpModeFlag > 0 ? (mvOccupied->BrakeOpModeFlag > 0 ?
log2(mvOccupied->BrakeOpModeFlag) : std::log2(mvOccupied->BrakeOpModeFlag) :
0)); 0));
} }
// alarm chain // alarm chain

View File

@@ -1,5 +1,5 @@
#pragma once #pragma once
#define VERSION_MAJOR 19 #define VERSION_MAJOR 19
#define VERSION_MINOR 116 #define VERSION_MINOR 119
#define VERSION_REVISION 0 #define VERSION_REVISION 0