mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-19 03:09:18 +02:00
AirCoupler - comments update.
This commit is contained in:
@@ -19,10 +19,10 @@ AirCoupler::~AirCoupler()
|
||||
{
|
||||
}
|
||||
|
||||
// zwraca 1, jeśli istnieje model prosty, 2 gdy skośny
|
||||
/**
|
||||
* Returns 0 when straight model exists,
|
||||
* 2 when oblique model exists, and 0 when neither of them exist.
|
||||
* \return 1 when \(straight\) TModel3d \c ModelOn exists
|
||||
* \return 2 when \(slanted\) TModel3d \c ModelxOn exists
|
||||
* \return 0 when neither of them exist
|
||||
*/
|
||||
int AirCoupler::GetStatus()
|
||||
{
|
||||
@@ -31,9 +31,8 @@ int AirCoupler::GetStatus()
|
||||
return 0;
|
||||
}
|
||||
|
||||
// zerowanie wskaźników
|
||||
/**
|
||||
* Reset pointers.
|
||||
* Reset pointers and variables.
|
||||
*/
|
||||
void AirCoupler::Clear()
|
||||
{
|
||||
@@ -43,25 +42,23 @@ void AirCoupler::Clear()
|
||||
On = false;
|
||||
xOn = false;
|
||||
}
|
||||
// wyszukanie submodeli
|
||||
|
||||
/**
|
||||
* Looks for submodels.
|
||||
* Looks for submodels in the model and updates pointers.
|
||||
*/
|
||||
void AirCoupler::Init(std::string const &asName, TModel3d *Model)
|
||||
{
|
||||
if (!Model)
|
||||
return; // nie ma w czym szukać
|
||||
// polaczony na wprost
|
||||
/** Straight connect. */
|
||||
ModelOn = Model->GetFromName(asName + "_on");
|
||||
// odwieszony
|
||||
/** Not connected. Hung up. */
|
||||
ModelOff = Model->GetFromName(asName + "_off");
|
||||
// polaczony na skos
|
||||
/** Oblique connect. */
|
||||
ModelxOn = Model->GetFromName(asName + "_xon");
|
||||
return;
|
||||
ModelOn = Model->GetFromName(asName + "_on"); // Straight connect.
|
||||
ModelOff = Model->GetFromName(asName + "_off"); // Not connected. Hung up.
|
||||
ModelxOn = Model->GetFromName(asName + "_xon"); // Slanted connect.
|
||||
}
|
||||
|
||||
/**
|
||||
* 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>();
|
||||
@@ -77,6 +74,7 @@ void AirCoupler::Load(cParser *Parser, TModel3d *Model)
|
||||
}
|
||||
}
|
||||
|
||||
// Update submodels visibility.
|
||||
void AirCoupler::Update()
|
||||
{
|
||||
if (ModelOn)
|
||||
|
||||
11
AirCoupler.h
11
AirCoupler.h
@@ -15,7 +15,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
class AirCoupler
|
||||
{
|
||||
private:
|
||||
// TButtonType eType;
|
||||
TSubModel *ModelOn, *ModelOff, *ModelxOn;
|
||||
bool On;
|
||||
bool xOn;
|
||||
@@ -24,24 +23,26 @@ private:
|
||||
public:
|
||||
AirCoupler();
|
||||
~AirCoupler();
|
||||
|
||||
///Reset members.
|
||||
void Clear();
|
||||
///Looks for submodels.
|
||||
void Init(std::string const &asName, TModel3d *Model);
|
||||
///Loads info about coupler.
|
||||
void Load(cParser *Parser, TModel3d *Model);
|
||||
int GetStatus();
|
||||
inline void TurnOn()
|
||||
inline void TurnOn() ///Turns on straight coupler.
|
||||
{
|
||||
On = true;
|
||||
xOn = false;
|
||||
Update();
|
||||
};
|
||||
inline void TurnOff()
|
||||
inline void TurnOff() ///Turns on disconnected coupler.
|
||||
{
|
||||
On = false;
|
||||
xOn = false;
|
||||
Update();
|
||||
};
|
||||
inline void TurnxOn()
|
||||
inline void TurnxOn() ///Turns on slanted coupler.
|
||||
{
|
||||
On = false;
|
||||
xOn = true;
|
||||
|
||||
Reference in New Issue
Block a user