16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-24 08:39:18 +02:00

Merge pull request #18 from tmj-fstate/mover_in_c++

Poprawki do stabilności działania i wycieków pamięci.
This commit is contained in:
firleju
2017-01-24 11:33:20 +01:00
committed by GitHub
43 changed files with 1809 additions and 2085 deletions

View File

@@ -10,7 +10,6 @@ http://mozilla.org/MPL/2.0/.
#ifndef AdvSoundH #ifndef AdvSoundH
#define AdvSoundH #define AdvSoundH
#include "Sound.h"
#include "RealSound.h" #include "RealSound.h"
#include "parser.h" #include "parser.h"

View File

@@ -11,21 +11,21 @@ http://mozilla.org/MPL/2.0/.
Copyright (C) 2001-2004 Marcin Wozniak, Maciej Czapkiewicz and others Copyright (C) 2001-2004 Marcin Wozniak, Maciej Czapkiewicz and others
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "Driver.h" #include "Driver.h"
#include <direct.h>
#include "Globals.h"
#include "Logs.h"
#include "mtable.h"
#include "DynObj.h" #include "DynObj.h"
#include "Event.h" #include "Event.h"
#include "Globals.h"
#include "Ground.h" #include "Ground.h"
#include "Logs.h"
#include "McZapkie/MOVER.h"
#include "McZapkie/mctools.h"
#include "MemCell.h" #include "MemCell.h"
#include "World.h" #include "World.h"
#include "mtable.h" #include "McZapkie/mctools.h"
#include <direct.h> #include "McZapkie/MOVER.h"
#define LOGVELOCITY 0 #define LOGVELOCITY 0
#define LOGORDERS 0 #define LOGORDERS 0
@@ -296,11 +296,10 @@ std::string TSpeedPos::TableText()
{ // pozycja tabelki pr?dko?ci { // pozycja tabelki pr?dko?ci
if (iFlags & spEnabled) if (iFlags & spEnabled)
{ // o ile pozycja istotna { // 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(); ", Vel=" + std::to_string(fVelNext) + ", Name=" + GetName();
// if (iFlags & spTrack) // je?li tor //if (iFlags & spTrack) // jeśli tor
// return "Flags=#" + IntToHex(iFlags, 8) + ", Dist=" + FloatToStrF(fDist, ffFixed, 7, 1) // return "Flags=#" + IntToHex(iFlags, 8) + ", Dist=" + FloatToStrF(fDist, ffFixed, 7, 1) +
// +
// ", Vel=" + AnsiString(fVelNext) + ", Track=" + trTrack->NameGet(); // ", Vel=" + AnsiString(fVelNext) + ", Track=" + trTrack->NameGet();
//else if (iFlags & spEvent) // jeśli event //else if (iFlags & spEvent) // jeśli event
// return "Flags=#" + IntToHex(iFlags, 8) + ", Dist=" + FloatToStrF(fDist, ffFixed, 7, 1) + // return "Flags=#" + IntToHex(iFlags, 8) + ", Dist=" + FloatToStrF(fDist, ffFixed, 7, 1) +
@@ -494,12 +493,9 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
pTrack = sSpeedTable[iLast].trTrack; // ostatnio sprawdzony tor pTrack = sSpeedTable[iLast].trTrack; // ostatnio sprawdzony tor
if (!pTrack) if (!pTrack)
return; // koniec toru, to nie ma co sprawdzać (nie ma prawa tak być) return; // koniec toru, to nie ma co sprawdzać (nie ma prawa tak być)
fLastDir = sSpeedTable[iLast].iFlags & spReverse ? fLastDir = (sSpeedTable[iLast].iFlags & spReverse) ? -1.0 : 1.0; // flaga ustawiona, gdy Point2 toru jest bli<6C>ej
-1.0 : fCurrentDistance = sSpeedTable[iLast].fDist; // aktualna odleg<65>o<EFBFBD><6F> do jego Point1
1.0; // flaga ustawiona, gdy Point2 toru jest bliżej fTrackLength = (sSpeedTable[iLast].iFlags & (spElapsed | spEnd)) ? 0.0 : pTrack->Length(); // nie dolicza<7A> d<>ugo<67>ci gdy:
fCurrentDistance = sSpeedTable[iLast].fDist; // aktualna odległość do jego Point1
fTrackLength =
sSpeedTable[iLast].iFlags & (spElapsed | spEnd) ? 0.0 : pTrack->Length(); // nie doliczać długości gdy:
// 32-minięty początek, // 32-minięty początek,
// 64-jazda do końca toru // 64-jazda do końca toru
} }
@@ -830,9 +826,8 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
// już semafora) // już semafora)
#if LOGSTOPS #if LOGSTOPS
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName + ": at " + WriteLog(pVehicle->asName + " as " + TrainParams->TrainName + ": at " +
std::to_string(GlobalTime->hh) + ":" + std::to_string(GlobalTime->hh) + ":" + std::to_string(GlobalTime->mm) +
std::to_string(GlobalTime->mm) + " skipped " + " skipped " + asNextStop); // informacja
asNextStop); // informacja
#endif #endif
fLastStopExpDist = mvOccupied->DistCounter + 0.250 + fLastStopExpDist = mvOccupied->DistCounter + 0.250 +
0.001 * fLength; // przy jakim dystansie (stanie 0.001 * fLength; // przy jakim dystansie (stanie
@@ -1155,10 +1150,6 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
iDrivigFlags |= moveSemaphorFound; //jeśli z przodu to dajemy falgę, że jest iDrivigFlags |= moveSemaphorFound; //jeśli z przodu to dajemy falgę, że jest
d_to_next_sem = Min0R(sSpeedTable[i].fDist, d_to_next_sem); d_to_next_sem = Min0R(sSpeedTable[i].fDist, d_to_next_sem);
} }
if (sSpeedTable[i].fDist <= d_to_next_sem)
{
VelSignalNext = sSpeedTable[i].fVelNext;
}
} }
else if (sSpeedTable[i].iFlags & spRoadVel) else if (sSpeedTable[i].iFlags & spRoadVel)
{ // to W6 { // to W6
@@ -1890,7 +1881,7 @@ bool TController::CheckVehicles(TOrders user)
{ // jeśli pojazd posiada pantograf, to przydzielamy mu maskę, którą będzie informował o { // jeśli pojazd posiada pantograf, to przydzielamy mu maskę, którą będzie informował o
// jeździe bezprądowej // jeździe bezprądowej
p->iOverheadMask = pantmask; p->iOverheadMask = pantmask;
pantmask << 1; // przesunięcie bitów, max. 32 pojazdy z pantografami w składzie pantmask = pantmask << 1; // przesunięcie bitów, max. 32 pojazdy z pantografami w składzie
} }
d = p->DirectionSet(d ? 1 : -1); // zwraca położenie następnego (1=zgodny,0=odwrócony - d = p->DirectionSet(d ? 1 : -1); // zwraca położenie następnego (1=zgodny,0=odwrócony -
// względem czoła składu) // względem czoła składu)
@@ -2173,9 +2164,8 @@ void TController::SetDriverPsyche()
bool TController::PrepareEngine() bool TController::PrepareEngine()
{ // odpalanie silnika { // odpalanie silnika
bool OK; bool OK = false,
bool voltfront, voltrear; voltfront = false,
voltfront = false;
voltrear = false; voltrear = false;
LastReactionTime = 0.0; LastReactionTime = 0.0;
ReactionTime = PrepareTime; ReactionTime = PrepareTime;
@@ -2320,7 +2310,7 @@ bool TController::PrepareEngine()
if (OK) if (OK)
{ {
if (eStopReason == stopSleep) // jeśli dotychczas spał if (eStopReason == stopSleep) // jeśli dotychczas spał
eStopReason == stopNone; // teraz nie ma powodu do stania eStopReason = stopNone; // teraz nie ma powodu do stania
iEngineActive = 1; iEngineActive = 1;
return true; return true;
} }
@@ -2955,8 +2945,7 @@ bool TController::PutCommand(std::string NewCommand, double NewValue1, double Ne
if (ConversionError == -8) if (ConversionError == -8)
ErrorLog("Missed timetable: " + NewCommand); ErrorLog("Missed timetable: " + NewCommand);
WriteLog("Cannot load timetable file " + NewCommand + "\r\nError " + WriteLog("Cannot load timetable file " + NewCommand + "\r\nError " +
std::to_string(ConversionError) + " in position " + std::to_string(ConversionError) + " in position " + std::to_string(TrainParams->StationCount));
std::to_string(TrainParams->StationCount));
NewCommand = ""; // puste, dla wymiennej tekstury NewCommand = ""; // puste, dla wymiennej tekstury
} }
else else
@@ -2970,21 +2959,20 @@ bool TController::PutCommand(std::string NewCommand, double NewValue1, double Ne
NewCommand = Global::asCurrentSceneryPath + NewCommand + ".wav"; // na razie jeden NewCommand = Global::asCurrentSceneryPath + NewCommand + ".wav"; // na razie jeden
if (FileExists(NewCommand)) if (FileExists(NewCommand))
{ // wczytanie dźwięku odjazdu podawanego bezpośrenido { // wczytanie dźwięku odjazdu podawanego bezpośrenido
tsGuardSignal = tsGuardSignal = new TTextSound(NewCommand.c_str(), 30, pVehicle->GetPosition().x,
new TTextSound(NewCommand.c_str(), 30, pVehicle->GetPosition().x, pVehicle->GetPosition().y, pVehicle->GetPosition().z,
pVehicle->GetPosition().y, pVehicle->GetPosition().z, false); false);
// rsGuardSignal->Stop(); // rsGuardSignal->Stop();
iGuardRadio = 0; // nie przez radio iGuardRadio = 0; // nie przez radio
} }
else else
{ {
NewCommand = NewCommand.insert(NewCommand.find_last_of("."), NewCommand = NewCommand.insert(NewCommand.find_last_of("."),"radio"); // wstawienie przed kropkč
"radio"); // wstawienie przed kropkč
if (FileExists(NewCommand)) if (FileExists(NewCommand))
{ // wczytanie dźwięku odjazdu w wersji radiowej (słychać tylko w kabinie) { // wczytanie dźwięku odjazdu w wersji radiowej (słychać tylko w kabinie)
tsGuardSignal = new TTextSound( tsGuardSignal = new TTextSound(NewCommand.c_str(), -1, pVehicle->GetPosition().x,
NewCommand.c_str(), -1, pVehicle->GetPosition().x, pVehicle->GetPosition().y, pVehicle->GetPosition().z,
pVehicle->GetPosition().y, pVehicle->GetPosition().z, false); false);
iGuardRadio = iRadioChannel; iGuardRadio = iRadioChannel;
} }
} }

View File

@@ -1,4 +1,4 @@
/* /*
This Source Code Form is subject to the This Source Code Form is subject to the
terms of the Mozilla Public License, v. terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not 2.0. If a copy of the MPL was not
@@ -1886,11 +1886,11 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
{ {
} }
} // koniec hamulce } // 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 // jakies inne prefiksy
} }
*/
} // koniec while kropka } // koniec while kropka
if (MoverParameters->CategoryFlag & 2) // jeśli samochód if (MoverParameters->CategoryFlag & 2) // jeśli samochód
@@ -2522,17 +2522,23 @@ bool TDynamicObject::Update(double dt, double dt1)
// ts.R=MyTrack->fRadius; //ujemne promienie są już zamienione przy // ts.R=MyTrack->fRadius; //ujemne promienie są już zamienione przy
// wczytywaniu // wczytywaniu
if (Axle0.vAngles.z != Axle1.vAngles.z) if (Axle0.vAngles.z != Axle1.vAngles.z)
{ // wyliczenie promienia z obrotów { // wyliczenie promienia z obrotów osi - modyfikację zgłosił youBy
// osi - modyfikację zgłosił youBy
ts.R = Axle0.vAngles.z - Axle1.vAngles.z; // różnica może dawać stałą ±M_2PI ts.R = Axle0.vAngles.z - Axle1.vAngles.z; // różnica może dawać stałą ±M_2PI
if (ts.R > M_PI) if( ( ts.R > 15000.0 ) || ( ts.R < -15000.0 ) ) {
ts.R -= M_2PI else if (ts.R < -M_PI) ts.R += M_2PI; // normalizacja // szkoda czasu na zbyt duże promienie, 4km to promień nie wymagający przechyłki
ts.R = 0.0;
}
else {
// normalizacja
if( ts.R > M_PI ) { ts.R -= M_2PI; }
else if( ts.R < -M_PI ) { ts.R += M_2PI; }
if( ts.R != 0.0 ) {
// sin(0) results in division by zero
// ts.R=fabs(0.5*MoverParameters->BDist/sin(ts.R*0.5)); // ts.R=fabs(0.5*MoverParameters->BDist/sin(ts.R*0.5));
ts.R = -0.5 * MoverParameters->BDist / sin( ts.R * 0.5 ); ts.R = -0.5 * MoverParameters->BDist / sin( ts.R * 0.5 );
if ((ts.R > 15000.0) || (ts.R < -15000.0)) }
ts.R = 0.0; // szkoda czasu na zbyt duże promienie, 4km to promień nie }
// wymagający
// przechyłki
} }
else else
ts.R = 0.0; ts.R = 0.0;
@@ -2840,7 +2846,7 @@ bool TDynamicObject::Update(double dt, double dt1)
i = 0; i = 0;
przek = przek / (np - nPrzekrF); przek = przek / (np - nPrzekrF);
for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0, 4); p; for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0, 4); p;
(kier > 0 ? p = p->NextC(4) : p = p->PrevC(4))) (true == kier ? p = p->NextC(4) : p = p->PrevC(4)))
{ {
if (!PrzekrF[i]) if (!PrzekrF[i])
{ {
@@ -2851,7 +2857,7 @@ bool TDynamicObject::Update(double dt, double dt1)
} }
i = 0; i = 0;
for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0, 4); p; for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0, 4); p;
(kier > 0 ? p = p->NextC(4) : p = p->PrevC(4))) (true == kier ? p = p->NextC(4) : p = p->PrevC(4)))
{ {
float Nmax = ((p->MoverParameters->P2FTrans * p->MoverParameters->MaxBrakePress[0] - float Nmax = ((p->MoverParameters->P2FTrans * p->MoverParameters->MaxBrakePress[0] -
p->MoverParameters->BrakeCylSpring) * p->MoverParameters->BrakeCylSpring) *
@@ -3389,24 +3395,24 @@ bool TDynamicObject::Update(double dt, double dt1)
// NBMX Obsluga drzwi, MC: zuniwersalnione // NBMX Obsluga drzwi, MC: zuniwersalnione
if ((dDoorMoveL < MoverParameters->DoorMaxShiftL) && (MoverParameters->DoorLeftOpened)) if ((dDoorMoveL < MoverParameters->DoorMaxShiftL) && (MoverParameters->DoorLeftOpened))
{ {
rsDoorOpen.Play(1, 0, MechInside, vPosition); rsDoorOpen.Play(vol, 0, MechInside, vPosition);
dDoorMoveL += dt1 * 0.5 * MoverParameters->DoorOpenSpeed; dDoorMoveL += dt1 * 0.5 * MoverParameters->DoorOpenSpeed;
} }
if ((dDoorMoveL > 0) && (!MoverParameters->DoorLeftOpened)) if ((dDoorMoveL > 0) && (!MoverParameters->DoorLeftOpened))
{ {
rsDoorClose.Play(1, 0, MechInside, vPosition); rsDoorClose.Play(vol, 0, MechInside, vPosition);
dDoorMoveL -= dt1 * MoverParameters->DoorCloseSpeed; dDoorMoveL -= dt1 * MoverParameters->DoorCloseSpeed;
if (dDoorMoveL < 0) if (dDoorMoveL < 0)
dDoorMoveL = 0; dDoorMoveL = 0;
} }
if ((dDoorMoveR < MoverParameters->DoorMaxShiftR) && (MoverParameters->DoorRightOpened)) if ((dDoorMoveR < MoverParameters->DoorMaxShiftR) && (MoverParameters->DoorRightOpened))
{ {
rsDoorOpen.Play(1, 0, MechInside, vPosition); rsDoorOpen.Play(vol, 0, MechInside, vPosition);
dDoorMoveR += dt1 * 0.5 * MoverParameters->DoorOpenSpeed; dDoorMoveR += dt1 * 0.5 * MoverParameters->DoorOpenSpeed;
} }
if ((dDoorMoveR > 0) && (!MoverParameters->DoorRightOpened)) if ((dDoorMoveR > 0) && (!MoverParameters->DoorRightOpened))
{ {
rsDoorClose.Play(1, 0, MechInside, vPosition); rsDoorClose.Play(vol, 0, MechInside, vPosition);
dDoorMoveR -= dt1 * MoverParameters->DoorCloseSpeed; dDoorMoveR -= dt1 * MoverParameters->DoorCloseSpeed;
if (dDoorMoveR < 0) if (dDoorMoveR < 0)
dDoorMoveR = 0; dDoorMoveR = 0;
@@ -3769,7 +3775,7 @@ void TDynamicObject::RenderSounds()
vol = rsSilnik.AM * MoverParameters->dizel_fill + rsSilnik.AA; vol = rsSilnik.AM * MoverParameters->dizel_fill + rsSilnik.AA;
else else
vol = vol =
rsSilnik.AM * fabs(MoverParameters->enrot / MoverParameters->nmax) + rsSilnik.AM * fabs(MoverParameters->enrot / MoverParameters->dizel_nmax) +
rsSilnik.AA * 0.9; rsSilnik.AA * 0.9;
} }
else else
@@ -4245,10 +4251,10 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
iMultiTex = 0; // czy jest wiele tekstur wymiennych? iMultiTex = 0; // czy jest wiele tekstur wymiennych?
parser.getTokens(); parser.getTokens();
parser >> asModel; parser >> asModel;
if (asModel.find('#') == asModel.length()) // Ra 2015-01: nie podoba mi się to if( asModel[asModel.size() - 1] == '#' ) // Ra 2015-01: nie podoba mi siê to
{ // model wymaga wielu tekstur wymiennych { // model wymaga wielu tekstur wymiennych
iMultiTex = 1; iMultiTex = 1;
asModel = asModel.substr(0, asModel.length() - 1); asModel.erase( asModel.length() - 1 );
} }
if ((i = asModel.find(',')) != std::string::npos) if ((i = asModel.find(',')) != std::string::npos)
{ // Ra 2015-01: może szukać przecinka w { // Ra 2015-01: może szukać przecinka w
@@ -4266,6 +4272,7 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
// modele w dynamics/basedir // modele w dynamics/basedir
Global::asCurrentTexturePath = BaseDir; // biezaca sciezka do tekstur to dynamic/... Global::asCurrentTexturePath = BaseDir; // biezaca sciezka do tekstur to dynamic/...
mdModel = TModelsManager::GetModel(asModel, true); mdModel = TModelsManager::GetModel(asModel, true);
assert( mdModel != nullptr ); // TODO: handle this more gracefully than all going to shit
if (ReplacableSkin != "none") if (ReplacableSkin != "none")
{ // tekstura wymienna jest raczej jedynie w "dynamic\" { // tekstura wymienna jest raczej jedynie w "dynamic\"
ReplacableSkin = ReplacableSkin =
@@ -4527,7 +4534,7 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
} }
if( token == "brakemode:" ) { if( token == "brakemode:" ) {
// Ra 15-01: gaďż˝ka nastawy hamulca // Ra 15-01: gałka nastawy hamulca
parser.getTokens(); parser.getTokens();
parser >> asAnimName; parser >> asAnimName;
smBrakeMode = mdModel->GetFromName(asAnimName.c_str()); smBrakeMode = mdModel->GetFromName(asAnimName.c_str());
@@ -4589,22 +4596,17 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
// układy // układy
if ((k >= 'A') && (k <= 'J')) // 10 chyba maksimum? if ((k >= 'A') && (k <= 'J')) // 10 chyba maksimum?
{ {
pAnimations[i++].dWheelAngle = pAnimations[i++].dWheelAngle = dWheelAngle + 1; // obrót osi napędzających
dWheelAngle + 1; // obrót osi napędzających --k; // następna będzie albo taka sama, albo bierzemy kolejny znak
--k; // następna będzie albo taka sama, albo bierzemy kolejny
// znak
m = 2; // następujące toczne będą miały inną średnicę m = 2; // następujące toczne będą miały inną średnicę
} }
else if ((k >= '1') && (k <= '9')) else if ((k >= '1') && (k <= '9'))
{ {
pAnimations[i++].dWheelAngle = dWheelAngle + m; // obrót osi pAnimations[i++].dWheelAngle = dWheelAngle + m; // obrót osi tocznych
// tocznych --k; // następna będzie albo taka sama, albo bierzemy kolejny znak
--k; // następna będzie albo taka sama, albo bierzemy kolejny
// znak
} }
else else
k = MoverParameters->AxleArangement[j++]; // pobranie kolejnego k = MoverParameters->AxleArangement[j++]; // pobranie kolejnego znaku
// znaku
} }
} }
} }
@@ -4774,8 +4776,7 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
*sm->GetMatrix()); // skopiowanie, bo będziemy mnożyć *sm->GetMatrix()); // skopiowanie, bo będziemy mnożyć
m( 3 )[ 1 ] = m( 3 )[ 1 ] =
m[ 3 ][ 1 ] + 0.054; // w górę o wysokość ślizgu (na razie tak) m[ 3 ][ 1 ] + 0.054; // w górę o wysokość ślizgu (na razie tak)
while (sm->Parent) while( sm->Parent ) {
{
if( sm->Parent->GetMatrix() ) if( sm->Parent->GetMatrix() )
m = *sm->Parent->GetMatrix() * m; m = *sm->Parent->GetMatrix() * m;
sm = sm->Parent; sm = sm->Parent;
@@ -5749,19 +5750,10 @@ int TDynamicObject::RouteWish(TTrack *tr)
std::string TDynamicObject::TextureTest(std::string const &name) std::string TDynamicObject::TextureTest(std::string const &name)
{ // Ra 2015-01: sprawdzenie dostępności tekstury o podanej nazwie { // Ra 2015-01: sprawdzenie dostępności tekstury o podanej nazwie
std::string x = name + ".dds"; // na razie prymitywnie std::vector<std::string> extensions = { ".dds", ".tga", ".bmp" };
if (FileExists(x.c_str())) for( auto const &extension : extensions ) {
return x; if( true == FileExists( name + extension ) ) {
else return name + extension;
{
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 return ""; // nie znaleziona

View File

@@ -26,8 +26,9 @@ Stele, firleju, szociu, hunter, ZiomalCl, OLI_EU and others
#include "opengl/ARB_Multisample.h" #include "opengl/ARB_Multisample.h"
#include "Globals.h" #include "Globals.h"
#include "Console.h"
#include "Logs.h" #include "Logs.h"
#include "Console.h"
#include "PyInt.h"
#include "World.h" #include "World.h"
#include "Mover.h" #include "Mover.h"
@@ -58,8 +59,8 @@ LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration For WndProc
int InitGL(GLvoid) // All Setup For OpenGL Goes Here int InitGL(GLvoid) // All Setup For OpenGL Goes Here
{ {
_clear87(); // _clear87();
_control87(MCW_EM, MCW_EM); // _control87(MCW_EM, MCW_EM);
glewInit(); glewInit();
// hunter-271211: przeniesione // hunter-271211: przeniesione
// AllocConsole(); // AllocConsole();
@@ -571,8 +572,14 @@ int WINAPI WinMain(HINSTANCE hInstance, // instance
LPSTR lpCmdLine, // command line parameters LPSTR lpCmdLine, // command line parameters
int nCmdShow) // window show state int nCmdShow) // window show state
{ {
#ifdef _MSC_VER #if defined(_MSC_VER) && defined (_DEBUG)
// memory leaks
_CrtSetDbgFlag( _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ) | _CRTDBG_LEAK_CHECK_DF ); _CrtSetDbgFlag( _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ) | _CRTDBG_LEAK_CHECK_DF );
// floating point operation errors
auto state = _clearfp();
state = _control87( 0, 0 );
// this will turn on FPE for #IND and zerodiv
state = _control87( state & ~( _EM_ZERODIVIDE | _EM_INVALID ), _MCW_EM );
#endif #endif
MSG msg; // windows message structure MSG msg; // windows message structure
@@ -701,6 +708,8 @@ int WINAPI WinMain(HINSTANCE hInstance, // instance
SystemParametersInfo(SPI_SETKEYBOARDSPEED, iOldSpeed, NULL, 0); SystemParametersInfo(SPI_SETKEYBOARDSPEED, iOldSpeed, NULL, 0);
SystemParametersInfo(SPI_SETKEYBOARDDELAY, iOldDelay, NULL, 0); SystemParametersInfo(SPI_SETKEYBOARDDELAY, iOldDelay, NULL, 0);
delete pConsole; // deaktywania sterownika delete pConsole; // deaktywania sterownika
TPythonInterpreter::killInstance();
// shutdown // shutdown
KillGLWindow(); // kill the window KillGLWindow(); // kill the window
return (msg.wParam); // exit the program return (msg.wParam); // exit the program

View File

@@ -72,6 +72,9 @@ TEvent::~TEvent()
delete[] Params[8].asPointer; // zwolnić obszar delete[] Params[8].asPointer; // zwolnić obszar
case tp_GetValues: // nic case tp_GetValues: // nic
break; break;
case tp_PutValues: // params[0].astext stores the token
SafeDeleteArray( Params[ 0 ].asText );
break;
} }
evJoined = NULL; // nie usuwać podczepionych tutaj evJoined = NULL; // nie usuwać podczepionych tutaj
}; };
@@ -87,6 +90,7 @@ void TEvent::Conditions(cParser *parser, string s)
std::string token, str; std::string token, str;
if (!asNodeName.empty()) if (!asNodeName.empty())
{ // podczepienie łańcucha, jeśli nie jest pusty { // podczepienie łańcucha, jeśli nie jest pusty
// BUG: 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 Params[9].asText = new char[asNodeName.length() + 1]; // usuwane i zamieniane na
// wskaźnik // wskaźnik
strcpy(Params[9].asText, asNodeName.c_str()); strcpy(Params[9].asText, asNodeName.c_str());
@@ -457,34 +461,43 @@ void TEvent::Load(cParser *parser, vector3 *org)
{ // obrót względem osi { // obrót względem osi
parser->getTokens(); parser->getTokens();
*parser >> token; *parser >> token;
Params[9].asText = new char[255]; // nazwa submodelu Params[9].asText = new char[token.size() + 1]; // nazwa submodelu
strcpy(Params[9].asText, token.c_str()); std::strcpy(Params[9].asText, token.c_str());
Params[0].asInt = 1; Params[0].asInt = 1;
parser->getTokens(4); parser->getTokens(4);
*parser >> Params[1].asdouble >> Params[2].asdouble >> Params[3].asdouble >> *parser
Params[4].asdouble; >> Params[1].asdouble
>> Params[2].asdouble
>> Params[3].asdouble
>> Params[4].asdouble;
} }
else if (token.compare("translate") == 0) else if (token.compare("translate") == 0)
{ // przesuw o wektor { // przesuw o wektor
parser->getTokens(); parser->getTokens();
*parser >> token; *parser >> token;
Params[9].asText = new char[255]; // nazwa submodelu Params[9].asText = new char[token.size() + 1]; // nazwa submodelu
strcpy(Params[9].asText, token.c_str()); std::strcpy(Params[9].asText, token.c_str());
Params[0].asInt = 2; Params[0].asInt = 2;
parser->getTokens(4); parser->getTokens(4);
*parser >> Params[1].asdouble >> Params[2].asdouble >> Params[3].asdouble >> *parser
Params[4].asdouble; >> Params[1].asdouble
>> Params[2].asdouble
>> Params[3].asdouble
>> Params[4].asdouble;
} }
else if (token.compare("digital") == 0) else if (token.compare("digital") == 0)
{ // licznik cyfrowy { // licznik cyfrowy
parser->getTokens(); parser->getTokens();
*parser >> token; *parser >> token;
Params[9].asText = new char[255]; // nazwa submodelu Params[9].asText = new char[token.size() + 1]; // nazwa submodelu
strcpy(Params[9].asText, token.c_str()); std::strcpy(Params[9].asText, token.c_str());
Params[0].asInt = 8; Params[0].asInt = 8;
parser->getTokens(4); // jaki ma być sens tych parametrów? parser->getTokens(4); // jaki ma być sens tych parametrów?
*parser >> Params[1].asdouble >> Params[2].asdouble >> Params[3].asdouble >> *parser
Params[4].asdouble; >> 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 else if (token.substr(token.length() - 4, 4) == ".vmd") // na razie tu, może będzie inaczej
{ // animacja z pliku VMD { // animacja z pliku VMD
@@ -499,12 +512,15 @@ void TEvent::Load(cParser *parser, vector3 *org)
} }
parser->getTokens(); parser->getTokens();
*parser >> token; *parser >> token;
Params[9].asText = new char[255]; // nazwa submodelu Params[9].asText = new char[token.size() + 1]; // nazwa submodelu
strcpy(Params[9].asText, token.c_str()); std::strcpy(Params[9].asText, token.c_str());
Params[0].asInt = 4; // rodzaj animacji Params[0].asInt = 4; // rodzaj animacji
parser->getTokens(4); parser->getTokens(4);
*parser >> Params[1].asdouble >> Params[2].asdouble >> Params[3].asdouble >> *parser
Params[4].asdouble; >> Params[1].asdouble
>> Params[2].asdouble
>> Params[3].asdouble
>> Params[4].asdouble;
} }
parser->getTokens(); parser->getTokens();
*parser >> token; *parser >> token;

View File

@@ -187,7 +187,7 @@ int Global::iBpp = 32; // chyba już nie używa się kart, na których 16bpp co
// maciek001: konfiguracja wstępna portu COM // maciek001: konfiguracja wstępna portu COM
bool Global::bMWDdebugEnable = false; bool Global::bMWDdebugEnable = false;
bool Global::bMWDInputDataEnable = false; bool Global::bMWDInputDataEnable = false;
unsigned long int Global::iMWDBaudrate = 500000; unsigned int Global::iMWDBaudrate = 500000;
std::string Global::sMWDPortId = "COM1"; // nazwa portu z którego korzystamy - na razie nie działa std::string Global::sMWDPortId = "COM1"; // nazwa portu z którego korzystamy - na razie nie działa
bool Global::bMWDBreakEnable = false; // zmienić na FALSE!!! jak już będzie działać wczytywanie z *.ini bool Global::bMWDBreakEnable = false; // zmienić na FALSE!!! jak już będzie działać wczytywanie z *.ini
double Global::fMWDAnalogCalib[4][3] = {{1023, 0, 1023},{1023, 0, 1023},{1023, 0, 1023},{1023, 0, 1023}}; // wartość max potencjometru, wartość min potencjometru, rozdzielczość (max. wartość jaka może być -1) double Global::fMWDAnalogCalib[4][3] = {{1023, 0, 1023},{1023, 0, 1023},{1023, 0, 1023},{1023, 0, 1023}}; // wartość max potencjometru, wartość min potencjometru, rozdzielczość (max. wartość jaka może być -1)
@@ -1247,7 +1247,7 @@ char bezogonkowo[] = "E?,?\"_++?%S<STZZ?`'\"\".--??s>stzz"
std::string Global::Bezogonkow(std::string str, bool _) std::string Global::Bezogonkow(std::string str, bool _)
{ // wycięcie liter z ogonkami, bo OpenGL nie umie wyświetlić { // wycięcie liter z ogonkami, bo OpenGL nie umie wyświetlić
for (unsigned int i = 1; i <= str.length(); ++i) for (unsigned int i = 1; i < str.length(); ++i)
if (str[i] & 0x80) if (str[i] & 0x80)
str[i] = bezogonkowo[str[i] & 0x7F]; str[i] = bezogonkowo[str[i] & 0x7F];
else if (str[i] < ' ') // znaki sterujące nie są obsługiwane else if (str[i] < ' ') // znaki sterujące nie są obsługiwane

View File

@@ -42,7 +42,6 @@ http://mozilla.org/MPL/2.0/.
#define _PROBLEND 1 #define _PROBLEND 1
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#pragma package(smart_init)
bool bCondition; // McZapkie: do testowania warunku na event multiple bool bCondition; // McZapkie: do testowania warunku na event multiple
string LogComment; string LogComment;
@@ -77,7 +76,7 @@ TGroundNode::TGroundNode()
asName = ""; asName = "";
// Color= TMaterialColor(1); // Color= TMaterialColor(1);
// fAngle=0; //obrót dla modelu // fAngle=0; //obrót dla modelu
// fLineThickness=1.0; //mm dla linii fLineThickness=1.0; //mm dla linii
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
Ambient[i] = Global::whiteLight[i] * 255; Ambient[i] = Global::whiteLight[i] * 255;
@@ -117,6 +116,9 @@ TGroundNode::~TGroundNode()
delete Model; delete Model;
Model = NULL; Model = NULL;
break; break;
case TP_SOUND:
SafeDelete(tsStaticSound);
break;
case TP_TERRAIN: case TP_TERRAIN:
{ // pierwsze nNode zawiera model E3D, reszta to trójkąty { // pierwsze nNode zawiera model E3D, reszta to trójkąty
for (int i = 1; i < iCount; ++i) for (int i = 1; i < iCount; ++i)
@@ -681,22 +683,12 @@ void TGroundNode::RenderAlphaDL()
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
//------------------ Podstawowy pojemnik terenu - sektor ----------------------- //------------------ Podstawowy pojemnik terenu - sektor -----------------------
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
TSubRect::TSubRect()
{
nRootNode = NULL; // lista wszystkich obiektów jest pusta
nRenderHidden = nRenderRect = nRenderRectAlpha = nRender = nRenderMixed = nRenderAlpha =
nRenderWires = NULL;
tTrackAnim = NULL; // nic nie animujemy
tTracks = NULL; // nie ma jeszcze torów
nRootMesh = nMeshed = NULL; // te listy też są puste
iNodeCount = 0; // licznik obiektów
iTracks = 0; // licznik torów
}
TSubRect::~TSubRect() TSubRect::~TSubRect()
{ {
if (Global::bManageNodes) // Ra: tu się coś sypie if (Global::bManageNodes) // Ra: tu się coś sypie
ResourceManager::Unregister(this); // wyrejestrowanie ze sprzątacza ResourceManager::Unregister(this); // wyrejestrowanie ze sprzątacza
// TODO: usunąć obiekty z listy (nRootMesh), bo są one tworzone dla sektora // TODO: usunąć obiekty z listy (nRootMesh), bo są one tworzone dla sektora
delete[] tTracks;
} }
void TSubRect::NodeAdd(TGroundNode *Node) void TSubRect::NodeAdd(TGroundNode *Node)
@@ -735,7 +727,7 @@ void TSubRect::NodeAdd(TGroundNode *Node)
{ {
if (t && (Node->TextureID != t)) if (t && (Node->TextureID != t))
{ // jeśli są dwie różne tekstury, dodajemy drugi obiekt dla danego toru { // jeśli są dwie różne tekstury, dodajemy drugi obiekt dla danego toru
TGroundNode *n = new TGroundNode(); TGroundNode *n = new TGroundNode(); // BUG: source of a memory leak here
n->iType = TP_DUMMYTRACK; // obiekt renderujący siatki dla tekstury n->iType = TP_DUMMYTRACK; // obiekt renderujący siatki dla tekstury
n->TextureID = t; n->TextureID = t;
n->pTrack = Node->pTrack; // wskazuje na ten sam tor n->pTrack = Node->pTrack; // wskazuje na ten sam tor
@@ -958,7 +950,7 @@ void TSubRect::Sort()
if (t < n1->TextureID) // jeśli (n1) ma inną teksturę niż poprzednie if (t < n1->TextureID) // jeśli (n1) ma inną teksturę niż poprzednie
{ // można zrobić obiekt renderujący { // można zrobić obiekt renderujący
t = n1->TextureID; t = n1->TextureID;
n2 = new TGroundNode(); n2 = new TGroundNode(); // BUG: source of a memory leak here
n2->nNext2 = nRootMesh; n2->nNext2 = nRootMesh;
nRootMesh = n2; // podczepienie na początku listy nRootMesh = n2; // podczepienie na początku listy
nRootMesh->iType = TP_MESH; // obiekt renderujący siatki dla tekstury nRootMesh->iType = TP_MESH; // obiekt renderujący siatki dla tekstury
@@ -1303,6 +1295,9 @@ void TGround::MoveGroundNode(vector3 pPosition)
*/ */
} }
TGroundVertex TempVerts[ 10000 ]; // tu wczytywane s¹ trójk¹ty
BYTE TempConnectionType[ 200 ]; // Ra: sprzêgi w sk³adzie; ujemne, gdy odwrotnie
TGround::TGround() TGround::TGround()
{ {
// RootNode=NULL; // RootNode=NULL;
@@ -1320,6 +1315,8 @@ TGround::TGround()
nRootOfType[i] = NULL; // zerowanie tablic wyszukiwania nRootOfType[i] = NULL; // zerowanie tablic wyszukiwania
bDynamicRemove = false; // na razie nic do usunięcia bDynamicRemove = false; // na razie nic do usunięcia
sTracks = new TNames(); // nazwy torów - na razie tak sTracks = new TNames(); // nazwy torów - na razie tak
::SecureZeroMemory( TempVerts, sizeof( TempVerts ) );
::SecureZeroMemory( TempConnectionType, sizeof( TempConnectionType ) );
} }
TGround::~TGround() TGround::~TGround()
@@ -1410,9 +1407,6 @@ int iTrainSetWehicleNumber = 0;
TGroundNode *nTrainSetNode = NULL; // poprzedni pojazd do łączenia TGroundNode *nTrainSetNode = NULL; // poprzedni pojazd do łączenia
TGroundNode *nTrainSetDriver = NULL; // pojazd, któremu zostanie wysłany rozkład TGroundNode *nTrainSetDriver = NULL; // pojazd, któremu zostanie wysłany rozkład
TGroundVertex TempVerts[10000]; // tu wczytywane są trójkąty
BYTE TempConnectionType[200]; // Ra: sprzęgi w składzie; ujemne, gdy odwrotnie
void TGround::RaTriangleDivider(TGroundNode *node) void TGround::RaTriangleDivider(TGroundNode *node)
{ // tworzy dodatkowe trójkąty i zmiejsza podany { // tworzy dodatkowe trójkąty i zmiejsza podany
// to jest wywoływane przy wczytywaniu trójkątów // to jest wywoływane przy wczytywaniu trójkątów
@@ -1767,8 +1761,7 @@ TGroundNode * TGround::AddGroundNode(cParser *parser)
*parser >> token; *parser >> token;
str = token; str = token;
//str = AnsiString(token.c_str()); //str = AnsiString(token.c_str());
tmp->tsStaticSound = new TTextSound(strdup(str.c_str()), sqrt(tmp->fSquareRadius), tmp->pCenter.x, tmp->tsStaticSound = new TTextSound(str, sqrt(tmp->fSquareRadius), tmp->pCenter.x, tmp->pCenter.y, tmp->pCenter.z, false, rmin);
tmp->pCenter.y, tmp->pCenter.z, false, rmin);
if (rmin < 0.0) if (rmin < 0.0)
rmin = rmin =
0.0; // przywrócenie poprawnej wartości, jeśli służyła do wyłączenia efektu Dopplera 0.0; // przywrócenie poprawnej wartości, jeśli służyła do wyłączenia efektu Dopplera
@@ -2273,8 +2266,9 @@ void TGround::FirstInit()
for (j = 1; j < Current->iCount; ++j) for (j = 1; j < Current->iCount; ++j)
{ // od 1 do końca są zestawy trójkątów { // od 1 do końca są zestawy trójkątów
std::string xxxzzz = Current->nNode[j].smTerrain->pName; // pobranie nazwy std::string xxxzzz = Current->nNode[j].smTerrain->pName; // pobranie nazwy
gr = GetRect(1000 * (stol_def(xxxzzz.substr(0, 3),0) - 500), gr = GetRect(
1000 * (stol_def(xxxzzz.substr(3, 3),0) - 500)); ( std::stoi( xxxzzz.substr( 0, 3 )) - 500 ) * 1000,
( std::stoi( xxxzzz.substr( 3, 3 )) - 500 ) * 1000 );
if (Global::bUseVBO) if (Global::bUseVBO)
gr->nTerrain = Current->nNode + j; // zapamiętanie gr->nTerrain = Current->nNode + j; // zapamiętanie
else else
@@ -2320,9 +2314,7 @@ void TGround::FirstInit()
WriteLog("InitLaunchers OK"); WriteLog("InitLaunchers OK");
WriteLog("InitGlobalTime"); WriteLog("InitGlobalTime");
// ABu 160205: juz nie TODO :) // ABu 160205: juz nie TODO :)
GlobalTime = new TMTableTime( GlobalTime = std::make_shared<TMTableTime>( hh, mm, srh, srm, ssh, ssm ); // McZapkie-300302: inicjacja czasu rozkladowego - TODO: czytac z trasy!
hh, mm, srh, srm, ssh,
ssm); // McZapkie-300302: inicjacja czasu rozkladowego - TODO: czytac z trasy!
WriteLog("InitGlobalTime OK"); WriteLog("InitGlobalTime OK");
// jeszcze ustawienie pogody, gdyby nie było w scenerii wpisów // jeszcze ustawienie pogody, gdyby nie było w scenerii wpisów
glClearColor(Global::AtmoColor[0], Global::AtmoColor[1], Global::AtmoColor[2], glClearColor(Global::AtmoColor[0], Global::AtmoColor[1], Global::AtmoColor[2],
@@ -3134,13 +3126,12 @@ bool TGround::InitEvents()
strcpy(buff, Current->Params[i].asText); strcpy(buff, Current->Params[i].asText);
SafeDeleteArray(Current->Params[i].asText); SafeDeleteArray(Current->Params[i].asText);
Current->Params[i].asEvent = FindEvent(buff); Current->Params[i].asEvent = FindEvent(buff);
if (!Current->Params[i].asEvent) // Ra: tylko w logu informacja o braku if( !Current->Params[ i ].asEvent ) { // Ra: tylko w logu informacja o braku
if (string(Current->Params[i].asText).substr(0, 5) != "none_") if( ( Current->Params[ i ].asText == NULL )
{ || ( std::string( Current->Params[ i ].asText ).substr( 0, 5 ) != "none_" ) ) {
WriteLog("Event \"" + string(buff) + WriteLog( "Event \"" + string( buff ) + "\" does not exist" );
"\" does not exist"); ErrorLog( "Missed event: " + string( buff ) + " in multiple " + Current->asName );
ErrorLog("Missed event: " + string(buff) + " in multiple " + }
Current->asName);
} }
} }
} }

View File

@@ -182,28 +182,28 @@ class TGroundNode : public Resource
class TSubRect : public Resource, public CMesh class TSubRect : public Resource, public CMesh
{ // sektor składowy kwadratu kilometrowego { // sektor składowy kwadratu kilometrowego
public: public:
int iTracks; // ilość torów w (tTracks) int iTracks = 0; // ilość torów w (tTracks)
TTrack **tTracks; // tory do renderowania pojazdów TTrack **tTracks = nullptr; // tory do renderowania pojazdów
protected: protected:
TTrack *tTrackAnim; // obiekty do przeliczenia animacji TTrack *tTrackAnim = nullptr; // obiekty do przeliczenia animacji
TGroundNode *nRootMesh; // obiekty renderujące wg tekstury (wtórne, lista po nNext2) TGroundNode *nRootMesh = nullptr; // obiekty renderujące wg tekstury (wtórne, lista po nNext2)
TGroundNode *nMeshed; // lista obiektów dla których istnieją obiekty renderujące grupowo TGroundNode *nMeshed = nullptr; // lista obiektów dla których istnieją obiekty renderujące grupowo
public: public:
TGroundNode * TGroundNode *
nRootNode; // wszystkie obiekty w sektorze, z wyjątkiem renderujących i pojazdów (nNext2) nRootNode = nullptr; // wszystkie obiekty w sektorze, z wyjątkiem renderujących i pojazdów (nNext2)
TGroundNode * TGroundNode *
nRenderHidden; // lista obiektów niewidocznych, "renderowanych" również z tyłu (nNext3) nRenderHidden = nullptr; // lista obiektów niewidocznych, "renderowanych" również z tyłu (nNext3)
TGroundNode *nRenderRect; // z poziomu sektora - nieprzezroczyste (nNext3) TGroundNode *nRenderRect = nullptr; // z poziomu sektora - nieprzezroczyste (nNext3)
TGroundNode *nRenderRectAlpha; // z poziomu sektora - przezroczyste (nNext3) TGroundNode *nRenderRectAlpha = nullptr; // z poziomu sektora - przezroczyste (nNext3)
TGroundNode *nRenderWires; // z poziomu sektora - druty i inne linie (nNext3) TGroundNode *nRenderWires = nullptr; // z poziomu sektora - druty i inne linie (nNext3)
TGroundNode *nRender; // indywidualnie - nieprzezroczyste (nNext3) TGroundNode *nRender = nullptr; // indywidualnie - nieprzezroczyste (nNext3)
TGroundNode *nRenderMixed; // indywidualnie - nieprzezroczyste i przezroczyste (nNext3) TGroundNode *nRenderMixed = nullptr; // indywidualnie - nieprzezroczyste i przezroczyste (nNext3)
TGroundNode *nRenderAlpha; // indywidualnie - przezroczyste (nNext3) TGroundNode *nRenderAlpha = nullptr; // indywidualnie - przezroczyste (nNext3)
int iNodeCount; // licznik obiektów, do pomijania pustych sektorów int iNodeCount = 0; // licznik obiektów, do pomijania pustych sektorów
public: public:
void LoadNodes(); // utworzenie VBO sektora void LoadNodes(); // utworzenie VBO sektora
public: public:
TSubRect(); // TSubRect() = default;
virtual ~TSubRect(); virtual ~TSubRect();
virtual void Release(); // zwalnianie VBO sektora virtual void Release(); // zwalnianie VBO sektora
void NodeAdd(TGroundNode *Node); // dodanie obiektu do sektora na etapie rozdzielania na sektory void NodeAdd(TGroundNode *Node); // dodanie obiektu do sektora na etapie rozdzielania na sektory

View File

@@ -1,22 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "maszyna", "maszyna.vcxproj", "{8E0232E5-1C67-442F-9E04-45ED2DDFC960}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8E0232E5-1C67-442F-9E04-45ED2DDFC960}.Debug|x86.ActiveCfg = Debug|Win32
{8E0232E5-1C67-442F-9E04-45ED2DDFC960}.Debug|x86.Build.0 = Debug|Win32
{8E0232E5-1C67-442F-9E04-45ED2DDFC960}.Release|x86.ActiveCfg = Release|Win32
{8E0232E5-1C67-442F-9E04-45ED2DDFC960}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -1,202 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{8E0232E5-1C67-442F-9E04-45ED2DDFC960}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetName>eu07++</TargetName>
<IntDir>$(SolutionDir)tmp\$(PlatformShortName)-$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(SolutionDir)bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>eu07++</TargetName>
<IntDir>$(SolutionDir)tmp\$(PlatformShortName)-$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(SolutionDir)bin\</OutDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)console;$(SolutionDir)mczapkie;$(SolutionDir)opengl;$(SolutionDir)python/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>$(DXSKD_DIR)lib/$(PlatformShortName);$(SolutionDir)opengl;$(SolutionDir)python/libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)console;$(SolutionDir)mczapkie;$(SolutionDir)opengl;$(SolutionDir)python/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(DXSKD_DIR)lib/$(PlatformShortName);$(SolutionDir)opengl;$(SolutionDir)python/libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="AdvSound.cpp" />
<ClCompile Include="AirCoupler.cpp" />
<ClCompile Include="AnimModel.cpp" />
<ClCompile Include="Button.cpp" />
<ClCompile Include="Camera.cpp" />
<ClCompile Include="Console.cpp" />
<ClCompile Include="console\LPT.cpp" />
<ClCompile Include="Console\MWD.cpp" />
<ClCompile Include="console\PoKeys55.cpp" />
<ClCompile Include="Driver.cpp" />
<ClCompile Include="dumb3d.cpp" />
<ClCompile Include="DynObj.cpp" />
<ClCompile Include="EU07.cpp" />
<ClCompile Include="Event.cpp" />
<ClCompile Include="EvLaunch.cpp" />
<ClCompile Include="FadeSound.cpp" />
<ClCompile Include="Float3d.cpp" />
<ClCompile Include="Gauge.cpp" />
<ClCompile Include="Globals.cpp" />
<ClCompile Include="Ground.cpp" />
<ClCompile Include="Logs.cpp" />
<ClCompile Include="mczapkie\friction.cpp" />
<ClCompile Include="mczapkie\hamulce.cpp" />
<ClCompile Include="mczapkie\mctools.cpp" />
<ClCompile Include="mczapkie\Mover.cpp" />
<ClCompile Include="mczapkie\Oerlikon_ESt.cpp" />
<ClCompile Include="MdlMngr.cpp" />
<ClCompile Include="MemCell.cpp" />
<ClCompile Include="Model3d.cpp" />
<ClCompile Include="mtable.cpp" />
<ClCompile Include="Names.cpp" />
<ClCompile Include="opengl\ARB_Multisample.cpp" />
<ClCompile Include="parser.cpp" />
<ClCompile Include="PyInt.cpp" />
<ClCompile Include="RealSound.cpp" />
<ClCompile Include="ResourceManager.cpp" />
<ClCompile Include="Segment.cpp" />
<ClCompile Include="sky.cpp" />
<ClCompile Include="Sound.cpp" />
<ClCompile Include="Spring.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Texture.cpp" />
<ClCompile Include="TextureDDS.cpp" />
<ClCompile Include="Timer.cpp" />
<ClCompile Include="Track.cpp" />
<ClCompile Include="Traction.cpp" />
<ClCompile Include="TractionPower.cpp" />
<ClCompile Include="Train.cpp" />
<ClCompile Include="TrkFoll.cpp" />
<ClCompile Include="VBO.cpp" />
<ClCompile Include="wavread.cpp" />
<ClCompile Include="World.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="AdvSound.h" />
<ClInclude Include="AirCoupler.h" />
<ClInclude Include="AnimModel.h" />
<ClInclude Include="Button.h" />
<ClInclude Include="Camera.h" />
<ClInclude Include="Classes.h" />
<ClInclude Include="Console.h" />
<ClInclude Include="Console\LPT.h" />
<ClInclude Include="Console\MWD.h" />
<ClInclude Include="Console\PoKeys55.h" />
<ClInclude Include="dumb3d.h" />
<ClInclude Include="DynObj.h" />
<ClInclude Include="Event.h" />
<ClInclude Include="FadeSound.h" />
<ClInclude Include="Float3d.h" />
<ClInclude Include="Gauge.h" />
<ClInclude Include="Globals.h" />
<ClInclude Include="Ground.h" />
<ClInclude Include="Logs.h" />
<ClInclude Include="McZapkie\friction.h" />
<ClInclude Include="McZapkie\hamulce.h" />
<ClInclude Include="McZapkie\mctools.h" />
<ClInclude Include="McZapkie\mover.h" />
<ClInclude Include="McZapkie\Oerlikon_ESt.h" />
<ClInclude Include="MdlMngr.h" />
<ClInclude Include="Model3d.h" />
<ClInclude Include="Names.h" />
<ClInclude Include="opengl\arb_multisample.h" />
<ClInclude Include="opengl\glew.h" />
<ClInclude Include="opengl\wglew.h" />
<ClInclude Include="parser.h" />
<ClInclude Include="PyInt.h" />
<ClInclude Include="python\include\Python.h" />
<ClInclude Include="RealSound.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="Segment.h" />
<ClInclude Include="sky.h" />
<ClInclude Include="Sound.h" />
<ClInclude Include="Spring.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="Texture.h" />
<ClInclude Include="TractionPower.h" />
<ClInclude Include="Train.h" />
<ClInclude Include="usefull.h" />
<ClInclude Include="VBO.h" />
<ClInclude Include="World.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="maszyna.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="eu07.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,346 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
<Filter Include="Source Files\opengl">
<UniqueIdentifier>{d91dfdb6-7d84-4b52-a16a-bad302b45e3c}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\mczapkie">
<UniqueIdentifier>{fafd38ab-4c2a-48c8-8e66-ad0d928573b3}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\console">
<UniqueIdentifier>{2d73d7b2-5252-499c-963a-88fa3cb1af53}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\opengl">
<UniqueIdentifier>{aec51dd3-af67-4f08-9dcb-889f673ad7c9}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\mczapkie">
<UniqueIdentifier>{36684428-8a48-435f-bca4-a24d9bfe2587}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\console">
<UniqueIdentifier>{cdf75bec-91f7-413c-8b57-9e32cba49148}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="AdvSound.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="AirCoupler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="AnimModel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Button.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Console.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Driver.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="dumb3d.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DynObj.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="EU07.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Event.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="EvLaunch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="FadeSound.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Float3d.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Gauge.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Globals.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Ground.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Logs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MdlMngr.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MemCell.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Model3d.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="mtable.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Names.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="parser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PyInt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RealSound.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ResourceManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Segment.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="sky.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Sound.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Spring.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TextureDDS.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Timer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Track.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Traction.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TractionPower.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Train.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TrkFoll.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="VBO.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="wavread.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="World.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="opengl\ARB_Multisample.cpp">
<Filter>Source Files\opengl</Filter>
</ClCompile>
<ClCompile Include="mczapkie\friction.cpp">
<Filter>Source Files\mczapkie</Filter>
</ClCompile>
<ClCompile Include="mczapkie\hamulce.cpp">
<Filter>Source Files\mczapkie</Filter>
</ClCompile>
<ClCompile Include="console\LPT.cpp">
<Filter>Source Files\console</Filter>
</ClCompile>
<ClCompile Include="mczapkie\mctools.cpp">
<Filter>Source Files\mczapkie</Filter>
</ClCompile>
<ClCompile Include="mczapkie\Mover.cpp">
<Filter>Source Files\mczapkie</Filter>
</ClCompile>
<ClCompile Include="mczapkie\Oerlikon_ESt.cpp">
<Filter>Source Files\mczapkie</Filter>
</ClCompile>
<ClCompile Include="console\PoKeys55.cpp">
<Filter>Source Files\console</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Console\MWD.cpp">
<Filter>Source Files\console</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="opengl\glew.h">
<Filter>Header Files\opengl</Filter>
</ClInclude>
<ClInclude Include="opengl\arb_multisample.h">
<Filter>Header Files\opengl</Filter>
</ClInclude>
<ClInclude Include="Globals.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Console.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Logs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="McZapkie\mover.h">
<Filter>Header Files\mczapkie</Filter>
</ClInclude>
<ClInclude Include="World.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="dumb3d.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PyInt.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="usefull.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Classes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Texture.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Camera.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Ground.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MdlMngr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="sky.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="parser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="VBO.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Float3d.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="python\include\Python.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TractionPower.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="McZapkie\Oerlikon_ESt.h">
<Filter>Header Files\mczapkie</Filter>
</ClInclude>
<ClInclude Include="McZapkie\mctools.h">
<Filter>Header Files\mczapkie</Filter>
</ClInclude>
<ClInclude Include="McZapkie\hamulce.h">
<Filter>Header Files\mczapkie</Filter>
</ClInclude>
<ClInclude Include="McZapkie\friction.h">
<Filter>Header Files\mczapkie</Filter>
</ClInclude>
<ClInclude Include="Console\PoKeys55.h">
<Filter>Header Files\console</Filter>
</ClInclude>
<ClInclude Include="Console\LPT.h">
<Filter>Header Files\console</Filter>
</ClInclude>
<ClInclude Include="RealSound.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Segment.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spring.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Button.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="AirCoupler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Gauge.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DynObj.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Train.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Names.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FadeSound.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Sound.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="AdvSound.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Model3d.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Event.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="AnimModel.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="opengl\wglew.h">
<Filter>Header Files\opengl</Filter>
</ClInclude>
<ClInclude Include="Console\MWD.h">
<Filter>Header Files\console</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="maszyna.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="eu07.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>

View File

@@ -496,10 +496,10 @@ struct TScheme
typedef TScheme TSchemeTable[ResArraySize + 1]; /*tablica rezystorow rozr.*/ typedef TScheme TSchemeTable[ResArraySize + 1]; /*tablica rezystorow rozr.*/
struct TDEScheme struct TDEScheme
{ {
double RPM; /*obroty diesla*/ double RPM = 0.0; /*obroty diesla*/
double GenPower; /*moc maksymalna*/ double GenPower = 0.0; /*moc maksymalna*/
double Umax; /*napiecie maksymalne*/ double Umax = 0.0; /*napiecie maksymalne*/
double Imax; /*prad maksymalny*/ double Imax = 0.0; /*prad maksymalny*/
}; };
typedef TDEScheme TDESchemeTable[33]; /*tablica rezystorow rozr.*/ typedef TDEScheme TDESchemeTable[33]; /*tablica rezystorow rozr.*/
struct TShuntScheme struct TShuntScheme
@@ -569,23 +569,28 @@ struct TTransmision
enum TCouplerType { NoCoupler, Articulated, Bare, Chain, Screw, Automatic }; enum TCouplerType { NoCoupler, Articulated, Bare, Chain, Screw, Automatic };
//class TMoverParameters; // wyforwardowanie klasy coby typ byl widoczny w ponizszej strukturze
class TMoverParameters; // wyforwardowanie klasy coby typ byl widoczny w ponizszej strukturze
struct TCoupling { struct TCoupling {
/*parametry*/ /*parametry*/
double SpringKB; double SpringKC; double beta; /*stala sprezystosci zderzaka/sprzegu, %tlumiennosci */ double SpringKB = 1.0; /*stala sprezystosci zderzaka/sprzegu, %tlumiennosci */
double DmaxB; double FmaxB; double DmaxC; double FmaxC; /*tolerancja scisku/rozciagania, sila rozerwania*/ double SpringKC = 1.0;
TCouplerType CouplerType; /*typ sprzegu*/ double beta = 0.0;
double DmaxB = 0.1; /*tolerancja scisku/rozciagania, sila rozerwania*/
double FmaxB = 1000.0;
double DmaxC = 0.1;
double FmaxC = 1000.0;
TCouplerType CouplerType = NoCoupler; /*typ sprzegu*/
/*zmienne*/ /*zmienne*/
int CouplingFlag; /*0 - wirtualnie, 1 - sprzegi, 2 - pneumatycznie, 4 - sterowanie, 8 - kabel mocy*/ int CouplingFlag = 0; /*0 - wirtualnie, 1 - sprzegi, 2 - pneumatycznie, 4 - sterowanie, 8 - kabel mocy*/
int AllowedFlag; //Ra: znaczenie jak wyżej, maska dostępnych int AllowedFlag = 3; //Ra: znaczenie jak wyżej, maska dostępnych
bool Render; /*ABu: czy rysowac jak zaczepiony sprzeg*/ bool Render = false; /*ABu: czy rysowac jak zaczepiony sprzeg*/
double CoupleDist; /*ABu: optymalizacja - liczenie odleglosci raz na klatkę, bez iteracji*/ double CoupleDist = 0.0; /*ABu: optymalizacja - liczenie odleglosci raz na klatkę, bez iteracji*/
TMoverParameters* Connected; /*co jest podlaczone*/ class TMoverParameters *Connected = nullptr; /*co jest podlaczone*/
int ConnectedNr; //Ra: od której strony podłączony do (Connected): 0=przód, 1=tył int ConnectedNr = 0; //Ra: od której strony podłączony do (Connected): 0=przód, 1=tył
double CForce; /*sila z jaka dzialal*/ double CForce = 0.0; /*sila z jaka dzialal*/
double Dist; /*strzalka ugiecia zderzaków*/ double Dist = 0.0; /*strzalka ugiecia zderzaków*/
bool CheckCollision; /*czy sprawdzac sile czy pedy*/ bool CheckCollision = false; /*czy sprawdzac sile czy pedy*/
}; };
class TMoverParameters class TMoverParameters
@@ -642,10 +647,11 @@ public:
TBrakeHandle BrakeLocHandle; TBrakeHandle BrakeLocHandle;
double MBPM; /*masa najwiekszego cisnienia*/ double MBPM; /*masa najwiekszego cisnienia*/
TBrake *Hamulec; std::shared_ptr<TBrake> Hamulec;
TDriverHandle *Handle; std::shared_ptr<TDriverHandle> Handle;
TDriverHandle *LocHandle; std::shared_ptr<TDriverHandle> LocHandle;
TReservoir *Pipe; TReservoir *Pipe2; std::shared_ptr<TReservoir> Pipe;
std::shared_ptr<TReservoir> Pipe2;
TLocalBrake LocalBrake; /*rodzaj hamulca indywidualnego*/ TLocalBrake LocalBrake; /*rodzaj hamulca indywidualnego*/
TBrakePressureTable BrakePressureTable; /*wyszczegolnienie cisnien w rurze*/ TBrakePressureTable BrakePressureTable; /*wyszczegolnienie cisnien w rurze*/
@@ -1110,9 +1116,17 @@ public:
/*funkcje ladujace pliki opisujace pojazd*/ /*funkcje ladujace pliki opisujace pojazd*/
bool LoadFIZ(std::string chkpath); //Q 20160717 bool LoadChkFile(std::string chkpath); bool LoadFIZ(std::string chkpath); //Q 20160717 bool LoadChkFile(std::string chkpath);
bool readMPT(int ln, std::string line); //Q 20160717 bool LoadFIZ_Doors( std::string const &line );
bool readRLIST(int ln, std::string line); //Q 20160718 bool readMPT0( std::string const &line );
bool readBPT(int ln, std::string line); //Q 20160721 bool readMPT( std::string const &line ); //Q 20160717
bool readMPTElectricSeries( std::string const &line );
bool readMPTDieselElectric( std::string const &line );
bool readMPTDieselEngine( std::string const &line );
bool readRList(int const ln, std::string const &line); //Q 20160718
bool readBPT(/*int const ln,*/ std::string const &line); //Q 20160721
bool readDList( std::string const &line );
bool readFFList( std::string const &line );
bool readWWList( std::string const &line );
void BrakeValveDecode( std::string s ); //Q 20160719 void BrakeValveDecode( std::string s ); //Q 20160719
void BrakeSubsystemDecode(); //Q 20160719 void BrakeSubsystemDecode(); //Q 20160719
void PowerParamDecode(std::string lines, std::string prefix, TPowerParameters &PowerParamDecode); //Q 20160719 void PowerParamDecode(std::string lines, std::string prefix, TPowerParameters &PowerParamDecode); //Q 20160719
@@ -1124,3 +1138,34 @@ public:
}; };
extern double Distance(TLocation Loc1, TLocation Loc2, TDimension Dim1, TDimension Dim2); extern double Distance(TLocation Loc1, TLocation Loc2, TDimension Dim1, TDimension Dim2);
template <typename _Type>
bool getkeyval( _Type &Variable, std::string const &Key, std::string const &Input, std::string const &Default ) {
std::string value;
auto lookup = Input.find( Key + "=" );
if( lookup != std::string::npos ) {
value = Input.substr( Input.find_first_not_of( ' ', lookup + Key.size() + 1 ) );
lookup = value.find( ' ' );
if( lookup != std::string::npos ) {
// trim everything past the value
value.erase( lookup );
}
}
if( false == value.empty() ) {
// set the specified variable to retrieved value
std::stringstream converter;
converter << value;
converter >> Variable;
return true; // located the variable
}
else {
// set the variable to provided default value
if( false == Default.empty() ) {
std::stringstream converter;
converter << Default;
converter >> Variable;
}
return false; // supplied the default
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -327,21 +327,17 @@ void TNESt3::Init(double PP, double HPP, double LPP, double BP, int BDF)
ValveRes->CreatePress(PP); ValveRes->CreatePress(PP);
BrakeCyl->CreatePress(BP); BrakeCyl->CreatePress(BP);
BrakeRes->CreatePress(PP); BrakeRes->CreatePress(PP);
CntrlRes = new TReservoir(); CntrlRes = std::make_shared<TReservoir>();
CntrlRes->CreateCap(15); CntrlRes->CreateCap(15);
CntrlRes->CreatePress(HPP); CntrlRes->CreatePress(HPP);
BrakeStatus = static_cast<int>(BP > 1.0); BrakeStatus = static_cast<int>(BP > 1.0);
Miedzypoj = new TReservoir(); Miedzypoj = std::make_shared<TReservoir>();
Miedzypoj->CreateCap(5); Miedzypoj->CreateCap(5);
Miedzypoj->CreatePress(PP); Miedzypoj->CreatePress(PP);
BVM = 1.0 / (HPP - 0.05 - LPP) * MaxBP; BVM = 1.0 / (HPP - 0.05 - LPP) * MaxBP;
BrakeDelayFlag = BDF; 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 if (!(typeid(*FM) == typeid(TDisk1) || typeid(*FM) == typeid(TDisk2))) // jesli zeliwo to schodz
RapidStaly = false; RapidStaly = false;
@@ -500,35 +496,36 @@ void TNESt3::SetSize(int size, std::string params) // ustawianie dysz (rozmiaru
if (params.find("ESt3") != std::string::npos) if (params.find("ESt3") != std::string::npos)
{ {
Podskok = 0.7; Podskok = 0.7;
Przekladniki[1] = new TRura(); Przekladniki[1] = std::make_shared<TRura>();
Przekladniki[3] = new TRura(); Przekladniki[3] = std::make_shared<TRura>();
} }
else else
{ {
Podskok = -1; Podskok = -1;
Przekladniki[1] = new TRapid(); Przekladniki[1] = std::make_shared<TRapid>();
if (params.find("-s216") != std::string::npos) if (params.find("-s216") != std::string::npos)
Przekladniki[1]->SetRapidParams(2, 16); Przekladniki[1]->SetRapidParams(2, 16);
else else
Przekladniki[1]->SetRapidParams(2, 0); Przekladniki[1]->SetRapidParams(2, 0);
Przekladniki[3] = new TPrzeciwposlizg(); Przekladniki[3] = std::make_shared<TPrzeciwposlizg>();
if (params.find("-ED") != std::string::npos) if (params.find("-ED") != std::string::npos)
{ {
delete Przekladniki[3]; // tutaj ma być destruktor
Przekladniki[1]->SetRapidParams(2, 18); Przekladniki[1]->SetRapidParams(2, 18);
Przekladniki[3] = new TPrzekED(); Przekladniki[3] = std::make_shared<TPrzekED>();
} }
} }
if (params.find("AL2") != std::string::npos) 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) else if (params.find("PZZ") != std::string::npos)
Przekladniki[2] = new TPrzek_PZZ(); Przekladniki[2] = std::make_shared<TPrzek_PZZ>();
else else
Przekladniki[2] = new TRura(); Przekladniki[2] = std::make_shared<TRura>();
if ((params.find("3d") + params.find("4d")) != std::string::npos) if( ( params.find( "3d" ) != std::string::npos )
|| ( params.find( "4d" ) != std::string::npos ) ) {
autom = false; autom = false;
}
else else
autom = true; autom = true;
if ((params.find("HBG300") != std::string::npos)) if ((params.find("HBG300") != std::string::npos))

View File

@@ -17,10 +17,10 @@ http://mozilla.org/MPL/2.0/.
Copyright (C) 2007-2014 Maciej Cierniak Copyright (C) 2007-2014 Maciej Cierniak
*/ */
#include <memory>
#include "hamulce.h" // Pascal unit #include "hamulce.h" // Pascal unit
#include "friction.h" // Pascal unit #include "friction.h" // Pascal unit
#include "mctools.h" // Pascal unit #include "mctools.h" // Pascal unit
#include <string>
/* /*
(C) youBy (C) youBy
@@ -72,8 +72,8 @@ class TPrzekladnik : public TReservoir // przekladnik (powtarzacz)
{ {
private: private:
public: public:
TReservoir *BrakeRes; std::shared_ptr<TReservoir> BrakeRes;
TReservoir *Next; std::shared_ptr<TReservoir> Next;
TPrzekladnik() : TReservoir() {}; TPrzekladnik() : TReservoir() {};
virtual void Update(double dt); 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: private:
bool RapidStatus; // status rapidu bool RapidStatus = false; // status rapidu
double RapidMult; // przelozenie (w dol) double RapidMult = 0.0; // przelozenie (w dol)
// Komora2: real; // Komora2: real;
double DN; double DN = 0.0;
double DL; // srednice dysz napelniania i luzowania double DL = 0.0; // srednice dysz napelniania i luzowania
public: public:
void SetRapidParams(double mult, double size); void SetRapidParams(double mult, double size);
void SetRapidStatus(bool rs); void SetRapidStatus(bool rs);
void Update(double dt) /*override*/; void Update(double dt) /*override*/;
inline TRapid() : TPrzekladnik() inline TRapid() :
{ TPrzekladnik()
RapidStatus = false; {}
RapidMult, DN, DL = 0.0;
}
}; };
class TPrzekCiagly : public TPrzekladnik // AL2 // AL2
class TPrzekCiagly : public TPrzekladnik {
{
private: private:
double mult; double mult = 0.0;
public: public:
void SetMult(double m); void SetMult(double m);
void Update(double dt) /*override*/; void Update(double dt) /*override*/;
inline TPrzekCiagly() : TPrzekladnik() inline TPrzekCiagly() :
{ TPrzekladnik()
mult = 0.0; {}
}
}; };
class TPrzek_PZZ : public TPrzekladnik // podwojny zawor zwrotny // podwojny zawor zwrotny
class TPrzek_PZZ : public TPrzekladnik {
{
private: private:
double LBP; double LBP = 0.0;
public: public:
void SetLBP(double P); void SetLBP(double P);
void Update(double dt) /*override*/; void Update(double dt) /*override*/;
inline TPrzek_PZZ() : TPrzekladnik() inline TPrzek_PZZ() :
{ TPrzekladnik()
LBP = 0.0; {}
}
}; };
class TPrzekZalamany : public TPrzekladnik // Knicksventil class TPrzekZalamany : public TPrzekladnik // Knicksventil
@@ -166,59 +162,55 @@ class TPrzekZalamany : public TPrzekladnik // Knicksventil
{ {
private: private:
public: 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: private:
double MaxP; double MaxP = 0.0;
public: public:
void SetP(double P); void SetP(double P);
void Update(double dt) /*override*/; void Update(double dt) /*override*/;
inline TPrzekED() : TRura() inline TPrzekED() :
{ TRura()
MaxP = 0.0; {}
}
}; };
class TNESt3 : public TBrake class TNESt3 : public TBrake {
{
private: private:
std::shared_ptr<TReservoir> CntrlRes; // zbiornik sterujacy
std::shared_ptr<TReservoir> Miedzypoj; // pojemnosc posrednia (urojona) do napelniania ZP i ZS
std::shared_ptr<TPrzekladnik> Przekladniki[ 4 ];
double Nozzles[ dMAX ]; // dysze double Nozzles[ dMAX ]; // dysze
TReservoir *CntrlRes; // zbiornik sterujący double BVM = 0.0; // przelozenie PG-CH
double BVM; // przelozenie PG-CH
// ValveFlag: byte; //polozenie roznych zaworkow // ValveFlag: byte; //polozenie roznych zaworkow
bool Zamykajacy; // pamiec zaworka zamykajacego bool Zamykajacy = false; // pamiec zaworka zamykajacego
// Przys_wlot: boolean; //wlot do komory przyspieszacza // Przys_wlot: boolean; //wlot do komory przyspieszacza
bool Przys_blok; // blokada przyspieszacza bool Przys_blok = false; // blokada przyspieszacza
TReservoir *Miedzypoj; // pojemnosc posrednia (urojona) do napelniania ZP i ZS bool RapidStatus = false;
TPrzekladnik *Przekladniki[4]; bool RapidStaly = false;
bool RapidStatus; double LoadC = 0.0;
bool RapidStaly; double TareM = 0.0; // masa proznego
double LoadC; double LoadM = 0.0; // masa pelnego
double TareM; double TareBP = 0.0; // cisnienie dla proznego
double LoadM; // masa proznego i pelnego double HBG300 = 0.0; // zawor ograniczajacy cisnienie
double TareBP; // cisnienie dla proznego double Podskok = 0.0; // podskok preznosci poczatkowej
double HBG300; // zawor ograniczajacy cisnienie
double Podskok; // podskok preznosci poczatkowej
// HPBR: real; //zasilanie ZP z wysokiego cisnienia // HPBR: real; //zasilanie ZP z wysokiego cisnienia
bool autom; // odluzniacz samoczynny bool autom = false; // odluzniacz samoczynny
double LBP; // cisnienie hamulca pomocniczego double LBP = 0.0; // cisnienie hamulca pomocniczego
public: public:
inline TNESt3(double i_mbp, double i_bcr, double i_bcd, double i_brc, 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) :
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 TBrake( i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
, i_BD, i_mat, i_ba, i_nbpa) {}
{
}
void Init(double PP, double HPP, double LPP, double BP, int BDF) /*override*/; void Init(double PP, double HPP, double LPP, double BP, int BDF) /*override*/;
virtual double GetPF(double PP, double dt, virtual double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
void EStParams(double i_crc); // parametry charakterystyczne dla ESt void EStParams(double i_crc); // parametry charakterystyczne dla ESt
virtual double GetCRP() /*override*/; virtual double GetCRP() /*override*/;
void CheckState(double BCP, double &dV1); // glowny przyrzad rozrzadczy void CheckState(double BCP, double &dV1); // glowny przyrzad rozrzadczy

View File

@@ -20,15 +20,15 @@ Copyright (C) 2007-2014 Maciej Cierniak
//---FUNKCJE OGOLNE--- //---FUNKCJE OGOLNE---
static double const DPL = 0.25; static double const DPL = 0.25;
double TFV4aM::pos_table[11] = {-2, 6, -1, 0, -2, 1, 4, 6, 0, 0, 0}; double const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 TFVel6::pos_table[11] = {-1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1};
double PR(double P1, double P2) double PR(double P1, double P2)
{ {
@@ -96,9 +96,9 @@ double PFVa(double PH, double PL, double S, double LIM,
FM = FM * (LIM - PL) / DP; // jesli jestesmy przy nastawieniu, to zawor sie przymyka FM = FM * (LIM - PL) / DP; // jesli jestesmy przy nastawieniu, to zawor sie przymyka
if ((sg > 0.5)) // jesli ponizej stosunku krytycznego if ((sg > 0.5)) // jesli ponizej stosunku krytycznego
if ((PH - PL) < DPL) // niewielka roznica cisnien if ((PH - PL) < DPL) // niewielka roznica cisnien
return (PH - PL) / DPL * FM * 2 * sqrt((sg) * (1 - sg)); return (PH - PL) / DPL * FM * 2 * sqrt((sg) * (1 - sg)); // BUG: (1-sg) can be < 0, leading to sqrt(-x)
else else
return FM * 2 * sqrt((sg) * (1 - sg)); return FM * 2 * sqrt( (sg) * ( 1 - sg ) ); // BUG: (1-sg) can be < 0, leading to sqrt(-x)
else // powyzej stosunku krytycznego else // powyzej stosunku krytycznego
return FM; return FM;
} }
@@ -147,14 +147,6 @@ void TReservoir::Flow(double dv)
dVol = dVol + dv; dVol = dVol + dv;
} }
TReservoir::TReservoir()
{
// inherited:: Create;
Cap = 1;
Vol = 0;
dVol = 0;
}
void TReservoir::Act() void TReservoir::Act()
{ {
Vol = Vol + dVol; Vol = Vol + dVol;
@@ -201,7 +193,8 @@ double TBrakeCyl::P()
static double const cD = 1; static double const cD = 1;
static double const pD = VD - cD; static double const pD = VD - cD;
double VtoC = Vol / Cap; // stosunek cisnienia do objetosci double VtoC = ( Cap > 0.0 ) ? Vol / Cap : 0.0; // stosunek cisnienia do objetosci.
// Added div/0 trap for vehicles with incomplete definitions (cars etc)
// P:=VtoC; // P:=VtoC;
if (VtoC < VS) if (VtoC < VS)
return VtoC * pS / VS; // objetosc szkodliwa return VtoC * pS / VS; // objetosc szkodliwa
@@ -264,9 +257,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 4.2; // objetosc CH w stosunku do cylindra 14" i cisnienia 4.2 atm
// BrakeCyl:=TReservoir.Create; // BrakeCyl:=TReservoir.Create;
BrakeCyl = new TBrakeCyl(); BrakeCyl = std::make_shared<TBrakeCyl>();
BrakeRes = new TReservoir(); BrakeRes = std::make_shared<TReservoir>();
ValveRes = new TReservoir(); ValveRes = std::make_shared<TReservoir>();
// tworzenie zbiornikow // tworzenie zbiornikow
BrakeCyl->CreateCap(i_bcd * BCA * 1000); BrakeCyl->CreateCap(i_bcd * BCA * 1000);
@@ -279,34 +272,34 @@ TBrake::TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn
switch (i_mat) switch (i_mat)
{ {
case bp_P10Bg: case bp_P10Bg:
FM = new TP10Bg(); FM = std::make_shared<TP10Bg>();
break; break;
case bp_P10Bgu: case bp_P10Bgu:
FM = new TP10Bgu(); FM = std::make_shared<TP10Bgu>();
break; break;
case bp_FR513: case bp_FR513:
FM = new TFR513(); FM = std::make_shared<TFR513>();
break; break;
case bp_FR510: case bp_FR510:
FM = new TFR510(); FM = std::make_shared<TFR510>();
break; break;
case bp_Cosid: case bp_Cosid:
FM = new TCosid(); FM = std::make_shared<TCosid>();
break; break;
case bp_P10yBg: case bp_P10yBg:
FM = new TP10yBg(); FM = std::make_shared<TP10yBg>();
break; break;
case bp_P10yBgu: case bp_P10yBgu:
FM = new TP10yBgu(); FM = std::make_shared<TP10yBgu>();
break; break;
case bp_D1: case bp_D1:
FM = new TDisk1(); FM = std::make_shared<TDisk1>();
break; break;
case bp_D2: case bp_D2:
FM = new TDisk2(); FM = std::make_shared<TDisk2>();
break; break;
default: // domyslnie default: // domyslnie
FM = new TP10(); FM = std::make_shared<TP10>();
} }
} }
@@ -1842,7 +1835,7 @@ void TKE::CheckReleaser(double dt)
CVP = CntrlRes->P(); CVP = CntrlRes->P();
// odluzniacz // odluzniacz
if ((BrakeStatus && b_rls) == b_rls) if ( true == ((BrakeStatus & b_rls) == b_rls))
if ((CVP - VVP < 0)) if ((CVP - VVP < 0))
BrakeStatus &= 247; BrakeStatus &= 247;
else else
@@ -2203,10 +2196,7 @@ double TFV4a::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
void TFV4a::Init(double Press) void TFV4a::Init(double Press)
{ {
CP = Press; CP = Press;
TP = 0;
RP = Press; RP = Press;
Time = false;
TimeEP = false;
} }
//---FV4a/M--- nowonapisany kran bez poprawki IC //---FV4a/M--- nowonapisany kran bez poprawki IC
@@ -2342,13 +2332,7 @@ double TFV4aM::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
void TFV4aM::Init(double Press) void TFV4aM::Init(double Press)
{ {
CP = Press; CP = Press;
TP = 0.0;
RP = Press; RP = Press;
XP = 0.0;
Time = false;
TimeEP = false;
RedAdj = 0.0;
Fala = false;
} }
void TFV4aM::SetReductor(double nAdj) void TFV4aM::SetReductor(double nAdj)
@@ -2483,12 +2467,6 @@ double TMHZ_EN57::GetPF(double i_bcp, double PP, double HP, double dt, double ep
void TMHZ_EN57::Init(double Press) void TMHZ_EN57::Init(double Press)
{ {
CP = Press; CP = Press;
TP = 0.0;
RP = 0.0;
Time = false;
TimeEP = false;
RedAdj = 0.0;
Fala = false;
} }
void TMHZ_EN57::SetReductor(double nAdj) void TMHZ_EN57::SetReductor(double nAdj)
@@ -2591,9 +2569,7 @@ double TM394::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
void TM394::Init(double Press) void TM394::Init(double Press)
{ {
CP = Press; CP = Press;
RedAdj = 0;
Time = true; Time = true;
TimeEP = false;
} }
void TM394::SetReductor(double nAdj) void TM394::SetReductor(double nAdj)
@@ -2615,32 +2591,23 @@ double TM394::GetPos(int i)
double TH14K1::GetPF(double i_bcp, double PP, double HP, double dt, double ep) double TH14K1::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
{ {
static int const LBDelay = 100; // szybkosc + zasilanie sterujacego int const LBDelay = 100; // szybkosc + zasilanie sterujacego
// static double const BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2] = // static double const BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2] =
//{ (10, 0), (4, 1), (0, 1), (4, 0), (4, -1), (15, -1) }; //{ (10, 0), (4, 1), (0, 1), (4, 0), (4, -1), (15, -1) };
static double const NomPress = 5.0; double const NomPress = 5.0;
double LimPP; int BCP = std::lround(i_bcp);
double dpPipe; if( i_bcp < -1 ) { BCP = 1; }
double dpMainValve;
double ActFlowSpeed;
int BCP;
BCP = lround(i_bcp); double LimPP = BPT_K[BCP + 1][1];
if (i_bcp < -1) if( LimPP < 0.0 ) { LimPP = 0.5 * PP; }
BCP = 1; else if( LimPP > 0.0 ) { LimPP = PP; }
LimPP = BPT_K[BCP + 1][1]; else { LimPP = CP; }
if (LimPP < 0) double ActFlowSpeed = BPT_K[BCP + 1][0];
LimPP = 0.5 * PP;
else if (LimPP > 0)
LimPP = PP;
else
LimPP = CP;
ActFlowSpeed = BPT_K[BCP + 1][0];
CP = CP + 6 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy CP = CP + 6 * std::min( std::abs(LimPP - CP), 0.05 ) * PR(CP, LimPP) * dt; // zbiornik sterujacy
dpMainValve = 0; double dpMainValve = 0.0;
if (BCP == -1) if (BCP == -1)
dpMainValve = PF(HP, PP, ActFlowSpeed / LBDelay) * dt; dpMainValve = PF(HP, PP, ActFlowSpeed / LBDelay) * dt;
@@ -2657,7 +2624,6 @@ double TH14K1::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
void TH14K1::Init(double Press) void TH14K1::Init(double Press)
{ {
CP = Press; CP = Press;
RedAdj = 0;
Time = true; Time = true;
TimeEP = true; TimeEP = true;
} }
@@ -2738,7 +2704,6 @@ void TSt113::Init(double Press)
{ {
Time = true; Time = true;
TimeEP = true; TimeEP = true;
EPS = 0.0;
} }
//--- test --- //--- test ---
@@ -2799,11 +2764,8 @@ double TFD1::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
void TFD1::Init(double Press) void TFD1::Init(double Press)
{ {
BP = 0;
MaxBP = Press; MaxBP = Press;
Time = false; Speed = 1.0;
TimeEP = false;
Speed = 1;
} }
double TFD1::GetCP() double TFD1::GetCP()
@@ -2844,10 +2806,8 @@ double TH1405::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
void TH1405::Init(double Press) void TH1405::Init(double Press)
{ {
BP = 0;
MaxBP = Press; MaxBP = Press;
Time = true; Time = true;
TimeEP = false;
} }
double TH1405::GetCP() double TH1405::GetCP()
@@ -2919,7 +2879,6 @@ void TFVel6::Init(double Press)
{ {
Time = true; Time = true;
TimeEP = true; TimeEP = true;
EPS = 0.0;
} }
// END // END

View File

@@ -1,6 +1,3 @@
#pragma once
#ifndef INCLUDED_HAMULCE_H
#define INCLUDED_HAMULCE_H
/*fizyka hamulcow dla symulatora*/ /*fizyka hamulcow dla symulatora*/
/* /*
@@ -17,6 +14,7 @@ http://mozilla.org/MPL/2.0/.
Copyright (C) 2007-2014 Maciej Cierniak Copyright (C) 2007-2014 Maciej Cierniak
*/ */
/* /*
(C) youBy (C) youBy
Co brakuje: Co brakuje:
@@ -34,9 +32,10 @@ H14K1 (zasadniczy), H1405 (pomocniczy), St113 (ep)
Knorr/West EP - żeby był Knorr/West EP - żeby był
*/ */
#pragma once
#include "friction.h" // Pascal unit #include "friction.h" // Pascal unit
#include "mctools.h" // Pascal unit #include "mctools.h" // Pascal unit
//#include <array>
static int const LocalBrakePosNo = 10; /*ilosc nastaw hamulca recznego lub pomocniczego*/ static int const LocalBrakePosNo = 10; /*ilosc nastaw hamulca recznego lub pomocniczego*/
static int const MainBrakeMaxPos = 10; /*max. ilosc nastaw hamulca zasadniczego*/ static int const MainBrakeMaxPos = 10; /*max. ilosc nastaw hamulca zasadniczego*/
@@ -48,6 +47,7 @@ static int const bdelay_R = 4; // R
static int const bdelay_M = 8; //Mg static int const bdelay_M = 8; //Mg
static int const bdelay_GR = 128; //G-R static int const bdelay_GR = 128; //G-R
/*stan hamulca*/ /*stan hamulca*/
static int const b_off = 0; //luzowanie static int const b_off = 0; //luzowanie
static int const b_hld = 1; //trzymanie static int const b_hld = 1; //trzymanie
@@ -112,10 +112,10 @@ static int const bh_MB = 5; // odciecie - utrzymanie stopnia hamowania/pierwszy
static int const bh_FB = 6; // pelne static int const bh_FB = 6; // pelne
static int const bh_EB = 7; // nagle static int const bh_EB = 7; // nagle
static int const bh_EPR = 8; // ep - luzowanie //pelny luz dla ep kątowego static int const bh_EPR = 8; // ep - luzowanie //pelny luz dla ep kątowego
static int const bh_EPN = 9; // ep - utrzymanie //jesli rowne luzowaniu, wtedy sterowanie static int const bh_EPN = 9; // ep - utrzymanie //jesli rowne luzowaniu, wtedy sterowanie przyciskiem
// przyciskiem
static int const bh_EPB = 10; // ep - hamowanie //pelne hamowanie dla ep kątowego static int const bh_EPB = 10; // ep - hamowanie //pelne hamowanie dla ep kątowego
static double const SpgD = 0.7917; static double const SpgD = 0.7917;
static double const SpO = 0.5067; //przekroj przewodu 1" w l/m static double const SpO = 0.5067; //przekroj przewodu 1" w l/m
//wyj: jednostka dosyc dziwna, ale wszystkie obliczenia //wyj: jednostka dosyc dziwna, ale wszystkie obliczenia
@@ -123,47 +123,41 @@ static double const SpO = 0.5067; // przekroj przewodu 1" w l/m
//zas dlugosc pojazdow jest podana w metrach //zas dlugosc pojazdow jest podana w metrach
//a predkosc przeplywu w m/s //3.5 //a predkosc przeplywu w m/s //3.5
//7//1.5 //7//1.5
// BPT: array[-2..6] of array [0..1] of real= ((0, 5.0), (14, 5.4), (9, 5.0), (6, 4.6), (9, 4.5), // BPT: array[-2..6] of array [0..1] of real= ((0, 5.0), (14, 5.4), (9, 5.0), (6, 4.6), (9, 4.5), (9, 4.0), (9, 3.5), (9, 2.8), (34, 2.8));
// (9, 4.0), (9, 3.5), (9, 2.8), (34, 2.8)); // BPT: array[-2..6] of array [0..1] of real= ((0, 5.0), (7, 5.0), (2.0, 5.0), (4.5, 4.6), (4.5, 4.2), (4.5, 3.8), (4.5, 3.4), (4.5, 2.8), (8, 2.8));
// BPT: array[-2..6] of array [0..1] of real= ((0, 5.0), (7, 5.0), (2.0, 5.0), (4.5, 4.6), (4.5, static double const BPT[9][2] = { {0 , 5.0} , {7 , 5.0} , {2.0 , 5.0} , {4.5 , 4.6} , {4.5 , 4.2} , {4.5 , 3.8} , {4.5 , 3.4} , {4.5 , 2.8} , {8 , 2.8} };
// 4.2), (4.5, 3.8), (4.5, 3.4), (4.5, 2.8), (8, 2.8)); static double const BPT_394[7][2] = { {13 , 10.0} , {5 , 5.0} , {0 , -1} , {5 , -1} , {5 , 0.0} , {5 , 0.0} , {18 , 0.0} };
static double BPT[9][2] = {{0, 5.0}, {7, 5.0}, {2.0, 5.0}, {4.5, 4.6}, {4.5, 4.2},
{4.5, 3.8}, {4.5, 3.4}, {4.5, 2.8}, {8, 2.8}};
static double BPT_394[7][2] = {{13, 10.0}, {5, 5.0}, {0, -1}, {5, -1},
{5, 0.0}, {5, 0.0}, {18, 0.0}};
//double *BPT = zero_based_BPT[2]; //tablica pozycji hamulca dla zakresu -2..6 //double *BPT = zero_based_BPT[2]; //tablica pozycji hamulca dla zakresu -2..6
//double *BPT_394 = zero_based_BPT_394[1]; //tablica pozycji hamulca dla zakresu -1..5 //double *BPT_394 = zero_based_BPT_394[1]; //tablica pozycji hamulca dla zakresu -1..5
// BPT: array[-2..6] of array [0..1] of real= ((0, 5.0), (12, 5.4), (9, 5.0), (9, 4.6), (9, 4.2), // BPT: array[-2..6] of array [0..1] of real= ((0, 5.0), (12, 5.4), (9, 5.0), (9, 4.6), (9, 4.2), (9, 3.8), (9, 3.4), (9, 2.8), (34, 2.8));
// (9, 3.8), (9, 3.4), (9, 2.8), (34, 2.8)); // BPT: array[-2..6] of array [0..1] of real= ((0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0));
// BPT: array[-2..6] of array [0..1] of real= ((0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0,
// 0),(0, 0),(0, 0));
static int const i_bcpno = 6; static int const i_bcpno = 6;
// static double const pi = 3.141592653589793; //definicja w mctools // static double const pi = 3.141592653589793; //definicja w mctools
//klasa obejmujaca pojedyncze zbiorniki //klasa obejmujaca pojedyncze zbiorniki
class TReservoir {
class TReservoir
{
protected: protected:
double Cap; double Cap = 1.0;
double Vol; double Vol = 0.0;
double dVol; double dVol = 0.0;
public: public:
TReservoir();
void CreateCap(double Capacity); void CreateCap(double Capacity);
void CreatePress(double Press); void CreatePress(double Press);
virtual double pa(); virtual double pa();
virtual double P(); virtual double P();
void Flow(double dv); void Flow(double dv);
void Act(); void Act();
TReservoir() = default;
}; };
typedef TReservoir *PReservoir; typedef TReservoir *PReservoir;
class TBrakeCyl : public TReservoir
{ class TBrakeCyl : public TReservoir {
public: public:
virtual double pa()/*override*/; virtual double pa()/*override*/;
virtual double P()/*override*/; virtual double P()/*override*/;
@@ -171,45 +165,40 @@ class TBrakeCyl : public TReservoir
}; };
//klasa obejmujaca uklad hamulca zespolonego pojazdu //klasa obejmujaca uklad hamulca zespolonego pojazdu
class TBrake {
class TBrake
{
protected: protected:
TReservoir *BrakeCyl; // silownik std::shared_ptr<TReservoir> BrakeCyl; //silownik
TReservoir *BrakeRes; // ZP std::shared_ptr<TReservoir> BrakeRes; //ZP
TReservoir *ValveRes; // komora wstepna std::shared_ptr<TReservoir> ValveRes; //komora wstepna
int BCN; // ilosc silownikow int BCN = 0; //ilosc silownikow
double BCM; // przekladnia hamulcowa double BCM = 0.0; //przekladnia hamulcowa
double BCA; // laczny przekroj silownikow double BCA = 0.0; //laczny przekroj silownikow
int BrakeDelays; // dostepne opoznienia int BrakeDelays = 0; //dostepne opoznienia
int BrakeDelayFlag; // aktualna nastawa int BrakeDelayFlag = 0; //aktualna nastawa
TFricMat *FM; // material cierny std::shared_ptr<TFricMat> FM; //material cierny
double MaxBP; // najwyzsze cisnienie double MaxBP = 0.0; //najwyzsze cisnienie
int BA; // osie hamowane int BA = 0; //osie hamowane
int NBpA; // klocki na os int NBpA = 0; //klocki na os
double SizeBR; // rozmiar^2 ZP (w stosunku do 14") double SizeBR = 0.0; //rozmiar^2 ZP (w stosunku do 14")
double SizeBC; // rozmiar^2 CH (w stosunku do 14") double SizeBC = 0.0; //rozmiar^2 CH (w stosunku do 14")
bool DCV; // podwojny zawor zwrotny bool DCV = false; //podwojny zawor zwrotny
double ASBP; // cisnienie hamulca pp double ASBP = 0.0; //cisnienie hamulca pp
int BrakeStatus; // flaga stanu int BrakeStatus = 0; //flaga stanu
int SoundFlag; int SoundFlag = 0;
public: public:
TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, TBrake(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);
int i_ba, int i_nbpa); //maksymalne cisnienie, promien, skok roboczy, pojemnosc ZP, ilosc cylindrow, opoznienia hamulca, material klockow, osie hamowane, klocki na os;
// maksymalne cisnienie, promien, skok roboczy, pojemnosc ZP; virtual void Init(double PP, double HPP, double LPP, double BP, int BDF); //inicjalizacja hamulca
// ilosc cylindrow, opoznienia hamulca, material klockow, osie hamowane, klocki na os;
virtual void Init(double PP, double HPP, double LPP, double BP,
int BDF); // inicjalizacja hamulca
double GetFC(double Vel, double N); //wspolczynnik tarcia - hamulec wie lepiej double GetFC(double Vel, double N); //wspolczynnik tarcia - hamulec wie lepiej
virtual double GetPF(double PP, double dt, double Vel); //przeplyw miedzy komora wstepna i PG virtual double GetPF(double PP, double dt, double Vel); //przeplyw miedzy komora wstepna i PG
double GetBCF(); //sila tlokowa z tloka double GetBCF(); //sila tlokowa z tloka
virtual double GetHPFlow(double HP, double dt); //przeplyw - 8 bar virtual double GetHPFlow(double HP, double dt); //przeplyw - 8 bar
double GetBCP(); //cisnienie cylindrow hamulcowych double GetBCP(); //cisnienie cylindrow hamulcowych
virtual double virtual double GetEDBCP(); //cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED w EP09
GetEDBCP(); // cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED w EP09
double GetBRP(); //cisnienie zbiornika pomocniczego double GetBRP(); //cisnienie zbiornika pomocniczego
double GetVRP(); //cisnienie komory wstepnej rozdzielacza double GetVRP(); //cisnienie komory wstepnej rozdzielacza
virtual double GetCRP(); //cisnienie zbiornika sterujacego virtual double GetCRP(); //cisnienie zbiornika sterujacego
@@ -226,52 +215,44 @@ class TBrake
virtual void ForceEmptiness(); virtual void ForceEmptiness();
int GetSoundFlag(); int GetSoundFlag();
virtual void SetED(double EDstate) {}; //stan hamulca ED do luzowania virtual void SetED(double EDstate) {}; //stan hamulca ED do luzowania
// procedure
}; };
class TWest : public TBrake class TWest : public TBrake {
{
private: private:
double LBP; // cisnienie hamulca pomocniczego double LBP = 0.0; //cisnienie hamulca pomocniczego
double dVP; // pobor powietrza wysokiego cisnienia double dVP = 0.0; //pobor powietrza wysokiego cisnienia
double EPS; // stan elektropneumatyka double EPS = 0.0; //stan elektropneumatyka
double TareM; double TareM = 0.0; //masa proznego
double LoadM; // masa proznego i pelnego double LoadM = 0.0; //i pelnego
double TareBP; // cisnienie dla proznego double TareBP = 0.0; //cisnienie dla proznego
double LoadC; // wspolczynnik przystawki wazacej double LoadC = 0.0; //wspolczynnik przystawki wazacej
public: public:
void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/; void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/;
void SetLBP(double P); //cisnienie z hamulca pomocniczego void SetLBP(double P); //cisnienie z hamulca pomocniczego
double GetPF(double PP, double dt, double GetPF(double PP, double dt, double Vel)/*override*/; //przeplyw miedzy komora wstepna i PG
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetHPFlow(double HP, double dt)/*override*/; double GetHPFlow(double HP, double dt)/*override*/;
void PLC(double mass); //wspolczynnik cisnienia przystawki wazacej void PLC(double mass); //wspolczynnik cisnienia przystawki wazacej
void SetEPS(double nEPS)/*override*/; //stan hamulca EP void SetEPS(double nEPS)/*override*/; //stan hamulca EP
void SetLP(double TM, double LM, double TBP); //parametry przystawki wazacej void SetLP(double TM, double LM, double TBP); //parametry przystawki wazacej
inline TWest(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, inline TWest(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) :
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)
: TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
{
LBP = 0, dVP = 0, EPS = 0, TareM = 0, TareBP = 0, LoadM = 0, LoadC = 0.0;
}
}; };
class TESt : public TBrake class TESt : public TBrake {
{
private: private:
protected: protected:
TReservoir *CntrlRes; // zbiornik sterujący std::shared_ptr<TReservoir> CntrlRes; // zbiornik sterujący
double BVM; // przelozenie PG-CH double BVM = 0.0; // przelozenie PG-CH
public: public:
void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/; void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/;
double GetPF(double PP, double dt, double GetPF(double PP, double dt, double Vel)/*override*/; //przeplyw miedzy komora wstepna i PG
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
void EStParams(double i_crc); //parametry charakterystyczne dla ESt void EStParams(double i_crc); //parametry charakterystyczne dla ESt
double GetCRP()/*override*/; double GetCRP()/*override*/;
void CheckState(double BCP, double & dV1); //glowny przyrzad rozrzadczy void CheckState(double BCP, double & dV1); //glowny przyrzad rozrzadczy
@@ -279,190 +260,161 @@ class TESt : public TBrake
double CVs(double BP); //napelniacz sterujacego double CVs(double BP); //napelniacz sterujacego
double BVs(double BCP); //napelniacz pomocniczego double BVs(double BCP); //napelniacz pomocniczego
inline TESt(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, inline TESt(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) :
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)
: TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
{ {
CntrlRes = new TReservoir(); CntrlRes = std::make_shared<TReservoir>();
} }
}; };
class TESt3 : public TESt class TESt3 : public TESt {
{
private: private:
//double CylFlowSpeed[2][2]; //zmienna nie uzywana //double CylFlowSpeed[2][2]; //zmienna nie uzywana
public: public:
double GetPF(double PP, double dt, double GetPF(double PP, double dt, double Vel)/*override*/; //przeplyw miedzy komora wstepna i PG
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
inline TESt3(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, inline TESt3(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) :
int i_mat, int i_ba, int i_nbpa) TESt( i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
: TESt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
{
}
}; };
class TESt3AL2 : public TESt3 class TESt3AL2 : public TESt3 {
{
private: private:
double TareM; std::shared_ptr<TReservoir> ImplsRes; //komora impulsowa
double LoadM; // masa proznego i pelnego double TareM = 0.0; //masa proznego
double TareBP; // cisnienie dla proznego double LoadM = 0.0; //i pelnego
double LoadC; double TareBP = 0.0; //cisnienie dla proznego
double LoadC = 0.0;
public: public:
TReservoir *ImplsRes; // komora impulsowa
void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/; void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/;
double GetPF(double PP, double dt, double GetPF(double PP, double dt, double Vel)/*override*/; //przeplyw miedzy komora wstepna i PG
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
void PLC(double mass); //wspolczynnik cisnienia przystawki wazacej void PLC(double mass); //wspolczynnik cisnienia przystawki wazacej
void SetLP(double TM, double LM, double TBP); //parametry przystawki wazacej void SetLP(double TM, double LM, double TBP); //parametry przystawki wazacej
inline TESt3AL2(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, inline TESt3AL2(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) :
int i_mat, int i_ba, int i_nbpa) TESt3( i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
: TESt3(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
{ {
TareM = 0, TareBP = 0, LoadM = 0, LoadC = 0.0; ImplsRes = std::make_shared<TReservoir>();
} }
}; };
class TESt4R : public TESt class TESt4R : public TESt {
{
private: private:
bool RapidStatus; bool RapidStatus = false;
protected: protected:
TReservoir *ImplsRes; // komora impulsowa std::shared_ptr<TReservoir> ImplsRes; //komora impulsowa
double RapidTemp; // aktualne, zmienne przelozenie double RapidTemp = 0.0; //aktualne, zmienne przelozenie
public: public:
void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/; void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/;
double GetPF(double PP, double dt, double GetPF(double PP, double dt, double Vel)/*override*/; //przeplyw miedzy komora wstepna i PG
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
inline TESt4R(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, inline TESt4R(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) :
int i_mat, int i_ba, int i_nbpa) TESt( i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
: TESt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
{ {
RapidTemp = 0.0; ImplsRes = std::make_shared<TReservoir>();
ImplsRes = new TReservoir();
} }
}; };
class TLSt : public TESt4R class TLSt : public TESt4R {
{
private: private:
// double CylFlowSpeed[2][2]; // zmienna nie używana // double CylFlowSpeed[2][2]; // zmienna nie używana
protected: protected:
double LBP; // cisnienie hamulca pomocniczego double LBP = 0.0; //cisnienie hamulca pomocniczego
double RM; // przelozenie rapida double RM = 0.0; //przelozenie rapida
double EDFlag; // luzowanie hamulca z powodu zalaczonego ED double EDFlag = 0.0; //luzowanie hamulca z powodu zalaczonego ED
public: public:
void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/; void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/;
void SetLBP(double P); //cisnienie z hamulca pomocniczego void SetLBP(double P); //cisnienie z hamulca pomocniczego
void SetRM(double RMR); //ustalenie przelozenia rapida void SetRM(double RMR); //ustalenie przelozenia rapida
double GetPF(double PP, double dt, double GetPF(double PP, double dt, double Vel)/*override*/; //przeplyw miedzy komora wstepna i PG
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetHPFlow(double HP, double dt)/*override*/; //przeplyw - 8 bar double GetHPFlow(double HP, double dt)/*override*/; //przeplyw - 8 bar
virtual double virtual double GetEDBCP(); //cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED w EP09
GetEDBCP(); // cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED w EP09
virtual void SetED(double EDstate); //stan hamulca ED do luzowania virtual void SetED(double EDstate); //stan hamulca ED do luzowania
inline TLSt(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, inline TLSt(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) :
int i_mat, int i_ba, int i_nbpa) TESt4R( i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
: TESt4R(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
{
}
}; };
class TEStED class TEStED : public TLSt { //zawor z EP09 - Est4 z oddzielnym przekladnikiem, kontrola rapidu i takie tam
: public TLSt // zawor z EP09 - Est4 z oddzielnym przekladnikiem, kontrola rapidu i takie tam
{
private: private:
std::shared_ptr<TReservoir> Miedzypoj; //pojemnosc posrednia (urojona) do napelniania ZP i ZS
double Nozzles[ 11 ]; //dysze double Nozzles[ 11 ]; //dysze
bool Zamykajacy; // pamiec zaworka zamykajacego bool Zamykajacy = false; //pamiec zaworka zamykajacego
bool Przys_blok; // blokada przyspieszacza bool Przys_blok = false; //blokada przyspieszacza
TReservoir *Miedzypoj; // pojemnosc posrednia (urojona) do napelniania ZP i ZS double TareM = 0.0; //masa proznego
double TareM; double LoadM = 0.0; //i pelnego
double LoadM; // masa proznego i pelnego double TareBP = 0.0; //cisnienie dla proznego
double TareBP; // cisnienie dla proznego double LoadC = 0.0;
double LoadC;
public: public:
void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/; void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/;
double GetPF(double PP, double dt, double GetPF(double PP, double dt, double Vel)/*override*/; //przeplyw miedzy komora wstepna i PG
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetEDBCP()/*override*/; //cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED double GetEDBCP()/*override*/; //cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED
void PLC(double mass); //wspolczynnik cisnienia przystawki wazacej void PLC(double mass); //wspolczynnik cisnienia przystawki wazacej
void SetLP(double TM, double LM, double TBP); //parametry przystawki wazacej void SetLP(double TM, double LM, double TBP); //parametry przystawki wazacej
inline TEStED(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, inline TEStED(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) :
int i_mat, int i_ba, int i_nbpa) TLSt( i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
: TLSt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
{ {
Przys_blok = false; Miedzypoj = std::make_shared<TReservoir>();
TareM = 0, TareBP = 0, LoadM = 0, LoadC = 0.0;
Miedzypoj = new TReservoir();
} }
}; };
class TEStEP2 : public TLSt class TEStEP2 : public TLSt {
{
private: private:
double TareM; double TareM = 0.0; //masa proznego
double LoadM; // masa proznego i pelnego double LoadM = 0.0; //masa pelnego
double TareBP; // cisnienie dla proznego double TareBP = 0.0; //cisnienie dla proznego
double LoadC; double LoadC = 0.0;
double EPS; double EPS = 0.0;
public: public:
void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/; //inicjalizacja void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/; //inicjalizacja
double GetPF(double PP, double dt, double GetPF(double PP, double dt, double Vel)/*override*/; //przeplyw miedzy komora wstepna i PG
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
void PLC(double mass); //wspolczynnik cisnienia przystawki wazacej void PLC(double mass); //wspolczynnik cisnienia przystawki wazacej
void SetEPS(double nEPS)/*override*/; //stan hamulca EP void SetEPS(double nEPS)/*override*/; //stan hamulca EP
void SetLP(double TM, double LM, double TBP); //parametry przystawki wazacej void SetLP(double TM, double LM, double TBP); //parametry przystawki wazacej
inline TEStEP2(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, inline TEStEP2(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) :
int i_mat, int i_ba, int i_nbpa) TLSt( i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
: TLSt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
{
TareM = 0, TareBP = 0, LoadM = 0, LoadC = 0, EPS = 0.0;
}
}; };
class TCV1 : public TBrake class TCV1 : public TBrake {
{
private: private:
double BVM; // przelozenie PG-CH double BVM = 0.0; //przelozenie PG-CH
protected: protected:
TReservoir *CntrlRes; // zbiornik sterujący std::shared_ptr<TReservoir> CntrlRes; // zbiornik sterujący
public: public:
void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/; void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/;
double GetPF(double PP, double dt, double GetPF(double PP, double dt, double Vel)/*override*/; //przeplyw miedzy komora wstepna i PG
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetCRP()/*override*/; double GetCRP()/*override*/;
void CheckState(double BCP, double & dV1); void CheckState(double BCP, double & dV1);
double CVs(double BP); double CVs(double BP);
double BVs(double BCP); double BVs(double BCP);
inline TCV1(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, inline TCV1(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) :
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)
: TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
{ {
CntrlRes = new TReservoir(); CntrlRes = std::make_shared<TReservoir>();
} }
}; };
@@ -474,61 +426,53 @@ class TCV1 : public TBrake
// bool RapidStatus; // bool RapidStatus;
//public: //public:
// // function GetPF(PP, dt, Vel: real): real; override; //przeplyw miedzy komora // // function GetPF(PP, dt, Vel: real): real; override; //przeplyw miedzy komora wstepna i PG
// wstepna i PG
// // procedure Init(PP, HPP, LPP, BP: real; BDF: int); override; // // procedure Init(PP, HPP, LPP, BP: real; BDF: int); override;
// inline TCV1R(double i_mbp, double i_bcr, double i_bcd, double i_brc, // inline TCV1R(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, // int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa,
// double PP, double HPP, double LPP, double BP, int BDF) : TCV1(i_mbp, i_bcr, i_bcd, // double PP, double HPP, double LPP, double BP, int BDF) : TCV1(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
// i_brc, i_bcn
// , i_BD, i_mat, i_ba, i_nbpa, PP, HPP, LPP, BP, BDF) { } // , i_BD, i_mat, i_ba, i_nbpa, PP, HPP, LPP, BP, BDF) { }
//}; //};
class TCV1L_TR : public TCV1 class TCV1L_TR : public TCV1 {
{
private: private:
TReservoir *ImplsRes; // komora impulsowa std::shared_ptr<TReservoir> ImplsRes; //komora impulsowa
double LBP; // cisnienie hamulca pomocniczego double LBP = 0.0; //cisnienie hamulca pomocniczego
public: public:
void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/; void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/;
double GetPF(double PP, double dt, double GetPF(double PP, double dt, double Vel)/*override*/; //przeplyw miedzy komora wstepna i PG
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
void SetLBP(double P); //cisnienie z hamulca pomocniczego void SetLBP(double P); //cisnienie z hamulca pomocniczego
double GetHPFlow(double HP, double dt)/*override*/; //przeplyw - 8 bar double GetHPFlow(double HP, double dt)/*override*/; //przeplyw - 8 bar
inline TCV1L_TR(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, inline TCV1L_TR(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) :
int i_mat, int i_ba, int i_nbpa) TCV1( i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
: TCV1(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
{ {
LBP = 0.0; ImplsRes = std::make_shared<TReservoir>();
ImplsRes = new TReservoir();
} }
}; };
class TKE : public TBrake // Knorr Einheitsbauart — jeden do wszystkiego class TKE : public TBrake { //Knorr Einheitsbauart — jeden do wszystkiego
{
private: private:
bool RapidStatus; std::shared_ptr<TReservoir> ImplsRes; //komora impulsowa
TReservoir *ImplsRes; // komora impulsowa std::shared_ptr<TReservoir> CntrlRes; // zbiornik sterujący
TReservoir *CntrlRes; // zbiornik sterujący std::shared_ptr<TReservoir> Brak2Res; //zbiornik pomocniczy 2
TReservoir *Brak2Res; // zbiornik pomocniczy 2 bool RapidStatus = false;
double BVM; // przelozenie PG-CH double BVM = 0.0; //przelozenie PG-CH
double TareM; double TareM = 0.0; //masa proznego
double LoadM; // masa proznego i pelnego double LoadM = 0.0; //masa pelnego
double TareBP; // cisnienie dla proznego double TareBP = 0.0; //cisnienie dla proznego
double LoadC; // wspolczynnik zaladowania double LoadC = 0.0; //wspolczynnik zaladowania
double RM; // przelozenie rapida double RM = 0.0; //przelozenie rapida
double LBP; // cisnienie hamulca pomocniczego double LBP = 0.0; //cisnienie hamulca pomocniczego
public: public:
void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/; void Init(double PP, double HPP, double LPP, double BP, int BDF)/*override*/;
void SetRM(double RMR); //ustalenie przelozenia rapida void SetRM(double RMR); //ustalenie przelozenia rapida
double GetPF(double PP, double dt, double GetPF(double PP, double dt, double Vel)/*override*/; //przeplyw miedzy komora wstepna i PG
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetHPFlow(double HP, double dt)/*override*/; //przeplyw - 8 bar double GetHPFlow(double HP, double dt)/*override*/; //przeplyw - 8 bar
double GetCRP()/*override*/; double GetCRP()/*override*/;
void CheckState(double BCP, double & dV1); void CheckState(double BCP, double & dV1);
@@ -539,29 +483,26 @@ class TKE : public TBrake // Knorr Einheitsbauart — jeden do wszystkiego
void SetLP(double TM, double LM, double TBP); //parametry przystawki wazacej void SetLP(double TM, double LM, double TBP); //parametry przystawki wazacej
void SetLBP(double P); //cisnienie z hamulca pomocniczego void SetLBP(double P); //cisnienie z hamulca pomocniczego
inline TKE(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, inline TKE(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) :
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)
: TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
{ {
RapidStatus = false; ImplsRes = std::make_shared<TReservoir>();
TareM = 0, TareBP = 0, LoadM = 0, LoadC = 0, RM = 0, LBP = 0.0; CntrlRes = std::make_shared<TReservoir>();
ImplsRes = new TReservoir(); Brak2Res = std::make_shared<TReservoir>();
CntrlRes = new TReservoir();
Brak2Res = new TReservoir();
} }
}; };
//klasa obejmujaca krany //klasa obejmujaca krany
class TDriverHandle {
class TDriverHandle
{
private: private:
// BCP: integer; // BCP: integer;
public: public:
bool Time; bool Time = false;
bool TimeEP; bool TimeEP = false;
double Sounds[ 5 ]; //wielkosci przeplywow dla dzwiekow double Sounds[ 5 ]; //wielkosci przeplywow dla dzwiekow
virtual double GetPF(double i_bcp, double PP, double HP, double dt, double ep); virtual double GetPF(double i_bcp, double PP, double HP, double dt, double ep);
virtual void Init(double Press); virtual void Init(double Press);
virtual double GetCP(); virtual double GetCP();
@@ -571,37 +512,34 @@ class TDriverHandle
virtual double GetEP(double pos); virtual double GetEP(double pos);
}; };
class TFV4a : public TDriverHandle class TFV4a : public TDriverHandle {
{
private: private:
double CP; double CP = 0.0; //zbiornik sterujący
double TP; double TP = 0.0; //zbiornik czasowy
double RP; // zbiornik sterujący, czasowy, redukcyjny double RP = 0.0; //zbiornik redukcyjny
public: public:
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/; double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
void Init(double Press)/*override*/; void Init(double Press)/*override*/;
inline TFV4a(void) : TDriverHandle() inline TFV4a() :
{ TDriverHandle()
} {}
}; };
class TFV4aM : public TDriverHandle class TFV4aM : public TDriverHandle {
{
private: private:
double CP; double CP = 0.0; //zbiornik sterujący
double TP; double TP = 0.0; //zbiornik czasowy
double RP; // zbiornik sterujący, czasowy, redukcyjny double RP = 0.0; //zbiornik redukcyjny
double XP; // komora powietrzna w reduktorze — jest potrzebna do odwzorowania fali double XP = 0.0; //komora powietrzna w reduktorze — jest potrzebna do odwzorowania fali
double RedAdj; // dostosowanie reduktora cisnienia (krecenie kapturkiem) double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
// Sounds: array[0..4] of real; //wielkosci przeplywow dla dzwiekow // Sounds: array[0..4] of real; //wielkosci przeplywow dla dzwiekow
bool Fala; bool Fala = false;
// double pos_table[]; static double const pos_table[11]; // = { -2, 6, -1, 0, -2, 1, 4, 6, 0, 0, 0 };
// double *pos_table; // = { -2, 6, -1, 0, -2, 1, 4, 6, 0, 0, 0 };
static double pos_table[11];
double LPP_RP(double pos); double LPP_RP(double pos);
bool EQ(double pos, double i_pos); bool EQ(double pos, double i_pos);
@@ -612,22 +550,21 @@ class TFV4aM : public TDriverHandle
double GetSound(int i)/*override*/; double GetSound(int i)/*override*/;
double GetPos(int i)/*override*/; double GetPos(int i)/*override*/;
inline TFV4aM(void) : TDriverHandle() inline TFV4aM() :
{ TDriverHandle()
} {}
}; };
class TMHZ_EN57 : public TDriverHandle class TMHZ_EN57 : public TDriverHandle {
{
private: private:
double CP; double CP = 0.0; //zbiornik sterujący
double TP; double TP = 0.0; //zbiornik czasowy
double RP; // zbiornik sterujący, czasowy, redukcyjny double RP = 0.0; //zbiornik redukcyjny
double RedAdj; // dostosowanie reduktora cisnienia (krecenie kapturkiem) double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
bool Fala; bool Fala = false;
// const double pos_table[11] = { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 }; static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
static double pos_table[11]; //= { 0, 12, 1, 2, 2, 4, 11, 12, 2, 2, 2 };
double LPP_RP(double pos); double LPP_RP(double pos);
bool EQ(double pos, double i_pos); bool EQ(double pos, double i_pos);
@@ -640,16 +577,15 @@ class TMHZ_EN57 : public TDriverHandle
double GetCP()/*override*/; double GetCP()/*override*/;
double GetEP(double pos); double GetEP(double pos);
inline TMHZ_EN57(void) : TDriverHandle() inline TMHZ_EN57(void) :
{ TDriverHandle()
} {}
}; };
/* FBS2= class(TTDriverHandle) /* FBS2= class(TTDriverHandle)
private private
CP, TP, RP: real; //zbiornik sterujący, czasowy, redukcyjny CP, TP, RP: real; //zbiornik sterujący, czasowy, redukcyjny
XP: real; //komora powietrzna w reduktorze — jest potrzebna do XP: real; //komora powietrzna w reduktorze — jest potrzebna do odwzorowania fali
odwzorowania fali
RedAdj: real; //dostosowanie reduktora cisnienia (krecenie kapturkiem) RedAdj: real; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
// Sounds: array[0..4] of real; //wielkosci przeplywow dla dzwiekow // Sounds: array[0..4] of real; //wielkosci przeplywow dla dzwiekow
Fala: boolean; Fala: boolean;
@@ -664,8 +600,7 @@ odwzorowania fali
/* TD2= class(TTDriverHandle) /* TD2= class(TTDriverHandle)
private private
CP, TP, RP: real; //zbiornik sterujący, czasowy, redukcyjny CP, TP, RP: real; //zbiornik sterujący, czasowy, redukcyjny
XP: real; //komora powietrzna w reduktorze — jest potrzebna do XP: real; //komora powietrzna w reduktorze — jest potrzebna do odwzorowania fali
odwzorowania fali
RedAdj: real; //dostosowanie reduktora cisnienia (krecenie kapturkiem) RedAdj: real; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
// Sounds: array[0..4] of real; //wielkosci przeplywow dla dzwiekow // Sounds: array[0..4] of real; //wielkosci przeplywow dla dzwiekow
Fala: boolean; Fala: boolean;
@@ -677,14 +612,12 @@ odwzorowania fali
function GetPos(i: int): real; override; function GetPos(i: int): real; override;
end;*/ end;*/
class TM394 : public TDriverHandle class TM394 : public TDriverHandle {
{
private: private:
double CP; // zbiornik sterujący, czasowy, redukcyjny double CP = 0.0; //zbiornik sterujący, czasowy, redukcyjny
double RedAdj; // dostosowanie reduktora cisnienia (krecenie kapturkiem) double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
// double const pos_table[11] = { -1, 5, -1, 0, 1, 2, 4, 5, 0, 0, 0 }; static double const pos_table[11]; // = { -1, 5, -1, 0, 1, 2, 4, 5, 0, 0, 0 };
static double pos_table[11]; // = { 0, 6, 0, 1, 2, 3, 5, 6, 1, 1, 1 };
public: public:
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/; double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
@@ -693,21 +626,20 @@ class TM394 : public TDriverHandle
double GetCP()/*override*/; double GetCP()/*override*/;
double GetPos(int i)/*override*/; double GetPos(int i)/*override*/;
inline TM394(void) : TDriverHandle() inline TM394(void) :
{ TDriverHandle()
} {}
}; };
class TH14K1 : public TDriverHandle class TH14K1 : public TDriverHandle {
{
private: private:
double static BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2]; static double const BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2];
// double const table[11] = { -1, 4, -1, 0, 1, 2, 3, 4, 0, 0, 0 }; static double const pos_table[11]; // = {-1, 4, -1, 0, 1, 2, 3, 4, 0, 0, 0};
double static pos_table[11]; // = { 0, 5, 0, 1, 2, 3, 4, 5, 1, 1, 1 };
protected: protected:
double CP; // zbiornik sterujący, czasowy, redukcyjny double CP = 0.0; //zbiornik sterujący, czasowy, redukcyjny
double RedAdj; // dostosowanie reduktora cisnienia (krecenie kapturkiem) double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
public: public:
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/; double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
@@ -716,20 +648,18 @@ class TH14K1 : public TDriverHandle
double GetCP()/*override*/; double GetCP()/*override*/;
double GetPos(int i)/*override*/; double GetPos(int i)/*override*/;
inline TH14K1(void) : TDriverHandle() inline TH14K1(void) :
{ TDriverHandle()
} {}
}; };
class TSt113 : public TH14K1 class TSt113 : public TH14K1 {
{
private: private:
double EPS; double EPS = 0.0;
double static BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2]; static double const BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2];
double static BEP_K[/*?*/ /*-1..5*/ (5) - (-1) + 1]; static double const BEP_K[/*?*/ /*-1..5*/ (5) - (-1) + 1];
// double const pos_table[11] = { -1, 5, -1, 0, 2, 3, 4, 5, 0, 0, 1 }; static double const pos_table[11]; // = {-1, 5, -1, 0, 2, 3, 4, 5, 0, 0, 1};
double static pos_table[11]; // = { 0, 6, 0, 1, 3, 4, 5, 6, 1, 1, 2 };
public: public:
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/; double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
@@ -737,52 +667,50 @@ class TSt113 : public TH14K1
double GetPos(int i)/*override*/; double GetPos(int i)/*override*/;
void Init(double Press)/*override*/; void Init(double Press)/*override*/;
inline TSt113(void) : TH14K1() inline TSt113(void) :
{ TH14K1()
} {}
}; };
class Ttest : public TDriverHandle class Ttest : public TDriverHandle {
{
private: private:
double CP; double CP = 0.0;
public: public:
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/; double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
void Init(double Press)/*override*/; void Init(double Press)/*override*/;
inline Ttest(void) : TDriverHandle() inline Ttest(void) :
{ TDriverHandle()
} {}
}; };
class TFD1 : public TDriverHandle class TFD1 : public TDriverHandle {
{
private: private:
double MaxBP; // najwyzsze cisnienie double MaxBP = 0.0; //najwyzsze cisnienie
double BP; // aktualne cisnienie double BP = 0.0; //aktualne cisnienie
public: public:
double Speed; // szybkosc dzialania double Speed = 0.0; //szybkosc dzialania
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/; double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
void Init(double Press)/*override*/; void Init(double Press)/*override*/;
double GetCP()/*override*/; double GetCP()/*override*/;
void SetSpeed(double nSpeed); void SetSpeed(double nSpeed);
// procedure Init(press: real; MaxBP: real); overload; // procedure Init(press: real; MaxBP: real); overload;
inline TFD1(void) : TDriverHandle() inline TFD1(void) :
{ TDriverHandle()
} {}
}; };
class TH1405 : public TDriverHandle class TH1405 : public TDriverHandle {
{
private: private:
double MaxBP; // najwyzsze cisnienie double MaxBP = 0.0; //najwyzsze cisnienie
double BP; // aktualne cisnienie double BP = 0.0; //aktualne cisnienie
public: public:
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/; double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
@@ -790,18 +718,16 @@ class TH1405 : public TDriverHandle
double GetCP()/*override*/; double GetCP()/*override*/;
// procedure Init(press: real; MaxBP: real); overload; // procedure Init(press: real; MaxBP: real); overload;
inline TH1405(void) : TDriverHandle() inline TH1405(void) :
{ TDriverHandle()
} {}
}; };
class TFVel6 : public TDriverHandle class TFVel6 : public TDriverHandle {
{
private: private:
double EPS; double EPS = 0.0;
// double const table[11] = { -1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1 }; static double const pos_table[ 11 ]; // = {-1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1};
double static pos_table[11]; // = { -1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1 };
public: public:
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/; double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
@@ -810,20 +736,14 @@ class TFVel6 : public TDriverHandle
double GetSound(int i)/*override*/; double GetSound(int i)/*override*/;
void Init(double Press)/*override*/; void Init(double Press)/*override*/;
inline TFVel6(void) : TDriverHandle() inline TFVel6(void) :
{ TDriverHandle()
} {}
}; };
extern double PF(double P1, double P2, double S, double DP = 0.25); extern double PF(double P1, double P2, double S, double DP = 0.25);
extern double PF1(double P1, double P2, double S); extern double PF1(double P1, double P2, double S);
extern double PFVa(double PH, double PL, double S, double LIM, extern double PFVa(double PH, double PL, double S, double LIM, double DP = 0.1); //zawor napelniajacy z PH do PL, PL do LIM
double DP = 0.1); // zawor napelniajacy z PH do PL, PL do LIM extern double PFVd(double PH, double PL, double S, double LIM, double DP = 0.1); //zawor wypuszczajacy z PH do PL, PH do LIM
extern double PFVd(double PH, double PL, double S, double LIM,
double DP = 0.1); // zawor wypuszczajacy z PH do PL, PH do LIM
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
#endif
#endif // INCLUDED_HAMULCE_H
// END

View File

@@ -279,7 +279,7 @@ std::string Tab2Sp(std::string const &s) /*Tab to Space sign*/
{ {
std::string s2 = ""; std::string s2 = "";
char tmp = (char)9; char tmp = (char)9;
for (int b = 0; b < s.length(); ++b) for (std::size_t b = 0; b < s.length(); ++b)
//{ //{
// if (s[b] == tmp[0]) // if (s[b] == tmp[0])
// s[b] = tmp[1]; // s[b] = tmp[1];
@@ -294,20 +294,32 @@ std::string Tab2Sp(std::string const &s) /*Tab to Space sign*/
return s2; 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()]; std::string replacement; replacement.reserve( Source.size() );
for (int b = 0; b < s.length(); ++b) std::for_each(Source.cbegin(), Source.cend(), [&](char const idx) {
{ if( idx != From ) { replacement += idx; }
if (s[b] == aim) else {
if (target == (char)"") if( To != NULL ) { replacement += To; } }
b++; } );
else
tmp[b] = target; return replacement;
else /*
tmp[b] = s[b]; 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 ];
} }
return std::string(tmp); else {
if( To != NULL ) {
replacement += To;
}
}
}
return replacement;
*/
} }
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> &elems)
@@ -387,29 +399,25 @@ std::string to_string(int _Val, int precision, int width)
return o.str(); 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; std::ostringstream converter;
o.width(width); converter << std::setw( Width ) << std::fixed << std::setprecision(Precision) << Value;
o << std::fixed << std::setprecision(precision); return converter.str();
o << _Val;
return o.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; std::ostringstream converter;
if (width) converter << "0x" << std::uppercase << std::setfill( '0' ) << std::setw( Width ) << std::hex << Value;
o.width(width); return converter.str();
o << std::fixed << std::hex;
if (precision)
o << std::setprecision(precision);
o << _Val;
return o.str();
}; };
int stol_def(const std::string &str, const int &DefaultValue) int stol_def(const std::string &str, const int &DefaultValue)
{ {
// NOTE: there's good chance this function is bugged, it produced wrong result on at least one occasion
// TODO: rewrite into something more reliable
// this function was developed iteratively on Codereview.stackexchange // this function was developed iteratively on Codereview.stackexchange
// with the assistance of @Corbin // with the assistance of @Corbin
std::size_t len = str.size(); std::size_t len = str.size();

View File

@@ -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 DWE(std::string s); /*Delete While Equal sign*/
std::string Ld2Sp(std::string const &s); /*Low dash to Space 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 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> &elems);
std::vector<std::string> Split(const std::string &s, char delim); std::vector<std::string> Split(const std::string &s, char delim);
std::vector<std::string> Split(const std::string &s); 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);
std::string to_string(double _Val, int precision); std::string to_string(double _Val, int precision);
std::string to_string(double _Val, int precision, int width); 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) inline std::string to_string(bool _Val)
{ {
return _Val == true ? "true" : "false"; return _Val == true ? "true" : "false";

View File

@@ -1844,7 +1844,11 @@ bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic) {
Init(); // generowanie siatek i zapis E3D Init(); // generowanie siatek i zapis E3D
} }
} }
return Root ? (iSubModelsCount > 0) : false; // brak pliku albo problem z wczytaniem bool const result = Root ? (iSubModelsCount > 0) : false; // brak pliku albo problem z wczytaniem
if( false == result ) {
ErrorLog( "Failed to load 3d model \"" + FileName + "\"" );
}
return result;
}; };
void TModel3d::LoadFromBinFile(std::string const &FileName, bool dynamic) void TModel3d::LoadFromBinFile(std::string const &FileName, bool dynamic)

View File

@@ -108,6 +108,11 @@ TNames::TNames()
ZeroMemory(rTypes, 20 * sizeof(ItemRecord *)); ZeroMemory(rTypes, 20 * sizeof(ItemRecord *));
}; };
TNames::~TNames() {
delete[] cBuffer;
}
int TNames::Add(int t, const char *n) int TNames::Add(int t, const char *n)
{ // dodanie obiektu typu (t) o nazwie (n) { // dodanie obiektu typu (t) o nazwie (n)
int len = strlen(n) + 1; // ze znacznikiem końca int len = strlen(n) + 1; // ze znacznikiem końca

View File

@@ -49,6 +49,7 @@ class TNames
int iLast; // ostatnio użyty rekord int iLast; // ostatnio użyty rekord
public: public:
TNames(); TNames();
~TNames();
int Add(int t, const char *n); // dodanie obiektu typu (t) 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, void *d); // dodanie obiektu z wskaźnikiem
int Add(int t, const char *n, int d); // dodanie obiektu z numerem int Add(int t, const char *n, int d); // dodanie obiektu z numerem

View File

@@ -45,13 +45,19 @@ TPythonInterpreter *TPythonInterpreter::getInstance()
return _instance; 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()) if (it == _classes.end())
{ {
FILE *sourceFile = _getFile(lookupPath, className); FILE *sourceFile = _getFile(lookupPath, className);
if (sourceFile != NULL) if (sourceFile != nullptr)
{ {
fseek(sourceFile, 0, SEEK_END); fseek(sourceFile, 0, SEEK_END);
long fsize = ftell(sourceFile); long fsize = ftell(sourceFile);
@@ -72,9 +78,12 @@ bool TPythonInterpreter::loadClassFile(const char *lookupPath, const char *class
handleError(); handleError();
return false; return false;
} }
_classes.insert( className );
/*
char *classNameToRemember = (char *)calloc(strlen(className) + 1, sizeof(char)); char *classNameToRemember = (char *)calloc(strlen(className) + 1, sizeof(char));
strcpy(classNameToRemember, className); strcpy(classNameToRemember, className);
_classes.insert(classNameToRemember); _classes.insert(classNameToRemember);
*/
free(buffer); free(buffer);
return true; return true;
} }
@@ -83,13 +92,28 @@ bool TPythonInterpreter::loadClassFile(const char *lookupPath, const char *class
return true; return true;
} }
PyObject *TPythonInterpreter::newClass(const char *className) PyObject *TPythonInterpreter::newClass( std::string const &className )
{ {
return newClass(className, NULL); 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; char *sourceFilePath;
if (lookupPath != NULL) if (lookupPath != NULL)
{ {
@@ -124,6 +148,7 @@ FILE *TPythonInterpreter::_getFile(const char *lookupPath, const char *className
return file; return file;
} }
return NULL; return NULL;
*/
} }
void TPythonInterpreter::handleError() 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) if (_main == NULL)
{ {
WriteLog("main turned into null"); WriteLog("main turned into null");
return NULL; return NULL;
} }
PyObject *classNameObj = PyObject_GetAttrString(_main, className); PyObject *classNameObj = PyObject_GetAttrString(_main, className.c_str());
if (classNameObj == NULL) if (classNameObj == NULL)
{ {
#ifdef _PY_INT_MORE_LOG #ifdef _PY_INT_MORE_LOG
@@ -477,18 +502,12 @@ void TPythonScreens::update()
void TPythonScreens::setLookupPath(std::string const &path) void TPythonScreens::setLookupPath(std::string const &path)
{ {
if (_lookupPath != NULL) _lookupPath = path;
{
free(_lookupPath);
}
_lookupPath = (char *)calloc(path.length() + 1, sizeof(char));
strcpy(_lookupPath, path.c_str());
} }
TPythonScreens::TPythonScreens() TPythonScreens::TPythonScreens()
{ {
_lookupPath = NULL; TPythonInterpreter::getInstance()->loadClassFile("", "abstractscreenrenderer");
TPythonInterpreter::getInstance()->loadClassFile(NULL, "abstractscreenrenderer");
_terminationFlag = false; _terminationFlag = false;
_renderReadyFlag = false; _renderReadyFlag = false;
_cleanupReadyFlag = false; _cleanupReadyFlag = false;
@@ -501,6 +520,7 @@ TPythonScreens::~TPythonScreens()
WriteLog("Called python sceeens destructor"); WriteLog("Called python sceeens destructor");
#endif // _PY_INT_MORE_LOG #endif // _PY_INT_MORE_LOG
reset(NULL); reset(NULL);
/*
if (_lookupPath != NULL) if (_lookupPath != NULL)
{ {
#ifdef _PY_INT_MORE_LOG #ifdef _PY_INT_MORE_LOG
@@ -508,6 +528,7 @@ TPythonScreens::~TPythonScreens()
#endif // _PY_INT_MORE_LOG #endif // _PY_INT_MORE_LOG
free(_lookupPath); free(_lookupPath);
} }
*/
} }
void TPythonScreens::run() void TPythonScreens::run()
@@ -551,7 +572,7 @@ void TPythonScreens::run()
void TPythonScreens::finish() void TPythonScreens::finish()
{ {
_thread == NULL; _thread = NULL;
} }
DWORD WINAPI ScreenRendererThread(LPVOID lpParam) DWORD WINAPI ScreenRendererThread(LPVOID lpParam)

18
PyInt.h
View File

@@ -30,21 +30,25 @@ class TPythonInterpreter
{ {
protected: protected:
TPythonInterpreter(); TPythonInterpreter();
~TPythonInterpreter() ~TPythonInterpreter() {}
{
}
static TPythonInterpreter *_instance; static TPythonInterpreter *_instance;
int _screenRendererPriority; int _screenRendererPriority;
std::set<const char *, ltstr> _classes; // std::set<const char *, ltstr> _classes;
std::set<std::string const> _classes;
PyObject *_main; PyObject *_main;
PyObject *_stdErr; 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: public:
static TPythonInterpreter *getInstance(); 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 *newClass(const char *className, PyObject *argsTuple); PyObject *newClass(const char *className, PyObject *argsTuple);
*/ 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() int getScreenRendererPriotity()
{ {
return _screenRendererPriority; return _screenRendererPriority;
@@ -79,7 +83,7 @@ class TPythonScreens
void *_thread; void *_thread;
unsigned int _threadId; unsigned int _threadId;
std::vector<TPythonScreenRenderer *> _screens; std::vector<TPythonScreenRenderer *> _screens;
char *_lookupPath; std::string _lookupPath;
void *_train; void *_train;
void _cleanup(); void _cleanup();
void _freeTrainState(); void _freeTrainState();

View File

@@ -37,7 +37,7 @@ TRealSound::TRealSound()
bLoopPlay = false; // dźwięk wyłączony 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) bool freqmod, double rmin)
{ {
Init(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin); Init(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin);
@@ -250,7 +250,7 @@ void TRealSound::ResetPosition()
pSound->SetCurrentPosition(0); 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) bool Dynamic, bool freqmod, double rmin)
: TRealSound(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin) : TRealSound(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin)
{ {

View File

@@ -18,7 +18,7 @@ class TRealSound
{ {
protected: protected:
PSound pSound; PSound pSound;
char *Nazwa; // dla celow odwszawiania // char *Nazwa; // dla celow odwszawiania NOTE: currently not used anywhere
double fDistance, fPreviousDistance; // dla liczenia Dopplera double fDistance, fPreviousDistance; // dla liczenia Dopplera
float fFrequency; // częstotliwość samplowania pliku float fFrequency; // częstotliwość samplowania pliku
int iDoppler; // Ra 2014-07: możliwość wyłączenia efektu Dopplera np. dla śpiewu ptaków 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 double FA; // offset czestotliwosci
bool bLoopPlay; // czy zapętlony dźwięk jest odtwarzany bool bLoopPlay; // czy zapętlony dźwięk jest odtwarzany
TRealSound(); 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); bool freqmod = false, double rmin = 0.0);
~TRealSound(); ~TRealSound();
void Free(); void Free();
@@ -54,7 +54,7 @@ class TTextSound : public TRealSound
std::string asText; std::string asText;
float fTime; // czas trwania float fTime; // czas trwania
public: 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); bool Dynamic, bool freqmod = false, double rmin = 0.0);
void Init(std::string const &SoundName, double SoundAttenuation, double X, double Y, double Z, void Init(std::string const &SoundName, double SoundAttenuation, double X, double Y, double Z,
bool Dynamic, bool freqmod = false, double rmin = 0.0); bool Dynamic, bool freqmod = false, double rmin = 0.0);

View File

@@ -14,6 +14,7 @@ http://mozilla.org/MPL/2.0/.
#include "Logs.h" #include "Logs.h"
#include "Usefull.h" #include "Usefull.h"
#include "mczapkie/mctools.h" #include "mczapkie/mctools.h"
#include "WavRead.h"
//#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } } //#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
#define SAFE_RELEASE(p) \ #define SAFE_RELEASE(p) \
{ \ { \

View File

@@ -11,14 +11,7 @@ http://mozilla.org/MPL/2.0/.
#define SoundH #define SoundH
#include <stack> #include <stack>
#undef EOF
#include <objbase.h>
//#include <initguid.h>
//#include <commdlg.h>
#include <mmreg.h>
#include <dsound.h> #include <dsound.h>
//#include "resource.h"
#include "WavRead.h"
typedef LPDIRECTSOUNDBUFFER PSound; typedef LPDIRECTSOUNDBUFFER PSound;

View File

@@ -59,30 +59,26 @@ TSwitchExtension::TSwitchExtension(TTrack *owner, int what)
pOwner = NULL; pOwner = NULL;
pNextAnim = NULL; pNextAnim = NULL;
bMovement = false; // nie potrzeba przeliczać fOffset1 bMovement = false; // nie potrzeba przeliczać fOffset1
Segments[0] = new TSegment(owner); // z punktu 1 do 2 Segments[0] = std::make_shared<TSegment>(owner); // z punktu 1 do 2
Segments[1] = new TSegment( Segments[1] = std::make_shared<TSegment>(owner); // z punktu 3 do 4 (1=3 dla zwrotnic; odwrócony dla skrzyżowań, ewentualnie 1=4)
owner); // z punktu 3 do 4 (1=3 dla zwrotnic; odwrócony dla skrzyżowań, ewentualnie 1=4)
Segments[2] = (what >= 3) ? Segments[2] = (what >= 3) ?
new TSegment(owner) : std::make_shared<TSegment>(owner) :
NULL; // z punktu 2 do 4 skrzyżowanie od góry: wersja "-1": nullptr; // z punktu 2 do 4 skrzyżowanie od góry: wersja "-1":
Segments[3] = Segments[3] = (what >= 4) ?
(what >= 4) ? new TSegment(owner) : NULL; // z punktu 4 do 1 1 1=4 0 0=3 std::make_shared<TSegment>(owner) :
Segments[4] = nullptr; // z punktu 4 do 1 1 1=4 0 0=3
(what >= 5) ? new TSegment(owner) : NULL; // z punktu 1 do 3 4 x 3 3 3 x 2 2 Segments[4] = (what >= 5) ?
Segments[5] = (what >= 6) ? new TSegment(owner) : std::make_shared<TSegment>(owner) :
NULL; // z punktu 3 do 2 2 2 1 1 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; evPlus = evMinus = NULL;
fVelocity = -1.0; // maksymalne ograniczenie prędkości (ustawianej eventem) fVelocity = -1.0; // maksymalne ograniczenie prędkości (ustawianej eventem)
vTrans = vector3(0, 0, 0); // docelowa translacja przesuwnicy vTrans = vector3(0, 0, 0); // docelowa translacja przesuwnicy
} }
TSwitchExtension::~TSwitchExtension() TSwitchExtension::~TSwitchExtension()
{ // nie ma nic do usuwania { // 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() TIsolated::TIsolated()
@@ -121,7 +117,7 @@ TIsolated * TIsolated::Find(const string &n)
return p; return p;
p = p->pNext; p = p->pNext;
} }
pRoot = new TIsolated(n, pRoot); pRoot = new TIsolated(n, pRoot); // BUG: source of a memory leak
return pRoot; return pRoot;
}; };
@@ -211,7 +207,11 @@ TTrack::TTrack(TGroundNode *g)
TTrack::~TTrack() TTrack::~TTrack()
{ // likwidacja odcinka { // 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) delete Segment; // dla zwrotnic nie usuwać tego (kopiowany)
else else
{ // usuwanie dodatkowych danych dla niezwykłych odcinków { // usuwanie dodatkowych danych dla niezwykłych odcinków
@@ -219,6 +219,7 @@ TTrack::~TTrack()
delete SwitchExtension->vPoints; // skrzyżowanie może mieć punkty delete SwitchExtension->vPoints; // skrzyżowanie może mieć punkty
SafeDelete(SwitchExtension); SafeDelete(SwitchExtension);
} }
*/
} }
void TTrack::Init() void TTrack::Init()
@@ -226,21 +227,21 @@ void TTrack::Init()
switch (eType) switch (eType)
{ {
case tt_Switch: 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; break;
case tt_Cross: // tylko dla skrzyżowania dróg 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->vPoints = NULL; // brak tablicy punktów
SwitchExtension->iPoints = 0; SwitchExtension->iPoints = 0;
SwitchExtension->bPoints = false; // tablica punktów nie wypełniona SwitchExtension->bPoints = false; // tablica punktów nie wypełniona
SwitchExtension->iRoads = 4; // domyślnie 4 SwitchExtension->iRoads = 4; // domyślnie 4
break; break;
case tt_Normal: case tt_Normal:
Segment = new TSegment(this); Segment = std::make_shared<TSegment>( this );
break; break;
case tt_Table: // oba potrzebne case tt_Table: // oba potrzebne
SwitchExtension = new TSwitchExtension(this, 1); // kopia oryginalnego toru SwitchExtension = std::make_shared<TSwitchExtension>( this, 1 ); // kopia oryginalnego toru
Segment = new TSegment(this); Segment = make_shared<TSegment>(this);
break; break;
} }
} }

20
Track.h
View File

@@ -48,13 +48,13 @@ class TSwitchExtension
public: public:
TSwitchExtension(TTrack *owner, int what); TSwitchExtension(TTrack *owner, int what);
~TSwitchExtension(); ~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ń // skrzy¿owañ
// TTrack *trNear[4]; //tory dołączone do punktów 1, 2, 3 i 4 // TTrack *trNear[4]; //tory do³¹czone do punktów 1, 2, 3 i 4
// dotychczasowe [2]+[2] wskaźniki zamienić na nowe [4] // dotychczasowe [2]+[2] wskaŸniki zamieniæ na nowe [4]
TTrack *pNexts[2]; // tory dołączone do punktów 2 i 4 TTrack *pNexts[2]; // tory do³¹czone do punktów 2 i 4
TTrack *pPrevs[2]; // tory dołączone do punktów 1 i 3 TTrack *pPrevs[2]; // tory do³¹czone do punktów 1 i 3
int iNextDirection[2]; // to też z [2]+[2] przerobić na [4] int iNextDirection[2]; // to te¿ z [2]+[2] przerobiæ na [4]
int iPrevDirection[2]; int iPrevDirection[2];
int CurrentIndex; // dla zwrotnicy int CurrentIndex; // dla zwrotnicy
double fOffset, fDesiredOffset; // aktualne i docelowe położenie napędu iglic double fOffset, fDesiredOffset; // aktualne i docelowe położenie napędu iglic
@@ -126,8 +126,8 @@ class TIsolated
class TTrack : public Resource class TTrack : public Resource
{ // trajektoria ruchu - opakowanie { // trajektoria ruchu - opakowanie
private: private:
TSwitchExtension *SwitchExtension; // dodatkowe dane do toru, który jest zwrotnicą std::shared_ptr<TSwitchExtension> SwitchExtension; // dodatkowe dane do toru, który jest zwrotnicą
TSegment *Segment; std::shared_ptr<TSegment> Segment;
TTrack *trNext; // odcinek od strony punktu 2 - to powinno być w segmencie TTrack *trNext; // odcinek od strony punktu 2 - to powinno być w segmencie
TTrack *trPrev; // odcinek od strony punktu 1 TTrack *trPrev; // odcinek od strony punktu 1
// McZapkie-070402: dodalem zmienne opisujace rozmiary tekstur // McZapkie-070402: dodalem zmienne opisujace rozmiary tekstur
@@ -204,7 +204,7 @@ class TTrack : public Resource
{ {
return Segment->GetLength(); return Segment->GetLength();
}; };
inline TSegment * CurrentSegment() inline std::shared_ptr<TSegment> CurrentSegment()
{ {
return Segment; return Segment;
}; };

View File

@@ -11,18 +11,19 @@ http://mozilla.org/MPL/2.0/.
Copyright (C) 2001-2004 Marcin Wozniak, Maciej Czapkiewicz and others Copyright (C) 2001-2004 Marcin Wozniak, Maciej Czapkiewicz and others
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "Train.h" #include "Train.h"
#include "Console.h"
#include "Driver.h"
#include "Globals.h" #include "Globals.h"
#include "Logs.h" #include "Logs.h"
#include "McZapkie\MOVER.h"
#include "McZapkie\hamulce.h"
#include "MdlMngr.h" #include "MdlMngr.h"
#include "Timer.h" #include "Timer.h"
#include "Driver.h"
#include "Console.h"
#include "McZapkie\hamulce.h"
#include "McZapkie\MOVER.h"
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
using namespace Timer; using namespace Timer;
@@ -69,14 +70,26 @@ void TCab::Load(cParser &Parser)
if (token == "cablight") if (token == "cablight")
{ {
Parser.getTokens( 9, false ); Parser.getTokens( 9, false );
Parser >> dimm_r >> dimm_g >> dimm_b >> intlit_r >> intlit_g >> intlit_b >> intlitlow_r >> Parser
intlitlow_g >> intlitlow_b; >> dimm_r
Parser.getTokens(); >> dimm_g
Parser >> token; >> dimm_b
>> intlit_r
>> intlit_g
>> intlit_b
>> intlitlow_r
>> intlitlow_g
>> intlitlow_b;
Parser.getTokens(); Parser >> token;
} }
CabPos1.x = std::stod( token ); CabPos1.x = std::stod( token );
Parser.getTokens( 5, false ); Parser.getTokens( 5, false );
Parser >> CabPos1.y >> CabPos1.z >> CabPos2.x >> CabPos2.y >> CabPos2.z; Parser
>> CabPos1.y
>> CabPos1.z
>> CabPos2.x
>> CabPos2.y
>> CabPos2.z;
bEnabled = true; bEnabled = true;
bOccupied = true; bOccupied = true;
@@ -216,9 +229,9 @@ bool TTrain::Init(TDynamicObject *NewDynamicObject, bool e3d)
fMechPitch = 0.1; fMechPitch = 0.1;
fMainRelayTimer = 0; // Hunter, do k...y nędzy, ustawiaj wartości początkowe zmiennych! fMainRelayTimer = 0; // Hunter, do k...y nędzy, ustawiaj wartości początkowe zmiennych!
if (!LoadMMediaFile(DynamicObject->asBaseDir + DynamicObject->MoverParameters->TypeName + if( false == LoadMMediaFile( DynamicObject->asBaseDir + DynamicObject->MoverParameters->TypeName + ".mmd" ) ) {
".mmd"))
return false; return false;
}
// McZapkie: w razie wykolejenia // McZapkie: w razie wykolejenia
// dsbDerailment=TSoundsManager::GetFromName("derail.wav"); // dsbDerailment=TSoundsManager::GetFromName("derail.wav");
@@ -344,9 +357,8 @@ PyObject *TTrain::GetTrainState()
if (typeid(mvControlled->Hamulec) == typeid(TLSt) || if (typeid(mvControlled->Hamulec) == typeid(TLSt) ||
typeid(mvControlled->Hamulec) == typeid(TEStED)) typeid(mvControlled->Hamulec) == typeid(TEStED))
{ {
TBrake *temp_ham = mvControlled->Hamulec;
// TLSt* temp_ham2 = temp_ham; // 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 else
bPN = false; bPN = false;
@@ -736,8 +748,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
else if (cKey == Global::Keys[k_OpenLeft]) // NBMX 17-09-2003: otwieranie drzwi else if (cKey == Global::Keys[k_OpenLeft]) // NBMX 17-09-2003: otwieranie drzwi
{ {
if (mvOccupied->DoorOpenCtrl == 1) if (mvOccupied->DoorOpenCtrl == 1)
if (mvOccupied->CabNo < 0 ? mvOccupied->DoorRight(true) : if (mvOccupied->CabNo < 0 ? mvOccupied->DoorRight(true) : mvOccupied->DoorLeft(true))
mvOccupied->DoorLeft(true))
{ {
dsbSwitch->SetVolume(DSBVOLUME_MAX); dsbSwitch->SetVolume(DSBVOLUME_MAX);
dsbSwitch->Play(0, 0, 0); dsbSwitch->Play(0, 0, 0);
@@ -750,9 +761,8 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
} }
else if (cKey == Global::Keys[k_OpenRight]) // NBMX 17-09-2003: otwieranie drzwi else if (cKey == Global::Keys[k_OpenRight]) // NBMX 17-09-2003: otwieranie drzwi
{ {
if (mvOccupied->DoorCloseCtrl == 1) if (mvOccupied->DoorOpenCtrl == 1)
if (mvOccupied->CabNo < 0 ? mvOccupied->DoorLeft(true) : if (mvOccupied->CabNo < 0 ? mvOccupied->DoorLeft(true) : mvOccupied->DoorRight(true))
mvOccupied->DoorRight(true))
{ {
dsbSwitch->SetVolume(DSBVOLUME_MAX); dsbSwitch->SetVolume(DSBVOLUME_MAX);
dsbSwitch->Play(0, 0, 0); dsbSwitch->Play(0, 0, 0);
@@ -898,7 +908,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
else if (cKey == Global::Keys[k_LeftSign]) // lewe swiatlo - włączenie else if (cKey == Global::Keys[k_LeftSign]) // lewe swiatlo - włączenie
// ABu 060205: dzielo Wingera po malutkim liftingu: // ABu 060205: dzielo Wingera po malutkim liftingu:
{ {
if (!mvOccupied->LightsPosNo > 0) if (false == (mvOccupied->LightsPosNo > 0))
{ {
if ((GetAsyncKeyState(VK_CONTROL) < 0) && if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
(ggRearLeftLightButton.SubModel)) // hunter-230112 - z controlem zapala z tylu (ggRearLeftLightButton.SubModel)) // hunter-230112 - z controlem zapala z tylu
@@ -1073,7 +1083,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
// tylne (koncowki) - // tylne (koncowki) -
// wlaczenie // wlaczenie
{ {
if (!mvOccupied->LightsPosNo > 0) if (false == (mvOccupied->LightsPosNo > 0))
{ {
if ((GetAsyncKeyState(VK_CONTROL) < 0) && if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
(ggRearRightLightButton.SubModel)) // hunter-230112 - z controlem zapala z tylu (ggRearRightLightButton.SubModel)) // hunter-230112 - z controlem zapala z tylu
@@ -1968,30 +1978,30 @@ if
} }
else if (cKey == Global::Keys[k_CloseLeft]) // NBMX 17-09-2003: zamykanie drzwi else if (cKey == Global::Keys[k_CloseLeft]) // NBMX 17-09-2003: zamykanie drzwi
{ {
if (mvOccupied->CabNo < 0 ? mvOccupied->DoorRight(false) : mvOccupied->DoorLeft(false)) if( mvOccupied->DoorCloseCtrl == 1 ) {
{ if( mvOccupied->CabNo < 0 ? mvOccupied->DoorRight( false ) : mvOccupied->DoorLeft( false ) ) {
dsbSwitch->SetVolume( DSBVOLUME_MAX ); dsbSwitch->SetVolume( DSBVOLUME_MAX );
dsbSwitch->Play( 0, 0, 0 ); dsbSwitch->Play( 0, 0, 0 );
if (dsbDoorClose) if( dsbDoorClose ) {
{
dsbDoorClose->SetCurrentPosition( 0 ); dsbDoorClose->SetCurrentPosition( 0 );
dsbDoorClose->Play( 0, 0, 0 ); dsbDoorClose->Play( 0, 0, 0 );
} }
} }
} }
}
else if (cKey == Global::Keys[k_CloseRight]) // NBMX 17-09-2003: zamykanie drzwi else if (cKey == Global::Keys[k_CloseRight]) // NBMX 17-09-2003: zamykanie drzwi
{ {
if (mvOccupied->CabNo < 0 ? mvOccupied->DoorLeft(false) : mvOccupied->DoorRight(false)) if( mvOccupied->DoorCloseCtrl == 1 ) {
{ if( mvOccupied->CabNo < 0 ? mvOccupied->DoorLeft( false ) : mvOccupied->DoorRight( false ) ) {
dsbSwitch->SetVolume( DSBVOLUME_MAX ); dsbSwitch->SetVolume( DSBVOLUME_MAX );
dsbSwitch->Play( 0, 0, 0 ); dsbSwitch->Play( 0, 0, 0 );
if (dsbDoorClose) if( dsbDoorClose ) {
{
dsbDoorClose->SetCurrentPosition( 0 ); dsbDoorClose->SetCurrentPosition( 0 );
dsbDoorClose->Play( 0, 0, 0 ); dsbDoorClose->Play( 0, 0, 0 );
} }
} }
} }
}
//----------- //-----------
// hunter-131211: dzwiek dla przelacznika universala // hunter-131211: dzwiek dla przelacznika universala
@@ -2105,7 +2115,7 @@ if
else if (cKey == Global::Keys[k_LeftSign]) // ABu 060205: lewe swiatlo - else if (cKey == Global::Keys[k_LeftSign]) // ABu 060205: lewe swiatlo -
// wylaczenie // wylaczenie
{ {
if (!mvOccupied->LightsPosNo > 0) if (false == (mvOccupied->LightsPosNo > 0))
{ {
if ((GetAsyncKeyState(VK_CONTROL) < 0) && if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
(ggRearLeftLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu (ggRearLeftLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
@@ -2278,7 +2288,7 @@ if
if (cKey == Global::Keys[k_RightSign]) // Winger 070304: swiatla tylne if (cKey == Global::Keys[k_RightSign]) // Winger 070304: swiatla tylne
// (koncowki) - wlaczenie // (koncowki) - wlaczenie
{ {
if (!mvOccupied->LightsPosNo > 0) if (false == (mvOccupied->LightsPosNo > 0))
{ {
if ((GetAsyncKeyState(VK_CONTROL) < 0) && if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
(ggRearRightLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu (ggRearRightLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
@@ -3220,7 +3230,7 @@ bool TTrain::Update()
rsRunningNoise.AM = am; rsRunningNoise.AM = am;
rsRunningNoise.AA = 0.7; rsRunningNoise.AA = 0.7;
rsRunningNoise.FA = fa; rsRunningNoise.FA = fa;
rsRunningNoise.FM - fm; rsRunningNoise.FM = fm;
} }
mvOccupied->EventFlag = false; mvOccupied->EventFlag = false;
} }
@@ -5063,6 +5073,7 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName)
dsbCouplerDetach = TSoundsManager::GetFromName("couplerdetach.wav", true); dsbCouplerDetach = TSoundsManager::GetFromName("couplerdetach.wav", true);
dsbCouplerStretch = TSoundsManager::GetFromName("en57_couplerstretch.wav", true); dsbCouplerStretch = TSoundsManager::GetFromName("en57_couplerstretch.wav", true);
dsbCouplerAttach = TSoundsManager::GetFromName("couplerattach.wav", true); dsbCouplerAttach = TSoundsManager::GetFromName("couplerattach.wav", true);
std::string token; std::string token;
do do
{ {

View File

@@ -102,7 +102,7 @@ TTrack * TTrackFollower::SetCurrentTrack(TTrack *pTrack, int end)
pCurrentTrack->AxleCounter(-1, Owner); // opuszczenie tamtego toru pCurrentTrack->AxleCounter(-1, Owner); // opuszczenie tamtego toru
} }
pCurrentTrack = pTrack; pCurrentTrack = pTrack;
pCurrentSegment = (pCurrentTrack ? pCurrentTrack->CurrentSegment() : NULL); pCurrentSegment = ( pCurrentTrack != nullptr ? pCurrentTrack->CurrentSegment() : nullptr );
if (!pCurrentTrack) if (!pCurrentTrack)
Error(Owner->MoverParameters->Name + " at NULL track"); Error(Owner->MoverParameters->Name + " at NULL track");
return pCurrentTrack; return pCurrentTrack;
@@ -330,5 +330,3 @@ void TTrackFollower::Render(float fNr)
} }
#endif #endif
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#pragma package(smart_init)

View File

@@ -16,10 +16,10 @@ http://mozilla.org/MPL/2.0/.
class TTrackFollower class TTrackFollower
{ // oś poruszająca się po torze { // oś poruszająca się po torze
private: private:
TTrack *pCurrentTrack; // na którym torze się znajduje TTrack *pCurrentTrack; // na którym torze siê znajduje
TSegment *pCurrentSegment; // zwrotnice mogą mieć dwa segmenty std::shared_ptr<TSegment> pCurrentSegment; // zwrotnice mog¹ mieæ dwa segmenty
double fCurrentDistance; // przesunięcie względem Point1 w stronę Point2 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 double fDirection; // ustawienie wzglêdem toru: -1.0 albo 1.0, mno¿one przez dystans
bool ComputatePosition(); // przeliczenie pozycji na torze bool ComputatePosition(); // przeliczenie pozycji na torze
TDynamicObject *Owner; // pojazd posiadający TDynamicObject *Owner; // pojazd posiadający
int iEventFlag; // McZapkie-020602: informacja o tym czy wyzwalac zdarzenie: 0,1,2,3 int iEventFlag; // McZapkie-020602: informacja o tym czy wyzwalac zdarzenie: 0,1,2,3

View File

@@ -35,7 +35,6 @@ http://mozilla.org/MPL/2.0/.
#define TEXTURE_FILTER_CONTROL_EXT 0x8500 #define TEXTURE_FILTER_CONTROL_EXT 0x8500
#define TEXTURE_LOD_BIAS_EXT 0x8501 #define TEXTURE_LOD_BIAS_EXT 0x8501
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#pragma package(smart_init)
typedef void(APIENTRY *FglutBitmapCharacter)(void *font, int character); // typ funkcji typedef void(APIENTRY *FglutBitmapCharacter)(void *font, int character); // typ funkcji
FglutBitmapCharacter glutBitmapCharacterDLL = NULL; // deklaracja zmiennej FglutBitmapCharacter glutBitmapCharacterDLL = NULL; // deklaracja zmiennej

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommand>T:\sources\Projects\maszyna\eu07++.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>..\..\Projects\maszyna</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommand>T:\sources\Projects\maszyna\eu07++.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>..\..\Projects\maszyna</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

View File

@@ -15,7 +15,7 @@ http://mozilla.org/MPL/2.0/.
#include "mtable.h" #include "mtable.h"
// using namespace Mtable; // 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*/ double CompareTime(double t1h, double t1m, double t2h, double t2m) /*roznica czasu w minutach*/
// zwraca różnicę czasu // zwraca różnicę czasu
@@ -529,19 +529,6 @@ void TMTableTime::UpdateMTableTime(double deltaT)
GameTime = GameTime + 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() bool TTrainParameters::DirectionChange()
// sprawdzenie, czy po zatrzymaniu wykonać kolejne komendy // sprawdzenie, czy po zatrzymaniu wykonać kolejne komendy
{ {

View File

@@ -86,20 +86,29 @@ class TMTableTime
{ {
public: public:
double GameTime; double GameTime = 0.0;
int dd; int dd = 0;
int hh; int hh = 0;
int mm; int mm = 0;
int srh; int srh = 0;
int srm; /*wschod slonca*/ int srm = 0; /*wschod slonca*/
int ssh; int ssh = 0;
int ssm; /*zachod slonca*/ int ssm = 0; /*zachod slonca*/
double mr; double mr = 0.0;
void UpdateMTableTime(double deltaT); 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) #if !defined(NO_IMPLICIT_NAMESPACE_USE)

Binary file not shown.

Binary file not shown.

View File

@@ -79,6 +79,10 @@ bool cParser::getTokens(int Count, bool ToLower, const char *Break)
for (i = 0; i < Count; ++i) for (i = 0; i < Count; ++i)
{ {
std::string string = readToken(ToLower, Break); std::string string = readToken(ToLower, Break);
if( true == string.empty() ) {
// no more tokens
break;
}
// collect parameters // collect parameters
if (i == 0) if (i == 0)
this->str(string); this->str(string);
@@ -191,7 +195,7 @@ bool cParser::trimComments(std::string &String)
return false; 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 { // pobieranie znaków aż do znalezienia znacznika końca
std::string token = ""; std::string token = "";
while (mStream->peek() != EOF) while (mStream->peek() != EOF)

View File

@@ -57,7 +57,7 @@ class cParser : public std::stringstream
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
readToken(); readToken();
}; };
inline bool expectToken(std::string value) inline bool expectToken(std::string const &value)
{ {
return readToken() == value; return readToken() == value;
}; };
@@ -77,7 +77,7 @@ class cParser : public std::stringstream
protected: protected:
// methods: // methods:
std::string readToken(bool ToLower = true, const char *Break = "\n\t ;"); 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; std::string trtest;
bool trimComments(std::string &String); bool trimComments(std::string &String);
// members: // members:

View File

@@ -10,6 +10,12 @@
#define _CRTDBG_MAP_ALLOC #define _CRTDBG_MAP_ALLOC
#include <stdlib.h> #include <stdlib.h>
#include <crtdbg.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 #endif
// operating system // operating system
#include "targetver.h" #include "targetver.h"
@@ -19,6 +25,7 @@
#undef NOMINMAX #undef NOMINMAX
// stl // stl
#include <cstdlib> #include <cstdlib>
#include <cassert>
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include <cmath> #include <cmath>
#include <cstdint> #include <cstdint>

View File

@@ -18,7 +18,6 @@ http://mozilla.org/MPL/2.0/.
#ifndef WAVE_READ_H #ifndef WAVE_READ_H
#define WAVE_READ_H #define WAVE_READ_H
#include <mmreg.h>
#include <mmsystem.h> #include <mmsystem.h>
HRESULT WaveOpenFile(CHAR *strFileName, HMMIO *phmmioIn, WAVEFORMATEX **ppwfxInfo, HRESULT WaveOpenFile(CHAR *strFileName, HMMIO *phmmioIn, WAVEFORMATEX **ppwfxInfo,