mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 03:09:18 +02:00
minor ai logic tweaks, minor bug fixes
This commit is contained in:
43
Driver.cpp
43
Driver.cpp
@@ -1373,6 +1373,12 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
// ograniczenie aktualnej prędkości aż do wyjechania za ograniczenie
|
||||
fVelDes = v;
|
||||
}
|
||||
if( ( sSpeedTable[ i ].iFlags & spEnd )
|
||||
&& ( mvOccupied->CategoryFlag & 1 ) ) {
|
||||
// if the railway track ends here set the velnext accordingly as well
|
||||
// TODO: test this with turntables and such
|
||||
fNext = 0.0;
|
||||
}
|
||||
// if (v==0.0) fAcc=-0.9; //hamowanie jeśli stop
|
||||
continue; // i tyle wystarczy
|
||||
}
|
||||
@@ -2455,8 +2461,6 @@ bool TController::PrepareEngine()
|
||||
// wyłączanie silnika (test wyłączenia, a część wykonawcza tylko jeśli steruje komputer)
|
||||
bool TController::ReleaseEngine() {
|
||||
|
||||
bool OK = false;
|
||||
|
||||
if( mvOccupied->Vel > 0.01 ) {
|
||||
// TBD, TODO: make a dedicated braking procedure out of it for potential reuse
|
||||
VelDesired = 0.0;
|
||||
@@ -2466,12 +2470,15 @@ bool TController::ReleaseEngine() {
|
||||
; // zerowanie nastawników
|
||||
}
|
||||
IncBrake();
|
||||
return OK; // don't bother with the rest until we're standing still
|
||||
// don't bother with the rest until we're standing still
|
||||
return false;
|
||||
}
|
||||
|
||||
LastReactionTime = 0.0;
|
||||
ReactionTime = PrepareTime;
|
||||
|
||||
bool OK { false };
|
||||
|
||||
if( false == AIControllFlag ) {
|
||||
// tylko to testujemy dla pojazdu człowieka
|
||||
OK = ( ( mvOccupied->ActiveDir == 0 ) && ( mvControlling->Mains ) );
|
||||
@@ -2515,7 +2522,7 @@ bool TController::ReleaseEngine() {
|
||||
}
|
||||
}
|
||||
|
||||
if( mvControlling->Mains ) {
|
||||
if( true == mvControlling->Mains ) {
|
||||
mvControlling->CompressorSwitch( false );
|
||||
mvControlling->ConverterSwitch( false );
|
||||
// line breaker/engine
|
||||
@@ -2528,15 +2535,9 @@ bool TController::ReleaseEngine() {
|
||||
else {
|
||||
OK = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (OK)
|
||||
{ // jeśli się zatrzymał
|
||||
iEngineActive = 0;
|
||||
eStopReason = stopSleep; // stoimy z powodu wyłączenia
|
||||
eAction = TAction::actSleep; //śpi (wygaszony)
|
||||
if (AIControllFlag)
|
||||
{
|
||||
if( OK ) {
|
||||
// finish vehicle shutdown
|
||||
if( ( mvControlling->EngineType == TEngineType::DieselElectric )
|
||||
|| ( mvControlling->EngineType == TEngineType::DieselEngine ) ) {
|
||||
// heating/cooling subsystem
|
||||
@@ -2550,9 +2551,17 @@ bool TController::ReleaseEngine() {
|
||||
mvControlling->OilPumpSwitch( false );
|
||||
}
|
||||
// gasimy światła
|
||||
Lights(0, 0);
|
||||
mvOccupied->BatterySwitch(false);
|
||||
Lights( 0, 0 );
|
||||
mvOccupied->BatterySwitch( false );
|
||||
}
|
||||
}
|
||||
|
||||
if (OK) {
|
||||
// jeśli się zatrzymał
|
||||
iEngineActive = 0;
|
||||
eStopReason = stopSleep; // stoimy z powodu wyłączenia
|
||||
eAction = TAction::actSleep; //śpi (wygaszony)
|
||||
|
||||
OrderNext(Wait_for_orders); //żeby nie próbował coś robić dalej
|
||||
TableClear(); // zapominamy ograniczenia
|
||||
iDrivigFlags &= ~moveActive; // ma nie skanować sygnałów i nie reagować na komendy
|
||||
@@ -4415,8 +4424,8 @@ TController::UpdateSituation(double dt) {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
fMinProximityDist = 0.01;
|
||||
fMaxProximityDist = 2.0; //[m]
|
||||
fMinProximityDist = 5.0;
|
||||
fMaxProximityDist = 10.0; //[m]
|
||||
fVelPlus = 2.0; // dopuszczalne przekroczenie prędkości na ograniczeniu bez hamowania
|
||||
fVelMinus = 5.0; // margines prędkości powodujący załączenie napędu
|
||||
}
|
||||
@@ -4809,7 +4818,7 @@ TController::UpdateSituation(double dt) {
|
||||
}
|
||||
}
|
||||
|
||||
if( ( OrderCurrentGet() & Wait_for_orders ) != 0 ) {
|
||||
if( OrderCurrentGet() == Wait_for_orders ) {
|
||||
// wait means sit and wait
|
||||
VelDesired = 0.0;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ drivingaid_panel::update() {
|
||||
text_lines.emplace_back( textline + " " + expandedtext, Global.UITextColor );
|
||||
}
|
||||
|
||||
auto const sizex = ( is_expanded ? 660 : 135 );
|
||||
auto const sizex = ( is_expanded ? 735 : 135 );
|
||||
size = { sizex, 85 };
|
||||
}
|
||||
|
||||
@@ -786,6 +786,7 @@ debug_panel::update_section_scenario( std::vector<text_line> &Output ) {
|
||||
// current luminance level
|
||||
textline = "Light level: " + to_string( Global.fLuminance, 3 );
|
||||
if( Global.FakeLight ) { textline += "(*)"; }
|
||||
textline += "\nAir temperature: " + to_string( Global.AirTemperature, 1 ) + " deg C";
|
||||
|
||||
Output.emplace_back( textline, Global.UITextColor );
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ opengl_material::deserialize( cParser &Input, bool const Loadnow ) {
|
||||
bool
|
||||
opengl_material::deserialize_mapping( cParser &Input, int const Priority, bool const Loadnow ) {
|
||||
// token can be a key or block end
|
||||
std::string const key { Input.getToken<std::string>( true, "\n\r\t ,;[]" ) };
|
||||
std::string const key { Input.getToken<std::string>( true, "\n\r\t ;[]" ) };
|
||||
|
||||
if( ( true == key.empty() ) || ( key == "}" ) ) { return false; }
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ init() {
|
||||
"Throttle: %2d+%d %c%s",
|
||||
" Speed: %d km/h (limit %d km/h%s)%s",
|
||||
", new limit: %d km/h in %.1f km",
|
||||
" Grade: %.1f%%",
|
||||
" Grade: %.1f%%%%",
|
||||
"Brakes: %4.1f+%-2.0f%c%s",
|
||||
" Pressure: %.2f kPa (train pipe: %.2f kPa)",
|
||||
"!ALERTER! ",
|
||||
@@ -48,7 +48,7 @@ init() {
|
||||
"Resume",
|
||||
"Quit",
|
||||
|
||||
"Name: %s%s\nLoad: %d %s\nStatus: %s%s\nCouplers:\n front: %s\n rear: %s",
|
||||
"Name: %s%s\nLoad: %.0f %s\nStatus: %s%s\nCouplers:\n front: %s\n rear: %s",
|
||||
", owned by: ",
|
||||
"none",
|
||||
"Devices: %c%c%c%c%c%c%c%c%c%c%c%c%c%c%s%s\nPower transfers: %.0f@%.0f%s%s%s%.0f@%.0f",
|
||||
@@ -70,7 +70,7 @@ init() {
|
||||
"Nastawnik: %2d+%d %c%s",
|
||||
" Predkosc: %d km/h (limit %d km/h%s)%s",
|
||||
", nowy limit: %d km/h za %.1f km",
|
||||
" Pochylenie: %.1f%%",
|
||||
" Pochylenie: %.1f%%%%",
|
||||
"Hamulce: %4.1f+%-2.0f%c%s",
|
||||
" Cisnienie: %.2f kPa (przewod glowny: %.2f kPa)",
|
||||
"!CZUWAK! ",
|
||||
@@ -88,7 +88,7 @@ init() {
|
||||
"Wznow",
|
||||
"Zakoncz",
|
||||
|
||||
"Nazwa: %s%s\nLadunek: %d %s\nStatus: %s%s\nSprzegi:\n przedni: %s\n tylny: %s",
|
||||
"Nazwa: %s%s\nLadunek: %.0f %s\nStatus: %s%s\nSprzegi:\n przedni: %s\n tylny: %s",
|
||||
", wlasciciel: ",
|
||||
"wolny",
|
||||
"Urzadzenia: %c%c%c%c%c%c%c%c%c%c%c%c%c%c%s%s\nTransfer pradow: %.0f@%.0f%s%s%s%.0f@%.0f",
|
||||
|
||||
Reference in New Issue
Block a user