mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
basic patches for most of discovered memory leaks, fixes for brake system components
This commit is contained in:
@@ -10,7 +10,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
#ifndef AdvSoundH
|
||||
#define AdvSoundH
|
||||
|
||||
#include "Sound.h"
|
||||
#include "RealSound.h"
|
||||
#include "parser.h"
|
||||
|
||||
|
||||
@@ -298,7 +298,7 @@ std::string TSpeedPos::TableText()
|
||||
{ // pozycja tabelki pr<70>dko<6B>ci
|
||||
if (iFlags & spEnabled)
|
||||
{ // o ile pozycja istotna
|
||||
return "Flags=#" + to_hex_str(iFlags, 8) + ", Dist=" + to_string(fDist, 1, 7) +
|
||||
return "Flags=" + to_hex_str(iFlags, 6) + ", Dist=" + to_string(fDist, 1, 7) +
|
||||
", Vel=" + std::to_string(fVelNext) + ", Name=" + GetName();
|
||||
//if (iFlags & spTrack) // je<6A>li tor
|
||||
// return "Flags=#" + IntToHex(iFlags, 8) + ", Dist=" + FloatToStrF(fDist, ffFixed, 7, 1) +
|
||||
@@ -495,12 +495,9 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
|
||||
pTrack = sSpeedTable[iLast].trTrack; // ostatnio sprawdzony tor
|
||||
if (!pTrack)
|
||||
return; // koniec toru, to nie ma co sprawdza<7A> (nie ma prawa tak by<62>)
|
||||
fLastDir = sSpeedTable[iLast].iFlags & spReverse ?
|
||||
-1.0 :
|
||||
1.0; // flaga ustawiona, gdy Point2 toru jest bli<6C>ej
|
||||
fLastDir = (sSpeedTable[iLast].iFlags & spReverse) ? -1.0 : 1.0; // flaga ustawiona, gdy Point2 toru jest bli<6C>ej
|
||||
fCurrentDistance = sSpeedTable[iLast].fDist; // aktualna odleg<65>o<EFBFBD><6F> do jego Point1
|
||||
fTrackLength =
|
||||
sSpeedTable[iLast].iFlags & (spElapsed | spEnd) ? 0.0 : pTrack->Length(); // nie dolicza<7A> d<>ugo<67>ci gdy:
|
||||
fTrackLength = (sSpeedTable[iLast].iFlags & (spElapsed | spEnd)) ? 0.0 : pTrack->Length(); // nie dolicza<7A> d<>ugo<67>ci gdy:
|
||||
// 32-mini<6E>ty pocz<63>tek,
|
||||
// 64-jazda do ko<6B>ca toru
|
||||
}
|
||||
|
||||
27
DynObj.cpp
27
DynObj.cpp
@@ -1886,11 +1886,11 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
||||
{
|
||||
}
|
||||
} // koniec hamulce
|
||||
else if (ActPar.substr(0, 1) == "") // tu mozna wpisac inny prefiks i inne rzeczy
|
||||
/* else if (ActPar.substr(0, 1) == "") // tu mozna wpisac inny prefiks i inne rzeczy
|
||||
{
|
||||
// jakies inne prefiksy
|
||||
}
|
||||
|
||||
*/
|
||||
} // koniec while kropka
|
||||
|
||||
if (MoverParameters->CategoryFlag & 2) // jeśli samochód
|
||||
@@ -5748,22 +5748,13 @@ int TDynamicObject::RouteWish(TTrack *tr)
|
||||
|
||||
std::string TDynamicObject::TextureTest(std::string const &name)
|
||||
{ // Ra 2015-01: sprawdzenie dostępności tekstury o podanej nazwie
|
||||
std::string x = name + ".dds"; // na razie prymitywnie
|
||||
if (FileExists(x.c_str()))
|
||||
return x;
|
||||
else
|
||||
{
|
||||
x = name + ".tga"; // w zasadzie to należałoby uwzględnić deklarowaną kolejność
|
||||
if (FileExists(x.c_str()))
|
||||
return x;
|
||||
else
|
||||
{
|
||||
x = name + ".bmp";
|
||||
if (FileExists(x.c_str()))
|
||||
return x;
|
||||
}
|
||||
}
|
||||
return ""; // nie znaleziona
|
||||
std::vector<std::string> extensions = { ".dds", ".tga", ".bmp" };
|
||||
for( auto const &extension : extensions ) {
|
||||
if( true == FileExists( name + extension ) ) {
|
||||
return name + extension;
|
||||
}
|
||||
}
|
||||
return ""; // nie znaleziona
|
||||
};
|
||||
|
||||
void TDynamicObject::DestinationSet(std::string to, std::string numer)
|
||||
|
||||
7
EU07.cpp
7
EU07.cpp
@@ -26,8 +26,9 @@ Stele, firleju, szociu, hunter, ZiomalCl, OLI_EU and others
|
||||
#include "opengl/ARB_Multisample.h"
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Console.h"
|
||||
#include "Logs.h"
|
||||
#include "Console.h"
|
||||
#include "PyInt.h"
|
||||
#include "World.h"
|
||||
#include "Mover.h"
|
||||
|
||||
@@ -582,7 +583,7 @@ int WINAPI WinMain(HINSTANCE hInstance, // instance
|
||||
Global::LoadIniFile("eu07.ini"); // teraz dopiero mo¿na przejrzeæ plik z ustawieniami
|
||||
Global::InitKeys("keys.ini"); // wczytanie mapowania klawiszy - jest na sta³e
|
||||
|
||||
// hunter-271211: ukrywanie konsoli
|
||||
// hunter-271211: ukrywanie konsoli
|
||||
if (Global::iWriteLogEnabled & 2)
|
||||
{
|
||||
AllocConsole();
|
||||
@@ -701,6 +702,8 @@ int WINAPI WinMain(HINSTANCE hInstance, // instance
|
||||
SystemParametersInfo(SPI_SETKEYBOARDSPEED, iOldSpeed, NULL, 0);
|
||||
SystemParametersInfo(SPI_SETKEYBOARDDELAY, iOldDelay, NULL, 0);
|
||||
delete pConsole; // deaktywania sterownika
|
||||
TPythonInterpreter::killInstance();
|
||||
|
||||
// shutdown
|
||||
KillGLWindow(); // kill the window
|
||||
return (msg.wParam); // exit the program
|
||||
|
||||
48
Event.cpp
48
Event.cpp
@@ -72,6 +72,9 @@ TEvent::~TEvent()
|
||||
delete[] Params[8].asPointer; // zwolniæ obszar
|
||||
case tp_GetValues: // nic
|
||||
break;
|
||||
case tp_PutValues: // params[0].astext stores the token
|
||||
SafeDeleteArray( Params[ 0 ].asText );
|
||||
break;
|
||||
}
|
||||
evJoined = NULL; // nie usuwaæ podczepionych tutaj
|
||||
};
|
||||
@@ -87,6 +90,7 @@ void TEvent::Conditions(cParser *parser, string s)
|
||||
std::string token, str;
|
||||
if (!asNodeName.empty())
|
||||
{ // podczepienie ³añcucha, jeœli nie jest pusty
|
||||
// NOTE: source of a memory leak -- the array never gets deleted. fix the destructor
|
||||
Params[9].asText = new char[asNodeName.length() + 1]; // usuwane i zamieniane na
|
||||
// wskaŸnik
|
||||
strcpy(Params[9].asText, asNodeName.c_str());
|
||||
@@ -457,34 +461,43 @@ void TEvent::Load(cParser *parser, vector3 *org)
|
||||
{ // obrót wzglêdem osi
|
||||
parser->getTokens();
|
||||
*parser >> token;
|
||||
Params[9].asText = new char[255]; // nazwa submodelu
|
||||
strcpy(Params[9].asText, token.c_str());
|
||||
Params[9].asText = new char[token.size() + 1]; // nazwa submodelu
|
||||
std::strcpy(Params[9].asText, token.c_str());
|
||||
Params[0].asInt = 1;
|
||||
parser->getTokens(4);
|
||||
*parser >> Params[1].asdouble >> Params[2].asdouble >> Params[3].asdouble >>
|
||||
Params[4].asdouble;
|
||||
*parser
|
||||
>> Params[1].asdouble
|
||||
>> Params[2].asdouble
|
||||
>> Params[3].asdouble
|
||||
>> Params[4].asdouble;
|
||||
}
|
||||
else if (token.compare("translate") == 0)
|
||||
{ // przesuw o wektor
|
||||
parser->getTokens();
|
||||
*parser >> token;
|
||||
Params[9].asText = new char[255]; // nazwa submodelu
|
||||
strcpy(Params[9].asText, token.c_str());
|
||||
Params[9].asText = new char[token.size() + 1]; // nazwa submodelu
|
||||
std::strcpy(Params[9].asText, token.c_str());
|
||||
Params[0].asInt = 2;
|
||||
parser->getTokens(4);
|
||||
*parser >> Params[1].asdouble >> Params[2].asdouble >> Params[3].asdouble >>
|
||||
Params[4].asdouble;
|
||||
*parser
|
||||
>> Params[1].asdouble
|
||||
>> Params[2].asdouble
|
||||
>> Params[3].asdouble
|
||||
>> Params[4].asdouble;
|
||||
}
|
||||
else if (token.compare("digital") == 0)
|
||||
{ // licznik cyfrowy
|
||||
parser->getTokens();
|
||||
*parser >> token;
|
||||
Params[9].asText = new char[255]; // nazwa submodelu
|
||||
strcpy(Params[9].asText, token.c_str());
|
||||
Params[9].asText = new char[token.size() + 1]; // nazwa submodelu
|
||||
std::strcpy(Params[9].asText, token.c_str());
|
||||
Params[0].asInt = 8;
|
||||
parser->getTokens(4); // jaki ma byæ sens tych parametrów?
|
||||
*parser >> Params[1].asdouble >> Params[2].asdouble >> Params[3].asdouble >>
|
||||
Params[4].asdouble;
|
||||
*parser
|
||||
>> Params[1].asdouble
|
||||
>> Params[2].asdouble
|
||||
>> Params[3].asdouble
|
||||
>> Params[4].asdouble;
|
||||
}
|
||||
else if (token.substr(token.length() - 4, 4) == ".vmd") // na razie tu, mo¿e bêdzie inaczej
|
||||
{ // animacja z pliku VMD
|
||||
@@ -499,12 +512,15 @@ void TEvent::Load(cParser *parser, vector3 *org)
|
||||
}
|
||||
parser->getTokens();
|
||||
*parser >> token;
|
||||
Params[9].asText = new char[255]; // nazwa submodelu
|
||||
strcpy(Params[9].asText, token.c_str());
|
||||
Params[9].asText = new char[token.size() + 1]; // nazwa submodelu
|
||||
std::strcpy(Params[9].asText, token.c_str());
|
||||
Params[0].asInt = 4; // rodzaj animacji
|
||||
parser->getTokens(4);
|
||||
*parser >> Params[1].asdouble >> Params[2].asdouble >> Params[3].asdouble >>
|
||||
Params[4].asdouble;
|
||||
*parser
|
||||
>> Params[1].asdouble
|
||||
>> Params[2].asdouble
|
||||
>> Params[3].asdouble
|
||||
>> Params[4].asdouble;
|
||||
}
|
||||
parser->getTokens();
|
||||
*parser >> token;
|
||||
|
||||
11
Ground.cpp
11
Ground.cpp
@@ -117,6 +117,9 @@ TGroundNode::~TGroundNode()
|
||||
delete Model;
|
||||
Model = NULL;
|
||||
break;
|
||||
case TP_SOUND:
|
||||
SafeDelete(tsStaticSound);
|
||||
break;
|
||||
case TP_TERRAIN:
|
||||
{ // pierwsze nNode zawiera model E3D, reszta to trójk¹ty
|
||||
for (int i = 1; i < iCount; ++i)
|
||||
@@ -697,6 +700,7 @@ TSubRect::~TSubRect()
|
||||
if (Global::bManageNodes) // Ra: tu siê coœ sypie
|
||||
ResourceManager::Unregister(this); // wyrejestrowanie ze sprz¹tacza
|
||||
// TODO: usun¹æ obiekty z listy (nRootMesh), bo s¹ one tworzone dla sektora
|
||||
delete[] tTracks;
|
||||
}
|
||||
|
||||
void TSubRect::NodeAdd(TGroundNode *Node)
|
||||
@@ -1767,8 +1771,7 @@ TGroundNode * TGround::AddGroundNode(cParser *parser)
|
||||
*parser >> token;
|
||||
str = token;
|
||||
//str = AnsiString(token.c_str());
|
||||
tmp->tsStaticSound = new TTextSound(strdup(str.c_str()), sqrt(tmp->fSquareRadius), tmp->pCenter.x,
|
||||
tmp->pCenter.y, tmp->pCenter.z, false, rmin);
|
||||
tmp->tsStaticSound = new TTextSound(str, sqrt(tmp->fSquareRadius), tmp->pCenter.x, tmp->pCenter.y, tmp->pCenter.z, false, rmin);
|
||||
if (rmin < 0.0)
|
||||
rmin =
|
||||
0.0; // przywrócenie poprawnej wartoœci, jeœli s³u¿y³a do wy³¹czenia efektu Dopplera
|
||||
@@ -2320,9 +2323,7 @@ void TGround::FirstInit()
|
||||
WriteLog("InitLaunchers OK");
|
||||
WriteLog("InitGlobalTime");
|
||||
// ABu 160205: juz nie TODO :)
|
||||
GlobalTime = new TMTableTime(
|
||||
hh, mm, srh, srm, ssh,
|
||||
ssm); // McZapkie-300302: inicjacja czasu rozkladowego - TODO: czytac z trasy!
|
||||
GlobalTime = std::make_shared<TMTableTime>( hh, mm, srh, srm, ssh, ssm ); // McZapkie-300302: inicjacja czasu rozkladowego - TODO: czytac z trasy!
|
||||
WriteLog("InitGlobalTime OK");
|
||||
// jeszcze ustawienie pogody, gdyby nie by³o w scenerii wpisów
|
||||
glClearColor(Global::AtmoColor[0], Global::AtmoColor[1], Global::AtmoColor[2],
|
||||
|
||||
@@ -642,10 +642,11 @@ public:
|
||||
TBrakeHandle BrakeLocHandle;
|
||||
double MBPM; /*masa najwiekszego cisnienia*/
|
||||
|
||||
TBrake *Hamulec;
|
||||
TDriverHandle *Handle;
|
||||
TDriverHandle *LocHandle;
|
||||
TReservoir *Pipe; TReservoir *Pipe2;
|
||||
std::shared_ptr<TBrake> Hamulec;
|
||||
std::shared_ptr<TDriverHandle> Handle;
|
||||
std::shared_ptr<TDriverHandle> LocHandle;
|
||||
std::shared_ptr<TReservoir> Pipe;
|
||||
std::shared_ptr<TReservoir> Pipe2;
|
||||
|
||||
TLocalBrake LocalBrake; /*rodzaj hamulca indywidualnego*/
|
||||
TBrakePressureTable BrakePressureTable; /*wyszczegolnienie cisnien w rurze*/
|
||||
|
||||
@@ -1796,154 +1796,157 @@ int TMoverParameters::ShowCurrent(int AmpN)
|
||||
|
||||
bool TMoverParameters::IncMainCtrl(int CtrlSpeed)
|
||||
{
|
||||
bool OK = false;
|
||||
if ((MainCtrlPosNo > 0) && (CabNo != 0))
|
||||
// basic fail conditions:
|
||||
if( ( CabNo == 0 )
|
||||
|| ( MainCtrlPosNo <= 0 ) ) {
|
||||
// nie ma sterowania
|
||||
return false;
|
||||
}
|
||||
if( ( TrainType == dt_ET22 ) && ( ScndCtrlPos != 0 ) ) {
|
||||
// w ET22 nie da się kręcić nastawnikiem przy włączonym boczniku
|
||||
return false;
|
||||
}
|
||||
if( ( TrainType == dt_EZT ) && ( ActiveDir == 0 ) ) {
|
||||
// w EZT nie da się załączyć pozycji bez ustawienia kierunku
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OK = false;
|
||||
if (MainCtrlPos < MainCtrlPosNo)
|
||||
{
|
||||
if (MainCtrlPos < MainCtrlPosNo)
|
||||
{
|
||||
if ((TrainType != dt_ET22) ||
|
||||
((TrainType == dt_ET22) &&
|
||||
(ScndCtrlPos ==
|
||||
0))) // w ET22 nie da się kręcić nastawnikiem przy włączonym boczniku
|
||||
switch (EngineType)
|
||||
{
|
||||
case None:
|
||||
case Dumb:
|
||||
case DieselElectric:
|
||||
case ElectricInductionMotor:
|
||||
{
|
||||
if (((CtrlSpeed == 1) && (TrainType != dt_EZT)) ||
|
||||
((CtrlSpeed == 1) && (TrainType == dt_EZT) && (ActiveDir != 0)))
|
||||
{ // w EZT nie da się załączyć pozycji bez ustawienia kierunku
|
||||
MainCtrlPos++;
|
||||
OK = true;
|
||||
}
|
||||
else if (((CtrlSpeed > 1) && (TrainType != dt_EZT)) ||
|
||||
((CtrlSpeed > 1) && (TrainType == dt_EZT) && (ActiveDir != 0)))
|
||||
OK = (IncMainCtrl(1) && IncMainCtrl(CtrlSpeed - 1));
|
||||
break;
|
||||
}
|
||||
switch( EngineType ) {
|
||||
case None:
|
||||
case Dumb:
|
||||
case DieselElectric:
|
||||
case ElectricInductionMotor:
|
||||
{
|
||||
if( CtrlSpeed > 1 ) {
|
||||
OK = ( IncMainCtrl( 1 )
|
||||
&& IncMainCtrl( CtrlSpeed - 1 ) ); // a fail will propagate up the recursion chain. should this be || instead?
|
||||
}
|
||||
else {
|
||||
++MainCtrlPos;
|
||||
OK = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ElectricSeriesMotor:
|
||||
{
|
||||
if ((CtrlSpeed == 1) && (ActiveDir != 0))
|
||||
{
|
||||
MainCtrlPos++;
|
||||
OK = true;
|
||||
if (Imax == ImaxHi)
|
||||
if (RList[MainCtrlPos].Bn > 1)
|
||||
{
|
||||
if (TrainType == dt_ET42)
|
||||
{
|
||||
MainCtrlPos--;
|
||||
OK = false;
|
||||
}
|
||||
if (MaxCurrentSwitch(false))
|
||||
SetFlag(
|
||||
SoundFlag,
|
||||
sound_relay); // wylaczanie wysokiego rozruchu // Q TODO:
|
||||
// if (EngineType=ElectricSeriesMotor) and (MainCtrlPos=1)
|
||||
// then
|
||||
// MainCtrlActualPos:=1;
|
||||
//
|
||||
}
|
||||
if ((CtrlSpeed == 1) && (ActiveDir == -1) && (RList[MainCtrlPos].Bn > 1) &&
|
||||
(TrainType != dt_PseudoDiesel))
|
||||
{ // blokada wejścia na równoległą podczas jazdy do tyłu
|
||||
MainCtrlPos--;
|
||||
OK = false;
|
||||
}
|
||||
//
|
||||
// if (TrainType == "et40")
|
||||
// if (Abs(Im) > IminHi)
|
||||
// {
|
||||
// MainCtrlPos--; //Blokada nastawnika po przekroczeniu minimalnego pradu
|
||||
// OK = false;
|
||||
// }
|
||||
//}
|
||||
if (DynamicBrakeFlag)
|
||||
if (TrainType == dt_ET42)
|
||||
if (MainCtrlPos > 20)
|
||||
{
|
||||
MainCtrlPos--;
|
||||
OK = false;
|
||||
}
|
||||
}
|
||||
else if ((CtrlSpeed > 1) && (ActiveDir != 0) && (TrainType != dt_ET40))
|
||||
{ // szybkie przejście na bezoporową
|
||||
case ElectricSeriesMotor:
|
||||
{
|
||||
if( ActiveDir == 0 ) { return false; }
|
||||
|
||||
while ((RList[MainCtrlPos].R > 0) && IncMainCtrl(1))
|
||||
; // tutaj ma być pętla na "pusto"
|
||||
// OK:=true ; {takie chamskie, potem poprawie} <-Ra: kto miał to
|
||||
// poprawić i po co?
|
||||
if (ActiveDir == -1)
|
||||
while ((RList[MainCtrlPos].Bn > 1) && IncMainCtrl(1))
|
||||
MainCtrlPos--;
|
||||
OK = false;
|
||||
// if (TrainType=dt_ET40) then
|
||||
// while Abs (Im)>IminHi do
|
||||
// dec(MainCtrlPos);
|
||||
// OK:=false ;
|
||||
//
|
||||
if (DynamicBrakeFlag)
|
||||
if (TrainType == dt_ET42)
|
||||
while (MainCtrlPos > 20)
|
||||
MainCtrlPos--;
|
||||
OK = false;
|
||||
}
|
||||
// return OK;
|
||||
if( CtrlSpeed > 1 ) {
|
||||
// szybkie przejście na bezoporową
|
||||
if( TrainType == dt_ET40 ) {
|
||||
break; // this means ET40 won't react at all to fast acceleration command. should it issue just IncMainCtrl(1) instead?
|
||||
}
|
||||
while( ( RList[ MainCtrlPos ].R > 0.0 )
|
||||
&& IncMainCtrl( 1 ) ) {
|
||||
// all work is done in the loop header
|
||||
;
|
||||
}
|
||||
// OK:=true ; {takie chamskie, potem poprawie} <-Ra: kto miał to
|
||||
// poprawić i po co?
|
||||
if( ActiveDir == -1 ) {
|
||||
while( ( RList[ MainCtrlPos ].Bn > 1 )
|
||||
&& IncMainCtrl( 1 ) ) {
|
||||
--MainCtrlPos;
|
||||
}
|
||||
}
|
||||
OK = false; // shouldn't this be part of the loop above?
|
||||
// if (TrainType=dt_ET40) then
|
||||
// while Abs (Im)>IminHi do
|
||||
// dec(MainCtrlPos);
|
||||
// OK:=false ;
|
||||
}
|
||||
else { // CtrlSpeed == 1
|
||||
++MainCtrlPos;
|
||||
OK = true;
|
||||
if( Imax == ImaxHi ) {
|
||||
if( RList[ MainCtrlPos ].Bn > 1 ) {
|
||||
if( true == MaxCurrentSwitch( false )) {
|
||||
// wylaczanie wysokiego rozruchu
|
||||
SetFlag( SoundFlag, sound_relay );
|
||||
} // Q TODO:
|
||||
// if (EngineType=ElectricSeriesMotor) and (MainCtrlPos=1)
|
||||
// then
|
||||
// MainCtrlActualPos:=1;
|
||||
//
|
||||
if( TrainType == dt_ET42 ) {
|
||||
--MainCtrlPos;
|
||||
OK = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( ActiveDir == -1 ) {
|
||||
if( ( TrainType != dt_PseudoDiesel )
|
||||
&& ( RList[ MainCtrlPos ].Bn > 1 ) ) {
|
||||
// blokada wejścia na równoległą podczas jazdy do tyłu
|
||||
--MainCtrlPos;
|
||||
OK = false;
|
||||
}
|
||||
}
|
||||
//
|
||||
// if (TrainType == "et40")
|
||||
// if (Abs(Im) > IminHi)
|
||||
// {
|
||||
// MainCtrlPos--; //Blokada nastawnika po przekroczeniu minimalnego pradu
|
||||
// OK = false;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
if( ( TrainType == dt_ET42 ) && ( true == DynamicBrakeFlag ) ) {
|
||||
if( MainCtrlPos > 20 ) {
|
||||
MainCtrlPos = 20;
|
||||
OK = false;
|
||||
}
|
||||
}
|
||||
// return OK;
|
||||
break;
|
||||
}
|
||||
|
||||
case DieselEngine:
|
||||
{
|
||||
if (CtrlSpeed == 1)
|
||||
{
|
||||
MainCtrlPos++;
|
||||
OK = true;
|
||||
if (MainCtrlPos > 0)
|
||||
CompressorAllow = true;
|
||||
else
|
||||
CompressorAllow = false;
|
||||
}
|
||||
else if (CtrlSpeed > 1)
|
||||
{
|
||||
while (MainCtrlPos < MainCtrlPosNo)
|
||||
IncMainCtrl(1);
|
||||
OK = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DieselEngine:
|
||||
{
|
||||
if( CtrlSpeed > 1 ) {
|
||||
while( MainCtrlPos < MainCtrlPosNo ) {
|
||||
IncMainCtrl( 1 );
|
||||
}
|
||||
}
|
||||
else {
|
||||
++MainCtrlPos;
|
||||
if( MainCtrlPos > 0 ) { CompressorAllow = true; }
|
||||
else { CompressorAllow = false; }
|
||||
}
|
||||
OK = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case WheelsDriven:
|
||||
{
|
||||
OK = AddPulseForce(CtrlSpeed);
|
||||
break;
|
||||
}
|
||||
|
||||
} // switch EngineType of
|
||||
}
|
||||
else // MainCtrlPos>=MainCtrlPosNo
|
||||
if (CoupledCtrl) // wspólny wał nastawnika jazdy i bocznikowania
|
||||
{
|
||||
if (ScndCtrlPos < ScndCtrlPosNo) // 3<3 -> false
|
||||
{
|
||||
ScndCtrlPos++;
|
||||
OK = true;
|
||||
}
|
||||
else
|
||||
OK = false;
|
||||
}
|
||||
if (OK)
|
||||
{
|
||||
SendCtrlToNext("MainCtrl", MainCtrlPos, CabNo); //???
|
||||
SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabNo);
|
||||
}
|
||||
case WheelsDriven:
|
||||
{
|
||||
OK = AddPulseForce( CtrlSpeed );
|
||||
break;
|
||||
}
|
||||
} // switch EngineType of
|
||||
}
|
||||
else {// MainCtrlPos>=MainCtrlPosNo
|
||||
if( true == CoupledCtrl ) {
|
||||
// wspólny wał nastawnika jazdy i bocznikowania
|
||||
if( ScndCtrlPos < ScndCtrlPosNo ) { // 3<3 -> false
|
||||
++ScndCtrlPos;
|
||||
OK = true;
|
||||
}
|
||||
else {
|
||||
OK = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( true == OK )
|
||||
{
|
||||
SendCtrlToNext("MainCtrl", MainCtrlPos, CabNo); //???
|
||||
SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabNo);
|
||||
}
|
||||
else // nie ma sterowania
|
||||
OK = false;
|
||||
// if OK then LastRelayTime:=0;
|
||||
|
||||
// hunter-101012: poprawka
|
||||
// poprzedni warunek byl niezbyt dobry, bo przez to przy trzymaniu +
|
||||
@@ -5871,16 +5874,16 @@ std::string getkeyval(int rettype, std::string key)
|
||||
int klen = key.length();
|
||||
int kpos = Pos(key, xline) - 1;
|
||||
temp.erase(0, kpos + klen);
|
||||
if (temp.find(" ") != std::string::npos)
|
||||
to = temp.find(" ");
|
||||
if (temp.find(' ') != std::string::npos)
|
||||
to = temp.find(' ');
|
||||
else
|
||||
to = 255;
|
||||
kval = temp.substr(0, to);
|
||||
if (kval != "")
|
||||
kval = TrimSpace(kval); // wyciagnieta wartosc
|
||||
|
||||
sectionname = ExchangeCharInString(sectionname, (char)":", (char)"");
|
||||
sectionname = ExchangeCharInString(sectionname, (char)".", (char)"");
|
||||
sectionname = ExchangeCharInString(sectionname, ':', NULL);
|
||||
sectionname = ExchangeCharInString(sectionname, '.', NULL);
|
||||
//--WriteLog(sectionname + "." + keyname + " val= [" + kval + "]");
|
||||
|
||||
// if (rettype == 1) vS = kval;
|
||||
@@ -6343,7 +6346,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
||||
|
||||
// appdir = ExtractFilePath(ParamStr(0));
|
||||
|
||||
std::ifstream in(file.c_str());
|
||||
std::ifstream in(file);
|
||||
if (!in.is_open())
|
||||
{
|
||||
WriteLog("E8 - FIZ FILE NOT EXIST.");
|
||||
@@ -7400,8 +7403,7 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
|
||||
case K:
|
||||
{
|
||||
WriteLog("XBT W, K");
|
||||
Hamulec = new TWest(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume,
|
||||
BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
Hamulec = std::make_shared<TWest>(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
if (MBPM < 2) // jesli przystawka wazaca
|
||||
Hamulec->SetLP(0, MaxBrakePress[3], 0);
|
||||
else
|
||||
@@ -7411,8 +7413,7 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
|
||||
case KE:
|
||||
{
|
||||
WriteLog("XBT WKE");
|
||||
Hamulec = new TKE(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo,
|
||||
BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
Hamulec = std::make_shared<TKE>(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
Hamulec->SetRM(RapidMult);
|
||||
if (MBPM < 2) // jesli przystawka wazaca
|
||||
Hamulec->SetLP(0, MaxBrakePress[3], 0);
|
||||
@@ -7426,9 +7427,8 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
|
||||
case ESt4:
|
||||
{
|
||||
WriteLog("XBT NESt3, ESt3, ESt3AL2, ESt4");
|
||||
Hamulec = new TNESt3(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume,
|
||||
BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
(static_cast<TNESt3 *>(Hamulec))->SetSize(BrakeValveSize, BrakeValveParams);
|
||||
Hamulec = std::make_shared<TNESt3>(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
static_cast<TNESt3 *>(Hamulec.get())->SetSize(BrakeValveSize, BrakeValveParams);
|
||||
if (MBPM < 2) // jesli przystawka wazaca
|
||||
Hamulec->SetLP(0, MaxBrakePress[3], 0);
|
||||
else
|
||||
@@ -7439,24 +7439,21 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
|
||||
case LSt:
|
||||
{
|
||||
WriteLog("XBT LSt");
|
||||
Hamulec = new TLSt(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo,
|
||||
BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
Hamulec = std::make_shared<TLSt>(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
Hamulec->SetRM(RapidMult);
|
||||
break;
|
||||
}
|
||||
case EStED:
|
||||
{
|
||||
WriteLog("XBT EStED");
|
||||
Hamulec = new TEStED(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume,
|
||||
BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
Hamulec = std::make_shared<TEStED>(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
Hamulec->SetRM(RapidMult);
|
||||
break;
|
||||
}
|
||||
case EP2:
|
||||
{
|
||||
WriteLog("XBT EP2");
|
||||
Hamulec = new TEStEP2(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume,
|
||||
BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
Hamulec = std::make_shared<TEStEP2>(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
Hamulec->SetLP(Mass, MBPM, MaxBrakePress[1]);
|
||||
break;
|
||||
}
|
||||
@@ -7464,21 +7461,18 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
|
||||
case CV1:
|
||||
{
|
||||
WriteLog("XBT CV1");
|
||||
Hamulec = new TCV1(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo,
|
||||
BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
Hamulec = std::make_shared<TCV1>(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
break;
|
||||
}
|
||||
case CV1_L_TR:
|
||||
{
|
||||
WriteLog("XBT CV1_L_T");
|
||||
Hamulec = new TCV1L_TR(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume,
|
||||
BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
Hamulec = std::make_shared<TCV1L_TR>(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
Hamulec = new TBrake(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume,
|
||||
BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
Hamulec = std::make_shared<TBrake>(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
}
|
||||
|
||||
Hamulec->SetASBP(MaxBrakePress[4]);
|
||||
@@ -7486,50 +7480,49 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
|
||||
switch (BrakeHandle)
|
||||
{
|
||||
case FV4a:
|
||||
Handle = new TFV4aM();
|
||||
Handle = std::make_shared<TFV4aM>();
|
||||
break;
|
||||
case FVel6:
|
||||
Handle = new TFVel6();
|
||||
Handle = std::make_shared<TFVel6>();
|
||||
break;
|
||||
case testH:
|
||||
Handle = new Ttest();
|
||||
Handle = std::make_shared<Ttest>();
|
||||
break;
|
||||
case M394:
|
||||
Handle = new TM394();
|
||||
Handle = std::make_shared<TM394>();
|
||||
break;
|
||||
case Knorr:
|
||||
Handle = new TH14K1();
|
||||
Handle = std::make_shared<TH14K1>();
|
||||
break;
|
||||
case St113:
|
||||
Handle = new TSt113();
|
||||
Handle = std::make_shared<TSt113>();
|
||||
break;
|
||||
default:
|
||||
Handle = new TDriverHandle();
|
||||
Handle = std::make_shared<TDriverHandle>();
|
||||
}
|
||||
|
||||
switch (BrakeLocHandle)
|
||||
{
|
||||
case FD1:
|
||||
{
|
||||
LocHandle = new TFD1();
|
||||
LocHandle = std::make_shared<TFD1>();
|
||||
LocHandle->Init(MaxBrakePress[0]);
|
||||
break;
|
||||
}
|
||||
case Knorr:
|
||||
{
|
||||
LocHandle = new TH1405();
|
||||
LocHandle = std::make_shared<TH1405>();
|
||||
LocHandle->Init(MaxBrakePress[0]);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LocHandle = new TDriverHandle();
|
||||
LocHandle = std::make_shared<TDriverHandle>();
|
||||
}
|
||||
|
||||
Pipe = new TReservoir();
|
||||
Pipe2 = new TReservoir(); // zabezpieczenie, bo sie PG wywala... :(
|
||||
Pipe->CreateCap((Max0R(Dim.L, 14) + 0.5) * Spg * 1); // dlugosc x przekroj x odejscia i takie
|
||||
// tam
|
||||
Pipe2->CreateCap((Max0R(Dim.L, 14) + 0.5) * Spg * 1);
|
||||
Pipe = std::make_shared<TReservoir>();
|
||||
Pipe->CreateCap( ( Max0R( Dim.L, 14 ) + 0.5 ) * Spg * 1 ); // dlugosc x przekroj x odejscia i takie tam
|
||||
Pipe2 = std::make_shared<TReservoir>(); // zabezpieczenie, bo sie PG wywala... :(
|
||||
Pipe2->CreateCap( (Max0R(Dim.L, 14) + 0.5) * Spg * 1 );
|
||||
|
||||
if (LightsPosNo > 0)
|
||||
LightsPos = LightsDefPos;
|
||||
|
||||
@@ -327,21 +327,17 @@ void TNESt3::Init(double PP, double HPP, double LPP, double BP, int BDF)
|
||||
ValveRes->CreatePress(PP);
|
||||
BrakeCyl->CreatePress(BP);
|
||||
BrakeRes->CreatePress(PP);
|
||||
CntrlRes = new TReservoir();
|
||||
CntrlRes = std::make_shared<TReservoir>();
|
||||
CntrlRes->CreateCap(15);
|
||||
CntrlRes->CreatePress(HPP);
|
||||
BrakeStatus = static_cast<int>(BP > 1.0);
|
||||
Miedzypoj = new TReservoir();
|
||||
Miedzypoj = std::make_shared<TReservoir>();
|
||||
Miedzypoj->CreateCap(5);
|
||||
Miedzypoj->CreatePress(PP);
|
||||
|
||||
BVM = 1.0 / (HPP - 0.05 - LPP) * MaxBP;
|
||||
|
||||
BrakeDelayFlag = BDF;
|
||||
RapidStatus = false;
|
||||
LoadC, LoadM, TareBP, TareM, Podskok, LBP = 0.0;
|
||||
|
||||
Zamykajacy, Przys_blok = false;
|
||||
|
||||
if (!(typeid(*FM) == typeid(TDisk1) || typeid(*FM) == typeid(TDisk2))) // jesli zeliwo to schodz
|
||||
RapidStaly = false;
|
||||
@@ -500,32 +496,31 @@ void TNESt3::SetSize(int size, std::string params) // ustawianie dysz (rozmiaru
|
||||
if (params.find("ESt3") != std::string::npos)
|
||||
{
|
||||
Podskok = 0.7;
|
||||
Przekladniki[1] = new TRura();
|
||||
Przekladniki[3] = new TRura();
|
||||
Przekladniki[1] = std::make_shared<TRura>();
|
||||
Przekladniki[3] = std::make_shared<TRura>();
|
||||
}
|
||||
else
|
||||
{
|
||||
Podskok = -1;
|
||||
Przekladniki[1] = new TRapid();
|
||||
Przekladniki[1] = std::make_shared<TRapid>();
|
||||
if (params.find("-s216") != std::string::npos)
|
||||
Przekladniki[1]->SetRapidParams(2, 16);
|
||||
else
|
||||
Przekladniki[1]->SetRapidParams(2, 0);
|
||||
Przekladniki[3] = new TPrzeciwposlizg();
|
||||
Przekladniki[3] = std::make_shared<TPrzeciwposlizg>();
|
||||
if (params.find("-ED") != std::string::npos)
|
||||
{
|
||||
delete Przekladniki[3]; // tutaj ma byæ destruktor
|
||||
Przekladniki[1]->SetRapidParams(2, 18);
|
||||
Przekladniki[3] = new TPrzekED();
|
||||
Przekladniki[3] = std::make_shared<TPrzekED>();
|
||||
}
|
||||
}
|
||||
|
||||
if (params.find("AL2") != std::string::npos)
|
||||
Przekladniki[2] = new TPrzekCiagly();
|
||||
Przekladniki[2] = std::make_shared<TPrzekCiagly>();
|
||||
else if (params.find("PZZ") != std::string::npos)
|
||||
Przekladniki[2] = new TPrzek_PZZ();
|
||||
Przekladniki[2] = std::make_shared<TPrzek_PZZ>();
|
||||
else
|
||||
Przekladniki[2] = new TRura();
|
||||
Przekladniki[2] = std::make_shared<TRura>();
|
||||
|
||||
if ((params.find("3d") + params.find("4d")) != std::string::npos)
|
||||
autom = false;
|
||||
|
||||
@@ -17,10 +17,10 @@ http://mozilla.org/MPL/2.0/.
|
||||
Copyright (C) 2007-2014 Maciej Cierniak
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include "hamulce.h" // Pascal unit
|
||||
#include "friction.h" // Pascal unit
|
||||
#include "mctools.h" // Pascal unit
|
||||
#include <string>
|
||||
|
||||
/*
|
||||
(C) youBy
|
||||
@@ -72,8 +72,8 @@ class TPrzekladnik : public TReservoir // przekladnik (powtarzacz)
|
||||
{
|
||||
private:
|
||||
public:
|
||||
TReservoir *BrakeRes;
|
||||
TReservoir *Next;
|
||||
std::shared_ptr<TReservoir> BrakeRes;
|
||||
std::shared_ptr<TReservoir> Next;
|
||||
|
||||
TPrzekladnik() : TReservoir() {};
|
||||
virtual void Update(double dt);
|
||||
@@ -110,55 +110,51 @@ class TPrzeciwposlizg : public TRura // przy napelnianiu - rura, przy poslizgu -
|
||||
}
|
||||
};
|
||||
|
||||
class TRapid : public TPrzekladnik // przekladnik dwustopniowy
|
||||
// przekladnik dwustopniowy
|
||||
class TRapid : public TPrzekladnik {
|
||||
|
||||
{
|
||||
private:
|
||||
bool RapidStatus; // status rapidu
|
||||
double RapidMult; // przelozenie (w dol)
|
||||
private:
|
||||
bool RapidStatus = false; // status rapidu
|
||||
double RapidMult = 0.0; // przelozenie (w dol)
|
||||
// Komora2: real;
|
||||
double DN;
|
||||
double DL; // srednice dysz napelniania i luzowania
|
||||
double DN = 0.0;
|
||||
double DL = 0.0; // srednice dysz napelniania i luzowania
|
||||
|
||||
public:
|
||||
public:
|
||||
void SetRapidParams(double mult, double size);
|
||||
void SetRapidStatus(bool rs);
|
||||
void Update(double dt) /*override*/;
|
||||
inline TRapid() : TPrzekladnik()
|
||||
{
|
||||
RapidStatus = false;
|
||||
RapidMult, DN, DL = 0.0;
|
||||
}
|
||||
inline TRapid() :
|
||||
TPrzekladnik()
|
||||
{}
|
||||
};
|
||||
|
||||
class TPrzekCiagly : public TPrzekladnik // AL2
|
||||
// AL2
|
||||
class TPrzekCiagly : public TPrzekladnik {
|
||||
|
||||
{
|
||||
private:
|
||||
double mult;
|
||||
private:
|
||||
double mult = 0.0;
|
||||
|
||||
public:
|
||||
void SetMult(double m);
|
||||
void Update(double dt) /*override*/;
|
||||
inline TPrzekCiagly() : TPrzekladnik()
|
||||
{
|
||||
mult = 0.0;
|
||||
}
|
||||
inline TPrzekCiagly() :
|
||||
TPrzekladnik()
|
||||
{}
|
||||
};
|
||||
|
||||
class TPrzek_PZZ : public TPrzekladnik // podwojny zawor zwrotny
|
||||
// podwojny zawor zwrotny
|
||||
class TPrzek_PZZ : public TPrzekladnik {
|
||||
|
||||
{
|
||||
private:
|
||||
double LBP;
|
||||
private:
|
||||
double LBP = 0.0;
|
||||
|
||||
public:
|
||||
public:
|
||||
void SetLBP(double P);
|
||||
void Update(double dt) /*override*/;
|
||||
inline TPrzek_PZZ() : TPrzekladnik()
|
||||
{
|
||||
LBP = 0.0;
|
||||
}
|
||||
inline TPrzek_PZZ() :
|
||||
TPrzekladnik()
|
||||
{}
|
||||
};
|
||||
|
||||
class TPrzekZalamany : public TPrzekladnik // Knicksventil
|
||||
@@ -166,59 +162,55 @@ class TPrzekZalamany : public TPrzekladnik // Knicksventil
|
||||
{
|
||||
private:
|
||||
public:
|
||||
TPrzekZalamany() : TPrzekladnik() {};
|
||||
TPrzekZalamany() :
|
||||
TPrzekladnik()
|
||||
{}
|
||||
};
|
||||
|
||||
class TPrzekED : public TRura // przy napelnianiu - rura, przy hamowaniu - upust
|
||||
// przy napelnianiu - rura, przy hamowaniu - upust
|
||||
class TPrzekED : public TRura {
|
||||
|
||||
{
|
||||
private:
|
||||
double MaxP;
|
||||
private:
|
||||
double MaxP = 0.0;
|
||||
|
||||
public:
|
||||
public:
|
||||
void SetP(double P);
|
||||
void Update(double dt) /*override*/;
|
||||
inline TPrzekED() : TRura()
|
||||
{
|
||||
MaxP = 0.0;
|
||||
}
|
||||
inline TPrzekED() :
|
||||
TRura()
|
||||
{}
|
||||
};
|
||||
|
||||
class TNESt3 : public TBrake
|
||||
class TNESt3 : public TBrake {
|
||||
|
||||
{
|
||||
private:
|
||||
double Nozzles[dMAX]; // dysze
|
||||
TReservoir *CntrlRes; // zbiornik sterujšcy
|
||||
double BVM; // przelozenie PG-CH
|
||||
private:
|
||||
std::shared_ptr<TReservoir> CntrlRes; // zbiornik sterujšcy
|
||||
std::shared_ptr<TReservoir> Miedzypoj; // pojemnosc posrednia (urojona) do napelniania ZP i ZS
|
||||
std::shared_ptr<TPrzekladnik> Przekladniki[ 4 ];
|
||||
double Nozzles[ dMAX ]; // dysze
|
||||
double BVM = 0.0; // przelozenie PG-CH
|
||||
// ValveFlag: byte; //polozenie roznych zaworkow
|
||||
bool Zamykajacy; // pamiec zaworka zamykajacego
|
||||
bool Zamykajacy = false; // pamiec zaworka zamykajacego
|
||||
// Przys_wlot: boolean; //wlot do komory przyspieszacza
|
||||
bool Przys_blok; // blokada przyspieszacza
|
||||
TReservoir *Miedzypoj; // pojemnosc posrednia (urojona) do napelniania ZP i ZS
|
||||
TPrzekladnik *Przekladniki[4];
|
||||
bool RapidStatus;
|
||||
bool RapidStaly;
|
||||
double LoadC;
|
||||
double TareM;
|
||||
double LoadM; // masa proznego i pelnego
|
||||
double TareBP; // cisnienie dla proznego
|
||||
double HBG300; // zawor ograniczajacy cisnienie
|
||||
double Podskok; // podskok preznosci poczatkowej
|
||||
bool Przys_blok = false; // blokada przyspieszacza
|
||||
bool RapidStatus = false;
|
||||
bool RapidStaly = false;
|
||||
double LoadC = 0.0;
|
||||
double TareM = 0.0; // masa proznego
|
||||
double LoadM = 0.0; // masa pelnego
|
||||
double TareBP = 0.0; // cisnienie dla proznego
|
||||
double HBG300 = 0.0; // zawor ograniczajacy cisnienie
|
||||
double Podskok = 0.0; // podskok preznosci poczatkowej
|
||||
// HPBR: real; //zasilanie ZP z wysokiego cisnienia
|
||||
bool autom; // odluzniacz samoczynny
|
||||
double LBP; // cisnienie hamulca pomocniczego
|
||||
bool autom = false; // odluzniacz samoczynny
|
||||
double LBP = 0.0; // cisnienie hamulca pomocniczego
|
||||
|
||||
|
||||
public:
|
||||
inline TNESt3(double i_mbp, double i_bcr, double i_bcd, double i_brc,
|
||||
int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
|
||||
, i_BD, i_mat, i_ba, i_nbpa)
|
||||
{
|
||||
}
|
||||
public:
|
||||
inline TNESt3(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) :
|
||||
TBrake( i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
{}
|
||||
void Init(double PP, double HPP, double LPP, double BP, int BDF) /*override*/;
|
||||
virtual double GetPF(double PP, double dt,
|
||||
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
virtual double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
void EStParams(double i_crc); // parametry charakterystyczne dla ESt
|
||||
virtual double GetCRP() /*override*/;
|
||||
void CheckState(double BCP, double &dV1); // glowny przyrzad rozrzadczy
|
||||
|
||||
@@ -20,15 +20,15 @@ Copyright (C) 2007-2014 Maciej Cierniak
|
||||
//---FUNKCJE OGOLNE---
|
||||
|
||||
static double const DPL = 0.25;
|
||||
double TFV4aM::pos_table[11] = {-2, 6, -1, 0, -2, 1, 4, 6, 0, 0, 0};
|
||||
double TMHZ_EN57::pos_table[11] = {-2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0};
|
||||
double TM394::pos_table[11] = {-1, 5, -1, 0, 1, 2, 4, 5, 0, 0, 0};
|
||||
double TH14K1::BPT_K[6][2] = {{10, 0}, {4, 1}, {0, 1}, {4, 0}, {4, -1}, {15, -1}};
|
||||
double TH14K1::pos_table[11] = {-1, 4, -1, 0, 1, 2, 3, 4, 0, 0, 0};
|
||||
double TSt113::BPT_K[6][2] = {{10, 0}, {4, 1}, {0, 1}, {4, 0}, {4, -1}, {15, -1}};
|
||||
double TSt113::BEP_K[7] = {0, -1, 1, 0, 0, 0, 0};
|
||||
double TSt113::pos_table[11] = {-1, 5, -1, 0, 2, 3, 4, 5, 0, 0, 1};
|
||||
double TFVel6::pos_table[11] = {-1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1};
|
||||
double const TFV4aM::pos_table[11] = {-2, 6, -1, 0, -2, 1, 4, 6, 0, 0, 0};
|
||||
double const TMHZ_EN57::pos_table[11] = {-2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0};
|
||||
double const TM394::pos_table[11] = {-1, 5, -1, 0, 1, 2, 4, 5, 0, 0, 0};
|
||||
double const TH14K1::BPT_K[6][2] = {{10, 0}, {4, 1}, {0, 1}, {4, 0}, {4, -1}, {15, -1}};
|
||||
double const TH14K1::pos_table[11] = {-1, 4, -1, 0, 1, 2, 3, 4, 0, 0, 0};
|
||||
double const TSt113::BPT_K[6][2] = {{10, 0}, {4, 1}, {0, 1}, {4, 0}, {4, -1}, {15, -1}};
|
||||
double const TSt113::BEP_K[7] = {0, -1, 1, 0, 0, 0, 0};
|
||||
double const TSt113::pos_table[11] = {-1, 5, -1, 0, 2, 3, 4, 5, 0, 0, 1};
|
||||
double const TFVel6::pos_table[11] = {-1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1};
|
||||
|
||||
double PR(double P1, double P2)
|
||||
{
|
||||
@@ -147,14 +147,6 @@ void TReservoir::Flow(double dv)
|
||||
dVol = dVol + dv;
|
||||
}
|
||||
|
||||
TReservoir::TReservoir()
|
||||
{
|
||||
// inherited:: Create;
|
||||
Cap = 1;
|
||||
Vol = 0;
|
||||
dVol = 0;
|
||||
}
|
||||
|
||||
void TReservoir::Act()
|
||||
{
|
||||
Vol = Vol + dVol;
|
||||
@@ -264,9 +256,9 @@ TBrake::TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn
|
||||
4.2; // objetosc CH w stosunku do cylindra 14" i cisnienia 4.2 atm
|
||||
|
||||
// BrakeCyl:=TReservoir.Create;
|
||||
BrakeCyl = new TBrakeCyl();
|
||||
BrakeRes = new TReservoir();
|
||||
ValveRes = new TReservoir();
|
||||
BrakeCyl = std::make_shared<TBrakeCyl>();
|
||||
BrakeRes = std::make_shared<TReservoir>();
|
||||
ValveRes = std::make_shared<TReservoir>();
|
||||
|
||||
// tworzenie zbiornikow
|
||||
BrakeCyl->CreateCap(i_bcd * BCA * 1000);
|
||||
@@ -279,34 +271,34 @@ TBrake::TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn
|
||||
switch (i_mat)
|
||||
{
|
||||
case bp_P10Bg:
|
||||
FM = new TP10Bg();
|
||||
FM = std::make_shared<TP10Bg>();
|
||||
break;
|
||||
case bp_P10Bgu:
|
||||
FM = new TP10Bgu();
|
||||
FM = std::make_shared<TP10Bgu>();
|
||||
break;
|
||||
case bp_FR513:
|
||||
FM = new TFR513();
|
||||
FM = std::make_shared<TFR513>();
|
||||
break;
|
||||
case bp_FR510:
|
||||
FM = new TFR510();
|
||||
FM = std::make_shared<TFR510>();
|
||||
break;
|
||||
case bp_Cosid:
|
||||
FM = new TCosid();
|
||||
FM = std::make_shared<TCosid>();
|
||||
break;
|
||||
case bp_P10yBg:
|
||||
FM = new TP10yBg();
|
||||
FM = std::make_shared<TP10yBg>();
|
||||
break;
|
||||
case bp_P10yBgu:
|
||||
FM = new TP10yBgu();
|
||||
FM = std::make_shared<TP10yBgu>();
|
||||
break;
|
||||
case bp_D1:
|
||||
FM = new TDisk1();
|
||||
FM = std::make_shared<TDisk1>();
|
||||
break;
|
||||
case bp_D2:
|
||||
FM = new TDisk2();
|
||||
FM = std::make_shared<TDisk2>();
|
||||
break;
|
||||
default: // domyslnie
|
||||
FM = new TP10();
|
||||
FM = std::make_shared<TP10>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2203,10 +2195,7 @@ double TFV4a::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
||||
void TFV4a::Init(double Press)
|
||||
{
|
||||
CP = Press;
|
||||
TP = 0;
|
||||
RP = Press;
|
||||
Time = false;
|
||||
TimeEP = false;
|
||||
}
|
||||
|
||||
//---FV4a/M--- nowonapisany kran bez poprawki IC
|
||||
@@ -2342,13 +2331,7 @@ double TFV4aM::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
||||
void TFV4aM::Init(double Press)
|
||||
{
|
||||
CP = Press;
|
||||
TP = 0.0;
|
||||
RP = Press;
|
||||
XP = 0.0;
|
||||
Time = false;
|
||||
TimeEP = false;
|
||||
RedAdj = 0.0;
|
||||
Fala = false;
|
||||
}
|
||||
|
||||
void TFV4aM::SetReductor(double nAdj)
|
||||
@@ -2483,12 +2466,6 @@ double TMHZ_EN57::GetPF(double i_bcp, double PP, double HP, double dt, double ep
|
||||
void TMHZ_EN57::Init(double Press)
|
||||
{
|
||||
CP = Press;
|
||||
TP = 0.0;
|
||||
RP = 0.0;
|
||||
Time = false;
|
||||
TimeEP = false;
|
||||
RedAdj = 0.0;
|
||||
Fala = false;
|
||||
}
|
||||
|
||||
void TMHZ_EN57::SetReductor(double nAdj)
|
||||
@@ -2591,9 +2568,7 @@ double TM394::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
||||
void TM394::Init(double Press)
|
||||
{
|
||||
CP = Press;
|
||||
RedAdj = 0;
|
||||
Time = true;
|
||||
TimeEP = false;
|
||||
}
|
||||
|
||||
void TM394::SetReductor(double nAdj)
|
||||
@@ -2657,7 +2632,6 @@ double TH14K1::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
||||
void TH14K1::Init(double Press)
|
||||
{
|
||||
CP = Press;
|
||||
RedAdj = 0;
|
||||
Time = true;
|
||||
TimeEP = true;
|
||||
}
|
||||
@@ -2738,7 +2712,6 @@ void TSt113::Init(double Press)
|
||||
{
|
||||
Time = true;
|
||||
TimeEP = true;
|
||||
EPS = 0.0;
|
||||
}
|
||||
|
||||
//--- test ---
|
||||
@@ -2799,11 +2772,8 @@ double TFD1::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
||||
|
||||
void TFD1::Init(double Press)
|
||||
{
|
||||
BP = 0;
|
||||
MaxBP = Press;
|
||||
Time = false;
|
||||
TimeEP = false;
|
||||
Speed = 1;
|
||||
Speed = 1.0;
|
||||
}
|
||||
|
||||
double TFD1::GetCP()
|
||||
@@ -2844,10 +2814,8 @@ double TH1405::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
||||
|
||||
void TH1405::Init(double Press)
|
||||
{
|
||||
BP = 0;
|
||||
MaxBP = Press;
|
||||
Time = true;
|
||||
TimeEP = false;
|
||||
}
|
||||
|
||||
double TH1405::GetCP()
|
||||
@@ -2919,7 +2887,6 @@ void TFVel6::Init(double Press)
|
||||
{
|
||||
Time = true;
|
||||
TimeEP = true;
|
||||
EPS = 0.0;
|
||||
}
|
||||
|
||||
// END
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -294,20 +294,32 @@ std::string Tab2Sp(std::string const &s) /*Tab to Space sign*/
|
||||
return s2;
|
||||
}
|
||||
|
||||
std::string ExchangeCharInString(std::string s, const char &aim, const char &target)
|
||||
std::string ExchangeCharInString( std::string const &Source, char const &From, char const &To )
|
||||
{
|
||||
char *tmp = new char[s.length()];
|
||||
for (int b = 0; b < s.length(); ++b)
|
||||
{
|
||||
if (s[b] == aim)
|
||||
if (target == (char)"")
|
||||
b++;
|
||||
else
|
||||
tmp[b] = target;
|
||||
else
|
||||
tmp[b] = s[b];
|
||||
std::string replacement; replacement.reserve( Source.size() );
|
||||
std::for_each(Source.cbegin(), Source.cend(), [&](char const idx) {
|
||||
if( idx != From ) { replacement += idx; }
|
||||
else {
|
||||
if( To != NULL ) { replacement += To; } }
|
||||
} );
|
||||
|
||||
return replacement;
|
||||
/*
|
||||
int const length = Source.size();
|
||||
std::string replacement; replacement.reserve( length );
|
||||
for( int idx = 0; idx < length; ++idx ) {
|
||||
if( Source[ idx ] != From ) {
|
||||
replacement += Source[ idx ];
|
||||
}
|
||||
else {
|
||||
if( To != NULL ) {
|
||||
replacement += To;
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::string(tmp);
|
||||
|
||||
return replacement;
|
||||
*/
|
||||
}
|
||||
|
||||
std::vector<std::string> &Split(const std::string &s, char delim, std::vector<std::string> &elems)
|
||||
@@ -387,25 +399,18 @@ std::string to_string(int _Val, int precision, int width)
|
||||
return o.str();
|
||||
};
|
||||
|
||||
std::string to_string(double _Val, int precision, int width)
|
||||
std::string to_string(double const Value, int const Precision, int const Width)
|
||||
{
|
||||
std::ostringstream o;
|
||||
o.width(width);
|
||||
o << std::fixed << std::setprecision(precision);
|
||||
o << _Val;
|
||||
return o.str();
|
||||
std::ostringstream converter;
|
||||
converter << std::setw( Width ) << std::fixed << std::setprecision(Precision) << Value;
|
||||
return converter.str();
|
||||
};
|
||||
|
||||
std::string to_hex_str(double _Val, int precision, int width)
|
||||
std::string to_hex_str( int const Value, int const Width )
|
||||
{
|
||||
std::ostringstream o;
|
||||
if (width)
|
||||
o.width(width);
|
||||
o << std::fixed << std::hex;
|
||||
if (precision)
|
||||
o << std::setprecision(precision);
|
||||
o << _Val;
|
||||
return o.str();
|
||||
std::ostringstream converter;
|
||||
converter << "0x" << std::uppercase << std::setfill( '0' ) << std::setw( Width ) << std::hex << Value;
|
||||
return converter.str();
|
||||
};
|
||||
|
||||
int stol_def(const std::string &str, const int &DefaultValue)
|
||||
|
||||
@@ -122,7 +122,7 @@ std::string DUE(std::string s); /*Delete Until Equal sign*/
|
||||
std::string DWE(std::string s); /*Delete While Equal sign*/
|
||||
std::string Ld2Sp(std::string const &s); /*Low dash to Space sign*/
|
||||
std::string Tab2Sp(std::string const &s); /*Tab to Space sign*/
|
||||
std::string ExchangeCharInString(std::string s, const char &aim, const char &target); // zamienia jeden znak na drugi
|
||||
std::string ExchangeCharInString(std::string const &s, const char &aim, const char &target); // zamienia jeden znak na drugi
|
||||
std::vector<std::string> &Split(const std::string &s, char delim, std::vector<std::string> &elems);
|
||||
std::vector<std::string> Split(const std::string &s, char delim);
|
||||
std::vector<std::string> Split(const std::string &s);
|
||||
@@ -134,7 +134,7 @@ std::string to_string(int _Val, int precision, int width);
|
||||
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(double _Val, int precision = 0, int width = 0);
|
||||
std::string to_hex_str( int const _Val, int const width = 4 );
|
||||
inline std::string to_string(bool _Val)
|
||||
{
|
||||
return _Val == true ? "true" : "false";
|
||||
|
||||
@@ -108,6 +108,11 @@ TNames::TNames()
|
||||
ZeroMemory(rTypes, 20 * sizeof(ItemRecord *));
|
||||
};
|
||||
|
||||
TNames::~TNames() {
|
||||
|
||||
delete[] cBuffer;
|
||||
}
|
||||
|
||||
int TNames::Add(int t, const char *n)
|
||||
{ // dodanie obiektu typu (t) o nazwie (n)
|
||||
int len = strlen(n) + 1; // ze znacznikiem końca
|
||||
|
||||
1
Names.h
1
Names.h
@@ -49,6 +49,7 @@ class TNames
|
||||
int iLast; // ostatnio u¿yty rekord
|
||||
public:
|
||||
TNames();
|
||||
~TNames();
|
||||
int Add(int t, const char *n); // dodanie obiektu typu (t)
|
||||
int Add(int t, const char *n, void *d); // dodanie obiektu z wskaŸnikiem
|
||||
int Add(int t, const char *n, int d); // dodanie obiektu z numerem
|
||||
|
||||
53
PyInt.cpp
53
PyInt.cpp
@@ -45,13 +45,19 @@ TPythonInterpreter *TPythonInterpreter::getInstance()
|
||||
return _instance;
|
||||
}
|
||||
|
||||
bool TPythonInterpreter::loadClassFile(const char *lookupPath, const char *className)
|
||||
void
|
||||
TPythonInterpreter::killInstance() {
|
||||
|
||||
delete _instance;
|
||||
}
|
||||
|
||||
bool TPythonInterpreter::loadClassFile( std::string const &lookupPath, std::string const &className )
|
||||
{
|
||||
std::set<const char *, ltstr>::const_iterator it = _classes.find(className);
|
||||
std::set<std::string const>::const_iterator it = _classes.find(className);
|
||||
if (it == _classes.end())
|
||||
{
|
||||
FILE *sourceFile = _getFile(lookupPath, className);
|
||||
if (sourceFile != NULL)
|
||||
if (sourceFile != nullptr)
|
||||
{
|
||||
fseek(sourceFile, 0, SEEK_END);
|
||||
long fsize = ftell(sourceFile);
|
||||
@@ -72,10 +78,13 @@ bool TPythonInterpreter::loadClassFile(const char *lookupPath, const char *class
|
||||
handleError();
|
||||
return false;
|
||||
}
|
||||
_classes.insert( className );
|
||||
/*
|
||||
char *classNameToRemember = (char *)calloc(strlen(className) + 1, sizeof(char));
|
||||
strcpy(classNameToRemember, className);
|
||||
_classes.insert(classNameToRemember);
|
||||
free(buffer);
|
||||
*/
|
||||
free(buffer);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -83,13 +92,28 @@ bool TPythonInterpreter::loadClassFile(const char *lookupPath, const char *class
|
||||
return true;
|
||||
}
|
||||
|
||||
PyObject *TPythonInterpreter::newClass(const char *className)
|
||||
PyObject *TPythonInterpreter::newClass( std::string const &className )
|
||||
{
|
||||
return newClass(className, NULL);
|
||||
}
|
||||
|
||||
FILE *TPythonInterpreter::_getFile(const char *lookupPath, const char *className)
|
||||
FILE *TPythonInterpreter::_getFile( std::string const &lookupPath, std::string const &className )
|
||||
{
|
||||
if( false == lookupPath.empty() ) {
|
||||
std::string const sourcefilepath = lookupPath + className + ".py";
|
||||
FILE *file = fopen( sourcefilepath.c_str(), "r" );
|
||||
#ifdef _PY_INT_MORE_LOG
|
||||
WriteLog( sourceFilePath );
|
||||
#endif // _PY_INT_MORE_LOG
|
||||
if( nullptr != file ) { return file; }
|
||||
}
|
||||
std::string sourcefilepath = "python\\local\\" + className + ".py";
|
||||
FILE *file = fopen( sourcefilepath.c_str(), "r" );
|
||||
#ifdef _PY_INT_MORE_LOG
|
||||
WriteLog( sourceFilePath );
|
||||
#endif // _PY_INT_MORE_LOG
|
||||
return file; // either the file, or a nullptr on fail
|
||||
/*
|
||||
char *sourceFilePath;
|
||||
if (lookupPath != NULL)
|
||||
{
|
||||
@@ -124,6 +148,7 @@ FILE *TPythonInterpreter::_getFile(const char *lookupPath, const char *className
|
||||
return file;
|
||||
}
|
||||
return NULL;
|
||||
*/
|
||||
}
|
||||
|
||||
void TPythonInterpreter::handleError()
|
||||
@@ -177,14 +202,14 @@ void TPythonInterpreter::handleError()
|
||||
}
|
||||
}
|
||||
}
|
||||
PyObject *TPythonInterpreter::newClass(const char *className, PyObject *argsTuple)
|
||||
PyObject *TPythonInterpreter::newClass(std::string const &className, PyObject *argsTuple)
|
||||
{
|
||||
if (_main == NULL)
|
||||
{
|
||||
WriteLog("main turned into null");
|
||||
return NULL;
|
||||
}
|
||||
PyObject *classNameObj = PyObject_GetAttrString(_main, className);
|
||||
PyObject *classNameObj = PyObject_GetAttrString(_main, className.c_str());
|
||||
if (classNameObj == NULL)
|
||||
{
|
||||
#ifdef _PY_INT_MORE_LOG
|
||||
@@ -477,18 +502,12 @@ void TPythonScreens::update()
|
||||
|
||||
void TPythonScreens::setLookupPath(std::string const &path)
|
||||
{
|
||||
if (_lookupPath != NULL)
|
||||
{
|
||||
free(_lookupPath);
|
||||
}
|
||||
_lookupPath = (char *)calloc(path.length() + 1, sizeof(char));
|
||||
strcpy(_lookupPath, path.c_str());
|
||||
_lookupPath = path;
|
||||
}
|
||||
|
||||
TPythonScreens::TPythonScreens()
|
||||
{
|
||||
_lookupPath = NULL;
|
||||
TPythonInterpreter::getInstance()->loadClassFile(NULL, "abstractscreenrenderer");
|
||||
TPythonInterpreter::getInstance()->loadClassFile("", "abstractscreenrenderer");
|
||||
_terminationFlag = false;
|
||||
_renderReadyFlag = false;
|
||||
_cleanupReadyFlag = false;
|
||||
@@ -501,6 +520,7 @@ TPythonScreens::~TPythonScreens()
|
||||
WriteLog("Called python sceeens destructor");
|
||||
#endif // _PY_INT_MORE_LOG
|
||||
reset(NULL);
|
||||
/*
|
||||
if (_lookupPath != NULL)
|
||||
{
|
||||
#ifdef _PY_INT_MORE_LOG
|
||||
@@ -508,6 +528,7 @@ TPythonScreens::~TPythonScreens()
|
||||
#endif // _PY_INT_MORE_LOG
|
||||
free(_lookupPath);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void TPythonScreens::run()
|
||||
|
||||
22
PyInt.h
22
PyInt.h
@@ -30,22 +30,26 @@ class TPythonInterpreter
|
||||
{
|
||||
protected:
|
||||
TPythonInterpreter();
|
||||
~TPythonInterpreter()
|
||||
{
|
||||
}
|
||||
~TPythonInterpreter() {}
|
||||
static TPythonInterpreter *_instance;
|
||||
int _screenRendererPriority;
|
||||
std::set<const char *, ltstr> _classes;
|
||||
PyObject *_main;
|
||||
// std::set<const char *, ltstr> _classes;
|
||||
std::set<std::string const> _classes;
|
||||
PyObject *_main;
|
||||
PyObject *_stdErr;
|
||||
FILE *_getFile(const char *lookupPath, const char *className);
|
||||
// FILE *_getFile(const char *lookupPath, const char *className);
|
||||
FILE *_getFile( std::string const &lookupPath, std::string const &className );
|
||||
|
||||
public:
|
||||
static TPythonInterpreter *getInstance();
|
||||
bool loadClassFile(const char *lookupPath, const char *className);
|
||||
static void killInstance();
|
||||
/* bool loadClassFile(const char *lookupPath, const char *className);
|
||||
PyObject *newClass(const char *className);
|
||||
PyObject *newClass(const char *className, PyObject *argsTuple);
|
||||
int getScreenRendererPriotity()
|
||||
*/ bool loadClassFile( std::string const &lookupPath, std::string const &className );
|
||||
PyObject *newClass( std::string const &className );
|
||||
PyObject *newClass( std::string const &className, PyObject *argsTuple );
|
||||
int getScreenRendererPriotity()
|
||||
{
|
||||
return _screenRendererPriority;
|
||||
};
|
||||
@@ -79,7 +83,7 @@ class TPythonScreens
|
||||
void *_thread;
|
||||
unsigned int _threadId;
|
||||
std::vector<TPythonScreenRenderer *> _screens;
|
||||
char *_lookupPath;
|
||||
std::string _lookupPath;
|
||||
void *_train;
|
||||
void _cleanup();
|
||||
void _freeTrainState();
|
||||
|
||||
@@ -37,7 +37,7 @@ TRealSound::TRealSound()
|
||||
bLoopPlay = false; // dźwięk wyłączony
|
||||
}
|
||||
|
||||
TRealSound::TRealSound(const char *SoundName, double SoundAttenuation, double X, double Y, double Z, bool Dynamic,
|
||||
TRealSound::TRealSound(std::string const &SoundName, double SoundAttenuation, double X, double Y, double Z, bool Dynamic,
|
||||
bool freqmod, double rmin)
|
||||
{
|
||||
Init(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin);
|
||||
@@ -250,7 +250,7 @@ void TRealSound::ResetPosition()
|
||||
pSound->SetCurrentPosition(0);
|
||||
}
|
||||
|
||||
TTextSound::TTextSound(const char *SoundName, double SoundAttenuation, double X, double Y, double Z,
|
||||
TTextSound::TTextSound(std::string const &SoundName, double SoundAttenuation, double X, double Y, double Z,
|
||||
bool Dynamic, bool freqmod, double rmin)
|
||||
: TRealSound(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ class TRealSound
|
||||
{
|
||||
protected:
|
||||
PSound pSound;
|
||||
char *Nazwa; // dla celow odwszawiania
|
||||
// char *Nazwa; // dla celow odwszawiania NOTE: currently not used anywhere
|
||||
double fDistance, fPreviousDistance; // dla liczenia Dopplera
|
||||
float fFrequency; // częstotliwość samplowania pliku
|
||||
int iDoppler; // Ra 2014-07: możliwość wyłączenia efektu Dopplera np. dla śpiewu ptaków
|
||||
@@ -31,7 +31,7 @@ class TRealSound
|
||||
double FA; // offset czestotliwosci
|
||||
bool bLoopPlay; // czy zapętlony dźwięk jest odtwarzany
|
||||
TRealSound();
|
||||
TRealSound(const char *SoundName, double SoundAttenuation, double X, double Y, double Z, bool Dynamic,
|
||||
TRealSound( std::string const &SoundName, double SoundAttenuation, double X, double Y, double Z, bool Dynamic,
|
||||
bool freqmod = false, double rmin = 0.0);
|
||||
~TRealSound();
|
||||
void Free();
|
||||
@@ -54,7 +54,7 @@ class TTextSound : public TRealSound
|
||||
std::string asText;
|
||||
float fTime; // czas trwania
|
||||
public:
|
||||
TTextSound(const char *SoundName, double SoundAttenuation, double X, double Y, double Z,
|
||||
TTextSound(std::string const &SoundName, double SoundAttenuation, double X, double Y, double Z,
|
||||
bool Dynamic, bool freqmod = false, double rmin = 0.0);
|
||||
void Init(std::string const &SoundName, double SoundAttenuation, double X, double Y, double Z,
|
||||
bool Dynamic, bool freqmod = false, double rmin = 0.0);
|
||||
|
||||
@@ -14,6 +14,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "Logs.h"
|
||||
#include "Usefull.h"
|
||||
#include "mczapkie/mctools.h"
|
||||
#include "WavRead.h"
|
||||
//#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
|
||||
#define SAFE_RELEASE(p) \
|
||||
{ \
|
||||
|
||||
7
Sound.h
7
Sound.h
@@ -11,14 +11,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#define SoundH
|
||||
|
||||
#include <stack>
|
||||
#undef EOF
|
||||
#include <objbase.h>
|
||||
//#include <initguid.h>
|
||||
//#include <commdlg.h>
|
||||
#include <mmreg.h>
|
||||
#include <dsound.h>
|
||||
//#include "resource.h"
|
||||
#include "WavRead.h"
|
||||
|
||||
typedef LPDIRECTSOUNDBUFFER PSound;
|
||||
|
||||
|
||||
49
Track.cpp
49
Track.cpp
@@ -59,30 +59,26 @@ TSwitchExtension::TSwitchExtension(TTrack *owner, int what)
|
||||
pOwner = NULL;
|
||||
pNextAnim = NULL;
|
||||
bMovement = false; // nie potrzeba przeliczać fOffset1
|
||||
Segments[0] = new TSegment(owner); // z punktu 1 do 2
|
||||
Segments[1] = new TSegment(
|
||||
owner); // z punktu 3 do 4 (1=3 dla zwrotnic; odwrócony dla skrzyżowań, ewentualnie 1=4)
|
||||
Segments[0] = std::make_shared<TSegment>(owner); // z punktu 1 do 2
|
||||
Segments[1] = std::make_shared<TSegment>(owner); // z punktu 3 do 4 (1=3 dla zwrotnic; odwrócony dla skrzyżowań, ewentualnie 1=4)
|
||||
Segments[2] = (what >= 3) ?
|
||||
new TSegment(owner) :
|
||||
NULL; // z punktu 2 do 4 skrzyżowanie od góry: wersja "-1":
|
||||
Segments[3] =
|
||||
(what >= 4) ? new TSegment(owner) : NULL; // z punktu 4 do 1 1 1=4 0 0=3
|
||||
Segments[4] =
|
||||
(what >= 5) ? new TSegment(owner) : NULL; // z punktu 1 do 3 4 x 3 3 3 x 2 2
|
||||
Segments[5] = (what >= 6) ? new TSegment(owner) :
|
||||
NULL; // z punktu 3 do 2 2 2 1 1
|
||||
evPlus = evMinus = NULL;
|
||||
std::make_shared<TSegment>(owner) :
|
||||
nullptr; // z punktu 2 do 4 skrzyżowanie od góry: wersja "-1":
|
||||
Segments[3] = (what >= 4) ?
|
||||
std::make_shared<TSegment>(owner) :
|
||||
nullptr; // z punktu 4 do 1 1 1=4 0 0=3
|
||||
Segments[4] = (what >= 5) ?
|
||||
std::make_shared<TSegment>(owner) :
|
||||
nullptr; // z punktu 1 do 3 4 x 3 3 3 x 2 2
|
||||
Segments[5] = (what >= 6) ?
|
||||
std::make_shared<TSegment>(owner) :
|
||||
nullptr; // z punktu 3 do 2 2 2 1 1
|
||||
evPlus = evMinus = NULL;
|
||||
fVelocity = -1.0; // maksymalne ograniczenie prędkości (ustawianej eventem)
|
||||
vTrans = vector3(0, 0, 0); // docelowa translacja przesuwnicy
|
||||
}
|
||||
TSwitchExtension::~TSwitchExtension()
|
||||
{ // nie ma nic do usuwania
|
||||
// delete Segments[0];
|
||||
// delete Segments[1];
|
||||
delete Segments[2];
|
||||
delete Segments[3];
|
||||
delete Segments[4];
|
||||
delete Segments[5];
|
||||
}
|
||||
|
||||
TIsolated::TIsolated()
|
||||
@@ -211,7 +207,11 @@ TTrack::TTrack(TGroundNode *g)
|
||||
|
||||
TTrack::~TTrack()
|
||||
{ // likwidacja odcinka
|
||||
if (eType == tt_Normal)
|
||||
if( eType == tt_Cross ) {
|
||||
delete SwitchExtension->vPoints; // skrzyżowanie może mieć punkty
|
||||
}
|
||||
|
||||
/* if (eType == tt_Normal)
|
||||
delete Segment; // dla zwrotnic nie usuwać tego (kopiowany)
|
||||
else
|
||||
{ // usuwanie dodatkowych danych dla niezwykłych odcinków
|
||||
@@ -219,6 +219,7 @@ TTrack::~TTrack()
|
||||
delete SwitchExtension->vPoints; // skrzyżowanie może mieć punkty
|
||||
SafeDelete(SwitchExtension);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void TTrack::Init()
|
||||
@@ -226,21 +227,21 @@ void TTrack::Init()
|
||||
switch (eType)
|
||||
{
|
||||
case tt_Switch:
|
||||
SwitchExtension = new TSwitchExtension(this, 2); // na wprost i na bok
|
||||
SwitchExtension = std::make_shared<TSwitchExtension>( this, 2 ); // na wprost i na bok
|
||||
break;
|
||||
case tt_Cross: // tylko dla skrzyżowania dróg
|
||||
SwitchExtension = new TSwitchExtension(this, 6); // 6 połączeń
|
||||
SwitchExtension = std::make_shared<TSwitchExtension>( this, 6 ); // 6 połączeń
|
||||
SwitchExtension->vPoints = NULL; // brak tablicy punktów
|
||||
SwitchExtension->iPoints = 0;
|
||||
SwitchExtension->bPoints = false; // tablica punktów nie wypełniona
|
||||
SwitchExtension->iRoads = 4; // domyślnie 4
|
||||
break;
|
||||
case tt_Normal:
|
||||
Segment = new TSegment(this);
|
||||
Segment = std::make_shared<TSegment>( this );
|
||||
break;
|
||||
case tt_Table: // oba potrzebne
|
||||
SwitchExtension = new TSwitchExtension(this, 1); // kopia oryginalnego toru
|
||||
Segment = new TSegment(this);
|
||||
SwitchExtension = std::make_shared<TSwitchExtension>( this, 1 ); // kopia oryginalnego toru
|
||||
Segment = make_shared<TSegment>(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
8
Track.h
8
Track.h
@@ -48,7 +48,7 @@ class TSwitchExtension
|
||||
public:
|
||||
TSwitchExtension(TTrack *owner, int what);
|
||||
~TSwitchExtension();
|
||||
TSegment *Segments[6]; // dwa tory od punktu 1, pozostałe dwa od 2? Ra 140101: 6 połączeń dla
|
||||
std::shared_ptr<TSegment> Segments[6]; // dwa tory od punktu 1, pozostałe dwa od 2? Ra 140101: 6 połączeń dla
|
||||
// skrzyżowań
|
||||
// TTrack *trNear[4]; //tory dołączone do punktów 1, 2, 3 i 4
|
||||
// dotychczasowe [2]+[2] wskaźniki zamienić na nowe [4]
|
||||
@@ -126,8 +126,8 @@ class TIsolated
|
||||
class TTrack : public Resource
|
||||
{ // trajektoria ruchu - opakowanie
|
||||
private:
|
||||
TSwitchExtension *SwitchExtension; // dodatkowe dane do toru, który jest zwrotnicą
|
||||
TSegment *Segment;
|
||||
std::shared_ptr<TSwitchExtension> SwitchExtension; // dodatkowe dane do toru, który jest zwrotnicą
|
||||
std::shared_ptr<TSegment> Segment;
|
||||
TTrack *trNext; // odcinek od strony punktu 2 - to powinno być w segmencie
|
||||
TTrack *trPrev; // odcinek od strony punktu 1
|
||||
// McZapkie-070402: dodalem zmienne opisujace rozmiary tekstur
|
||||
@@ -204,7 +204,7 @@ class TTrack : public Resource
|
||||
{
|
||||
return Segment->GetLength();
|
||||
};
|
||||
inline TSegment * CurrentSegment()
|
||||
inline std::shared_ptr<TSegment> CurrentSegment()
|
||||
{
|
||||
return Segment;
|
||||
};
|
||||
|
||||
@@ -316,7 +316,6 @@ PyObject *TTrain::GetTrainState()
|
||||
PyDict_SetItemString( dict, ( std::string( "eimp_u" ) + std::to_string( i + 1 ) + "_comp_a" ).c_str(), PyGetBool( bComp[ i ][ 0 ] ) );
|
||||
PyDict_SetItemString( dict, ( std::string( "eimp_u" ) + std::to_string( i + 1 ) + "_comp_w" ).c_str(), PyGetBool( bComp[ i ][ 1 ] ) );
|
||||
PyDict_SetItemString( dict, ( std::string( "eimp_c" ) + std::to_string( i + 1 ) + "_heat" ).c_str(), PyGetBool( bHeat[ i ] ) );
|
||||
|
||||
}
|
||||
for (int i = 0; i<20; i++)
|
||||
{
|
||||
@@ -325,13 +324,13 @@ PyObject *TTrain::GetTrainState()
|
||||
PyGetFloatS(fPress[i][j]));
|
||||
}
|
||||
bool bEP, bPN;
|
||||
bEP = (mvControlled->LocHandle->GetCP()>0.2) || (fEIMParams[0][2]>0.01);
|
||||
bEP = ( mvControlled->LocHandle->GetCP() > 0.2 ) || ( fEIMParams[0][2] > 0.01 );
|
||||
PyDict_SetItemString(dict, "dir_brake", PyGetBool(bEP));
|
||||
if (typeid(mvControlled->Hamulec) == typeid(TLSt) || typeid(mvControlled->Hamulec) == typeid(TEStED))
|
||||
{
|
||||
TBrake* temp_ham = mvControlled->Hamulec;
|
||||
// auto temp_ham = mvControlled->Hamulec;
|
||||
// TLSt* temp_ham2 = temp_ham;
|
||||
bPN = (static_cast<TLSt*>(temp_ham)->GetEDBCP()>0.2);
|
||||
bPN = ( static_cast<TLSt *>(mvControlled->Hamulec.get())->GetEDBCP() > 0.2 );
|
||||
}
|
||||
else
|
||||
bPN = false;
|
||||
|
||||
@@ -102,7 +102,7 @@ TTrack * TTrackFollower::SetCurrentTrack(TTrack *pTrack, int end)
|
||||
pCurrentTrack->AxleCounter(-1, Owner); // opuszczenie tamtego toru
|
||||
}
|
||||
pCurrentTrack = pTrack;
|
||||
pCurrentSegment = (pCurrentTrack ? pCurrentTrack->CurrentSegment() : NULL);
|
||||
pCurrentSegment = ( pCurrentTrack != nullptr ? pCurrentTrack->CurrentSegment() : nullptr );
|
||||
if (!pCurrentTrack)
|
||||
Error(Owner->MoverParameters->Name + " at NULL track");
|
||||
return pCurrentTrack;
|
||||
|
||||
@@ -17,8 +17,8 @@ class TTrackFollower
|
||||
{ // oœ poruszaj¹ca siê po torze
|
||||
private:
|
||||
TTrack *pCurrentTrack; // na którym torze siê znajduje
|
||||
TSegment *pCurrentSegment; // zwrotnice mog¹ mieæ dwa segmenty
|
||||
double fCurrentDistance; // przesuniêcie wzglêdem Point1 w stronê Point2
|
||||
std::shared_ptr<TSegment> pCurrentSegment; // zwrotnice mog¹ mieæ dwa segmenty
|
||||
double fCurrentDistance; // przesuniêcie wzglêdem Point1 w stronê Point2
|
||||
double fDirection; // ustawienie wzglêdem toru: -1.0 albo 1.0, mno¿one przez dystans
|
||||
bool ComputatePosition(); // przeliczenie pozycji na torze
|
||||
TDynamicObject *Owner; // pojazd posiadaj¹cy
|
||||
|
||||
15
mtable.cpp
15
mtable.cpp
@@ -15,7 +15,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "mtable.h"
|
||||
|
||||
// using namespace Mtable;
|
||||
TMTableTime *Mtable::GlobalTime;
|
||||
std::shared_ptr<TMTableTime> Mtable::GlobalTime;
|
||||
|
||||
double CompareTime(double t1h, double t1m, double t2h, double t2m) /*roznica czasu w minutach*/
|
||||
// zwraca ró¿nicê czasu
|
||||
@@ -529,19 +529,6 @@ void TMTableTime::UpdateMTableTime(double deltaT)
|
||||
GameTime = GameTime + deltaT;
|
||||
}
|
||||
|
||||
TMTableTime::TMTableTime(int InitH, int InitM, int InitSRH, int InitSRM, int InitSSH, int InitSSM)
|
||||
{
|
||||
GameTime = 0.0;
|
||||
dd = 0;
|
||||
hh = InitH;
|
||||
mm = InitM;
|
||||
srh = InitSRH;
|
||||
srm = InitSRM;
|
||||
ssh = InitSSH;
|
||||
ssm = InitSSM;
|
||||
mr = 0.0;
|
||||
}
|
||||
|
||||
bool TTrainParameters::DirectionChange()
|
||||
// sprawdzenie, czy po zatrzymaniu wykonaæ kolejne komendy
|
||||
{
|
||||
|
||||
31
mtable.h
31
mtable.h
@@ -86,20 +86,29 @@ class TMTableTime
|
||||
|
||||
{
|
||||
public:
|
||||
double GameTime;
|
||||
int dd;
|
||||
int hh;
|
||||
int mm;
|
||||
int srh;
|
||||
int srm; /*wschod slonca*/
|
||||
int ssh;
|
||||
int ssm; /*zachod slonca*/
|
||||
double mr;
|
||||
double GameTime = 0.0;
|
||||
int dd = 0;
|
||||
int hh = 0;
|
||||
int mm = 0;
|
||||
int srh = 0;
|
||||
int srm = 0; /*wschod slonca*/
|
||||
int ssh = 0;
|
||||
int ssm = 0; /*zachod slonca*/
|
||||
double mr = 0.0;
|
||||
void UpdateMTableTime(double deltaT);
|
||||
TMTableTime(int InitH, int InitM, int InitSRH, int InitSRM, int InitSSH, int InitSSM);
|
||||
TMTableTime(int InitH, int InitM, int InitSRH, int InitSRM, int InitSSH, int InitSSM) :
|
||||
hh( InitH ),
|
||||
mm( InitM ),
|
||||
srh( InitSRH ),
|
||||
srm( InitSRM ),
|
||||
ssh( InitSSH ),
|
||||
ssm( InitSSM )
|
||||
{}
|
||||
|
||||
TMTableTime() = default;
|
||||
};
|
||||
|
||||
extern TMTableTime *GlobalTime;
|
||||
extern std::shared_ptr<TMTableTime> GlobalTime;
|
||||
}
|
||||
|
||||
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
|
||||
|
||||
@@ -191,7 +191,7 @@ bool cParser::trimComments(std::string &String)
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string cParser::readComment(const std::string Break)
|
||||
std::string cParser::readComment(std::string const &Break)
|
||||
{ // pobieranie znaków a¿ do znalezienia znacznika koñca
|
||||
std::string token = "";
|
||||
while (mStream->peek() != EOF)
|
||||
|
||||
4
parser.h
4
parser.h
@@ -57,7 +57,7 @@ class cParser : public std::stringstream
|
||||
for (int i = 0; i < count; i++)
|
||||
readToken();
|
||||
};
|
||||
inline bool expectToken(std::string value)
|
||||
inline bool expectToken(std::string const &value)
|
||||
{
|
||||
return readToken() == value;
|
||||
};
|
||||
@@ -77,7 +77,7 @@ class cParser : public std::stringstream
|
||||
protected:
|
||||
// methods:
|
||||
std::string readToken(bool ToLower = true, const char *Break = "\n\t ;");
|
||||
std::string readComment(const std::string Break = "\n\t ;");
|
||||
std::string readComment(std::string const &Break = "\n\t ;");
|
||||
std::string trtest;
|
||||
bool trimComments(std::string &String);
|
||||
// members:
|
||||
|
||||
7
stdafx.h
7
stdafx.h
@@ -10,6 +10,12 @@
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#ifdef _DEBUG
|
||||
#ifndef DBG_NEW
|
||||
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
|
||||
#define new DBG_NEW
|
||||
#endif
|
||||
#endif // _DEBUG
|
||||
#endif
|
||||
// operating system
|
||||
#include "targetver.h"
|
||||
@@ -19,6 +25,7 @@
|
||||
#undef NOMINMAX
|
||||
// stl
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
|
||||
Reference in New Issue
Block a user