mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 13:59:19 +02:00
2
.gitignore
vendored
2
.gitignore
vendored
@@ -74,4 +74,6 @@ builds/build_*
|
|||||||
builds/*.zip
|
builds/*.zip
|
||||||
builds/deps_*
|
builds/deps_*
|
||||||
|
|
||||||
|
doc/
|
||||||
|
|
||||||
CMakeLists.txt.user
|
CMakeLists.txt.user
|
||||||
|
|||||||
@@ -10,69 +10,77 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "AirCoupler.h"
|
#include "AirCoupler.h"
|
||||||
|
|
||||||
TAirCoupler::TAirCoupler()
|
AirCoupler::AirCoupler()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
TAirCoupler::~TAirCoupler()
|
AirCoupler::~AirCoupler()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int TAirCoupler::GetStatus()
|
/**
|
||||||
{ // zwraca 1, jeśli istnieje model prosty, 2 gdy skośny
|
* \return 1 when \(straight\) TModel3d \c ModelOn exists
|
||||||
int x = 0;
|
* \return 2 when \(slanted\) TModel3d \c ModelxOn exists
|
||||||
if (pModelOn)
|
* \return 0 when neither of them exist
|
||||||
x = 1;
|
*/
|
||||||
if (pModelxOn)
|
int AirCoupler::GetStatus()
|
||||||
x = 2;
|
{
|
||||||
return x;
|
if (ModelOn) return 1;
|
||||||
|
if (ModelxOn) return 2;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TAirCoupler::Clear()
|
/**
|
||||||
{ // zerowanie wskaźników
|
* Reset pointers and variables.
|
||||||
pModelOn = NULL;
|
*/
|
||||||
pModelOff = NULL;
|
void AirCoupler::Clear()
|
||||||
pModelxOn = NULL;
|
{
|
||||||
bOn = false;
|
ModelOn = NULL;
|
||||||
bxOn = false;
|
ModelOff = NULL;
|
||||||
|
ModelxOn = NULL;
|
||||||
|
On = false;
|
||||||
|
xOn = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TAirCoupler::Init(std::string const &asName, TModel3d *pModel)
|
/**
|
||||||
{ // wyszukanie submodeli
|
* Looks for submodels in the model and updates pointers.
|
||||||
if (!pModel)
|
*/
|
||||||
return; // nie ma w czym szukać
|
void AirCoupler::Init(std::string const &asName, TModel3d *Model)
|
||||||
pModelOn = pModel->GetFromName( asName + "_on" ); // połączony na wprost
|
{
|
||||||
pModelOff = pModel->GetFromName( asName + "_off" ); // odwieszony
|
if (!Model)
|
||||||
pModelxOn = pModel->GetFromName( asName + "_xon" ); // połączony na skos
|
return;
|
||||||
|
ModelOn = Model->GetFromName(asName + "_on"); // Straight connect.
|
||||||
|
ModelOff = Model->GetFromName(asName + "_off"); // Not connected. Hung up.
|
||||||
|
ModelxOn = Model->GetFromName(asName + "_xon"); // Slanted connect.
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
void TAirCoupler::Load(cParser *Parser, TModel3d *pModel)
|
* Gets name of submodel \(from cParser \b *Parser\),
|
||||||
|
* looks for it in the TModel3d \b *Model and update pointers.
|
||||||
|
* If submodel is not found, reset pointers.
|
||||||
|
*/
|
||||||
|
void AirCoupler::Load(cParser *Parser, TModel3d *Model)
|
||||||
{
|
{
|
||||||
std::string name = Parser->getToken<std::string>();
|
std::string name = Parser->getToken<std::string>();
|
||||||
if( pModel ) {
|
if(Model)
|
||||||
|
{
|
||||||
Init( name, pModel );
|
Init(name, Model);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pModelOn = NULL;
|
ModelOn = NULL;
|
||||||
pModelxOn = NULL;
|
ModelxOn = NULL;
|
||||||
pModelOff = NULL;
|
ModelOff = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TAirCoupler::Update()
|
// Update submodels visibility.
|
||||||
|
void AirCoupler::Update()
|
||||||
{
|
{
|
||||||
// if ((pModelOn!=NULL) && (pModelOn!=NULL))
|
if (ModelOn)
|
||||||
{
|
ModelOn->iVisible = On;
|
||||||
if (pModelOn)
|
if (ModelOff)
|
||||||
pModelOn->iVisible = bOn;
|
ModelOff->iVisible = !(On || xOn);
|
||||||
if (pModelOff)
|
if (ModelxOn)
|
||||||
pModelOff->iVisible = !(bOn || bxOn);
|
ModelxOn->iVisible = xOn;
|
||||||
if (pModelxOn)
|
|
||||||
pModelxOn->iVisible = bxOn;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|||||||
64
AirCoupler.h
64
AirCoupler.h
@@ -12,42 +12,40 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "Model3d.h"
|
#include "Model3d.h"
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
|
||||||
class TAirCoupler
|
class AirCoupler
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// TButtonType eType;
|
TSubModel *ModelOn, *ModelOff, *ModelxOn;
|
||||||
TSubModel *pModelOn, *pModelOff, *pModelxOn;
|
bool On;
|
||||||
bool bOn;
|
bool xOn;
|
||||||
bool bxOn;
|
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TAirCoupler();
|
AirCoupler();
|
||||||
~TAirCoupler();
|
~AirCoupler();
|
||||||
|
///Reset members.
|
||||||
void Clear();
|
void Clear();
|
||||||
inline void TurnOn()
|
///Looks for submodels.
|
||||||
{
|
void Init(std::string const &asName, TModel3d *Model);
|
||||||
bOn = true;
|
///Loads info about coupler.
|
||||||
bxOn = false;
|
void Load(cParser *Parser, TModel3d *Model);
|
||||||
Update();
|
|
||||||
};
|
|
||||||
inline void TurnOff()
|
|
||||||
{
|
|
||||||
bOn = false;
|
|
||||||
bxOn = false;
|
|
||||||
Update();
|
|
||||||
};
|
|
||||||
inline void TurnxOn()
|
|
||||||
{
|
|
||||||
bOn = false;
|
|
||||||
bxOn = true;
|
|
||||||
Update();
|
|
||||||
};
|
|
||||||
// inline bool Active() { if ((pModelOn)||(pModelOff)) return true; return false;};
|
|
||||||
int GetStatus();
|
int GetStatus();
|
||||||
void Init(std::string const &asName, TModel3d *pModel);
|
inline void TurnOn() ///Turns on straight coupler.
|
||||||
void Load(cParser *Parser, TModel3d *pModel);
|
{
|
||||||
// bool Render();
|
On = true;
|
||||||
|
xOn = false;
|
||||||
|
Update();
|
||||||
|
};
|
||||||
|
inline void TurnOff() ///Turns on disconnected coupler.
|
||||||
|
{
|
||||||
|
On = false;
|
||||||
|
xOn = false;
|
||||||
|
Update();
|
||||||
|
};
|
||||||
|
inline void TurnxOn() ///Turns on slanted coupler.
|
||||||
|
{
|
||||||
|
On = false;
|
||||||
|
xOn = true;
|
||||||
|
Update();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|||||||
16
DynObj.h
16
DynObj.h
@@ -266,15 +266,15 @@ public: // modele składowe pojazdu
|
|||||||
|
|
||||||
TButton btCoupler1; // sprzegi
|
TButton btCoupler1; // sprzegi
|
||||||
TButton btCoupler2;
|
TButton btCoupler2;
|
||||||
TAirCoupler
|
AirCoupler
|
||||||
btCPneumatic1; // sprzegi powietrzne //yB - zmienione z Button na AirCoupler - krzyzyki
|
btCPneumatic1; // sprzegi powietrzne //yB - zmienione z Button na AirCoupler - krzyzyki
|
||||||
TAirCoupler btCPneumatic2;
|
AirCoupler btCPneumatic2;
|
||||||
TAirCoupler btCPneumatic1r; // ABu: to zeby nie bylo problemow przy laczeniu wagonow,
|
AirCoupler btCPneumatic1r; // ABu: to zeby nie bylo problemow przy laczeniu wagonow,
|
||||||
TAirCoupler btCPneumatic2r; // jesli beda polaczone sprzegami 1<->1 lub 0<->0
|
AirCoupler btCPneumatic2r; // jesli beda polaczone sprzegami 1<->1 lub 0<->0
|
||||||
TAirCoupler btPneumatic1; // ABu: sprzegi powietrzne zolte
|
AirCoupler btPneumatic1; // ABu: sprzegi powietrzne zolte
|
||||||
TAirCoupler btPneumatic2;
|
AirCoupler btPneumatic2;
|
||||||
TAirCoupler btPneumatic1r; // ABu: analogicznie jak 4 linijki wyzej
|
AirCoupler btPneumatic1r; // ABu: analogicznie jak 4 linijki wyzej
|
||||||
TAirCoupler btPneumatic2r;
|
AirCoupler btPneumatic2r;
|
||||||
|
|
||||||
TButton btCCtrl1; // sprzegi sterowania
|
TButton btCCtrl1; // sprzegi sterowania
|
||||||
TButton btCCtrl2;
|
TButton btCCtrl2;
|
||||||
|
|||||||
Reference in New Issue
Block a user