mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Poprawki do działania tabelki rozkładów. Poprawka funkcji konwersji int na string.
This commit is contained in:
@@ -39,6 +39,7 @@ class TRotation;
|
||||
namespace Mtable
|
||||
{
|
||||
class TTrainParameters; // rozk³ad jazdy
|
||||
class TMtableTime; // czas dla danego posterunku
|
||||
};
|
||||
|
||||
class TController; // obiekt steruj¹cy poci¹giem (AI)
|
||||
|
||||
14
Driver.cpp
14
Driver.cpp
@@ -838,7 +838,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
// następny postój
|
||||
TrainParams->UpdateMTable(
|
||||
GlobalTime->hh, GlobalTime->mm,
|
||||
asNextStop.substr(20, asNextStop.length()));
|
||||
asNextStop.substr(19, asNextStop.length()));
|
||||
TrainParams->StationIndexInc(); // przejście do następnej
|
||||
asNextStop =
|
||||
TrainParams->NextStop(); // pobranie kolejnego miejsca zatrzymania
|
||||
@@ -5292,20 +5292,18 @@ TCommandType TController::BackwardScan()
|
||||
|
||||
std::string TController::NextStop()
|
||||
{ // informacja o następnym zatrzymaniu, wyświetlane pod [F1]
|
||||
if (asNextStop.length() < 20)
|
||||
if (asNextStop.length() < 19)
|
||||
return ""; // nie zawiera nazwy stacji, gdy dojechał do końca
|
||||
// dodać godzinę odjazdu
|
||||
if (!TrainParams)
|
||||
return ""; // tu nie powinno nigdy wejść
|
||||
TMTableLine *t = TrainParams->TimeTable + TrainParams->StationIndex;
|
||||
std::string tmp = "";
|
||||
if (t->Dh >= 0) // jeśli jest godzina odjazdu
|
||||
return asNextStop.substr(20, 30) + " " + Global::to_string(t->Dh) +
|
||||
":" + Global::to_string(100 + t->Dm).substr(2, 2); // odjazd
|
||||
return asNextStop.substr(19, 30) + " " + Global::to_string(t->Dh) + ":" +
|
||||
Global::to_string(t->Dm); // odjazd
|
||||
else if (t->Ah >= 0) // przyjazd
|
||||
return asNextStop.substr(20, 30) + " (" + Global::to_string(t->Ah) +
|
||||
":" + Global::to_string(100 + t->Am).substr(2, 2) +
|
||||
")"; // przyjazd
|
||||
return asNextStop.substr(19, 30) + " (" + Global::to_string(t->Ah) + ":" +
|
||||
Global::to_string(t->Am) + ")"; // przyjazd
|
||||
return "";
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "Console.h"
|
||||
#include <Controls.hpp> //do odczytu daty
|
||||
#include "World.h"
|
||||
|
||||
#include <ostream>
|
||||
// namespace Global {
|
||||
|
||||
// parametry do u¿ytku wewnêtrznego
|
||||
@@ -921,10 +921,9 @@ double Global::CutValueToRange(double min, double value, double max)
|
||||
|
||||
std::string Global::to_string(int _Val)
|
||||
{
|
||||
std::string str;
|
||||
int num = 3;
|
||||
sprintf((char*)str.c_str(), "%d", _Val);
|
||||
return str;
|
||||
std::ostringstream o;
|
||||
o << _Val;
|
||||
return o.str();
|
||||
};
|
||||
|
||||
#pragma package(smart_init)
|
||||
|
||||
@@ -14,7 +14,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "mtable.h"
|
||||
#include <fstream>
|
||||
|
||||
using namespace Mtable;
|
||||
//using namespace Mtable;
|
||||
TMTableTime *Mtable::GlobalTime;
|
||||
|
||||
double CompareTime(double t1h, double t1m, double t2h, double t2m) /*roznica czasu w minutach*/
|
||||
// zwraca ró¿nicê czasu
|
||||
|
||||
10
mtable.h
10
mtable.h
@@ -77,9 +77,10 @@ namespace Mtable
|
||||
void StationIndexInc();
|
||||
};
|
||||
|
||||
struct /*class*/ TMTableTime
|
||||
class TMTableTime
|
||||
|
||||
{
|
||||
public:
|
||||
double GameTime;
|
||||
int dd;
|
||||
int hh;
|
||||
@@ -93,6 +94,11 @@ namespace Mtable
|
||||
TMTableTime(int InitH, int InitM, int InitSRH, int InitSRM, int InitSSH, int InitSSM);
|
||||
};
|
||||
|
||||
TMTableTime *GlobalTime;
|
||||
extern TMTableTime *GlobalTime;
|
||||
}
|
||||
|
||||
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
|
||||
using namespace Mtable;
|
||||
#endif
|
||||
|
||||
#endif // MTABLE_H
|
||||
|
||||
Reference in New Issue
Block a user