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

reformat: remove redundant 'else' keyword

This commit is contained in:
jerrrrycho
2026-07-04 05:50:57 +02:00
parent 31f9ca0afc
commit b4b6686320
14 changed files with 482 additions and 331 deletions

View File

@@ -1133,6 +1133,7 @@ double TMoverParameters::PipeRatio(void)
double pr;
if (DeltaPipePress > 0)
{
if (false) // SPKS!! no to jak nie wchodzimy to po co branch?
{
if (3.0 * PipePress > HighPipePress + LowPipePress + LowPipePress)
@@ -1145,8 +1146,8 @@ double TMoverParameters::PipeRatio(void)
// if (Compressor > 0.5)
// then pr : = pr * 1.333; // dziwny rapid wywalamy
}
else
pr = (HighPipePress - std::max(LowPipePress, std::min(HighPipePress, PipePress))) / DeltaPipePress;
}
else
pr = 0;
return pr;
@@ -9830,7 +9831,9 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
continue;
}
else if (issection("BuffCoupl1.", inputline))
else
{
if (issection("BuffCoupl1.", inputline))
{
startBPT = false;
@@ -9838,8 +9841,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
LoadFIZ_BuffCoupl(inputline, 1);
continue;
}
else if (issection("BuffCoupl2.", inputline))
if (issection("BuffCoupl2.", inputline))
{
startBPT = false;
@@ -9847,6 +9849,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
LoadFIZ_BuffCoupl(inputline, 2);
continue;
}
}
if (issection("TurboPos:", inputline))
{

View File

@@ -394,11 +394,13 @@ double TNESt3::CVs(double const BP) // napelniacz sterujacego
// przeplyw ZS <-> PG
if (MPP < CVP - 0.17)
return 0.0;
else if (MPP > CVP - 0.08)
return Nozzles[dSd];
else
{
if (MPP > CVP - 0.08)
return Nozzles[dSd];
return Nozzles[dSm];
}
}
double TNESt3::BVs(double const BCP) // napelniacz pomocniczego
{
@@ -408,15 +410,18 @@ double TNESt3::BVs(double const BCP) // napelniacz pomocniczego
// przeplyw ZP <-> rozdzielacz
if (MPP < CVP - 0.3)
return Nozzles[dP];
else if( BCP < 0.5 ) {
else
{
if (BCP < 0.5)
{
if (true == Zamykajacy)
return Nozzles[dPm]; // 1.25
else
return Nozzles[dPd];
}
else
return 0.0;
}
}
void TNESt3::PLC(double const mass)
{

View File

@@ -63,11 +63,13 @@ double PF_old(double P1, double P2, double S)
const double PL = P1 + P2 - PH + 2;
if (PH - PL < 0.0001)
return 0;
else if (PH - PL < 0.05)
return 20 * (PH - PL) * (PH + 1) * 222 * S * (P2 - P1) / (1.13 * PH - PL);
else
{
if (PH - PL < 0.05)
return 20 * (PH - PL) * (PH + 1) * 222 * S * (P2 - P1) / (1.13 * PH - PL);
return (PH + 1) * 222 * S * (P2 - P1) / (1.13 * PH - PL);
}
}
/// <summary>
/// Pneumatic flow rate from one pressure to another through an orifice of area S.
@@ -86,11 +88,12 @@ double PF(double const P1, double const P2, double const S, double const DP)
double const sg = PL / PH; // bezwymiarowy stosunek cisnien
double const FM = PH * 197.0 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
if (sg > 0.5) // jesli ponizej stosunku krytycznego
{
if (PH - PL < DP) // niewielka roznica cisnien
return (1.0 - sg) / DPL * FM * 2.0 * std::sqrt(DP * (PH - DP));
// return 1/DPL*(PH-PL)*fm*2*SQRT((sg)*(1-sg));
else
return FM * 2.0 * std::sqrt(sg * (1.0 - sg));
}
else // powyzej stosunku krytycznego
return FM;
}
@@ -112,10 +115,11 @@ double PF1(double const P1, double const P2, double const S)
double const sg = PL / PH; // bezwymiarowy stosunek cisnien
double const FM = PH * 197.0 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
if (sg > 0.5) // jesli ponizej stosunku krytycznego
{
if (sg < DPS) // niewielka roznica cisnien
return (1.0 - sg) / DPS * FM * 2.0 * std::sqrt(DPS * (1.0 - DPS));
else
return FM * 2.0 * std::sqrt(sg * (1.0 - sg));
}
else // powyzej stosunku krytycznego
return FM;
}
@@ -144,10 +148,12 @@ double PFVa(double PH, double PL, double const S, double LIM, double const DP)
if (LIM - PL < DP)
FM = FM * (LIM - PL) / DP; // jesli jestesmy przy nastawieniu, to zawor sie przymyka
if (sg > 0.5) // jesli ponizej stosunku krytycznego
{
if (PH - PL < DPL) // niewielka roznica cisnien
return (PH - PL) / DPL * FM * 2 * std::sqrt(sg * (1 - sg)); // BUG: (1-sg) can be < 0, leading to sqrt(-x)
else
return FM * 2 * std::sqrt(sg * (1 - sg)); // BUG: (1-sg) can be < 0, leading to sqrt(-x)
return FM * 2 * std::sqrt(sg * (1 - sg));
}
// BUG: (1-sg) can be < 0, leading to sqrt(-x)
else // powyzej stosunku krytycznego
return FM;
}
@@ -178,10 +184,11 @@ double PFVd(double PH, double PL, double const S, double LIM, double const DP)
if (PH - LIM < 0.1)
FM = FM * (PH - LIM) / DP; // jesli jestesmy przy nastawieniu, to zawor sie przymyka
if (sg > 0.5) // jesli ponizej stosunku krytycznego
{
if (PH - PL < DPL) // niewielka roznica cisnien
return (PH - PL) / DPL * FM * 2.0 * std::sqrt(sg * (1.0 - sg));
else
return FM * 2.0 * std::sqrt(sg * (1.0 - sg));
}
else // powyzej stosunku krytycznego
return FM;
}
@@ -307,10 +314,13 @@ double TBrakeCyl::P()
// P:=VtoC;
if (VtoC < VS)
return VtoC * pS / VS; // objetosc szkodliwa
else if (VtoC > VD)
return VtoC - cD; // caly silownik;
else
return pS + (VtoC - VS) / (VD - VS) * (pD - pS); // wysuwanie tloka
{
if (VtoC > VD)
return VtoC - cD; // caly silownik;
return pS + (VtoC - VS) / (VD - VS) * (pD - pS);
}
// wysuwanie tloka
} //*)
//---HAMULEC---
@@ -940,16 +950,20 @@ double TESt::CVs(double const BP)
// przeplyw ZS <-> PG
if (VVP < CVP - 0.12 || BVP < CVP - 0.3 || BP > 0.4)
return 0;
else if (VVP > CVP + 0.4)
else
{
if (VVP > CVP + 0.4)
{
if (BVP > CVP + 0.2)
return 0.23;
else
return 0.05;
else if (BVP > CVP - 0.1)
}
if (BVP > CVP - 0.1)
return 1;
else
return 0.3;
}
}
/// <summary>
/// Returns the dimensionless opening factor of the ZP-filling slide valve
@@ -971,14 +985,17 @@ double TESt::BVs(double const BCP)
// przeplyw ZP <-> rozdzielacz
if (BVP < CVP - 0.3)
return 0.6;
else if (BCP < 0.5)
else
{
if (BCP < 0.5)
{
if (VVP > CVP + 0.4)
return 0.1;
else
return 0.3;
else
}
return 0;
}
}
/// <summary>
/// One-step Oerlikon ESt distributor advance: runs CheckState/CheckReleaser,
@@ -2217,11 +2234,13 @@ double TCV1::BVs(double const BCP)
// przeplyw ZP <-> rozdzielacz
if (BVP < CVP - 0.1)
return 1;
else if (BCP > 0.05)
return 0;
else
{
if (BCP > 0.05)
return 0;
return 0.2 * (1.5 - int(BVP > VVP));
}
}
/// <summary>
/// One-step distributor advance for the DAKO CV1: runs CheckState, integrates
@@ -2591,11 +2610,13 @@ double TKE::CVs(double const BP)
// przeplyw ZS <-> PG
if (BP > 0.2)
return 0;
else if (VVP > CVP + 0.4)
return 0.05;
else
{
if (VVP > CVP + 0.4)
return 0.05;
return 0.23;
}
}
/// <summary>
/// Returns the KE ZP-filling slide valve opening factor: closed when ZP
@@ -2617,11 +2638,13 @@ double TKE::BVs(double const BCP)
// przeplyw ZP <-> rozdzielacz
if (BVP > VVP)
return 0;
else if (BVP < CVP - 0.3)
return 0.6;
else
{
if (BVP < CVP - 0.3)
return 0.6;
return 0.13;
}
}
/// <summary>
/// One-step distributor advance for the Knorr KE. Drives CheckState/CheckReleaser,
@@ -3429,11 +3452,13 @@ double TMHZ_EN57::LPP_RP(double pos) // cisnienie z zaokraglonej pozycji;
{
if (pos > 8.5)
return 5.0 - 0.15 * pos - 0.35;
else if (pos > 0.5)
return 5.0 - 0.15 * pos - 0.1;
else
{
if (pos > 0.5)
return 5.0 - 0.15 * pos - 0.1;
return 5.0;
}
}
/// <summary>
/// Configures handle parameters: auto / manual overcharge support, the

View File

@@ -9819,13 +9819,40 @@ void ImGui::ShowMetricsWindow(bool* p_open)
static ImRect GetWindowRect(ImGuiWindow* window, int rect_type)
{
if (rect_type == WRT_OuterRect) { return window->Rect(); }
else if (rect_type == WRT_OuterRectClipped) { return window->OuterRectClipped; }
else if (rect_type == WRT_InnerRect) { return window->InnerRect; }
else if (rect_type == WRT_InnerClipRect) { return window->InnerClipRect; }
else if (rect_type == WRT_WorkRect) { return window->WorkRect; }
else if (rect_type == WRT_Contents) {
const ImVec2 min = window->InnerRect.Min - window->Scroll + window->WindowPadding; return ImRect(min, min + window->ContentSize); }
else if (rect_type == WRT_ContentsRegionRect) { return window->ContentsRegionRect; }
else
{
if (rect_type == WRT_OuterRectClipped)
{
return window->OuterRectClipped;
}
if (rect_type == WRT_InnerRect)
{
return window->InnerRect;
}
else
{
if (rect_type == WRT_InnerClipRect)
{
return window->InnerClipRect;
}
if (rect_type == WRT_WorkRect)
{
return window->WorkRect;
}
else
{
if (rect_type == WRT_Contents)
{
const ImVec2 min = window->InnerRect.Min - window->Scroll + window->WindowPadding;
return ImRect(min, min + window->ContentSize);
}
if (rect_type == WRT_ContentsRegionRect)
{
return window->ContentsRegionRect;
}
}
}
}
IM_ASSERT(0);
return ImRect();
}

View File

@@ -1280,8 +1280,20 @@ struct ImVector
inline T* erase_unsorted(const T* it) { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; if (it < Data+Size-1) memcpy(Data + off, Data + Size - 1, sizeof(T)); Size--; return Data + off; }
inline T* insert(const T* it, const T& v) { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(T)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; }
inline bool contains(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; }
inline T* find(const T& v) { T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data == v) break; else ++data; return data; }
inline const T* find(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data == v) break; else ++data; return data; }
inline T* find(const T& v) { T* data = Data; const T* data_end = Data + Size; while (data < data_end)
{
if (*data == v)
break;
++data;
}
return data; }
inline const T* find(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end)
{
if (*data == v)
break;
++data;
}
return data; }
inline bool find_erase(const T& v) { const T* it = find(v); if (it < Data + Size) { erase(it); return true; } return false; }
inline bool find_erase_unsorted(const T& v) { const T* it = find(v); if (it < Data + Size) { erase_unsorted(it); return true; } return false; }
inline int index_from_ptr(const T* it) const { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; return (int)off; }

View File

@@ -1188,10 +1188,20 @@ static stbtt_uint32 stbtt__cff_int(stbtt__buf *b)
{
const int b0 = stbtt__buf_get8(b);
if (b0 >= 32 && b0 <= 246) return b0 - 139;
else if (b0 >= 247 && b0 <= 250) return (b0 - 247)*256 + stbtt__buf_get8(b) + 108;
else if (b0 >= 251 && b0 <= 254) return -(b0 - 251)*256 - stbtt__buf_get8(b) - 108;
else if (b0 == 28) return stbtt__buf_get16(b);
else if (b0 == 29) return stbtt__buf_get32(b);
else
{
if (b0 >= 247 && b0 <= 250)
return (b0 - 247) * 256 + stbtt__buf_get8(b) + 108;
if (b0 >= 251 && b0 <= 254)
return -(b0 - 251) * 256 - stbtt__buf_get8(b) - 108;
else
{
if (b0 == 28)
return stbtt__buf_get16(b);
if (b0 == 29)
return stbtt__buf_get32(b);
}
}
STBTT_assert(0);
return 0;
}
@@ -1469,16 +1479,25 @@ STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codep
if (unicode_codepoint < bytes-6)
return ttBYTE(data + index_map + 6 + unicode_codepoint);
return 0;
} else if (format == 6) {
} else
{
if (format == 6)
{
const stbtt_uint32 first = ttUSHORT(data + index_map + 6);
const stbtt_uint32 count = ttUSHORT(data + index_map + 8);
if ((stbtt_uint32)unicode_codepoint >= first && (stbtt_uint32)unicode_codepoint < first + count)
return ttUSHORT(data + index_map + 10 + (unicode_codepoint - first) * 2);
return 0;
} else if (format == 2) {
}
if (format == 2)
{
STBTT_assert(0); // @TODO: high-byte mapping for japanese/chinese/korean
return 0;
} else if (format == 4) { // standard mapping for windows fonts: binary search collection of ranges
}
else
{
if (format == 4)
{ // standard mapping for windows fonts: binary search collection of ranges
const stbtt_uint16 segcount = ttUSHORT(data + index_map + 6) >> 1;
stbtt_uint16 searchRange = ttUSHORT(data + index_map + 8) >> 1;
stbtt_uint16 entrySelector = ttUSHORT(data + index_map + 10);
@@ -1498,7 +1517,8 @@ STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codep
// now decrement to bias correctly to find smallest
search -= 2;
while (entrySelector) {
while (entrySelector)
{
stbtt_uint16 end;
searchRange >>= 1;
end = ttUSHORT(data + search + searchRange * 2);
@@ -1523,12 +1543,16 @@ STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codep
return ttUSHORT(data + offset + (unicode_codepoint - start) * 2 + index_map + 14 + segcount * 6 + 2 + 2 * item);
}
} else if (format == 12 || format == 13) {
}
if (format == 12 || format == 13)
{
const stbtt_uint32 ngroups = ttULONG(data + index_map + 12);
stbtt_int32 low, high;
low = 0; high = (stbtt_int32)ngroups;
low = 0;
high = (stbtt_int32)ngroups;
// Binary search the right group.
while (low < high) {
while (low < high)
{
const stbtt_int32 mid = low + ((high - low) >> 1); // rounds down, so low <= mid < high
const stbtt_uint32 start_char = ttULONG(data + index_map + 16 + mid * 12);
const stbtt_uint32 end_char = ttULONG(data + index_map + 16 + mid * 12 + 4);
@@ -1536,7 +1560,8 @@ STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codep
high = mid;
else if ((stbtt_uint32)unicode_codepoint > end_char)
low = mid + 1;
else {
else
{
const stbtt_uint32 start_glyph = ttULONG(data + index_map + 16 + mid * 12 + 8);
if (format == 12)
return start_glyph + unicode_codepoint - start_char;
@@ -1546,6 +1571,8 @@ STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codep
}
return 0; // not found
}
}
}
// @TODO
STBTT_assert(0);
return 0;

View File

@@ -7612,11 +7612,13 @@ static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp)
maxv = stbi__pnm_getinteger(s, &c); // read max value
if (maxv > 65535)
return stbi__err("max value > 65535", "PPM image supports only 8-bit and 16-bit images");
else if (maxv > 255)
return 16;
else
{
if (maxv > 255)
return 16;
return 8;
}
}
static int stbi__pnm_is16(stbi__context *s)
{

View File

@@ -55,8 +55,17 @@ inline
comparison_pass
comparison_pass_from_string( std::string const Input ) {
if( Input == "all" ) { return comparison_pass::all; }
else if( Input == "any" ) { return comparison_pass::any; }
else if( Input == "none" ) { return comparison_pass::none; }
else
{
if (Input == "any")
{
return comparison_pass::any;
}
if (Input == "none")
{
return comparison_pass::none;
}
}
return comparison_pass::all; // legacy default
}
@@ -65,11 +74,32 @@ inline
comparison_operator
comparison_operator_from_string( std::string const Input ) {
if( Input == "==" ) { return comparison_operator::equal; }
else if( Input == "!=" ) { return comparison_operator::not_equal; }
else if( Input == "<" ) { return comparison_operator::lt; }
else if( Input == ">" ) { return comparison_operator::gt; }
else if( Input == "<=" ) { return comparison_operator::lt_eq; }
else if( Input == ">=" ) { return comparison_operator::gt_eq; }
else
{
if (Input == "!=")
{
return comparison_operator::not_equal;
}
if (Input == "<")
{
return comparison_operator::lt;
}
else
{
if (Input == ">")
{
return comparison_operator::gt;
}
if (Input == "<=")
{
return comparison_operator::lt_eq;
}
else if (Input == ">=")
{
return comparison_operator::gt_eq;
}
}
}
return comparison_operator::equal; // legacy default
}

View File

@@ -348,15 +348,13 @@ std::string TSpeedPos::GetName() const
{
if( iFlags & spTrack ) // jeśli tor
return trTrack->name();
else if( iFlags & spEvent ) // jeśli event
return
evEvent->m_name
+ " [" + std::to_string( static_cast<int>( evEvent->input_value( 1 ) ) )
+ ", " + std::to_string( static_cast<int>( evEvent->input_value( 2 ) ) )
+ "]";
else
{
if (iFlags & spEvent) // jeśli event
return evEvent->m_name + " [" + std::to_string(static_cast<int>(evEvent->input_value(1))) + ", " + std::to_string(static_cast<int>(evEvent->input_value(2))) + "]";
return "";
}
}
std::string TSpeedPos::TableText() const
{ // pozycja tabelki pr?dko?ci

View File

@@ -2302,19 +2302,25 @@ event_manager::insert( basic_event *Event ) {
return false;
}
// tymczasowo wyjątki:
else if( Event->m_name.ends_with("lineinfo:") ) {
else
{
if (Event->m_name.ends_with("lineinfo:"))
{
// tymczasowa utylizacja duplikatów W5
return false;
}
else if( Event->m_name.ends_with("_warning") ) {
if (Event->m_name.ends_with("_warning"))
{
// tymczasowa utylizacja duplikatu z trąbieniem
return false;
}
else if( Event->m_name.ends_with("_shp") ) {
else if (Event->m_name.ends_with("_shp"))
{
// nie podlegają logowaniu
// tymczasowa utylizacja duplikatu SHP
return false;
}
}
auto *duplicate = m_events[ lookup->second ];
if( Global.bJoinEvents ) {

View File

@@ -1787,6 +1787,7 @@ bool TTrack::SetConnections(int i)
bool TTrack::Switch(int i, float const t, float const d)
{ // przełączenie torów z uruchomieniem animacji
if (SwitchExtension) // tory przełączalne mają doklejkę
{
if (eType == tt_Switch)
{ // przekładanie zwrotnicy jak zwykle
if (t > 0.f) // prędkość liniowa ruchu iglic
@@ -1794,8 +1795,7 @@ bool TTrack::Switch(int i, float const t, float const d)
if (d >= 0.f) // dodatkowy ruch drugiej iglicy (zamknięcie nastawnicze)
SwitchExtension->fOffsetDelay = d;
i &= 1; // ograniczenie błędów !!!!
SwitchExtension->fDesiredOffset =
i ? fMaxOffset + SwitchExtension->fOffsetDelay : -SwitchExtension->fOffsetDelay;
SwitchExtension->fDesiredOffset = i ? fMaxOffset + SwitchExtension->fOffsetDelay : -SwitchExtension->fOffsetDelay;
SwitchExtension->CurrentIndex = i;
Segment = SwitchExtension->Segments[i]; // wybranie aktywnej drogi - potrzebne to?
trNext = SwitchExtension->pNexts[i]; // przełączenie końców
@@ -1803,15 +1803,16 @@ bool TTrack::Switch(int i, float const t, float const d)
iNextDirection = SwitchExtension->iNextDirection[i];
iPrevDirection = SwitchExtension->iPrevDirection[i];
fRadius = fRadiusTable[i]; // McZapkie: wybor promienia toru
if( SwitchExtension->fVelocity <= -2 ) {
if (SwitchExtension->fVelocity <= -2)
{
//-1 oznacza maksymalną prędkość, a dalsze ujemne to ograniczenie na bok
fVelocity = i ? -SwitchExtension->fVelocity : -1;
}
else {
else
{
fVelocity = SwitchExtension->fVelocity;
}
if (SwitchExtension->pOwner ? SwitchExtension->pOwner->RaTrackAnimAdd(this) :
true) // jeśli nie dodane do animacji
if (SwitchExtension->pOwner ? SwitchExtension->pOwner->RaTrackAnimAdd(this) : true) // jeśli nie dodane do animacji
{ // nie ma się co bawić
SwitchExtension->fOffset = SwitchExtension->fDesiredOffset;
// przeliczenie położenia iglic; czy zadziała na niewyświetlanym sektorze w VBO?
@@ -1819,7 +1820,7 @@ bool TTrack::Switch(int i, float const t, float const d)
}
return true;
}
else if (eType == tt_Table)
if (eType == tt_Table)
{ // blokowanie (0, szukanie torów) lub odblokowanie (1, rozłączenie) obrotnicy
if (i) // NOTE: this condition seems opposite to intention/comment? TODO: investigate this
{ // 0: rozłączenie sąsiednich torów od obrotnicy
@@ -1848,16 +1849,17 @@ bool TTrack::Switch(int i, float const t, float const d)
if (trNext || trPrev)
{
fVelocity = 6.0; // jazda dozwolona
if( trPrev
&& trPrev->fVelocity == 0.0 ) {
if (trPrev && trPrev->fVelocity == 0.0)
{
// ustawienie 0 da możliwość zatrzymania AI na obrotnicy
trPrev->VelocitySet(6.0); // odblokowanie dołączonego toru do jazdy
}
if( trNext
&& trNext->fVelocity == 0.0 ) {
if (trNext && trNext->fVelocity == 0.0)
{
trNext->VelocitySet(6.0);
}
if( SwitchExtension->evPlus ) { // w starych sceneriach może nie być
if (SwitchExtension->evPlus)
{ // w starych sceneriach może nie być
// potwierdzenie wykonania (np. odpala WZ)
simulation::Events.AddToQuery(SwitchExtension->evPlus, nullptr);
}
@@ -1877,6 +1879,7 @@ bool TTrack::Switch(int i, float const t, float const d)
iPrevDirection = SwitchExtension->iPrevDirection[i];
return true;
}
}
if (iCategoryFlag == 1)
iDamageFlag = (iDamageFlag & 127) + 128 * (i & 1); // przełączanie wykolejenia
else

View File

@@ -504,19 +504,26 @@ double TTraction::VoltageGet(double u, double i)
i1 = psPower[1]->CurrentGet(r1g);
return (i0 + i1) * res;
}
else if (r0t >= 0.0)
else
{
if (r0t >= 0.0)
return psPower[0]->CurrentGet(res + r0t) * res;
else if (r1t >= 0.0)
if (r1t >= 0.0)
return psPower[1]->CurrentGet(res + r1t) * res;
else
return 0.0; // co z tym zrobić?
return 0.0;
}
else if (psPower[0] && r0t >= 0.0)
// co z tym zrobić?
}
else
{
if (psPower[0] && r0t >= 0.0)
{ // jeśli odcinek podłączony jest tylko z jednej strony
return psPower[0]->CurrentGet(res + r0t) * res;
}
else if (psPower[1] && r1t >= 0.0)
if (psPower[1] && r1t >= 0.0)
return psPower[1]->CurrentGet(res + r1t) * res;
}
return 0.0; // gdy nie podłączony wcale?
};

View File

@@ -215,7 +215,9 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
}
continue;
}
else if (s > pCurrentSegment->GetLength())
else
{
if (s > pCurrentSegment->GetLength())
{ // jeśli przekroczenie toru od strony Point2
bCanSkip = bPrimary && pCurrentTrack->CheckDynamicObject(Owner);
if (bCanSkip) // tylko główna oś przenosi pojazd do innego toru
@@ -246,11 +248,11 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
}
continue;
}
else
{ // gdy zostaje na tym samym torze (przesuwanie już nie zmienia toru)
// gdy zostaje na tym samym torze (przesuwanie już nie zmienia toru)
if (bPrimary)
{ // tylko gdy początkowe ustawienie, dodajemy eventy stania do kolejki
if (Owner->MoverParameters->CabOccupied != 0) {
if (Owner->MoverParameters->CabOccupied != 0)
{
pCurrentTrack->QueueEvents(pCurrentTrack->m_events1, Owner, -1.0);
pCurrentTrack->QueueEvents(pCurrentTrack->m_events2, Owner, -1.0);

View File

@@ -169,15 +169,19 @@ bool TTrainParameters::IsTimeToGo(double hh, double mm)
{
if (StationIndex < 1)
return true; // przed pierwszą jechać
else if (StationIndex < StationCount)
else
{
if (StationIndex < StationCount)
{ // oprócz ostatniego przystanku
if (TimeTable[StationIndex].Ah < 0) // odjazd z poprzedniego
return true; // czas przyjazdu nie był podany - przelot
else
return CompareTime(hh, mm, TimeTable[StationIndex].Dh, TimeTable[StationIndex].Dm) <= 0;
}
else // gdy rozkład się skończył
return false; // dalej nie jechać
// gdy rozkład się skończył
return false;
}
// dalej nie jechać
}
// returns: difference between specified time and scheduled departure from current stop, in seconds