Improve connect mode. If track is blocked by another train AI search bakcward for sign if before the another train is signal.

This commit is contained in:
firleju
2016-01-17 19:48:06 +01:00
parent 7e0cb417ce
commit 7653ca1186
2 changed files with 8 additions and 1 deletions

View File

@@ -695,6 +695,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
double a; // przyspieszenie
double v; // prędkość
double d; // droga
double d_to_next_sem = 10000.0; //ustaiwamy na pewno dalej niż widzi AI
TCommandType go = cm_Unknown;
eSignNext = NULL;
int i, k = iLast - iFirst + 1;
@@ -1016,7 +1017,10 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
if (sSpeedTable[i].fDist < 0)
VelSignalLast = sSpeedTable[i].fVelNext; //minięty daje prędkość obowiązującą
else
{
iDrivigFlags |= moveSemaphorFound; //jeśli z przodu to dajemy falgę, że jest
d_to_next_sem = Min0R(sSpeedTable[i].fDist, d_to_next_sem);
}
}
else if (sSpeedTable[i].iFlags & spRoadVel)
{ // to W6
@@ -1231,6 +1235,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
if (VelRoad >= 0.0)
fVelDes = Min0R(fVelDes, VelRoad);
// nastepnego semafora albo zwrotnicy to uznajemy, że mijamy W5
FirstSemaphorDist = d_to_next_sem; // przepisanie znalezionej wartosci do zmiennej
return go;
};
@@ -1291,6 +1296,7 @@ TController::TController(bool AI, TDynamicObject *NewControll, bool InitPsyche,
HelpMeFlag = false;
// fProximityDist=1; //nie używane
ActualProximityDist = 1;
FirstSemaphorDist = 10000.0;
vCommandLocation.x = 0;
vCommandLocation.y = 0;
vCommandLocation.z = 0;
@@ -3902,7 +3908,7 @@ bool TController::UpdateSituation(double dt)
// ma taboru do podłączenia
// Ra 2F1H: z tym (fTrackBlock) to nie jest najlepszy pomysł, bo lepiej by
// było porównać z odległością od sygnalizatora z przodu
if ((OrderList[OrderPos] & Connect) ? pVehicles[0]->fTrackBlock > 2000 :
if ((OrderList[OrderPos] & Connect) ? (pVehicles[0]->fTrackBlock > 2000 || pVehicles[0]->fTrackBlock > FirstSemaphorDist) :
true)
if ((comm = BackwardScan()) != cm_Unknown) // jeśli w drugą można jechać
{ // należy sprawdzać odległość od znalezionego sygnalizatora,