mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 08:59:18 +02:00
Projekt się buduje, ale ma 3k warningów.
This commit is contained in:
69
Driver.cpp
69
Driver.cpp
@@ -26,6 +26,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "MemCell.h"
|
||||
#include "World.h"
|
||||
#include "dir.h"
|
||||
#include "mctools.h"
|
||||
|
||||
#define LOGVELOCITY 0
|
||||
#define LOGORDERS 0
|
||||
@@ -87,7 +88,7 @@ const double HardAcceleration = 0.9;
|
||||
const double PrepareTime = 2.0; //[s] przeb<65>yski <20>wiadomo<6D>ci przy odpalaniu
|
||||
bool WriteLogFlag = false;
|
||||
|
||||
AnsiString StopReasonTable[] = {
|
||||
string StopReasonTable[] = {
|
||||
// przyczyny zatrzymania ruchu AI
|
||||
"", // stopNone, //nie ma powodu - powinien jecha<68>
|
||||
"Off", // stopSleep, //nie zosta<74> odpalony, to nie pojedzie
|
||||
@@ -244,7 +245,8 @@ bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len)
|
||||
if (trTrack->iNumDynamics > 0) // a skrzy<7A>owanie zawiera pojazd
|
||||
{
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("Tor " + trTrack->NameGet() + " zajety przed pojazdem. Num=" + trTrack->iNumDynamics + "Dist= " + fDist);
|
||||
WriteLog("Tor " + trTrack->NameGet() + " zajety przed pojazdem. Num=" +
|
||||
to_string(trTrack->iNumDynamics) + "Dist= " + to_string(fDist));
|
||||
fVelNext =
|
||||
0.0; // to zabroni<6E> wjazdu (chyba <20>e ten z przodu te<74> jedzie prosto)
|
||||
}
|
||||
@@ -267,7 +269,8 @@ bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len)
|
||||
0) // je<6A>li jeszcze nie wjechano na tor, a co<63> na nim jest
|
||||
{
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("Rozjazd " + trTrack->NameGet() + " zajety przed pojazdem. Num=" + trTrack->iNumDynamics + "Dist= "+fDist);
|
||||
WriteLog("Rozjazd " + trTrack->NameGet() + " zajety przed pojazdem. Num=" +
|
||||
to_string(trTrack->iNumDynamics) + "Dist= "+ to_string(fDist));
|
||||
//fDist -= 30.0;
|
||||
fVelNext = 0.0; // to niech stanie w zwi<77>kszonej odleg<65>o<EFBFBD>ci
|
||||
// else if (fVelNext==0.0) //je<6A>li zosta<74>a wyzerowana
|
||||
@@ -810,7 +813,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
{ // o ile dana pozycja tabelki jest istotna
|
||||
if (sSpeedTable[i].iFlags & spPassengerStopPoint)
|
||||
{ // je<6A>li przystanek, trzeba obs<62>u<EFBFBD>y<EFBFBD> wg rozk<7A>adu
|
||||
if (sSpeedTable[i].evEvent->CommandGet() != AnsiString(asNextStop.c_str()))
|
||||
if (sSpeedTable[i].evEvent->CommandGet() != asNextStop)
|
||||
{ // je<6A>li nazwa nie jest zgodna
|
||||
if (sSpeedTable[i].fDist < -fLength) // je<6A>li zosta<74> przejechany
|
||||
sSpeedTable[i].iFlags =
|
||||
@@ -830,7 +833,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
#if LOGSTOPS
|
||||
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName + ": at " +
|
||||
to_string(GlobalTime->hh) + ":" + to_string(GlobalTime->mm) +
|
||||
" skipped " + asNextStop.); // informacja
|
||||
" skipped " + asNextStop); // informacja
|
||||
#endif
|
||||
fLastStopExpDist = mvOccupied->DistCounter + 0.250 +
|
||||
0.001 * fLength; // przy jakim dystansie (stanie
|
||||
@@ -1026,7 +1029,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
else
|
||||
{ // je<6A>li dojechali<6C>my do ko<6B>ca rozk<7A>adu
|
||||
#if LOGSTOPS
|
||||
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName) +
|
||||
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName +
|
||||
": at " + to_string(GlobalTime->hh) + ":" +
|
||||
to_string(GlobalTime->mm) +
|
||||
" end of route."); // informacja
|
||||
@@ -1486,17 +1489,17 @@ TController::TController(bool AI, TDynamicObject *NewControll, bool InitPsyche,
|
||||
if (WriteLogFlag)
|
||||
{
|
||||
mkdir("physicslog\\");
|
||||
LogFile.open("physicslog\\" + VehicleName.c_str() + ".dat",
|
||||
LogFile.open(string("physicslog\\" + VehicleName + ".dat").c_str(),
|
||||
std::ios::in | std::ios::out | std::ios::trunc);
|
||||
#if LOGPRESS == 0
|
||||
LogFile << AnsiString(" Time [s] Velocity [m/s] Acceleration [m/ss] Coupler.Dist[m] "
|
||||
LogFile << string(" Time [s] Velocity [m/s] Acceleration [m/ss] Coupler.Dist[m] "
|
||||
"Coupler.Force[N] TractionForce [kN] FrictionForce [kN] "
|
||||
"BrakeForce [kN] BrakePress [MPa] PipePress [MPa] "
|
||||
"MotorCurrent [A] MCP SCP BCP LBP DmgFlag Command CVal1 CVal2")
|
||||
.c_str() << "\r\n";
|
||||
#endif
|
||||
#if LOGPRESS == 1
|
||||
LogFile << AnsiString("t\tVel\tAcc\tPP\tVVP\tBP\tBVP\tCVP").c_str() << "\n";
|
||||
LogFile << string("t\tVel\tAcc\tPP\tVVP\tBP\tBVP\tCVP").c_str() << "\n";
|
||||
#endif
|
||||
LogFile.flush();
|
||||
}
|
||||
@@ -1874,8 +1877,8 @@ bool TController::CheckVehicles(TOrders user)
|
||||
{
|
||||
if (TrainParams)
|
||||
if (p->asDestination == "none")
|
||||
p->DestinationSet(AnsiString(TrainParams->Relation2.c_str()),
|
||||
AnsiString(TrainParams->TrainName.c_str())); // relacja docelowa, je<6A>li nie by<62>o
|
||||
p->DestinationSet(TrainParams->Relation2,
|
||||
TrainParams->TrainName); // relacja docelowa, je<6A>li nie by<62>o
|
||||
if (AIControllFlag) // je<6A>li prowadzi komputer
|
||||
p->RaLightsSet(0, 0); // gasimy <20>wiat<61>a
|
||||
if (p->MoverParameters->EnginePowerSource.SourceType == CurrentCollector)
|
||||
@@ -2890,7 +2893,7 @@ void TController::RecognizeCommand()
|
||||
}
|
||||
|
||||
void TController::PutCommand(std::string NewCommand, double NewValue1, double NewValue2,
|
||||
const TLocation &NewLocation, TStopReason reason = stopComm)
|
||||
const TLocation &NewLocation, TStopReason reason)
|
||||
{ // wys<79>anie komendy przez event PutValues, jak pojazd ma obsad<61>, to wysy<73>a tutaj, a nie do pojazdu
|
||||
// bezpo<70>rednio
|
||||
vector3 sl;
|
||||
@@ -2902,7 +2905,7 @@ void TController::PutCommand(std::string NewCommand, double NewValue1, double Ne
|
||||
}
|
||||
|
||||
bool TController::PutCommand(std::string NewCommand, double NewValue1, double NewValue2,
|
||||
const vector3 *NewLocation, TStopReason reason = stopComm)
|
||||
const vector3 *NewLocation, TStopReason reason)
|
||||
{ // analiza komendy
|
||||
if (NewCommand == "CabSignal")
|
||||
{ // SHP wyzwalane jest przez cz<63>on z obsad<61>, ale obs<62>ugiwane przez silnikowy
|
||||
@@ -2926,16 +2929,16 @@ bool TController::PutCommand(std::string NewCommand, double NewValue1, double Ne
|
||||
mvOccupied->PutCommand("Emergency_brake", 1.0, 1.0, mvOccupied->Loc);
|
||||
return true; // za<7A>atwione
|
||||
}
|
||||
else if (NewCommand.Pos("Timetable:") == 1)
|
||||
else if (NewCommand.find("Timetable:") == 0)
|
||||
{ // przypisanie nowego rozk<7A>adu jazdy, r<>wnie<69> prowadzonemu przez u<>ytkownika
|
||||
NewCommand.Delete(1, 10); // zostanie nazwa pliku z rozk<7A>adem
|
||||
NewCommand = NewCommand.erase(0, 10); // zostanie nazwa pliku z rozk<7A>adem
|
||||
#if LOGSTOPS
|
||||
WriteLog("New timetable for " + pVehicle->asName + ": " + NewCommand); // informacja
|
||||
#endif
|
||||
if (!TrainParams)
|
||||
TrainParams = new TTrainParameters(std::string(NewCommand.c_str())); // rozk<7A>ad jazdy
|
||||
TrainParams = new TTrainParameters(NewCommand); // rozk<7A>ad jazdy
|
||||
else
|
||||
TrainParams->NewName(std::string(NewCommand.c_str())); // czy<7A>ci tabelk<6C> przystank<6E>w
|
||||
TrainParams->NewName(NewCommand); // czy<7A>ci tabelk<6C> przystank<6E>w
|
||||
delete tsGuardSignal;
|
||||
tsGuardSignal = NULL; // wywalenie kierownika
|
||||
if (NewCommand != "none")
|
||||
@@ -2947,7 +2950,7 @@ bool TController::PutCommand(std::string NewCommand, double NewValue1, double Ne
|
||||
if (ConversionError == -8)
|
||||
ErrorLog("Missed timetable: " + NewCommand);
|
||||
WriteLog("Cannot load timetable file " + NewCommand + "\r\nError " +
|
||||
ConversionError + " in position " + TrainParams->StationCount);
|
||||
to_string(ConversionError) + " in position " + to_string(TrainParams->StationCount));
|
||||
NewCommand = ""; // puste, dla wymiennej tekstury
|
||||
}
|
||||
else
|
||||
@@ -2959,10 +2962,9 @@ bool TController::PutCommand(std::string NewCommand, double NewValue1, double Ne
|
||||
asNextStop = TrainParams->NextStop();
|
||||
iDrivigFlags |= movePrimary; // skoro dosta<74> rozk<7A>ad, to jest teraz g<><67>wnym
|
||||
NewCommand = Global::asCurrentSceneryPath + NewCommand + ".wav"; // na razie jeden
|
||||
if (FileExists(NewCommand))
|
||||
if (fileExists(NewCommand))
|
||||
{ // wczytanie d<>wi<77>ku odjazdu podawanego bezpo<70>renido
|
||||
tsGuardSignal = new TTextSound();
|
||||
tsGuardSignal->Init(NewCommand.c_str(), 30, pVehicle->GetPosition().x,
|
||||
tsGuardSignal = new TTextSound(NewCommand.c_str(), 30, pVehicle->GetPosition().x,
|
||||
pVehicle->GetPosition().y, pVehicle->GetPosition().z,
|
||||
false);
|
||||
// rsGuardSignal->Stop();
|
||||
@@ -2970,23 +2972,22 @@ bool TController::PutCommand(std::string NewCommand, double NewValue1, double Ne
|
||||
}
|
||||
else
|
||||
{
|
||||
NewCommand.Insert("radio", NewCommand.Length() - 3); // wstawienie przed kropk<70>
|
||||
if (FileExists(NewCommand))
|
||||
NewCommand = NewCommand.insert(NewCommand.find_last_of("."),"radio"); // wstawienie przed kropk<70>
|
||||
if (fileExists(NewCommand))
|
||||
{ // wczytanie d<>wi<77>ku odjazdu w wersji radiowej (s<>ycha<68> tylko w kabinie)
|
||||
tsGuardSignal = new TTextSound();
|
||||
tsGuardSignal->Init(NewCommand.c_str(), -1, pVehicle->GetPosition().x,
|
||||
tsGuardSignal = new TTextSound(NewCommand.c_str(), -1, pVehicle->GetPosition().x,
|
||||
pVehicle->GetPosition().y, pVehicle->GetPosition().z,
|
||||
false);
|
||||
iGuardRadio = iRadioChannel;
|
||||
}
|
||||
}
|
||||
NewCommand = AnsiString(TrainParams->Relation2.c_str()); // relacja docelowa z rozk<7A>adu
|
||||
NewCommand = TrainParams->Relation2; // relacja docelowa z rozk<7A>adu
|
||||
}
|
||||
// jeszcze poustawia<69> tekstury na wy<77>wietlaczach
|
||||
TDynamicObject *p = pVehicles[0];
|
||||
while (p)
|
||||
{
|
||||
p->DestinationSet(NewCommand, AnsiString(TrainParams->TrainName.c_str())); // relacja docelowa
|
||||
p->DestinationSet(NewCommand, TrainParams->TrainName); // relacja docelowa
|
||||
p = p->Next(); // pojazd pod<6F><64>czony od ty<74>u (licz<63>c od czo<7A>a)
|
||||
}
|
||||
}
|
||||
@@ -4880,7 +4881,7 @@ void TController::OrdersDump()
|
||||
WriteLog("Orders for " + pVehicle->asName + ":");
|
||||
for (int b = 0; b < maxorders; ++b)
|
||||
{
|
||||
WriteLog(AnsiString(b) + ": " + Order2Str(OrderList[b]) + (OrderPos == b ? " <-" : ""));
|
||||
WriteLog(to_string(b) + ": " + Order2Str(OrderList[b]) + (OrderPos == b ? " <-" : ""));
|
||||
if (b) // z wyj<79>tkiem pierwszej pozycji
|
||||
if (OrderList[b] == Wait_for_orders) // je<6A>li ko<6B>cowa komenda
|
||||
break; // dalej nie trzeba
|
||||
@@ -4988,7 +4989,7 @@ void TController::OrdersInit(double fVel)
|
||||
// Ale mozna by je zapodac ze scenerii
|
||||
};
|
||||
|
||||
AnsiString TController::StopReasonText()
|
||||
string TController::StopReasonText()
|
||||
{ // informacja tekstowa o przyczynie zatrzymania
|
||||
if (eStopReason != 7) // zawalidroga b<>dzie inaczej
|
||||
return StopReasonTable[eStopReason];
|
||||
@@ -5300,11 +5301,11 @@ std::string TController::NextStop()
|
||||
return ""; // tu nie powinno nigdy wej<65><6A>
|
||||
TMTableLine *t = TrainParams->TimeTable + TrainParams->StationIndex;
|
||||
if (t->Dh >= 0) // je<6A>li jest godzina odjazdu
|
||||
return asNextStop.substr(19, 30) + " " + Global::to_string(t->Dh) + ":" +
|
||||
Global::to_string(t->Dm); // odjazd
|
||||
return asNextStop.substr(19, 30) + " " + to_string(t->Dh) + ":" +
|
||||
to_string(t->Dm); // odjazd
|
||||
else if (t->Ah >= 0) // przyjazd
|
||||
return asNextStop.substr(19, 30) + " (" + Global::to_string(t->Ah) + ":" +
|
||||
Global::to_string(t->Am) + ")"; // przyjazd
|
||||
return asNextStop.substr(19, 30) + " (" + to_string(t->Ah) + ":" +
|
||||
to_string(t->Am) + ")"; // przyjazd
|
||||
return "";
|
||||
};
|
||||
|
||||
@@ -5477,5 +5478,5 @@ void TController::RouteSwitch(int d)
|
||||
};
|
||||
std::string TController::OwnerName()
|
||||
{
|
||||
return pVehicle ? pVehicle->MoverParameters->Name : ("none");
|
||||
return pVehicle ? pVehicle->MoverParameters->Name : string("none");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user