mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 12:49:18 +02:00
build 181128. coupler sounds enhancement, minor ai logic tweaks, minor bug fixes
This commit is contained in:
@@ -209,13 +209,20 @@ static int const s_CAtest = 128;
|
||||
/*dzwieki*/
|
||||
enum sound {
|
||||
none,
|
||||
loud = 0x1,
|
||||
couplerstretch = 0x2,
|
||||
bufferclash = 0x4,
|
||||
relay = 0x10,
|
||||
parallel = 0x20,
|
||||
shuntfield = 0x40,
|
||||
pneumatic = 0x80
|
||||
loud = 1 << 0,
|
||||
couplerstretch = 1 << 1,
|
||||
bufferclash = 1 << 2,
|
||||
relay = 1 << 3,
|
||||
parallel = 1 << 4,
|
||||
shuntfield = 1 << 5,
|
||||
pneumatic = 1 << 6,
|
||||
detachall = 1 << 7,
|
||||
attachcoupler = 1 << 8,
|
||||
attachbrakehose = 1 << 9,
|
||||
attachmainhose = 1 << 10,
|
||||
attachcontrol = 1 << 11,
|
||||
attachgangway = 1 << 12,
|
||||
attachheating = 1 << 13
|
||||
};
|
||||
|
||||
//szczególne typy pojazdów (inna obsługa) dla zmiennej TrainType
|
||||
@@ -1245,7 +1252,7 @@ public:
|
||||
double Distance(const TLocation &Loc1, const TLocation &Loc2, const TDimension &Dim1, const TDimension &Dim2);
|
||||
/* double Distance(const vector3 &Loc1, const vector3 &Loc2, const vector3 &Dim1, const vector3 &Dim2);
|
||||
*/ //bool AttachA(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, int CouplingType, bool Forced = false);
|
||||
bool Attach(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, int CouplingType, bool Forced = false);
|
||||
bool Attach(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, int CouplingType, bool Forced = false, bool Audible = true);
|
||||
int DettachStatus(int ConnectNo);
|
||||
bool Dettach(int ConnectNo);
|
||||
void SetCoupleDist();
|
||||
|
||||
@@ -406,7 +406,7 @@ double TMoverParameters::CouplerDist(int Coupler)
|
||||
return Couplers[ Coupler ].CoupleDist;
|
||||
};
|
||||
|
||||
bool TMoverParameters::Attach(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, int CouplingType, bool Forced)
|
||||
bool TMoverParameters::Attach(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, int CouplingType, bool Forced, bool Audible)
|
||||
{ //łączenie do swojego sprzęgu (ConnectNo) pojazdu (ConnectTo) stroną (ConnectToNr)
|
||||
// Ra: zwykle wykonywane dwukrotnie, dla każdego pojazdu oddzielnie
|
||||
// Ra: trzeba by odróżnić wymóg dociśnięcia od uszkodzenia sprzęgu przy podczepianiu AI do
|
||||
@@ -433,12 +433,32 @@ bool TMoverParameters::Attach(int ConnectNo, int ConnectToNr, TMoverParameters *
|
||||
coupler.Render = true; // tego rysować
|
||||
othercoupler.Render = false; // a tego nie
|
||||
};
|
||||
auto const couplingchange { CouplingType ^ coupler.CouplingFlag };
|
||||
coupler.CouplingFlag = CouplingType; // ustawienie typu sprzęgu
|
||||
// if (CouplingType!=ctrain_virtual) //Ra: wirtualnego nie łączymy zwrotnie!
|
||||
//{//jeśli łączenie sprzęgiem niewirtualnym, ustawiamy połączenie zwrotne
|
||||
othercoupler.CouplingFlag = CouplingType;
|
||||
othercoupler.Connected = this;
|
||||
othercoupler.CoupleDist = coupler.CoupleDist;
|
||||
|
||||
if( ( true == Audible ) && ( couplingchange != 0 ) ) {
|
||||
// set sound event flag
|
||||
int soundflag{ sound::none };
|
||||
std::vector<std::pair<coupling, sound>> const soundmappings = {
|
||||
{ coupling::coupler, sound::attachcoupler },
|
||||
{ coupling::brakehose, sound::attachbrakehose },
|
||||
{ coupling::mainhose, sound::attachmainhose },
|
||||
{ coupling::control, sound::attachcontrol},
|
||||
{ coupling::gangway, sound::attachgangway},
|
||||
{ coupling::heating, sound::attachheating} };
|
||||
for( auto const &soundmapping : soundmappings ) {
|
||||
if( ( couplingchange & soundmapping.first ) != 0 ) {
|
||||
soundflag |= soundmapping.second;
|
||||
}
|
||||
}
|
||||
SetFlag( coupler.sounds, soundflag );
|
||||
}
|
||||
|
||||
return true;
|
||||
//}
|
||||
// podłączenie nie udało się - jest wirtualne
|
||||
@@ -489,6 +509,10 @@ bool TMoverParameters::Dettach(int ConnectNo)
|
||||
Couplers[ConnectNo].Connected->Couplers[Couplers[ConnectNo].ConnectedNr].CouplingFlag =
|
||||
0; // pozostaje sprzęg wirtualny
|
||||
Couplers[ConnectNo].CouplingFlag = 0; // pozostaje sprzęg wirtualny
|
||||
|
||||
// set sound event flag
|
||||
SetFlag( Couplers[ ConnectNo ].sounds, sound::detachall );
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (i > 0)
|
||||
@@ -4395,7 +4419,8 @@ double TMoverParameters::CouplerForce(int CouplerN, double dt)
|
||||
// sprzeganie wagonow z samoczynnymi sprzegami}
|
||||
// CouplingFlag:=ctrain_coupler+ctrain_pneumatic+ctrain_controll+ctrain_passenger+ctrain_scndpneumatic;
|
||||
// EN57
|
||||
Couplers[ CouplerN ].CouplingFlag = coupling::coupler | coupling::brakehose | coupling::mainhose | coupling::control;
|
||||
Couplers[ CouplerN ].CouplingFlag = coupling::coupler /*| coupling::brakehose | coupling::mainhose | coupling::control*/;
|
||||
SetFlag( Couplers[ CouplerN ].sounds, sound::attachcoupler );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4847,9 +4872,13 @@ double TMoverParameters::TractionForce( double dt ) {
|
||||
|
||||
EnginePower = Voltage * Im / 1000.0;
|
||||
/*
|
||||
// NOTE: this part is experimentally disabled, as it generated early traction force drop for undetermined purpose
|
||||
if ((tmpV > 2) && (EnginePower < tmp))
|
||||
Ft = Ft * EnginePower / tmp;
|
||||
// power curve drop
|
||||
// NOTE: disabled for the time being due to side-effects
|
||||
if( ( tmpV > 1 ) && ( EnginePower < tmp ) ) {
|
||||
Ft = interpolate(
|
||||
Ft, EnginePower / tmp,
|
||||
clamp( tmpV - 1.0, 0.0, 1.0 ) );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user