mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
Dalsze poprawki do AnsiString w różnych plikach.
This commit is contained in:
@@ -30,11 +30,8 @@ class TTraction; // drut
|
||||
class TTractionPowerSource; // zasilanie drutów
|
||||
|
||||
class TMoverParameters;
|
||||
namespace _mover
|
||||
{
|
||||
class TLocation;
|
||||
class TRotation;
|
||||
};
|
||||
|
||||
namespace Mtable
|
||||
{
|
||||
|
||||
22
Driver.cpp
22
Driver.cpp
@@ -828,9 +828,9 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
{ // zaliczamy posterunek w pewnej odleg<65>o<EFBFBD>ci przed (cho<68> W4 nie zas<61>ania
|
||||
// ju<6A> semafora)
|
||||
#if LOGSTOPS
|
||||
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName.c_str() + ": at " +
|
||||
AnsiString(GlobalTime->hh) + ":" + AnsiString(GlobalTime->mm) +
|
||||
" skipped " + AnsiString(asNextStop.c_str())); // informacja
|
||||
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName + ": at " +
|
||||
to_string(GlobalTime->hh) + ":" + to_string(GlobalTime->mm) +
|
||||
" skipped " + asNextStop.); // informacja
|
||||
#endif
|
||||
fLastStopExpDist = mvOccupied->DistCounter + 0.250 +
|
||||
0.001 * fLength; // przy jakim dystansie (stanie
|
||||
@@ -999,10 +999,10 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
asNextStop = TrainParams->NextStop(); // pobranie kolejnego miejsca zatrzymania
|
||||
// TableClear(); //aby od nowa sprawdzi<7A>o W4 z inn<6E> nazw<7A> ju<6A> - to nie jest dobry pomys<79>
|
||||
#if LOGSTOPS
|
||||
WriteLog(pVehicle->asName + " as " + AnsiString(TrainParams->TrainName.c_str()) +
|
||||
": at " + AnsiString(GlobalTime->hh) + ":" +
|
||||
AnsiString(GlobalTime->mm) + " next " +
|
||||
AnsiString(asNextStop.c_str())); // informacja
|
||||
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName +
|
||||
": at " + to_string(GlobalTime->hh) + ":" +
|
||||
to_string(GlobalTime->mm) + " next " +
|
||||
asNextStop); // informacja
|
||||
#endif
|
||||
if (int(floor(sSpeedTable[i].evEvent->ValueGet(1))) & 1)
|
||||
iDrivigFlags |= moveStopHere; // nie podje<6A>d<EFBFBD>a<EFBFBD> do semafora,
|
||||
@@ -1026,9 +1026,9 @@ 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 " + AnsiString(TrainParams->TrainName.c_str()) +
|
||||
": at " + AnsiString(GlobalTime->hh) + ":" +
|
||||
AnsiString(GlobalTime->mm) +
|
||||
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName) +
|
||||
": at " + to_string(GlobalTime->hh) + ":" +
|
||||
to_string(GlobalTime->mm) +
|
||||
" end of route."); // informacja
|
||||
#endif
|
||||
asNextStop = TrainParams->NextStop(); // informacja o ko<6B>cu trasy
|
||||
@@ -1486,7 +1486,7 @@ TController::TController(bool AI, TDynamicObject *NewControll, bool InitPsyche,
|
||||
if (WriteLogFlag)
|
||||
{
|
||||
mkdir("physicslog\\");
|
||||
LogFile.open(AnsiString("physicslog\\" + VehicleName + ".dat").c_str(),
|
||||
LogFile.open("physicslog\\" + VehicleName.c_str() + ".dat",
|
||||
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] "
|
||||
|
||||
2
Driver.h
2
Driver.h
@@ -288,7 +288,7 @@ class TController
|
||||
private:
|
||||
double fMaxProximityDist; // akceptowalna odległość stanięcia przed przeszkodą
|
||||
TStopReason eStopReason; // powód zatrzymania przy ustawieniu zerowej prędkości
|
||||
AnsiString VehicleName;
|
||||
std::string VehicleName;
|
||||
double fVelPlus; // dopuszczalne przekroczenie prędkości na ograniczeniu bez hamowania
|
||||
double fVelMinus; // margines obniżenia prędkości, powodujący załączenie napędu
|
||||
double fWarningDuration; // ile czasu jeszcze trąbić
|
||||
|
||||
@@ -163,7 +163,7 @@ void TEvent::Load(cParser *parser, vector3 *org)
|
||||
|
||||
parser->getTokens();
|
||||
*parser >> token;
|
||||
asName = AnsiString(token.c_str()).LowerCase(); // u¿ycie parametrów mo¿e dawaæ wielkie
|
||||
asName = ToLower(token); // u¿ycie parametrów mo¿e dawaæ wielkie
|
||||
|
||||
parser->getTokens();
|
||||
*parser >> token;
|
||||
@@ -224,7 +224,7 @@ void TEvent::Load(cParser *parser, vector3 *org)
|
||||
if (str != "none")
|
||||
asNodeName = str; // nazwa obiektu powi¹zanego
|
||||
|
||||
if (asName.SubString(1, 5) == "none_")
|
||||
if (asName.substr(0, 5) == "none_")
|
||||
Type = tp_Ignored; // Ra: takie s¹ ignorowane
|
||||
|
||||
switch (Type)
|
||||
@@ -568,9 +568,9 @@ void TEvent::Load(cParser *parser, vector3 *org)
|
||||
ti = !ti; // zmiana flagi dla s³owa "else"
|
||||
}
|
||||
else if (i >= 8)
|
||||
ErrorLog("Bad event: \"" + str + "\" ignored in multiple \"" + asName + "\"!");
|
||||
ErrorLog("Bad event: \"" + string(str.c_str()) + "\" ignored in multiple \"" + asName + "\"!");
|
||||
else
|
||||
WriteLog("Event \"" + str + "\" ignored in multiple \"" + asName + "\"!");
|
||||
WriteLog("Event \"" + string(str.c_str()) + "\" ignored in multiple \"" + asName + "\"!");
|
||||
parser->getTokens();
|
||||
*parser >> token;
|
||||
str = AnsiString(token.c_str());
|
||||
|
||||
2
Event.h
2
Event.h
@@ -12,6 +12,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include "Classes.h"
|
||||
#include "dumb3d.h"
|
||||
#include <string>
|
||||
|
||||
using namespace Math3D;
|
||||
|
||||
typedef enum
|
||||
|
||||
@@ -976,7 +976,7 @@ std::string to_string(double _Val, int precision, int width)
|
||||
return o.str();
|
||||
};
|
||||
|
||||
std::string to_hex_str(double _Val, int precision = 0, int width = 0)
|
||||
std::string to_hex_str(double _Val, int precision, int width)
|
||||
{
|
||||
std::ostringstream o;
|
||||
if (width)
|
||||
|
||||
@@ -333,7 +333,7 @@ class Global
|
||||
std::string to_string(double _Val);
|
||||
std::string to_string(double _Val, int precision);
|
||||
std::string to_string(double _Val, int precision, int width);
|
||||
std::string to_hex_str(int _Val, int precision, int width);
|
||||
std::string to_hex_str(int _Val, int precision = 0, int width = 0);
|
||||
|
||||
|
||||
std::string ToLower(std::string text);
|
||||
|
||||
8
Logs.cpp
8
Logs.cpp
@@ -75,6 +75,7 @@ void WriteLog(const char *str, bool newline)
|
||||
WriteConsoleOnly(str, newline);
|
||||
}
|
||||
};
|
||||
|
||||
void ErrorLog(const char *str)
|
||||
{ // Ra: bezwarunkowa rejestracja powa¿nych b³êdów
|
||||
if (!errors.is_open())
|
||||
@@ -94,6 +95,13 @@ void Error(const AnsiString &asMessage, bool box)
|
||||
MessageBox(NULL, asMessage.c_str(), AnsiString("EU07 " + Global::asRelease).c_str(), MB_OK);
|
||||
WriteLog(asMessage.c_str());
|
||||
}
|
||||
|
||||
void ErrorLog(const std::string &str, bool newline = true)
|
||||
{
|
||||
ErrorLog(str.c_str());
|
||||
WriteLog(str.c_str(), newline);
|
||||
}
|
||||
|
||||
void ErrorLog(const AnsiString &asMessage)
|
||||
{ // zapisywanie b³êdów "errors.txt"
|
||||
ErrorLog(asMessage.c_str());
|
||||
|
||||
3
Logs.h
3
Logs.h
@@ -17,7 +17,8 @@ void WriteConsoleOnly(const char *str, bool newline = true);
|
||||
void WriteLog(const char *str, double value);
|
||||
void WriteLog(const char *str, bool newline = true);
|
||||
void Error(const AnsiString &asMessage, bool box = true);
|
||||
void ErrorLog(const AnsiString &asMessage);
|
||||
void ErrorLog(const std::string &str, bool newline = true);
|
||||
//void ErrorLog(const AnsiString &asMessage);
|
||||
void WriteLog(const AnsiString &str, bool newline = true);
|
||||
void WriteLog(const std::string &str, bool newline = true);
|
||||
void CommLog(const char *str);
|
||||
|
||||
15
MdlMngr.cpp
15
MdlMngr.cpp
@@ -20,6 +20,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include "MdlMngr.h"
|
||||
#include "Globals.h"
|
||||
#include <string>
|
||||
|
||||
#define SeekFiles AnsiString("*.t3d")
|
||||
|
||||
@@ -99,7 +100,7 @@ TModel3d * TModelsManager::GetModel(const char *Name, bool dynamic)
|
||||
// - niebo animowane, œcie¿ka brana ze wpisu, tekstury nieokreœlone
|
||||
// - wczytanie modelu animowanego - Init() - sprawdziæ
|
||||
char buf[255];
|
||||
AnsiString buftp = Global::asCurrentTexturePath; // zapamiêtanie aktualnej œcie¿ki do tekstur,
|
||||
std::string buftp = Global::asCurrentTexturePath; // zapamiêtanie aktualnej œcie¿ki do tekstur,
|
||||
// bo bêdzie tyczmasowo zmieniana
|
||||
/*
|
||||
// Ra: niby tak jest lepiej, ale dzia³a gorzej, wiêc przywrócone jest oryginalne
|
||||
@@ -148,9 +149,9 @@ TModel3d * TModelsManager::GetModel(const char *Name, bool dynamic)
|
||||
strcat(buf, Name);
|
||||
if (strchr(Name, '/') != NULL)
|
||||
{
|
||||
Global::asCurrentTexturePath = Global::asCurrentTexturePath + AnsiString(Name);
|
||||
Global::asCurrentTexturePath.Delete(Global::asCurrentTexturePath.Pos("/") + 1,
|
||||
Global::asCurrentTexturePath.Length());
|
||||
Global::asCurrentTexturePath = Global::asCurrentTexturePath + Name;
|
||||
Global::asCurrentTexturePath.erase(Global::asCurrentTexturePath.find("/") + 1,
|
||||
Global::asCurrentTexturePath.length());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -159,9 +160,9 @@ TModel3d * TModelsManager::GetModel(const char *Name, bool dynamic)
|
||||
if (dynamic) // na razie tak, bo nie wiadomo, jaki mo¿e mieæ wp³yw na pozosta³e modele
|
||||
if (strchr(Name, '/') != NULL)
|
||||
{ // pobieranie tekstur z katalogu, w którym jest model
|
||||
Global::asCurrentTexturePath = Global::asCurrentTexturePath + AnsiString(Name);
|
||||
Global::asCurrentTexturePath.Delete(Global::asCurrentTexturePath.Pos("/") + 1,
|
||||
Global::asCurrentTexturePath.Length());
|
||||
Global::asCurrentTexturePath = Global::asCurrentTexturePath + Name;
|
||||
Global::asCurrentTexturePath.erase(Global::asCurrentTexturePath.find("/") + 1,
|
||||
Global::asCurrentTexturePath.length() - 1);
|
||||
}
|
||||
}
|
||||
StrLower(buf);
|
||||
|
||||
10
Model3d.cpp
10
Model3d.cpp
@@ -1624,11 +1624,11 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, float8 *v, TStringPack *t, TS
|
||||
// TextureID=TTexturesManager::GetTextureID(t->String(TextureID));
|
||||
// asTexture=AnsiString(t->String(iTexture));
|
||||
pTexture = t->String(iTexture);
|
||||
AnsiString t = AnsiString(pTexture);
|
||||
if (t.LastDelimiter("/\\") == 0)
|
||||
t.Insert(Global::asCurrentTexturePath, 1);
|
||||
TextureID = TTexturesManager::GetTextureID(szTexturePath,
|
||||
Global::asCurrentTexturePath.c_str(), t.c_str());
|
||||
string tex = pTexture;
|
||||
if (tex.find_last_of("/\\") == string::npos)
|
||||
tex.insert(0, Global::asCurrentTexturePath);
|
||||
TextureID = TTexturesManager::GetTextureID(
|
||||
szTexturePath, const_cast<char*>(Global::asCurrentTexturePath.c_str()), tex);
|
||||
// TexAlpha=TTexturesManager::GetAlpha(TextureID); //zmienna robocza
|
||||
// ustawienie cyklu przezroczyste/nieprzezroczyste zale¿nie od w³asnoœci
|
||||
// sta³ej tekstury
|
||||
|
||||
@@ -400,7 +400,7 @@ void TPythonScreens::reset(void *train)
|
||||
_train = train;
|
||||
}
|
||||
|
||||
void TPythonScreens::init(TQueryParserComp *parser, TModel3d *model, AnsiString name, int cab)
|
||||
void TPythonScreens::init(TQueryParserComp *parser, TModel3d *model, string name, int cab)
|
||||
{
|
||||
char buff[255];
|
||||
AnsiString asSubModelName = parser->GetNextSymbol();
|
||||
@@ -471,13 +471,13 @@ void TPythonScreens::update()
|
||||
_cleanupReadyFlag = true;
|
||||
}
|
||||
|
||||
void TPythonScreens::setLookupPath(AnsiString path)
|
||||
void TPythonScreens::setLookupPath(string path)
|
||||
{
|
||||
if (_lookupPath != NULL)
|
||||
{
|
||||
free(_lookupPath);
|
||||
}
|
||||
_lookupPath = (char *)calloc(path.Length() + 1, sizeof(char));
|
||||
_lookupPath = (char *)calloc(path.length() + 1, sizeof(char));
|
||||
strcpy(_lookupPath, path.c_str());
|
||||
}
|
||||
|
||||
|
||||
7
PyInt.h
7
PyInt.h
@@ -8,6 +8,9 @@
|
||||
#include "Model3d.h"
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define PyGetFloat(param) PyFloat_FromDouble(param >= 0 ? param : -param)
|
||||
#define PyGetFloatS(param) PyFloat_FromDouble(param)
|
||||
@@ -85,8 +88,8 @@ class TPythonScreens
|
||||
|
||||
public:
|
||||
void reset(void *train);
|
||||
void setLookupPath(AnsiString path);
|
||||
void init(TQueryParserComp *parser, TModel3d *model, AnsiString name, int cab);
|
||||
void setLookupPath(string path);
|
||||
void init(TQueryParserComp *parser, TModel3d *model, string name, int cab);
|
||||
void update();
|
||||
TPythonScreens();
|
||||
~TPythonScreens();
|
||||
|
||||
@@ -75,7 +75,7 @@ TTexturesManager::Names::iterator TTexturesManager::LoadFromFile(std::string fil
|
||||
if (!texinfo.first)
|
||||
{
|
||||
WriteLog("Failed");
|
||||
ErrorLog("Missed texture: " + AnsiString(realFileName.c_str()));
|
||||
ErrorLog("Missed texture: " + realFileName);
|
||||
return _names.end();
|
||||
};
|
||||
|
||||
|
||||
@@ -3104,7 +3104,7 @@ void TTrack::MovedUp1(double dh)
|
||||
fTexHeight1 += dh;
|
||||
};
|
||||
|
||||
AnsiString TTrack::NameGet()
|
||||
string TTrack::NameGet()
|
||||
{ // ustalenie nazwy toru
|
||||
if (this)
|
||||
if (pMyNode)
|
||||
|
||||
3
Track.h
3
Track.h
@@ -15,6 +15,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "opengl/glew.h"
|
||||
#include <system.hpp>
|
||||
#include "Classes.h"
|
||||
#include <string>
|
||||
|
||||
class TEvent;
|
||||
|
||||
@@ -275,7 +276,7 @@ class TTrack : public Resource
|
||||
bool IsGroupable();
|
||||
int TestPoint(vector3 *Point);
|
||||
void MovedUp1(double dh);
|
||||
AnsiString NameGet();
|
||||
string NameGet();
|
||||
void VelocitySet(float v);
|
||||
float VelocityGet();
|
||||
void ConnectionsLog();
|
||||
|
||||
45
Train.cpp
45
Train.cpp
@@ -24,6 +24,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "Console.h"
|
||||
#include "McZapkie\hamulce.h"
|
||||
#include <typeinfo>
|
||||
#include <fstream>
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma package(smart_init)
|
||||
@@ -2709,7 +2710,7 @@ bool TTrain::Update()
|
||||
bDoors[i][2] = (p->dDoorMoveL > 0.001);
|
||||
iDoorNo[i] = p->iAnimType[ANIM_DOORS];
|
||||
iUnits[i] = iUnitNo;
|
||||
cCode[i] = p->MoverParameters->TypeName[p->MoverParameters->TypeName.Length()];
|
||||
cCode[i] = p->MoverParameters->TypeName[p->MoverParameters->TypeName.length()];
|
||||
asCarName[i] = p->GetName();
|
||||
bPants[iUnitNo - 1][0] = (bPants[iUnitNo - 1][0] || p->MoverParameters->PantFrontUp);
|
||||
bPants[iUnitNo - 1][1] = (bPants[iUnitNo - 1][1] || p->MoverParameters->PantRearUp);
|
||||
@@ -5010,15 +5011,18 @@ bool TTrain::CabChange(int iDirection)
|
||||
bool TTrain::LoadMMediaFile(std::string asFileName)
|
||||
{
|
||||
double dSDist;
|
||||
TFileStream *fs;
|
||||
fs = new TFileStream(asFileName, fmOpenRead | fmShareCompat);
|
||||
AnsiString str = "";
|
||||
std::ifstream t(asFileName.c_str());
|
||||
std::stringstream buffer;
|
||||
buffer << t.rdbuf();
|
||||
//TFileStream *fs;
|
||||
//fs = new TFileStream(asFileName, fmOpenRead | fmShareCompat);
|
||||
AnsiString str = AnsiString(buffer.str().c_str());
|
||||
// DecimalSeparator='.';
|
||||
int size = fs->Size;
|
||||
str.SetLength(size);
|
||||
fs->Read(str.c_str(), size);
|
||||
str += "";
|
||||
delete fs;
|
||||
//int size = fs->Size;
|
||||
//str.SetLength(size);
|
||||
//fs->Read(str.c_str(), size);
|
||||
//str += "";
|
||||
//delete fs;
|
||||
TQueryParserComp *Parser;
|
||||
Parser = new TQueryParserComp(NULL);
|
||||
Parser->TextToParse = str;
|
||||
@@ -5302,15 +5306,18 @@ bool TTrain::InitializeCab(int NewCabNo, std::string asFileName)
|
||||
pyScreens.setLookupPath(DynamicObject->asBaseDir);
|
||||
bool parse = false;
|
||||
double dSDist;
|
||||
TFileStream *fs;
|
||||
fs = new TFileStream(asFileName, fmOpenRead | fmShareCompat);
|
||||
AnsiString str = "";
|
||||
std::ifstream t(asFileName.c_str());
|
||||
std::stringstream buffer;
|
||||
buffer << t.rdbuf();
|
||||
//TFileStream *fs;
|
||||
//fs = new TFileStream(asFileName, fmOpenRead | fmShareCompat);
|
||||
AnsiString str = AnsiString(buffer.str().c_str());
|
||||
// DecimalSeparator='.';
|
||||
int size = fs->Size;
|
||||
str.SetLength(size);
|
||||
fs->Read(str.c_str(), size);
|
||||
str += "";
|
||||
delete fs;
|
||||
//int size = fs->Size;
|
||||
//str.SetLength(size);
|
||||
//fs->Read(str.c_str(), size);
|
||||
//str += "";
|
||||
//delete fs;
|
||||
TQueryParserComp *Parser;
|
||||
Parser = new TQueryParserComp(NULL);
|
||||
Parser->TextToParse = str;
|
||||
@@ -5386,13 +5393,13 @@ bool TTrain::InitializeCab(int NewCabNo, std::string asFileName)
|
||||
str = Parser->GetNextSymbol().LowerCase();
|
||||
if (str != AnsiString("none"))
|
||||
{
|
||||
str = DynamicObject->asBaseDir + str;
|
||||
str = AnsiString(DynamicObject->asBaseDir.c_str()) + str;
|
||||
Global::asCurrentTexturePath =
|
||||
DynamicObject->asBaseDir; // bie¿¹ca sciezka do tekstur to dynamic/...
|
||||
TModel3d *k = TModelsManager::GetModel(
|
||||
str.c_str(), true); // szukaj kabinê jako oddzielny model
|
||||
Global::asCurrentTexturePath =
|
||||
AnsiString(szTexturePath); // z powrotem defaultowa sciezka do tekstur
|
||||
szTexturePath; // z powrotem defaultowa sciezka do tekstur
|
||||
// if (DynamicObject->mdKabina!=k)
|
||||
if (k)
|
||||
DynamicObject->mdKabina = k; // nowa kabina
|
||||
|
||||
2
Train.h
2
Train.h
@@ -388,7 +388,7 @@ class TTrain
|
||||
int iUnits[20]; // numer jednostki
|
||||
int iDoorNo[20]; // liczba drzwi
|
||||
char cCode[20]; //kod pojazdu
|
||||
AnsiString asCarName[20]; //nazwa czlonu
|
||||
string asCarName[20]; //nazwa czlonu
|
||||
bool bMains[8]; //WSy
|
||||
float fCntVol[8]; //napiecie NN
|
||||
bool bPants[8][2]; //podniesienie pantografow
|
||||
|
||||
Reference in New Issue
Block a user