mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 23:49:17 +02:00
reformat: remove redundant 'else' keyword
This commit is contained in:
@@ -1133,6 +1133,7 @@ double TMoverParameters::PipeRatio(void)
|
|||||||
double pr;
|
double pr;
|
||||||
|
|
||||||
if (DeltaPipePress > 0)
|
if (DeltaPipePress > 0)
|
||||||
|
{
|
||||||
if (false) // SPKS!! no to jak nie wchodzimy to po co branch?
|
if (false) // SPKS!! no to jak nie wchodzimy to po co branch?
|
||||||
{
|
{
|
||||||
if (3.0 * PipePress > HighPipePress + LowPipePress + LowPipePress)
|
if (3.0 * PipePress > HighPipePress + LowPipePress + LowPipePress)
|
||||||
@@ -1145,8 +1146,8 @@ double TMoverParameters::PipeRatio(void)
|
|||||||
// if (Compressor > 0.5)
|
// if (Compressor > 0.5)
|
||||||
// then pr : = pr * 1.333; // dziwny rapid wywalamy
|
// then pr : = pr * 1.333; // dziwny rapid wywalamy
|
||||||
}
|
}
|
||||||
else
|
pr = (HighPipePress - std::max(LowPipePress, std::min(HighPipePress, PipePress))) / DeltaPipePress;
|
||||||
pr = (HighPipePress - std::max(LowPipePress, std::min(HighPipePress, PipePress))) / DeltaPipePress;
|
}
|
||||||
else
|
else
|
||||||
pr = 0;
|
pr = 0;
|
||||||
return pr;
|
return pr;
|
||||||
@@ -9830,22 +9831,24 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (issection("BuffCoupl1.", inputline))
|
else
|
||||||
{
|
{
|
||||||
|
if (issection("BuffCoupl1.", inputline))
|
||||||
|
{
|
||||||
|
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("BuffCoupl1", inputline);
|
fizlines.emplace("BuffCoupl1", inputline);
|
||||||
LoadFIZ_BuffCoupl(inputline, 1);
|
LoadFIZ_BuffCoupl(inputline, 1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (issection("BuffCoupl2.", inputline))
|
||||||
|
{
|
||||||
|
|
||||||
else if (issection("BuffCoupl2.", inputline))
|
startBPT = false;
|
||||||
{
|
fizlines.emplace("BuffCoupl2", inputline);
|
||||||
|
LoadFIZ_BuffCoupl(inputline, 2);
|
||||||
startBPT = false;
|
continue;
|
||||||
fizlines.emplace("BuffCoupl2", inputline);
|
}
|
||||||
LoadFIZ_BuffCoupl(inputline, 2);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (issection("TurboPos:", inputline))
|
if (issection("TurboPos:", inputline))
|
||||||
|
|||||||
@@ -394,10 +394,12 @@ double TNESt3::CVs(double const BP) // napelniacz sterujacego
|
|||||||
// przeplyw ZS <-> PG
|
// przeplyw ZS <-> PG
|
||||||
if (MPP < CVP - 0.17)
|
if (MPP < CVP - 0.17)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
else if (MPP > CVP - 0.08)
|
|
||||||
return Nozzles[dSd];
|
|
||||||
else
|
else
|
||||||
return Nozzles[dSm];
|
{
|
||||||
|
if (MPP > CVP - 0.08)
|
||||||
|
return Nozzles[dSd];
|
||||||
|
return Nozzles[dSm];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double TNESt3::BVs(double const BCP) // napelniacz pomocniczego
|
double TNESt3::BVs(double const BCP) // napelniacz pomocniczego
|
||||||
@@ -408,14 +410,17 @@ double TNESt3::BVs(double const BCP) // napelniacz pomocniczego
|
|||||||
// przeplyw ZP <-> rozdzielacz
|
// przeplyw ZP <-> rozdzielacz
|
||||||
if (MPP < CVP - 0.3)
|
if (MPP < CVP - 0.3)
|
||||||
return Nozzles[dP];
|
return Nozzles[dP];
|
||||||
else if( BCP < 0.5 ) {
|
|
||||||
if( true == Zamykajacy )
|
|
||||||
return Nozzles[ dPm ]; // 1.25
|
|
||||||
else
|
|
||||||
return Nozzles[ dPd ];
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
return 0.0;
|
{
|
||||||
|
if (BCP < 0.5)
|
||||||
|
{
|
||||||
|
if (true == Zamykajacy)
|
||||||
|
return Nozzles[dPm]; // 1.25
|
||||||
|
else
|
||||||
|
return Nozzles[dPd];
|
||||||
|
}
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TNESt3::PLC(double const mass)
|
void TNESt3::PLC(double const mass)
|
||||||
|
|||||||
@@ -63,10 +63,12 @@ double PF_old(double P1, double P2, double S)
|
|||||||
const double PL = P1 + P2 - PH + 2;
|
const double PL = P1 + P2 - PH + 2;
|
||||||
if (PH - PL < 0.0001)
|
if (PH - PL < 0.0001)
|
||||||
return 0;
|
return 0;
|
||||||
else if (PH - PL < 0.05)
|
|
||||||
return 20 * (PH - PL) * (PH + 1) * 222 * S * (P2 - P1) / (1.13 * PH - PL);
|
|
||||||
else
|
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);
|
return (PH + 1) * 222 * S * (P2 - P1) / (1.13 * PH - PL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -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 sg = PL / PH; // bezwymiarowy stosunek cisnien
|
||||||
double const FM = PH * 197.0 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
|
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 > 0.5) // jesli ponizej stosunku krytycznego
|
||||||
|
{
|
||||||
if (PH - PL < DP) // niewielka roznica cisnien
|
if (PH - PL < DP) // niewielka roznica cisnien
|
||||||
return (1.0 - sg) / DPL * FM * 2.0 * std::sqrt(DP * (PH - DP));
|
return (1.0 - sg) / DPL * FM * 2.0 * std::sqrt(DP * (PH - DP));
|
||||||
// return 1/DPL*(PH-PL)*fm*2*SQRT((sg)*(1-sg));
|
// return 1/DPL*(PH-PL)*fm*2*SQRT((sg)*(1-sg));
|
||||||
else
|
return FM * 2.0 * std::sqrt(sg * (1.0 - sg));
|
||||||
return FM * 2.0 * std::sqrt(sg * (1.0 - sg));
|
}
|
||||||
else // powyzej stosunku krytycznego
|
else // powyzej stosunku krytycznego
|
||||||
return FM;
|
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 sg = PL / PH; // bezwymiarowy stosunek cisnien
|
||||||
double const FM = PH * 197.0 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
|
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 > 0.5) // jesli ponizej stosunku krytycznego
|
||||||
|
{
|
||||||
if (sg < DPS) // niewielka roznica cisnien
|
if (sg < DPS) // niewielka roznica cisnien
|
||||||
return (1.0 - sg) / DPS * FM * 2.0 * std::sqrt(DPS * (1.0 - DPS));
|
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));
|
||||||
return FM * 2.0 * std::sqrt(sg * (1.0 - sg));
|
}
|
||||||
else // powyzej stosunku krytycznego
|
else // powyzej stosunku krytycznego
|
||||||
return FM;
|
return FM;
|
||||||
}
|
}
|
||||||
@@ -144,10 +148,12 @@ double PFVa(double PH, double PL, double const S, double LIM, double const DP)
|
|||||||
if (LIM - PL < DP)
|
if (LIM - PL < DP)
|
||||||
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 * std::sqrt(sg * (1 - sg)); // BUG: (1-sg) can be < 0, leading to sqrt(-x)
|
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));
|
||||||
return FM * 2 * std::sqrt(sg * (1 - sg)); // BUG: (1-sg) can be < 0, leading to sqrt(-x)
|
}
|
||||||
|
// BUG: (1-sg) can be < 0, leading to sqrt(-x)
|
||||||
else // powyzej stosunku krytycznego
|
else // powyzej stosunku krytycznego
|
||||||
return FM;
|
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)
|
if (PH - LIM < 0.1)
|
||||||
FM = FM * (PH - LIM) / DP; // jesli jestesmy przy nastawieniu, to zawor sie przymyka
|
FM = FM * (PH - LIM) / 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.0 * std::sqrt(sg * (1.0 - sg));
|
return (PH - PL) / DPL * FM * 2.0 * std::sqrt(sg * (1.0 - sg));
|
||||||
else
|
return FM * 2.0 * std::sqrt(sg * (1.0 - sg));
|
||||||
return FM * 2.0 * std::sqrt(sg * (1.0 - sg));
|
}
|
||||||
else // powyzej stosunku krytycznego
|
else // powyzej stosunku krytycznego
|
||||||
return FM;
|
return FM;
|
||||||
}
|
}
|
||||||
@@ -307,10 +314,13 @@ double TBrakeCyl::P()
|
|||||||
// P:=VtoC;
|
// P:=VtoC;
|
||||||
if (VtoC < VS)
|
if (VtoC < VS)
|
||||||
return VtoC * pS / VS; // objetosc szkodliwa
|
return VtoC * pS / VS; // objetosc szkodliwa
|
||||||
else if (VtoC > VD)
|
|
||||||
return VtoC - cD; // caly silownik;
|
|
||||||
else
|
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---
|
//---HAMULEC---
|
||||||
@@ -940,15 +950,19 @@ double TESt::CVs(double const BP)
|
|||||||
// przeplyw ZS <-> PG
|
// przeplyw ZS <-> PG
|
||||||
if (VVP < CVP - 0.12 || BVP < CVP - 0.3 || BP > 0.4)
|
if (VVP < CVP - 0.12 || BVP < CVP - 0.3 || BP > 0.4)
|
||||||
return 0;
|
return 0;
|
||||||
else if (VVP > CVP + 0.4)
|
|
||||||
if (BVP > CVP + 0.2)
|
|
||||||
return 0.23;
|
|
||||||
else
|
|
||||||
return 0.05;
|
|
||||||
else if (BVP > CVP - 0.1)
|
|
||||||
return 1;
|
|
||||||
else
|
else
|
||||||
return 0.3;
|
{
|
||||||
|
if (VVP > CVP + 0.4)
|
||||||
|
{
|
||||||
|
if (BVP > CVP + 0.2)
|
||||||
|
return 0.23;
|
||||||
|
return 0.05;
|
||||||
|
}
|
||||||
|
if (BVP > CVP - 0.1)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0.3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -971,13 +985,16 @@ double TESt::BVs(double const BCP)
|
|||||||
// przeplyw ZP <-> rozdzielacz
|
// przeplyw ZP <-> rozdzielacz
|
||||||
if (BVP < CVP - 0.3)
|
if (BVP < CVP - 0.3)
|
||||||
return 0.6;
|
return 0.6;
|
||||||
else if (BCP < 0.5)
|
|
||||||
if (VVP > CVP + 0.4)
|
|
||||||
return 0.1;
|
|
||||||
else
|
|
||||||
return 0.3;
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (BCP < 0.5)
|
||||||
|
{
|
||||||
|
if (VVP > CVP + 0.4)
|
||||||
|
return 0.1;
|
||||||
|
return 0.3;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -2217,10 +2234,12 @@ double TCV1::BVs(double const BCP)
|
|||||||
// przeplyw ZP <-> rozdzielacz
|
// przeplyw ZP <-> rozdzielacz
|
||||||
if (BVP < CVP - 0.1)
|
if (BVP < CVP - 0.1)
|
||||||
return 1;
|
return 1;
|
||||||
else if (BCP > 0.05)
|
|
||||||
return 0;
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (BCP > 0.05)
|
||||||
|
return 0;
|
||||||
return 0.2 * (1.5 - int(BVP > VVP));
|
return 0.2 * (1.5 - int(BVP > VVP));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -2591,10 +2610,12 @@ double TKE::CVs(double const BP)
|
|||||||
// przeplyw ZS <-> PG
|
// przeplyw ZS <-> PG
|
||||||
if (BP > 0.2)
|
if (BP > 0.2)
|
||||||
return 0;
|
return 0;
|
||||||
else if (VVP > CVP + 0.4)
|
|
||||||
return 0.05;
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (VVP > CVP + 0.4)
|
||||||
|
return 0.05;
|
||||||
return 0.23;
|
return 0.23;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -2617,10 +2638,12 @@ double TKE::BVs(double const BCP)
|
|||||||
// przeplyw ZP <-> rozdzielacz
|
// przeplyw ZP <-> rozdzielacz
|
||||||
if (BVP > VVP)
|
if (BVP > VVP)
|
||||||
return 0;
|
return 0;
|
||||||
else if (BVP < CVP - 0.3)
|
|
||||||
return 0.6;
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (BVP < CVP - 0.3)
|
||||||
|
return 0.6;
|
||||||
return 0.13;
|
return 0.13;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -3429,10 +3452,12 @@ double TMHZ_EN57::LPP_RP(double pos) // cisnienie z zaokraglonej pozycji;
|
|||||||
{
|
{
|
||||||
if (pos > 8.5)
|
if (pos > 8.5)
|
||||||
return 5.0 - 0.15 * pos - 0.35;
|
return 5.0 - 0.15 * pos - 0.35;
|
||||||
else if (pos > 0.5)
|
|
||||||
return 5.0 - 0.15 * pos - 0.1;
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (pos > 0.5)
|
||||||
|
return 5.0 - 0.15 * pos - 0.1;
|
||||||
return 5.0;
|
return 5.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -9819,14 +9819,41 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
static ImRect GetWindowRect(ImGuiWindow* window, int rect_type)
|
static ImRect GetWindowRect(ImGuiWindow* window, int rect_type)
|
||||||
{
|
{
|
||||||
if (rect_type == WRT_OuterRect) { return window->Rect(); }
|
if (rect_type == WRT_OuterRect) { return window->Rect(); }
|
||||||
else if (rect_type == WRT_OuterRectClipped) { return window->OuterRectClipped; }
|
else
|
||||||
else if (rect_type == WRT_InnerRect) { return window->InnerRect; }
|
{
|
||||||
else if (rect_type == WRT_InnerClipRect) { return window->InnerClipRect; }
|
if (rect_type == WRT_OuterRectClipped)
|
||||||
else if (rect_type == WRT_WorkRect) { return window->WorkRect; }
|
{
|
||||||
else if (rect_type == WRT_Contents) {
|
return window->OuterRectClipped;
|
||||||
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; }
|
if (rect_type == WRT_InnerRect)
|
||||||
IM_ASSERT(0);
|
{
|
||||||
|
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();
|
return ImRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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* 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 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 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 T* find(const T& v) { T* data = Data; const T* data_end = Data + Size; while (data < data_end)
|
||||||
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; }
|
{
|
||||||
|
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(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 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; }
|
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; }
|
||||||
|
|||||||
@@ -1188,10 +1188,20 @@ static stbtt_uint32 stbtt__cff_int(stbtt__buf *b)
|
|||||||
{
|
{
|
||||||
const int b0 = stbtt__buf_get8(b);
|
const int b0 = stbtt__buf_get8(b);
|
||||||
if (b0 >= 32 && b0 <= 246) return b0 - 139;
|
if (b0 >= 32 && b0 <= 246) return b0 - 139;
|
||||||
else if (b0 >= 247 && b0 <= 250) return (b0 - 247)*256 + stbtt__buf_get8(b) + 108;
|
else
|
||||||
else 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 >= 247 && b0 <= 250)
|
||||||
else if (b0 == 29) return stbtt__buf_get32(b);
|
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);
|
STBTT_assert(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1469,82 +1479,99 @@ STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codep
|
|||||||
if (unicode_codepoint < bytes-6)
|
if (unicode_codepoint < bytes-6)
|
||||||
return ttBYTE(data + index_map + 6 + unicode_codepoint);
|
return ttBYTE(data + index_map + 6 + unicode_codepoint);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (format == 6) {
|
} else
|
||||||
const stbtt_uint32 first = ttUSHORT(data + index_map + 6);
|
{
|
||||||
const stbtt_uint32 count = ttUSHORT(data + index_map + 8);
|
if (format == 6)
|
||||||
if ((stbtt_uint32) unicode_codepoint >= first && (stbtt_uint32) unicode_codepoint < first+count)
|
{
|
||||||
return ttUSHORT(data + index_map + 10 + (unicode_codepoint - first)*2);
|
const stbtt_uint32 first = ttUSHORT(data + index_map + 6);
|
||||||
return 0;
|
const stbtt_uint32 count = ttUSHORT(data + index_map + 8);
|
||||||
} else if (format == 2) {
|
if ((stbtt_uint32)unicode_codepoint >= first && (stbtt_uint32)unicode_codepoint < first + count)
|
||||||
STBTT_assert(0); // @TODO: high-byte mapping for japanese/chinese/korean
|
return ttUSHORT(data + index_map + 10 + (unicode_codepoint - first) * 2);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (format == 4) { // standard mapping for windows fonts: binary search collection of ranges
|
}
|
||||||
const stbtt_uint16 segcount = ttUSHORT(data+index_map+6) >> 1;
|
if (format == 2)
|
||||||
stbtt_uint16 searchRange = ttUSHORT(data+index_map+8) >> 1;
|
{
|
||||||
stbtt_uint16 entrySelector = ttUSHORT(data+index_map+10);
|
STBTT_assert(0); // @TODO: high-byte mapping for japanese/chinese/korean
|
||||||
const stbtt_uint16 rangeShift = ttUSHORT(data+index_map+12) >> 1;
|
return 0;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
const stbtt_uint16 rangeShift = ttUSHORT(data + index_map + 12) >> 1;
|
||||||
|
|
||||||
// do a binary search of the segments
|
// do a binary search of the segments
|
||||||
const stbtt_uint32 endCount = index_map + 14;
|
const stbtt_uint32 endCount = index_map + 14;
|
||||||
stbtt_uint32 search = endCount;
|
stbtt_uint32 search = endCount;
|
||||||
|
|
||||||
if (unicode_codepoint > 0xffff)
|
if (unicode_codepoint > 0xffff)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// they lie from endCount .. endCount + segCount
|
// they lie from endCount .. endCount + segCount
|
||||||
// but searchRange is the nearest power of two, so...
|
// but searchRange is the nearest power of two, so...
|
||||||
if (unicode_codepoint >= ttUSHORT(data + search + rangeShift*2))
|
if (unicode_codepoint >= ttUSHORT(data + search + rangeShift * 2))
|
||||||
search += rangeShift*2;
|
search += rangeShift * 2;
|
||||||
|
|
||||||
// now decrement to bias correctly to find smallest
|
// now decrement to bias correctly to find smallest
|
||||||
search -= 2;
|
search -= 2;
|
||||||
while (entrySelector) {
|
while (entrySelector)
|
||||||
stbtt_uint16 end;
|
{
|
||||||
searchRange >>= 1;
|
stbtt_uint16 end;
|
||||||
end = ttUSHORT(data + search + searchRange*2);
|
searchRange >>= 1;
|
||||||
if (unicode_codepoint > end)
|
end = ttUSHORT(data + search + searchRange * 2);
|
||||||
search += searchRange*2;
|
if (unicode_codepoint > end)
|
||||||
--entrySelector;
|
search += searchRange * 2;
|
||||||
}
|
--entrySelector;
|
||||||
search += 2;
|
}
|
||||||
|
search += 2;
|
||||||
|
|
||||||
{
|
{
|
||||||
stbtt_uint16 offset, start;
|
stbtt_uint16 offset, start;
|
||||||
const stbtt_uint16 item = (stbtt_uint16) ((search - endCount) >> 1);
|
const stbtt_uint16 item = (stbtt_uint16)((search - endCount) >> 1);
|
||||||
|
|
||||||
STBTT_assert(unicode_codepoint <= ttUSHORT(data + endCount + 2*item));
|
STBTT_assert(unicode_codepoint <= ttUSHORT(data + endCount + 2 * item));
|
||||||
start = ttUSHORT(data + index_map + 14 + segcount*2 + 2 + 2*item);
|
start = ttUSHORT(data + index_map + 14 + segcount * 2 + 2 + 2 * item);
|
||||||
if (unicode_codepoint < start)
|
if (unicode_codepoint < start)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
offset = ttUSHORT(data + index_map + 14 + segcount*6 + 2 + 2*item);
|
offset = ttUSHORT(data + index_map + 14 + segcount * 6 + 2 + 2 * item);
|
||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
return (stbtt_uint16) (unicode_codepoint + ttSHORT(data + index_map + 14 + segcount*4 + 2 + 2*item));
|
return (stbtt_uint16)(unicode_codepoint + ttSHORT(data + index_map + 14 + segcount * 4 + 2 + 2 * item));
|
||||||
|
|
||||||
return ttUSHORT(data + offset + (unicode_codepoint-start)*2 + index_map + 14 + segcount*6 + 2 + 2*item);
|
return ttUSHORT(data + offset + (unicode_codepoint - start) * 2 + index_map + 14 + segcount * 6 + 2 + 2 * item);
|
||||||
}
|
}
|
||||||
} else if (format == 12 || format == 13) {
|
}
|
||||||
const stbtt_uint32 ngroups = ttULONG(data+index_map+12);
|
if (format == 12 || format == 13)
|
||||||
stbtt_int32 low,high;
|
{
|
||||||
low = 0; high = (stbtt_int32)ngroups;
|
const stbtt_uint32 ngroups = ttULONG(data + index_map + 12);
|
||||||
// Binary search the right group.
|
stbtt_int32 low, high;
|
||||||
while (low < high) {
|
low = 0;
|
||||||
const stbtt_int32 mid = low + ((high-low) >> 1); // rounds down, so low <= mid < high
|
high = (stbtt_int32)ngroups;
|
||||||
const stbtt_uint32 start_char = ttULONG(data+index_map+16+mid*12);
|
// Binary search the right group.
|
||||||
const stbtt_uint32 end_char = ttULONG(data+index_map+16+mid*12+4);
|
while (low < high)
|
||||||
if ((stbtt_uint32) unicode_codepoint < start_char)
|
{
|
||||||
high = mid;
|
const stbtt_int32 mid = low + ((high - low) >> 1); // rounds down, so low <= mid < high
|
||||||
else if ((stbtt_uint32) unicode_codepoint > end_char)
|
const stbtt_uint32 start_char = ttULONG(data + index_map + 16 + mid * 12);
|
||||||
low = mid+1;
|
const stbtt_uint32 end_char = ttULONG(data + index_map + 16 + mid * 12 + 4);
|
||||||
else {
|
if ((stbtt_uint32)unicode_codepoint < start_char)
|
||||||
const stbtt_uint32 start_glyph = ttULONG(data+index_map+16+mid*12+8);
|
high = mid;
|
||||||
if (format == 12)
|
else if ((stbtt_uint32)unicode_codepoint > end_char)
|
||||||
return start_glyph + unicode_codepoint-start_char;
|
low = mid + 1;
|
||||||
else // format == 13
|
else
|
||||||
return start_glyph;
|
{
|
||||||
}
|
const stbtt_uint32 start_glyph = ttULONG(data + index_map + 16 + mid * 12 + 8);
|
||||||
}
|
if (format == 12)
|
||||||
return 0; // not found
|
return start_glyph + unicode_codepoint - start_char;
|
||||||
|
else // format == 13
|
||||||
|
return start_glyph;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0; // not found
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// @TODO
|
// @TODO
|
||||||
STBTT_assert(0);
|
STBTT_assert(0);
|
||||||
|
|||||||
@@ -7612,10 +7612,12 @@ static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp)
|
|||||||
maxv = stbi__pnm_getinteger(s, &c); // read max value
|
maxv = stbi__pnm_getinteger(s, &c); // read max value
|
||||||
if (maxv > 65535)
|
if (maxv > 65535)
|
||||||
return stbi__err("max value > 65535", "PPM image supports only 8-bit and 16-bit images");
|
return stbi__err("max value > 65535", "PPM image supports only 8-bit and 16-bit images");
|
||||||
else if (maxv > 255)
|
|
||||||
return 16;
|
|
||||||
else
|
else
|
||||||
return 8;
|
{
|
||||||
|
if (maxv > 255)
|
||||||
|
return 16;
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stbi__pnm_is16(stbi__context *s)
|
static int stbi__pnm_is16(stbi__context *s)
|
||||||
|
|||||||
@@ -55,23 +55,53 @@ inline
|
|||||||
comparison_pass
|
comparison_pass
|
||||||
comparison_pass_from_string( std::string const Input ) {
|
comparison_pass_from_string( std::string const Input ) {
|
||||||
if( Input == "all" ) { return comparison_pass::all; }
|
if( Input == "all" ) { return comparison_pass::all; }
|
||||||
else if( Input == "any" ) { return comparison_pass::any; }
|
else
|
||||||
else if( Input == "none" ) { return comparison_pass::none; }
|
{
|
||||||
|
if (Input == "any")
|
||||||
|
{
|
||||||
|
return comparison_pass::any;
|
||||||
|
}
|
||||||
|
if (Input == "none")
|
||||||
|
{
|
||||||
|
return comparison_pass::none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return comparison_pass::all; // legacy default
|
return comparison_pass::all; // legacy default
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
comparison_operator
|
comparison_operator
|
||||||
comparison_operator_from_string( std::string const Input ) {
|
comparison_operator_from_string( std::string const Input ) {
|
||||||
if( Input == "==" ) { return comparison_operator::equal; }
|
if( Input == "==" ) { return comparison_operator::equal; }
|
||||||
else if( Input == "!=" ) { return comparison_operator::not_equal; }
|
else
|
||||||
else if( Input == "<" ) { return comparison_operator::lt; }
|
{
|
||||||
else if( Input == ">" ) { return comparison_operator::gt; }
|
if (Input == "!=")
|
||||||
else if( Input == "<=" ) { return comparison_operator::lt_eq; }
|
{
|
||||||
else if( Input == ">=" ) { return comparison_operator::gt_eq; }
|
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
|
return comparison_operator::equal; // legacy default
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -348,14 +348,12 @@ std::string TSpeedPos::GetName() const
|
|||||||
{
|
{
|
||||||
if( iFlags & spTrack ) // jeśli tor
|
if( iFlags & spTrack ) // jeśli tor
|
||||||
return trTrack->name();
|
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
|
else
|
||||||
return "";
|
{
|
||||||
|
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
|
std::string TSpeedPos::TableText() const
|
||||||
|
|||||||
@@ -2302,21 +2302,27 @@ event_manager::insert( basic_event *Event ) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// tymczasowo wyjątki:
|
// tymczasowo wyjątki:
|
||||||
else if( Event->m_name.ends_with("lineinfo:") ) {
|
else
|
||||||
// tymczasowa utylizacja duplikatów W5
|
{
|
||||||
return false;
|
if (Event->m_name.ends_with("lineinfo:"))
|
||||||
}
|
{
|
||||||
else if( Event->m_name.ends_with("_warning") ) {
|
// tymczasowa utylizacja duplikatów W5
|
||||||
// tymczasowa utylizacja duplikatu z trąbieniem
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
if (Event->m_name.ends_with("_warning"))
|
||||||
else if( Event->m_name.ends_with("_shp") ) {
|
{
|
||||||
// nie podlegają logowaniu
|
// tymczasowa utylizacja duplikatu z trąbieniem
|
||||||
// tymczasowa utylizacja duplikatu SHP
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
else if (Event->m_name.ends_with("_shp"))
|
||||||
|
{
|
||||||
|
// nie podlegają logowaniu
|
||||||
|
// tymczasowa utylizacja duplikatu SHP
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto *duplicate = m_events[ lookup->second ];
|
auto *duplicate = m_events[ lookup->second ];
|
||||||
if( Global.bJoinEvents ) {
|
if( Global.bJoinEvents ) {
|
||||||
// doczepka (taki wirtualny multiple bez warunków)
|
// doczepka (taki wirtualny multiple bez warunków)
|
||||||
duplicate->append( Event );
|
duplicate->append( Event );
|
||||||
|
|||||||
185
world/Track.cpp
185
world/Track.cpp
@@ -1787,97 +1787,100 @@ bool TTrack::SetConnections(int i)
|
|||||||
bool TTrack::Switch(int i, float const t, float const d)
|
bool TTrack::Switch(int i, float const t, float const d)
|
||||||
{ // przełączenie torów z uruchomieniem animacji
|
{ // przełączenie torów z uruchomieniem animacji
|
||||||
if (SwitchExtension) // tory przełączalne mają doklejkę
|
if (SwitchExtension) // tory przełączalne mają doklejkę
|
||||||
if (eType == tt_Switch)
|
{
|
||||||
{ // przekładanie zwrotnicy jak zwykle
|
if (eType == tt_Switch)
|
||||||
if (t > 0.f) // prędkość liniowa ruchu iglic
|
{ // przekładanie zwrotnicy jak zwykle
|
||||||
SwitchExtension->fOffsetSpeed = t; // prędkość łatwiej zgrać z animacją modelu
|
if (t > 0.f) // prędkość liniowa ruchu iglic
|
||||||
if (d >= 0.f) // dodatkowy ruch drugiej iglicy (zamknięcie nastawnicze)
|
SwitchExtension->fOffsetSpeed = t; // prędkość łatwiej zgrać z animacją modelu
|
||||||
SwitchExtension->fOffsetDelay = d;
|
if (d >= 0.f) // dodatkowy ruch drugiej iglicy (zamknięcie nastawnicze)
|
||||||
i &= 1; // ograniczenie błędów !!!!
|
SwitchExtension->fOffsetDelay = d;
|
||||||
SwitchExtension->fDesiredOffset =
|
i &= 1; // ograniczenie błędów !!!!
|
||||||
i ? fMaxOffset + SwitchExtension->fOffsetDelay : -SwitchExtension->fOffsetDelay;
|
SwitchExtension->fDesiredOffset = i ? fMaxOffset + SwitchExtension->fOffsetDelay : -SwitchExtension->fOffsetDelay;
|
||||||
SwitchExtension->CurrentIndex = i;
|
SwitchExtension->CurrentIndex = i;
|
||||||
Segment = SwitchExtension->Segments[i]; // wybranie aktywnej drogi - potrzebne to?
|
Segment = SwitchExtension->Segments[i]; // wybranie aktywnej drogi - potrzebne to?
|
||||||
trNext = SwitchExtension->pNexts[i]; // przełączenie końców
|
trNext = SwitchExtension->pNexts[i]; // przełączenie końców
|
||||||
trPrev = SwitchExtension->pPrevs[i];
|
trPrev = SwitchExtension->pPrevs[i];
|
||||||
iNextDirection = SwitchExtension->iNextDirection[i];
|
iNextDirection = SwitchExtension->iNextDirection[i];
|
||||||
iPrevDirection = SwitchExtension->iPrevDirection[i];
|
iPrevDirection = SwitchExtension->iPrevDirection[i];
|
||||||
fRadius = fRadiusTable[i]; // McZapkie: wybor promienia toru
|
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;
|
//-1 oznacza maksymalną prędkość, a dalsze ujemne to ograniczenie na bok
|
||||||
}
|
fVelocity = i ? -SwitchExtension->fVelocity : -1;
|
||||||
else {
|
}
|
||||||
fVelocity = SwitchExtension->fVelocity;
|
else
|
||||||
}
|
{
|
||||||
if (SwitchExtension->pOwner ? SwitchExtension->pOwner->RaTrackAnimAdd(this) :
|
fVelocity = SwitchExtension->fVelocity;
|
||||||
true) // jeśli nie dodane do animacji
|
}
|
||||||
{ // nie ma się co bawić
|
if (SwitchExtension->pOwner ? SwitchExtension->pOwner->RaTrackAnimAdd(this) : true) // jeśli nie dodane do animacji
|
||||||
SwitchExtension->fOffset = SwitchExtension->fDesiredOffset;
|
{ // nie ma się co bawić
|
||||||
// przeliczenie położenia iglic; czy zadziała na niewyświetlanym sektorze w VBO?
|
SwitchExtension->fOffset = SwitchExtension->fDesiredOffset;
|
||||||
RaAnimate();
|
// przeliczenie położenia iglic; czy zadziała na niewyświetlanym sektorze w VBO?
|
||||||
}
|
RaAnimate();
|
||||||
return true;
|
}
|
||||||
}
|
return true;
|
||||||
else if (eType == tt_Table)
|
}
|
||||||
{ // blokowanie (0, szukanie torów) lub odblokowanie (1, rozłączenie) obrotnicy
|
if (eType == tt_Table)
|
||||||
if (i) // NOTE: this condition seems opposite to intention/comment? TODO: investigate this
|
{ // blokowanie (0, szukanie torów) lub odblokowanie (1, rozłączenie) obrotnicy
|
||||||
{ // 0: rozłączenie sąsiednich torów od obrotnicy
|
if (i) // NOTE: this condition seems opposite to intention/comment? TODO: investigate this
|
||||||
if (trPrev) // jeśli jest tor od Point1 obrotnicy
|
{ // 0: rozłączenie sąsiednich torów od obrotnicy
|
||||||
if (iPrevDirection) // 0:dołączony Point1, 1:dołączony Point2
|
if (trPrev) // jeśli jest tor od Point1 obrotnicy
|
||||||
trPrev->trNext = nullptr; // rozłączamy od Point2
|
if (iPrevDirection) // 0:dołączony Point1, 1:dołączony Point2
|
||||||
else
|
trPrev->trNext = nullptr; // rozłączamy od Point2
|
||||||
trPrev->trPrev = nullptr; // rozłączamy od Point1
|
else
|
||||||
if (trNext) // jeśli jest tor od Point2 obrotnicy
|
trPrev->trPrev = nullptr; // rozłączamy od Point1
|
||||||
if (iNextDirection) // 0:dołączony Point1, 1:dołączony Point2
|
if (trNext) // jeśli jest tor od Point2 obrotnicy
|
||||||
trNext->trNext = nullptr; // rozłączamy od Point2
|
if (iNextDirection) // 0:dołączony Point1, 1:dołączony Point2
|
||||||
else
|
trNext->trNext = nullptr; // rozłączamy od Point2
|
||||||
trNext->trPrev = nullptr; // rozłączamy od Point1
|
else
|
||||||
trNext = trPrev = nullptr; // na końcu rozłączamy obrotnicę (wkaźniki do sąsiadów już niepotrzebne)
|
trNext->trPrev = nullptr; // rozłączamy od Point1
|
||||||
fVelocity = 0.0; // AI, nie ruszaj się!
|
trNext = trPrev = nullptr; // na końcu rozłączamy obrotnicę (wkaźniki do sąsiadów już niepotrzebne)
|
||||||
if (SwitchExtension->pOwner)
|
fVelocity = 0.0; // AI, nie ruszaj się!
|
||||||
SwitchExtension->pOwner->RaTrackAnimAdd(this); // dodanie do listy animacyjnej
|
if (SwitchExtension->pOwner)
|
||||||
// TODO: unregister path ends in the owner cell
|
SwitchExtension->pOwner->RaTrackAnimAdd(this); // dodanie do listy animacyjnej
|
||||||
}
|
// TODO: unregister path ends in the owner cell
|
||||||
else
|
}
|
||||||
{ // 1: ustalenie finalnego położenia (gdy nie było animacji)
|
else
|
||||||
RaAnimate(); // ostatni etap animowania
|
{ // 1: ustalenie finalnego położenia (gdy nie było animacji)
|
||||||
// zablokowanie pozycji i połączenie do sąsiednich torów
|
RaAnimate(); // ostatni etap animowania
|
||||||
// TODO: register new position of the path endpoints with the region
|
// zablokowanie pozycji i połączenie do sąsiednich torów
|
||||||
simulation::Region->TrackJoin( this );
|
// TODO: register new position of the path endpoints with the region
|
||||||
if (trNext || trPrev)
|
simulation::Region->TrackJoin(this);
|
||||||
{
|
if (trNext || trPrev)
|
||||||
fVelocity = 6.0; // jazda dozwolona
|
{
|
||||||
if( trPrev
|
fVelocity = 6.0; // jazda dozwolona
|
||||||
&& 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
|
// 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 );
|
{
|
||||||
}
|
trNext->VelocitySet(6.0);
|
||||||
if( SwitchExtension->evPlus ) { // w starych sceneriach może nie być
|
}
|
||||||
// potwierdzenie wykonania (np. odpala WZ)
|
if (SwitchExtension->evPlus)
|
||||||
simulation::Events.AddToQuery( SwitchExtension->evPlus, nullptr );
|
{ // w starych sceneriach może nie być
|
||||||
}
|
// potwierdzenie wykonania (np. odpala WZ)
|
||||||
}
|
simulation::Events.AddToQuery(SwitchExtension->evPlus, nullptr);
|
||||||
}
|
}
|
||||||
SwitchExtension->CurrentIndex = i; // zapamiętanie stanu zablokowania
|
}
|
||||||
return true;
|
}
|
||||||
}
|
SwitchExtension->CurrentIndex = i; // zapamiętanie stanu zablokowania
|
||||||
else if (eType == tt_Cross)
|
return true;
|
||||||
{ // to jest przydatne tylko do łączenia odcinków
|
}
|
||||||
i &= 1;
|
else if (eType == tt_Cross)
|
||||||
SwitchExtension->CurrentIndex = i;
|
{ // to jest przydatne tylko do łączenia odcinków
|
||||||
Segment = SwitchExtension->Segments[i]; // wybranie aktywnej drogi - potrzebne to?
|
i &= 1;
|
||||||
trNext = SwitchExtension->pNexts[i]; // przełączenie końców
|
SwitchExtension->CurrentIndex = i;
|
||||||
trPrev = SwitchExtension->pPrevs[i];
|
Segment = SwitchExtension->Segments[i]; // wybranie aktywnej drogi - potrzebne to?
|
||||||
iNextDirection = SwitchExtension->iNextDirection[i];
|
trNext = SwitchExtension->pNexts[i]; // przełączenie końców
|
||||||
iPrevDirection = SwitchExtension->iPrevDirection[i];
|
trPrev = SwitchExtension->pPrevs[i];
|
||||||
return true;
|
iNextDirection = SwitchExtension->iNextDirection[i];
|
||||||
}
|
iPrevDirection = SwitchExtension->iPrevDirection[i];
|
||||||
if (iCategoryFlag == 1)
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (iCategoryFlag == 1)
|
||||||
iDamageFlag = (iDamageFlag & 127) + 128 * (i & 1); // przełączanie wykolejenia
|
iDamageFlag = (iDamageFlag & 127) + 128 * (i & 1); // przełączanie wykolejenia
|
||||||
else
|
else
|
||||||
Error("Cannot switch normal track");
|
Error("Cannot switch normal track");
|
||||||
|
|||||||
@@ -504,20 +504,27 @@ double TTraction::VoltageGet(double u, double i)
|
|||||||
i1 = psPower[1]->CurrentGet(r1g);
|
i1 = psPower[1]->CurrentGet(r1g);
|
||||||
return (i0 + i1) * res;
|
return (i0 + i1) * res;
|
||||||
}
|
}
|
||||||
else if (r0t >= 0.0)
|
|
||||||
return psPower[0]->CurrentGet(res + r0t) * res;
|
|
||||||
else if (r1t >= 0.0)
|
|
||||||
return psPower[1]->CurrentGet(res + r1t) * res;
|
|
||||||
else
|
else
|
||||||
return 0.0; // co z tym zrobić?
|
{
|
||||||
|
if (r0t >= 0.0)
|
||||||
|
return psPower[0]->CurrentGet(res + r0t) * res;
|
||||||
|
if (r1t >= 0.0)
|
||||||
|
return psPower[1]->CurrentGet(res + r1t) * res;
|
||||||
|
else
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
// co z tym zrobić?
|
||||||
}
|
}
|
||||||
else if (psPower[0] && r0t >= 0.0)
|
else
|
||||||
{ // jeśli odcinek podłączony jest tylko z jednej strony
|
{
|
||||||
return psPower[0]->CurrentGet(res + r0t) * res;
|
if (psPower[0] && r0t >= 0.0)
|
||||||
}
|
{ // jeśli odcinek podłączony jest tylko z jednej strony
|
||||||
else if (psPower[1] && r1t >= 0.0)
|
return psPower[0]->CurrentGet(res + r0t) * res;
|
||||||
return psPower[1]->CurrentGet(res + r1t) * res;
|
}
|
||||||
return 0.0; // gdy nie podłączony wcale?
|
if (psPower[1] && r1t >= 0.0)
|
||||||
|
return psPower[1]->CurrentGet(res + r1t) * res;
|
||||||
|
}
|
||||||
|
return 0.0; // gdy nie podłączony wcale?
|
||||||
};
|
};
|
||||||
|
|
||||||
glm::vec3
|
glm::vec3
|
||||||
|
|||||||
@@ -215,53 +215,55 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
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
|
|
||||||
Owner->MyTrack->RemoveDynamicObject(Owner); // zdejmujemy pojazd z dotychczasowego toru
|
|
||||||
fDistance = s - pCurrentSegment->GetLength();
|
|
||||||
dir = fDirection;
|
|
||||||
if (pCurrentTrack->eType == tt_Cross)
|
|
||||||
{
|
|
||||||
if (!SetCurrentTrack(pCurrentTrack->Connected(iSegment, fDirection), 1))
|
|
||||||
return false; // wyjście z błędem
|
|
||||||
}
|
|
||||||
else if (!SetCurrentTrack(pCurrentTrack->Connected(1, fDirection), 1)) // ustawia fDirection
|
|
||||||
return false; // wyjście z błędem
|
|
||||||
if (dir != fDirection) //(pCurrentTrack->iNextDirection)
|
|
||||||
{ // gdy zmiana kierunku toru (Point2->Point2)
|
|
||||||
fDistance = -fDistance; //(s-pCurrentSegment->GetLength());
|
|
||||||
fCurrentDistance = pCurrentSegment->GetLength();
|
|
||||||
}
|
|
||||||
else // gdy kierunek bez zmiany (Point2->Point1)
|
|
||||||
fCurrentDistance = 0;
|
|
||||||
if (bCanSkip)
|
|
||||||
{ // jak główna oś, to dodanie pojazdu do nowego toru
|
|
||||||
pCurrentTrack->AddDynamicObject(Owner);
|
|
||||||
iEventFlag = 3; // McZapkie-020602: umozliwienie uruchamiania event1,2 po zmianie toru
|
|
||||||
iEventallFlag = 3;
|
|
||||||
if (!Owner->MyTrack)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{ // gdy zostaje na tym samym torze (przesuwanie już nie zmienia toru)
|
{
|
||||||
if (bPrimary)
|
if (s > pCurrentSegment->GetLength())
|
||||||
{ // tylko gdy początkowe ustawienie, dodajemy eventy stania do kolejki
|
{ // jeśli przekroczenie toru od strony Point2
|
||||||
if (Owner->MoverParameters->CabOccupied != 0) {
|
bCanSkip = bPrimary && pCurrentTrack->CheckDynamicObject(Owner);
|
||||||
|
if (bCanSkip) // tylko główna oś przenosi pojazd do innego toru
|
||||||
|
Owner->MyTrack->RemoveDynamicObject(Owner); // zdejmujemy pojazd z dotychczasowego toru
|
||||||
|
fDistance = s - pCurrentSegment->GetLength();
|
||||||
|
dir = fDirection;
|
||||||
|
if (pCurrentTrack->eType == tt_Cross)
|
||||||
|
{
|
||||||
|
if (!SetCurrentTrack(pCurrentTrack->Connected(iSegment, fDirection), 1))
|
||||||
|
return false; // wyjście z błędem
|
||||||
|
}
|
||||||
|
else if (!SetCurrentTrack(pCurrentTrack->Connected(1, fDirection), 1)) // ustawia fDirection
|
||||||
|
return false; // wyjście z błędem
|
||||||
|
if (dir != fDirection) //(pCurrentTrack->iNextDirection)
|
||||||
|
{ // gdy zmiana kierunku toru (Point2->Point2)
|
||||||
|
fDistance = -fDistance; //(s-pCurrentSegment->GetLength());
|
||||||
|
fCurrentDistance = pCurrentSegment->GetLength();
|
||||||
|
}
|
||||||
|
else // gdy kierunek bez zmiany (Point2->Point1)
|
||||||
|
fCurrentDistance = 0;
|
||||||
|
if (bCanSkip)
|
||||||
|
{ // jak główna oś, to dodanie pojazdu do nowego toru
|
||||||
|
pCurrentTrack->AddDynamicObject(Owner);
|
||||||
|
iEventFlag = 3; // McZapkie-020602: umozliwienie uruchamiania event1,2 po zmianie toru
|
||||||
|
iEventallFlag = 3;
|
||||||
|
if (!Owner->MyTrack)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
|
||||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events1, Owner, -1.0 );
|
pCurrentTrack->QueueEvents(pCurrentTrack->m_events1, Owner, -1.0);
|
||||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events2, Owner, -1.0 );
|
pCurrentTrack->QueueEvents(pCurrentTrack->m_events2, Owner, -1.0);
|
||||||
}
|
}
|
||||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events1all, Owner, -1.0 );
|
pCurrentTrack->QueueEvents(pCurrentTrack->m_events1all, Owner, -1.0);
|
||||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events2all, Owner, -1.0 );
|
pCurrentTrack->QueueEvents(pCurrentTrack->m_events2all, Owner, -1.0);
|
||||||
}
|
}
|
||||||
fCurrentDistance = s;
|
fCurrentDistance = s;
|
||||||
return ComputatePosition(); // przeliczenie XYZ, true o ile nie wyjechał na NULL
|
return ComputatePosition(); // przeliczenie XYZ, true o ile nie wyjechał na NULL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool TTrackFollower::ComputatePosition()
|
bool TTrackFollower::ComputatePosition()
|
||||||
|
|||||||
@@ -169,15 +169,19 @@ bool TTrainParameters::IsTimeToGo(double hh, double mm)
|
|||||||
{
|
{
|
||||||
if (StationIndex < 1)
|
if (StationIndex < 1)
|
||||||
return true; // przed pierwszą jechać
|
return true; // przed pierwszą jechać
|
||||||
else if (StationIndex < StationCount)
|
else
|
||||||
{ // oprócz ostatniego przystanku
|
{
|
||||||
if (TimeTable[StationIndex].Ah < 0) // odjazd z poprzedniego
|
if (StationIndex < StationCount)
|
||||||
return true; // czas przyjazdu nie był podany - przelot
|
{ // oprócz ostatniego przystanku
|
||||||
else
|
if (TimeTable[StationIndex].Ah < 0) // odjazd z poprzedniego
|
||||||
return CompareTime(hh, mm, TimeTable[StationIndex].Dh, TimeTable[StationIndex].Dm) <= 0;
|
return true; // czas przyjazdu nie był podany - przelot
|
||||||
}
|
else
|
||||||
else // gdy rozkład się skończył
|
return CompareTime(hh, mm, TimeTable[StationIndex].Dh, TimeTable[StationIndex].Dm) <= 0;
|
||||||
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
|
// returns: difference between specified time and scheduled departure from current stop, in seconds
|
||||||
|
|||||||
Reference in New Issue
Block a user