diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 494c32f6..7ff19b4a 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -591,29 +591,29 @@ bool TMoverParameters::Attach(int ConnectNo, int ConnectToNr, TMoverParameters * return false; } - auto &coupler{Couplers[ConnectNo]}; - auto &othercoupler = ConnectTo->Couplers[ConnectToNr != 2 ? ConnectToNr : coupler.ConnectedNr]; - auto const distance{CouplerDist(this, ConnectTo) - (coupler.adapter_length + othercoupler.adapter_length)}; + auto &thiscoupler{Couplers[ConnectNo]}; + auto &othercoupler = ConnectTo->Couplers[ConnectToNr != 2 ? ConnectToNr : thiscoupler.ConnectedNr]; + auto const distance{CouplerDist(this, ConnectTo) - (thiscoupler.adapter_length + othercoupler.adapter_length)}; - if (auto const couplercheck{Enforce || (distance <= dEpsilon && coupler.type() != TCouplerType::NoCoupler && coupler.type() == othercoupler.type())}; false == couplercheck) + if (auto const couplercheck{Enforce || (distance <= dEpsilon && thiscoupler.type() != TCouplerType::NoCoupler && thiscoupler.type() == othercoupler.type())}; false == couplercheck) { return false; } // stykaja sie zderzaki i kompatybilne typy sprzegow, chyba że łączenie na starcie - if (coupler.CouplingFlag == coupling::faux) + if (thiscoupler.CouplingFlag == coupling::faux) { // jeśli wcześniej nie było połączone, ustalenie z której strony rysować sprzęg - coupler.Render = true; // tego rysować + thiscoupler.Render = true; // tego rysować othercoupler.Render = false; // a tego nie } - auto const couplingchange{CouplingType ^ coupler.CouplingFlag}; - coupler.Connected = ConnectTo; - coupler.CouplingFlag = CouplingType; // ustawienie typu sprzęgu + auto const couplingchange{CouplingType ^ thiscoupler.CouplingFlag}; + thiscoupler.Connected = ConnectTo; + thiscoupler.CouplingFlag = CouplingType; // ustawienie typu sprzęgu if (ConnectToNr != 2) { - coupler.ConnectedNr = ConnectToNr; // 2=nic nie podłączone + thiscoupler.ConnectedNr = ConnectToNr; // 2=nic nie podłączone } othercoupler.Connected = this; othercoupler.CouplingFlag = CouplingType; @@ -633,7 +633,7 @@ bool TMoverParameters::Attach(int ConnectNo, int ConnectToNr, TMoverParameters * soundflag |= mappingsound; } } - SetFlag(coupler.sounds, soundflag); + SetFlag(thiscoupler.sounds, soundflag); } return true; @@ -657,30 +657,30 @@ int TMoverParameters::DettachStatus(int ConnectNo) bool TMoverParameters::Dettach(int ConnectNo) { // rozlaczanie - auto &coupler{Couplers[ConnectNo]}; - auto &othervehicle{coupler.Connected}; - auto &othercoupler{othervehicle->Couplers[coupler.ConnectedNr]}; + auto &thiscoupler{Couplers[ConnectNo]}; + auto &othervehicle{thiscoupler.Connected}; + auto &othercoupler{othervehicle->Couplers[thiscoupler.ConnectedNr]}; if (othervehicle == nullptr) { return true; } // nie ma nic, to odczepiono - auto couplingchange{coupler.CouplingFlag}; // presume we'll uncouple all active flags + auto couplingchange{thiscoupler.CouplingFlag}; // presume we'll uncouple all active flags auto const couplingstate{DettachStatus(ConnectNo)}; // stan sprzęgu if (couplingstate < 0) { // gdy scisniete zderzaki, chyba ze zerwany sprzeg (wirtualnego nie odpinamy z drugiej strony) std::tie(othercoupler.Connected, othercoupler.ConnectedNr, othercoupler.CouplingFlag) = std::make_tuple(nullptr, -1, coupling::faux); - std::tie(coupler.Connected, coupler.ConnectedNr, coupler.CouplingFlag) = std::make_tuple(nullptr, -1, coupling::faux); + std::tie(thiscoupler.Connected, thiscoupler.ConnectedNr, thiscoupler.CouplingFlag) = std::make_tuple(nullptr, -1, coupling::faux); } else if (couplingstate > 0) { // odłączamy węże i resztę, pozostaje sprzęg fizyczny, który wymaga dociśnięcia (z wirtualnym nic) - coupler.CouplingFlag &= coupling::coupler; + thiscoupler.CouplingFlag &= coupling::coupler; othercoupler.CouplingFlag &= coupling::coupler; } // set sound event flag - couplingchange ^= coupler.CouplingFlag; // remaining bits were removed from coupling + couplingchange ^= thiscoupler.CouplingFlag; // remaining bits were removed from coupling if (couplingchange != 0) { int soundflag{sound::detach}; // HACK: use detach flag to indicate removal of listed coupling @@ -694,7 +694,7 @@ bool TMoverParameters::Dettach(int ConnectNo) soundflag |= mappingsound; } } - SetFlag(coupler.sounds, soundflag); + SetFlag(thiscoupler.sounds, soundflag); } return couplingstate < 0; @@ -1188,7 +1188,7 @@ void TMoverParameters::CollisionDetect(int const End, double const dt) return; } // shouldn't normally happen but, eh - auto &coupler{Couplers[End]}; + auto &thiscoupler{Couplers[End]}; auto *othervehicle{Neighbours[End].vehicle->MoverParameters}; auto const otherend{Neighbours[End].vehicle_end}; auto &othercoupler{othervehicle->Couplers[otherend]}; @@ -1196,19 +1196,19 @@ void TMoverParameters::CollisionDetect(int const End, double const dt) auto velocity{V}; auto othervehiclevelocity{othervehicle->V}; // calculate collision force and new velocities for involved vehicles - auto const VirtualCoupling{(coupler.CouplingFlag == coupling::faux)}; + auto const VirtualCoupling{(thiscoupler.CouplingFlag == coupling::faux)}; auto CCF{0.0}; switch (End) { case 0: { - CCF = ComputeCollision(velocity, othervehiclevelocity, TotalMass, othervehicle->TotalMass, (coupler.beta + othercoupler.beta) / 2.0, VirtualCoupling) / dt; + CCF = ComputeCollision(velocity, othervehiclevelocity, TotalMass, othervehicle->TotalMass, (thiscoupler.beta + othercoupler.beta) / 2.0, VirtualCoupling) / dt; break; // yB: ej ej ej, a po } case 1: { - CCF = ComputeCollision(othervehiclevelocity, velocity, othervehicle->TotalMass, TotalMass, (coupler.beta + othercoupler.beta) / 2.0, VirtualCoupling) / dt; + CCF = ComputeCollision(othervehiclevelocity, velocity, othervehicle->TotalMass, TotalMass, (thiscoupler.beta + othercoupler.beta) / 2.0, VirtualCoupling) / dt; break; } default: @@ -1219,13 +1219,13 @@ void TMoverParameters::CollisionDetect(int const End, double const dt) if (Global.crash_damage) { - if (-coupler.Dist >= coupler.DmaxB && FuzzyLogic(std::abs(CCF), 5.0 * (coupler.FmaxC + 1.0), p_coupldmg)) + if (-thiscoupler.Dist >= thiscoupler.DmaxB && FuzzyLogic(std::abs(CCF), 5.0 * (thiscoupler.FmaxC + 1.0), p_coupldmg)) { // small chance to smash the coupler if it's hit with excessive force damage_coupler(End); } - if (coupler.CouplingFlag == coupling::faux || true == TestFlag(othervehicle->DamageFlag, dtrain_out)) + if (thiscoupler.CouplingFlag == coupling::faux || true == TestFlag(othervehicle->DamageFlag, dtrain_out)) { // HACK: limit excessive speed derailment checks to vehicles which aren't part of the same consist auto const safevelocitylimit{15.0}; auto const velocitydifference{glm::length(glm::angleAxis(Rot.Rz, glm::dvec3{0, 1, 0}) * V - glm::angleAxis(othervehicle->Rot.Rz, glm::dvec3{0, 1, 0}) * othervehicle->V) * @@ -1276,9 +1276,9 @@ void TMoverParameters::CollisionDetect(int const End, double const dt) void TMoverParameters::damage_coupler(int const End) { - auto &coupler{Couplers[End]}; + auto &thiscoupler{Couplers[End]}; - if (coupler.type() == TCouplerType::Articulated) + if (thiscoupler.type() == TCouplerType::Articulated) { return; } // HACK: don't break articulated couplings no matter what @@ -1286,27 +1286,27 @@ void TMoverParameters::damage_coupler(int const End) if (SetFlag(DamageFlag, dtrain_coupling)) EventFlag = true; - if ((coupler.CouplingFlag & coupling::brakehose) == coupling::brakehose) + if ((thiscoupler.CouplingFlag & coupling::brakehose) == coupling::brakehose) { // hamowanie nagle - zerwanie przewodow hamulcowych AlarmChainFlag = true; } - coupler.CouplingFlag = 0; + thiscoupler.CouplingFlag = 0; - if (coupler.Connected != nullptr) + if (thiscoupler.Connected != nullptr) { switch (End) { // break connection with other vehicle, if there's any case 0: { - coupler.Connected->Couplers[end::rear].CouplingFlag = coupling::faux; + thiscoupler.Connected->Couplers[end::rear].CouplingFlag = coupling::faux; break; } case 1: { - coupler.Connected->Couplers[end::front].CouplingFlag = coupling::faux; + thiscoupler.Connected->Couplers[end::front].CouplingFlag = coupling::faux; break; } default: @@ -1831,7 +1831,7 @@ void TMoverParameters::PowerCouplersCheck(double const /*Deltatime*/, coupling c for (auto side = 0; side < 2; ++side) { - auto &coupler{Couplers[side]}; + auto &thiscoupler{Couplers[side]}; // NOTE: in the loop we actually update the state of the coupler on the opposite end of the vehicle auto &oppositecoupler{Couplers[side == end::front ? end::rear : end::front]}; @@ -1871,9 +1871,9 @@ void TMoverParameters::PowerCouplersCheck(double const /*Deltatime*/, coupling c } } - auto const *coupling = Coupling == coupling::highvoltage ? &coupler.power_high : - Coupling == coupling::power110v ? &coupler.power_110v : - Coupling == coupling::power24v ? &coupler.power_24v : + auto const *coupling = Coupling == coupling::highvoltage ? &thiscoupler.power_high : + Coupling == coupling::power110v ? &thiscoupler.power_110v : + Coupling == coupling::power24v ? &thiscoupler.power_24v : nullptr; auto *oppositecoupling = Coupling == coupling::highvoltage ? &oppositecoupler.power_high : Coupling == coupling::power110v ? &oppositecoupler.power_110v : @@ -1885,9 +1885,9 @@ void TMoverParameters::PowerCouplersCheck(double const /*Deltatime*/, coupling c oppositecoupling->is_live = false; oppositecoupling->is_local = localpowersource; // indicate power source // draw from external source - if (coupler.Connected != nullptr) + if (thiscoupler.Connected != nullptr) { - auto const &connectedcoupler{coupler.Connected->Couplers[coupler.ConnectedNr]}; + auto const &connectedcoupler{thiscoupler.Connected->Couplers[thiscoupler.ConnectedNr]}; auto const *connectedcoupling = Coupling == coupling::highvoltage ? &connectedcoupler.power_high : Coupling == coupling::power110v ? &connectedcoupler.power_110v : Coupling == coupling::power24v ? &connectedcoupler.power_24v : @@ -1934,21 +1934,21 @@ void TMoverParameters::PowerCouplersCheck(double const /*Deltatime*/, coupling c Coupling == coupling::power24v ? &PowerCircuits[0].second : nullptr; - for (auto &coupler : Couplers) + for (auto &thiscoupler : Couplers) { - auto *coupling = Coupling == coupling::highvoltage ? &coupler.power_high : - Coupling == coupling::power110v ? &coupler.power_110v : - Coupling == coupling::power24v ? &coupler.power_24v : + auto *coupling = Coupling == coupling::highvoltage ? &thiscoupler.power_high : + Coupling == coupling::power110v ? &thiscoupler.power_110v : + Coupling == coupling::power24v ? &thiscoupler.power_24v : nullptr; coupling->current = 0.0; - if (coupler.Connected == nullptr) + if (thiscoupler.Connected == nullptr) { continue; } - auto const &connectedothercoupler{coupler.Connected->Couplers[coupler.ConnectedNr == end::front ? end::rear : end::front]}; + auto const &connectedothercoupler{thiscoupler.Connected->Couplers[thiscoupler.ConnectedNr == end::front ? end::rear : end::front]}; auto const *connectedothercoupling = Coupling == coupling::highvoltage ? &connectedothercoupler.power_high : Coupling == coupling::power110v ? &connectedothercoupler.power_110v : Coupling == coupling::power24v ? &connectedothercoupler.power_24v : @@ -3983,10 +3983,10 @@ bool TMoverParameters::DynamicBrakeSwitch(bool Switch) { DynamicBrakeFlag = Switch; DBS = true; - for (auto &coupler : Couplers) + for (auto &thiscoupler : Couplers) // with Couplers[b] do - if (TestFlag(coupler.CouplingFlag, coupling::control)) - coupler.Connected->DynamicBrakeFlag = Switch; + if (TestFlag(thiscoupler.CouplingFlag, coupling::control)) + thiscoupler.Connected->DynamicBrakeFlag = Switch; // end; // if (DynamicBrakeType=dbrake_passive) and (TrainType=dt_ET42) then // begin @@ -5165,7 +5165,7 @@ double TMoverParameters::BrakeForce(TTrackParam const & /*Track*/) { double K{0}; - double Fb{0}; + double brakeforce{0}; switch (LocalBrake) { @@ -5222,11 +5222,11 @@ double TMoverParameters::BrakeForce(TTrackParam const & /*Track*/) // Fb:=UnitBrakeForce*NBpA {ham. reczny dziala na jedna os} // else //yB: to nie do konca ma sens, ponieważ ręczny w wagonie działa na jeden cylinder // hamulcowy/wózek, dlatego potrzebne są oddzielnie liczone osie - Fb = UnitBrakeForce * NBrakeAxles * std::max(1, NBpA); + brakeforce = UnitBrakeForce * NBrakeAxles * std::max(1, NBpA); // u:=((BrakePress*P2FTrans)-BrakeCylSpring*BrakeCylMult[BCMFlag]/BrakeCylNo-0.83*BrakeSlckAdj/(BrakeCylNo))*BrakeCylNo; // { end; } - return Fb; + return brakeforce; } // ************************************************************************************************* @@ -5306,7 +5306,7 @@ double TMoverParameters::Adhesive(double staticfriction) const double TMoverParameters::CouplerForce(int const End, double dt) { - auto &coupler{Couplers[End]}; + auto &thiscoupler{Couplers[End]}; auto *othervehicle{Neighbours[End].vehicle->MoverParameters}; auto const otherend{Neighbours[End].vehicle_end}; auto &othercoupler{othervehicle->Couplers[otherend]}; @@ -5321,81 +5321,81 @@ double TMoverParameters::CouplerForce(int const End, double dt) auto const absdV{std::abs(dV)}; // potentially generate sounds on clash or stretch - if (newdistance < 0.0 && coupler.Dist > newdistance && dV < -0.1 && false == coupler.has_adapter()) + if (newdistance < 0.0 && thiscoupler.Dist > newdistance && dV < -0.1 && false == thiscoupler.has_adapter()) { // HACK: with adapter present we presume buffers won't clash // 090503: dzwieki pracy zderzakow - SetFlag(coupler.sounds, absdV > 5.0 ? sound::bufferclash | sound::loud : sound::bufferclash); + SetFlag(thiscoupler.sounds, absdV > 5.0 ? sound::bufferclash | sound::loud : sound::bufferclash); } - else if (coupler.CouplingFlag != coupling::faux && newdistance > 0.001 && coupler.Dist <= 0.001 && absdV > 0.005 && Vel > 1.0) + else if (thiscoupler.CouplingFlag != coupling::faux && newdistance > 0.001 && thiscoupler.Dist <= 0.001 && absdV > 0.005 && Vel > 1.0) { // 090503: dzwieki pracy sprzegu - SetFlag(coupler.sounds, absdV > 0.035 ? sound::couplerstretch | sound::loud : sound::couplerstretch); + SetFlag(thiscoupler.sounds, absdV > 0.035 ? sound::couplerstretch | sound::loud : sound::couplerstretch); } - coupler.CheckCollision = false; - coupler.Dist = 0.0; + thiscoupler.CheckCollision = false; + thiscoupler.Dist = 0.0; double CF{0.0}; - if (coupler.CouplingFlag == coupling::faux && initialdistance > 0.05) + if (thiscoupler.CouplingFlag == coupling::faux && initialdistance > 0.05) { // arbitrary distance // potentially reset auto coupling lock - coupler.AutomaticCouplingAllowed = true; + thiscoupler.AutomaticCouplingAllowed = true; } - if (coupler.CouplingFlag != coupling::faux || initialdistance < 0) + if (thiscoupler.CouplingFlag != coupling::faux || initialdistance < 0) { - coupler.Dist = std::clamp(newdistance, coupler.has_adapter() ? 0 : -coupler.DmaxB, coupler.DmaxC); + thiscoupler.Dist = std::clamp(newdistance, thiscoupler.has_adapter() ? 0 : -thiscoupler.DmaxB, thiscoupler.DmaxC); double BetaAvg = 0; double Fmax = 0; - if (coupler.CouplingFlag == coupling::faux) + if (thiscoupler.CouplingFlag == coupling::faux) { - BetaAvg = coupler.beta; - Fmax = (coupler.FmaxC + coupler.FmaxB) * CouplerTune; + BetaAvg = thiscoupler.beta; + Fmax = (thiscoupler.FmaxC + thiscoupler.FmaxB) * CouplerTune; } else { // usrednij bo wspolny sprzeg - BetaAvg = 0.5 * (coupler.beta + othercoupler.beta); - Fmax = 0.5 * (coupler.FmaxC + coupler.FmaxB + othercoupler.FmaxC + othercoupler.FmaxB) * CouplerTune; + BetaAvg = 0.5 * (thiscoupler.beta + othercoupler.beta); + Fmax = 0.5 * (thiscoupler.FmaxC + thiscoupler.FmaxB + othercoupler.FmaxC + othercoupler.FmaxB) * CouplerTune; } - auto const distDelta{std::abs(newdistance) - std::abs(coupler.Dist)}; // McZapkie-191103: poprawka na histereze + auto const distDelta{std::abs(newdistance) - std::abs(thiscoupler.Dist)}; // McZapkie-191103: poprawka na histereze if (newdistance > 0) { if (distDelta > 0) { - CF = -(coupler.SpringKC + othercoupler.SpringKC) * coupler.Dist / 2.0 * DirF(End) - Fmax * dV * BetaAvg; + CF = -(thiscoupler.SpringKC + othercoupler.SpringKC) * thiscoupler.Dist / 2.0 * DirF(End) - Fmax * dV * BetaAvg; } else { - CF = -(coupler.SpringKC + othercoupler.SpringKC) * coupler.Dist / 2.0 * DirF(End) * BetaAvg - Fmax * dV * BetaAvg; + CF = -(thiscoupler.SpringKC + othercoupler.SpringKC) * thiscoupler.Dist / 2.0 * DirF(End) * BetaAvg - Fmax * dV * BetaAvg; } // liczenie sily ze sprezystosci sprzegu - if (newdistance > coupler.DmaxC + othercoupler.DmaxC) + if (newdistance > thiscoupler.DmaxC + othercoupler.DmaxC) { // zderzenie - coupler.CheckCollision = true; + thiscoupler.CheckCollision = true; } - if (std::abs(CF) > coupler.FmaxC) + if (std::abs(CF) > thiscoupler.FmaxC) { // coupler is stretched with excessive force, may break - coupler.stretch_duration += static_cast(dt); + thiscoupler.stretch_duration += static_cast(dt); // give coupler 1 sec of leeway to account for simulation glitches, before checking whether it breaks // (arbitrary) chance to break grows from 10-100% over 10 sec period - if (Global.crash_damage && coupler.stretch_duration > 1.f && Random() < coupler.stretch_duration * 0.1f * dt) + if (Global.crash_damage && thiscoupler.stretch_duration > 1.f && Random() < thiscoupler.stretch_duration * 0.1f * dt) { damage_coupler(End); } } else { - coupler.stretch_duration = 0.f; + thiscoupler.stretch_duration = 0.f; } } if (newdistance < 0) @@ -5403,29 +5403,29 @@ double TMoverParameters::CouplerForce(int const End, double dt) if (distDelta > 0) { - CF = -(coupler.SpringKB + othercoupler.SpringKB) * coupler.Dist / 2.0 * DirF(End) - Fmax * dV * BetaAvg; + CF = -(thiscoupler.SpringKB + othercoupler.SpringKB) * thiscoupler.Dist / 2.0 * DirF(End) - Fmax * dV * BetaAvg; } else { - CF = -(coupler.SpringKB + othercoupler.SpringKB) * coupler.Dist / 2.0 * DirF(End) * BetaAvg - Fmax * dV * BetaAvg; + CF = -(thiscoupler.SpringKB + othercoupler.SpringKB) * thiscoupler.Dist / 2.0 * DirF(End) * BetaAvg - Fmax * dV * BetaAvg; } // liczenie sily ze sprezystosci zderzaka - auto const collisiondistance{(coupler.has_adapter() || othercoupler.has_adapter() ? - std::min(coupler.DmaxB, othercoupler.DmaxB) : // HACK: only take into account buffering ability of automatic coupler - coupler.DmaxB + othercoupler.DmaxB)}; + auto const collisiondistance{(thiscoupler.has_adapter() || othercoupler.has_adapter() ? + std::min(thiscoupler.DmaxB, othercoupler.DmaxB) : // HACK: only take into account buffering ability of automatic coupler + thiscoupler.DmaxB + othercoupler.DmaxB)}; if (-newdistance > collisiondistance) { // zderzenie - coupler.CheckCollision = true; + thiscoupler.CheckCollision = true; } - if (-newdistance >= std::min(collisiondistance, dEpsilon) && coupler.type() == TCouplerType::Automatic && coupler.type() == othercoupler.type() && coupler.CouplingFlag == coupling::faux && - coupler.AutomaticCouplingAllowed && + if (-newdistance >= std::min(collisiondistance, dEpsilon) && thiscoupler.type() == TCouplerType::Automatic && thiscoupler.type() == othercoupler.type() && thiscoupler.CouplingFlag == coupling::faux && + thiscoupler.AutomaticCouplingAllowed && othercoupler.AutomaticCouplingAllowed) { // sprzeganie wagonow z samoczynnymi sprzegami - auto couplingtype{coupler.AutomaticCouplingFlag & othercoupler.AutomaticCouplingFlag}; + auto couplingtype{thiscoupler.AutomaticCouplingFlag & othercoupler.AutomaticCouplingFlag}; // potentially exclude incompatible control coupling - if (coupler.control_type != othercoupler.control_type) + if (thiscoupler.control_type != othercoupler.control_type) { couplingtype &= ~coupling::control; } @@ -5434,7 +5434,7 @@ double TMoverParameters::CouplerForce(int const End, double dt) { // HACK: we're reusing sound enum to mark whether vehicle was connected to another SetFlag(AIFlag, sound::attachcoupler); - coupler.AutomaticCouplingAllowed = false; + thiscoupler.AutomaticCouplingAllowed = false; othercoupler.AutomaticCouplingAllowed = false; } /* @@ -5445,7 +5445,7 @@ double TMoverParameters::CouplerForce(int const End, double dt) } } - if (coupler.CouplingFlag != coupling::faux) + if (thiscoupler.CouplingFlag != coupling::faux) { // uzgadnianie prawa Newtona othervehicle->Couplers[1 - End].CForce = -CF; @@ -6569,9 +6569,9 @@ bool TMoverParameters::FuseFlagCheck(void) const if (Power > 0.01) FFC = FuseFlag; else // pobor pradu jezeli niema mocy - for (auto &coupler : Couplers) - if (TestFlag(coupler.CouplingFlag, coupling::control) && coupler.Connected->Power > 0.01) - FFC = coupler.Connected->FuseFlagCheck(); + for (auto &thiscoupler : Couplers) + if (TestFlag(thiscoupler.CouplingFlag, coupling::control) && thiscoupler.Connected->Power > 0.01) + FFC = thiscoupler.Connected->FuseFlagCheck(); return FFC; } @@ -6799,9 +6799,9 @@ bool TMoverParameters::ResistorsFlagCheck(void) const RFC = ResistorsFlag; else // pobor pradu jezeli niema mocy { - for (auto &coupler : Couplers) - if (TestFlag(coupler.CouplingFlag, coupling::control) && coupler.Connected->Power > 0.01) - RFC = coupler.Connected->ResistorsFlagCheck(); + for (auto &thiscoupler : Couplers) + if (TestFlag(thiscoupler.CouplingFlag, coupling::control) && thiscoupler.Connected->Power > 0.01) + RFC = thiscoupler.Connected->ResistorsFlagCheck(); } return RFC; } @@ -7974,7 +7974,7 @@ double TMoverParameters::dizel_fillcheck(int mcp, double dt) // Q: 20160715 // Oblicza moment siły wytwarzany przez silnik spalinowy // ************************************************************************************************* -double TMoverParameters::dizel_Momentum(double dizel_fill, double n, double dt) +double TMoverParameters::dizel_Momentum(double Fill, double n, double dt) { // liczy moment sily wytwarzany przez silnik spalinowy} double Moment = 0; double enMoment = 0; @@ -7997,14 +7997,14 @@ double TMoverParameters::dizel_Momentum(double dizel_fill, double n, double dt) { if (dizel_Momentum_Table.size() > 1) { - Moment = TableInterpolation(dizel_Momentum_Table, enrot) * dizel_fill - dizel_Mstand; + Moment = TableInterpolation(dizel_Momentum_Table, enrot) * Fill - dizel_Mstand; } else { - Moment = (dizel_Mmax - (dizel_Mmax - dizel_Mnmax) * square((enrot - dizel_nMmax) / (dizel_nMmax - dizel_nmax))) * dizel_fill - dizel_Mstand; + Moment = (dizel_Mmax - (dizel_Mmax - dizel_Mnmax) * square((enrot - dizel_nMmax) / (dizel_nMmax - dizel_nmax))) * Fill - dizel_Mstand; } Mm = Moment; - dizel_FuelConsumptionActual = dizel_FuelConsumption * enrot * dizel_fill; + dizel_FuelConsumptionActual = dizel_FuelConsumption * enrot * Fill; dizel_FuelConsumptedTotal += dizel_FuelConsumptionActual * dt / 3600.0; if (hydro_R && hydro_R_Placement == 2) Moment -= dizel_MomentumRetarder(enrot, dt); @@ -8375,10 +8375,10 @@ void TMoverParameters::dizel_Heat(double const dt) */ } -bool TMoverParameters::AssignLoad(std::string const &Name, float const Amount) +bool TMoverParameters::AssignLoad(std::string const &Loadname, float const Amount) { - if (Name == "pantstate") + if (Loadname == "pantstate") { if (EnginePowerSource.SourceType == TPowerSource::CurrentCollector) { @@ -8418,27 +8418,27 @@ bool TMoverParameters::AssignLoad(std::string const &Name, float const Amount) } } - if (Name.empty()) + if (Loadname.empty()) { // empty the vehicle if requested - LoadTypeChange = LoadType.name != Name; + LoadTypeChange = LoadType.name != Loadname; LoadType = load_attributes(); LoadAmount = 0.f; return true; } // can't mix load types, at least for the time being - if (LoadAmount > 0 && LoadType.name != Name) + if (LoadAmount > 0 && LoadType.name != Loadname) { return false; } - auto const loadattributes = std::ranges::find_if(LoadAttributes, [&](auto const &attributes) { return attributes.name == Name; }); + auto const loadattributes = std::ranges::find_if(LoadAttributes, [&](auto const &attributes) { return attributes.name == Loadname; }); if (loadattributes == std::end(LoadAttributes)) { // didn't find matching load configuration, this type is unsupported return false; } - LoadTypeChange = LoadType.name != Name; + LoadTypeChange = LoadType.name != Loadname; LoadType = *loadattributes; LoadAmount = std::clamp(Amount, 0.f, MaxLoad); ComputeMass(); @@ -8936,14 +8936,14 @@ double TMoverParameters::GetTrainsetVoltage(int const Coupling) const { continue; } - auto const &coupler{Couplers[end]}; - if (auto const fullcoupling{coupler.CouplingFlag | (TestFlag(coupler.CouplingFlag, coupler.PowerCoupling) ? coupler.PowerFlag : 0)}; (fullcoupling & Coupling) == 0) + auto const &thiscoupler{Couplers[end]}; + if (auto const fullcoupling{thiscoupler.CouplingFlag | (TestFlag(thiscoupler.CouplingFlag, thiscoupler.PowerCoupling) ? thiscoupler.PowerFlag : 0)}; (fullcoupling & Coupling) == 0) { continue; } - auto *connectedpowercoupling = (Coupling & (coupling::highvoltage | coupling::heating)) != 0 ? &coupler.Connected->Couplers[coupler.ConnectedNr].power_high : - (Coupling & coupling::power110v) != 0 ? &coupler.Connected->Couplers[coupler.ConnectedNr].power_110v : - (Coupling & coupling::power24v) != 0 ? &coupler.Connected->Couplers[coupler.ConnectedNr].power_24v : + auto *connectedpowercoupling = (Coupling & (coupling::highvoltage | coupling::heating)) != 0 ? &thiscoupler.Connected->Couplers[thiscoupler.ConnectedNr].power_high : + (Coupling & coupling::power110v) != 0 ? &thiscoupler.Connected->Couplers[thiscoupler.ConnectedNr].power_110v : + (Coupling & coupling::power24v) != 0 ? &thiscoupler.Connected->Couplers[thiscoupler.ConnectedNr].power_24v : nullptr; if (connectedpowercoupling != nullptr && connectedpowercoupling->is_live) { @@ -10613,59 +10613,59 @@ void TMoverParameters::LoadFIZ_Doors(std::string const &line) void TMoverParameters::LoadFIZ_BuffCoupl(std::string const &line, int const Index) { - TCoupling *coupler; + TCoupling *thiscoupler; if (Index == 2) { - coupler = &Couplers[1]; + thiscoupler = &Couplers[1]; } else { - coupler = &Couplers[0]; + thiscoupler = &Couplers[0]; } std::map couplertypes{ {"Automatic", TCouplerType::Automatic}, {"Screw", TCouplerType::Screw}, {"Chain", TCouplerType::Chain}, {"Bare", TCouplerType::Bare}, {"Articulated", TCouplerType::Articulated}, }; auto lookup = couplertypes.find(extract_value("CType", line)); - coupler->CouplerType = lookup != couplertypes.end() ? lookup->second : TCouplerType::NoCoupler; + thiscoupler->CouplerType = lookup != couplertypes.end() ? lookup->second : TCouplerType::NoCoupler; - extract_value(coupler->SpringKC, "kC", line, ""); - extract_value(coupler->DmaxC, "DmaxC", line, ""); - extract_value(coupler->FmaxC, "FmaxC", line, ""); - extract_value(coupler->SpringKB, "kB", line, ""); - extract_value(coupler->DmaxB, "DmaxB", line, ""); - extract_value(coupler->FmaxB, "FmaxB", line, ""); - extract_value(coupler->beta, "beta", line, ""); - extract_value(coupler->AutomaticCouplingFlag, "AutomaticFlag", line, ""); - extract_value(coupler->AllowedFlag, "AllowedFlag", line, ""); - if (coupler->AllowedFlag < 0) + extract_value(thiscoupler->SpringKC, "kC", line, ""); + extract_value(thiscoupler->DmaxC, "DmaxC", line, ""); + extract_value(thiscoupler->FmaxC, "FmaxC", line, ""); + extract_value(thiscoupler->SpringKB, "kB", line, ""); + extract_value(thiscoupler->DmaxB, "DmaxB", line, ""); + extract_value(thiscoupler->FmaxB, "FmaxB", line, ""); + extract_value(thiscoupler->beta, "beta", line, ""); + extract_value(thiscoupler->AutomaticCouplingFlag, "AutomaticFlag", line, ""); + extract_value(thiscoupler->AllowedFlag, "AllowedFlag", line, ""); + if (thiscoupler->AllowedFlag < 0) { - coupler->AllowedFlag = -coupler->AllowedFlag | coupling::permanent; + thiscoupler->AllowedFlag = -thiscoupler->AllowedFlag | coupling::permanent; } - extract_value(coupler->PowerCoupling, "PowerCoupling", line, ""); - extract_value(coupler->PowerFlag, "PowerFlag", line, ""); - extract_value(coupler->control_type, "ControlType", line, ""); + extract_value(thiscoupler->PowerCoupling, "PowerCoupling", line, ""); + extract_value(thiscoupler->PowerFlag, "PowerFlag", line, ""); + extract_value(thiscoupler->control_type, "ControlType", line, ""); - if (coupler->CouplerType != TCouplerType::NoCoupler && coupler->CouplerType != TCouplerType::Bare && coupler->CouplerType != TCouplerType::Articulated) + if (thiscoupler->CouplerType != TCouplerType::NoCoupler && thiscoupler->CouplerType != TCouplerType::Bare && thiscoupler->CouplerType != TCouplerType::Articulated) { - coupler->SpringKC *= 1000; - coupler->FmaxC *= 1000; - coupler->SpringKB *= 1000; - coupler->FmaxB *= 1000; + thiscoupler->SpringKC *= 1000; + thiscoupler->FmaxC *= 1000; + thiscoupler->SpringKB *= 1000; + thiscoupler->FmaxB *= 1000; } - else if (coupler->CouplerType == TCouplerType::Bare) + else if (thiscoupler->CouplerType == TCouplerType::Bare) { - coupler->SpringKC = 50.0 * Mass + Ftmax / 0.05; - coupler->DmaxC = 0.05; - coupler->FmaxC = 100.0 * Mass + 2 * Ftmax; - coupler->SpringKB = 60.0 * Mass + Ftmax / 0.05; - coupler->DmaxB = 0.05; - coupler->FmaxB = 50.0 * Mass + 2.0 * Ftmax; - coupler->beta = 0.3; + thiscoupler->SpringKC = 50.0 * Mass + Ftmax / 0.05; + thiscoupler->DmaxC = 0.05; + thiscoupler->FmaxC = 100.0 * Mass + 2 * Ftmax; + thiscoupler->SpringKB = 60.0 * Mass + Ftmax / 0.05; + thiscoupler->DmaxB = 0.05; + thiscoupler->FmaxB = 50.0 * Mass + 2.0 * Ftmax; + thiscoupler->beta = 0.3; } - else if (coupler->CouplerType == TCouplerType::Articulated) + else if (thiscoupler->CouplerType == TCouplerType::Articulated) { /* coupler->SpringKC = 60.0 * Mass + 1000; @@ -10676,13 +10676,13 @@ void TMoverParameters::LoadFIZ_BuffCoupl(std::string const &line, int const Inde coupler->FmaxB = 4000000.0 + 2.0 * Ftmax; coupler->beta = 0.55; */ - coupler->SpringKC = 4500 * 1000; - coupler->DmaxC = 0.05; - coupler->FmaxC = 850 * 1000; - coupler->SpringKB = 9200 * 1000; - coupler->DmaxB = 0.05; - coupler->FmaxB = 320 * 1000; - coupler->beta = 0.55; + thiscoupler->SpringKC = 4500 * 1000; + thiscoupler->DmaxC = 0.05; + thiscoupler->FmaxC = 850 * 1000; + thiscoupler->SpringKB = 9200 * 1000; + thiscoupler->DmaxB = 0.05; + thiscoupler->FmaxB = 320 * 1000; + thiscoupler->beta = 0.55; } if (Index == 0) @@ -11656,12 +11656,12 @@ void TMoverParameters::LoadFIZ_PowerParamsDecode(TPowerParameters &Powerparamete } } -TPowerType TMoverParameters::LoadFIZ_PowerDecode(std::string const &Power) const +TPowerType TMoverParameters::LoadFIZ_PowerDecode(std::string const &Powertype) const { std::map powertypes{ {"BioPower", TPowerType::BioPower}, {"MechPower", TPowerType::MechPower}, {"ElectricPower", TPowerType::ElectricPower}, {"SteamPower", TPowerType::SteamPower}}; - auto lookup = powertypes.find(Power); + auto lookup = powertypes.find(Powertype); return lookup != powertypes.end() ? lookup->second : TPowerType::NoPower; } @@ -12489,13 +12489,13 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV else if (Command == "DoorPermit") { - auto const left{CValue2 > 0 ? 1 : 2}; + auto const leftside{CValue2 > 0 ? 1 : 2}; - if (auto const right{3 - left}; std::abs(static_cast(CValue1)) & right) + if (auto const rightside{3 - leftside}; std::abs(static_cast(CValue1)) & rightside) { PermitDoors_(side::right, CValue1 > 0); } - if (std::abs(static_cast(CValue1)) & left) + if (std::abs(static_cast(CValue1)) & leftside) { PermitDoors_(side::left, CValue1 > 0); } @@ -12508,15 +12508,15 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV if ((Doors.open_control == control_t::conductor || Doors.open_control == control_t::driver || Doors.open_control == control_t::mixed) && (Power24vIsAvailable || Power110vIsAvailable)) { - auto const left{CValue2 > 0 ? 1 : 2}; - auto const right{3 - left}; + auto const leftside{CValue2 > 0 ? 1 : 2}; + auto const rightside{3 - leftside}; - if (static_cast(CValue1) & right) + if (static_cast(CValue1) & rightside) { Doors.instances[side::right].remote_open = true; Doors.instances[side::right].remote_close = false; } - if (static_cast(CValue1) & left) + if (static_cast(CValue1) & leftside) { Doors.instances[side::left].remote_open = true; Doors.instances[side::left].remote_close = false; @@ -12530,15 +12530,15 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV if ((Doors.close_control == control_t::conductor || Doors.close_control == control_t::driver || Doors.close_control == control_t::mixed) && (Power24vIsAvailable || Power110vIsAvailable)) { - auto const left{CValue2 > 0 ? 1 : 2}; - auto const right{3 - left}; + auto const leftside{CValue2 > 0 ? 1 : 2}; + auto const rightside{3 - leftside}; - if (static_cast(CValue1) & right) + if (static_cast(CValue1) & rightside) { Doors.instances[side::right].remote_close = true; Doors.instances[side::right].remote_open = false; } - if (static_cast(CValue1) & left) + if (static_cast(CValue1) & leftside) { Doors.instances[side::left].remote_close = true; Doors.instances[side::left].remote_open = false; diff --git a/application/driveruipanels.cpp b/application/driveruipanels.cpp index 18175193..4d8e5152 100644 --- a/application/driveruipanels.cpp +++ b/application/driveruipanels.cpp @@ -52,7 +52,7 @@ drivingaid_panel::update() { || controlled->Mechanik == nullptr ) { return; } auto const *mover = controlled->MoverParameters; - auto const *driver = controlled->Mechanik; + auto const *vehicledriver = controlled->Mechanik; auto const *owner = controlled->ctOwner != nullptr ? controlled->ctOwner : controlled->Mechanik; { // throttle, velocity, speed limits and grade @@ -140,8 +140,8 @@ drivingaid_panel::update() { std::snprintf( m_buffer.data(), m_buffer.size(), STR_C("Throttle: %3d+%d %c%s"), - mover->EIMCtrlType > 0 ? std::max(0, static_cast(100.4 * mover->eimic_real)) : driver->Controlling()->MainCtrlPos, - mover->EIMCtrlType > 0 ? driver->Controlling()->MainCtrlPos : driver->Controlling()->ScndCtrlPos, + mover->EIMCtrlType > 0 ? std::max(0, static_cast(100.4 * mover->eimic_real)) : vehicledriver->Controlling()->MainCtrlPos, + mover->EIMCtrlType > 0 ? vehicledriver->Controlling()->MainCtrlPos : vehicledriver->Controlling()->ScndCtrlPos, mover->SpeedCtrlUnit.IsActive ? 'T' : mover->DirActive > 0 ? 'D' : mover->DirActive < 0 ? 'R' : @@ -569,8 +569,8 @@ debug_panel::render() { // sections ImGui::Separator(); if (true == render_section( "Vehicle", m_vehiclelines ) && DebugModeFlag && m_input.mover && m_input.mover->DamageFlag != 0 && true == ImGui::Button( "Stop and repair consist" )) { - command_relay relay; - relay.post(user_command::resetconsist, 0.0, 0.0, GLFW_PRESS, 0, glm::vec3(0.0f), &m_input.vehicle->name()); + command_relay commandrelay; + commandrelay.post(user_command::resetconsist, 0.0, 0.0, GLFW_PRESS, 0, glm::vec3(0.0f), &m_input.vehicle->name()); } render_section( "Vehicle Engine", m_enginelines ); render_section( "Vehicle AI", m_ailines ); @@ -601,8 +601,8 @@ debug_panel::render() { ImGui::Separator(); bool flag = DebugModeFlag; if (ImGui::Checkbox("Debug Mode", &flag)) { - command_relay relay; - relay.post(user_command::debugtoggle, 0.0, 0.0, GLFW_RELEASE, 0); + command_relay commandrelay; + commandrelay.post(user_command::debugtoggle, 0.0, 0.0, GLFW_RELEASE, 0); } } @@ -623,8 +623,8 @@ debug_panel::render_section_scenario() { auto fogrange = std::log( Global.fFogEnd ); if( ImGui::SliderFloat( ( to_string( std::exp( fogrange ), 0, 5 ) + " m###fogend" ).c_str(), &fogrange, std::log( 10.0f ), std::log( 50000.0f ), "Fog distance" ) ) { - command_relay relay; - relay.post( + command_relay commandrelay; + commandrelay.post( user_command::setweather, std::clamp( std::exp( fogrange ), 10.0f, 50000.0f ), Global.Overcast, @@ -637,8 +637,8 @@ debug_panel::render_section_scenario() { (to_string(Airtemperature, 1) + " deg C###Airtemperature").c_str(), &Airtemperature, -35.0f, 40.0f, "Air Temperature")) { - command_relay relay; - relay.post( + command_relay commandrelay; + commandrelay.post( user_command::settemperature, std::clamp(Airtemperature, -35.0f, 40.0f), Global.Overcast, @@ -649,8 +649,8 @@ debug_panel::render_section_scenario() { { if( ImGui::SliderFloat( ( to_string( Global.Overcast, 2, 5 ) + " (" + Global.Weather + ")###overcast" ).c_str(), &Global.Overcast, 0.0f, 2.0f, "Cloud cover" ) ) { - command_relay relay; - relay.post( + command_relay commandrelay; + commandrelay.post( user_command::setweather, Global.fFogEnd, std::clamp( Global.Overcast, 0.0f, 2.0f ), @@ -661,8 +661,8 @@ debug_panel::render_section_scenario() { { if( ImGui::SliderFloat( ( to_string( Global.fMoveLight, 0, 5 ) + " (" + Global.Season + ")###movelight" ).c_str(), &Global.fMoveLight, 0.0f, 364.0f, "Day of year" ) ) { - command_relay relay; - relay.post( + command_relay commandrelay; + commandrelay.post( user_command::setdatetime, std::clamp( Global.fMoveLight, 0.0f, 365.0f ), simulation::Time.data().wHour * 60 + simulation::Time.data().wMinute, @@ -687,8 +687,8 @@ debug_panel::render_section_scenario() { + ":" + std::string( std::to_string( int( 100 + simulation::Time.data().wMinute ) ).substr( 1, 2 ) ) ) }; if( ImGui::SliderInt( ( timestring + " (" + Global.Period + ")###simulationtime" ).c_str(), &time, 0, 1439, "Time of day" ) ) { - command_relay relay; - relay.post( + command_relay commandrelay; + commandrelay.post( user_command::setdatetime, Global.fMoveLight, std::clamp( time, 0, 1439 ), @@ -1314,36 +1314,36 @@ debug_panel::update_section_eventqueue( std::vector &Output ) { // current event queue auto const time { Timer::GetTime() }; - auto const *event { simulation::Events.begin() }; + auto const *queuedevent { simulation::Events.begin() }; auto const searchfilter { std::string( m_eventsearch.data() ) }; Output.emplace_back( "Delay: Event:", Global.UITextColor ); - while( event != nullptr + while( queuedevent != nullptr && Output.size() < 30 ) { - if( false == event->m_ignored - && false == event->m_passive + if( false == queuedevent->m_ignored + && false == queuedevent->m_passive && ( false == m_eventqueueactivevehicleonly - || event->m_activator == m_input.vehicle ) ) { + || queuedevent->m_activator == m_input.vehicle ) ) { - auto const label { event->m_name + ( event->m_activator ? " (by: " + event->m_activator->asName + ")" : "" ) }; + auto const label { queuedevent->m_name + ( queuedevent->m_activator ? " (by: " + queuedevent->m_activator->asName + ")" : "" ) }; if( false == searchfilter.empty() && false == contains(label, searchfilter) ) { - event = event->m_next; + queuedevent = queuedevent->m_next; continue; } - auto const delay { " " + to_string( std::max( 0.0, event->m_launchtime - time ), 1 ) }; + auto const delay { " " + to_string( std::max( 0.0, queuedevent->m_launchtime - time ), 1 ) }; textline = delay.substr( delay.length() - 6 ) + " " - + label + ( event->m_sibling ? " (joint event)" : "" ); + + label + ( queuedevent->m_sibling ? " (joint event)" : "" ); Output.emplace_back( textline, Global.UITextColor ); } - event = event->m_next; + queuedevent = queuedevent->m_next; } if( Output.size() == 1 ) { // event queue can be empty either because no event got through active filters, or because it is genuinely empty @@ -1569,8 +1569,8 @@ debug_panel::render_section_settings() const { if (simulation::Train) { float val = simulation::Train->get_radiovolume(); if( ImGui::SliderFloat( ( std::to_string( static_cast( val * 100 ) ) + "%###volumeradio" ).c_str(), &val, 0.0f, 1.0f, "Vehicle radio volume" ) ) { - command_relay relay; - relay.post(user_command::radiovolumeset, val, 0.0, GLFW_PRESS, 0); + command_relay commandrelay; + commandrelay.post(user_command::radiovolumeset, val, 0.0, GLFW_PRESS, 0); } } diff --git a/gl/query.cpp b/gl/query.cpp index ab58f0cf..148d2ce2 100644 --- a/gl/query.cpp +++ b/gl/query.cpp @@ -49,7 +49,7 @@ std::optional gl::query::result() return std::nullopt; } -GLenum gl::query::glenum_target(targets target) const +GLenum gl::query::glenum_target(targets Target) const { static GLenum mapping[6] = { @@ -60,7 +60,7 @@ GLenum gl::query::glenum_target(targets target) const GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, GL_TIME_ELAPSED }; - return mapping[target]; + return mapping[Target]; } thread_local gl::query* gl::query::active_queries[6]; diff --git a/gl/shader.cpp b/gl/shader.cpp index ad9f72c5..4e357777 100644 --- a/gl/shader.cpp +++ b/gl/shader.cpp @@ -198,7 +198,7 @@ void gl::shader::parse_texture_entries(std::string &str) std::istringstream ss(str.substr(fp + 1, fe - fp - 1)); std::string token; - std::string name; + std::string uniformname; texture_entry conf; size_t arg = 0; @@ -206,7 +206,7 @@ void gl::shader::parse_texture_entries(std::string &str) { std::istringstream token_ss(token); if (arg == 0) - token_ss >> name; + token_ss >> uniformname; else if (arg == 1) token_ss >> conf.id; else if (arg == 2) @@ -223,12 +223,12 @@ void gl::shader::parse_texture_entries(std::string &str) if (arg == 3) { - if (name.empty()) + if (uniformname.empty()) log_error("empty name"); else if (conf.id >= gl::MAX_TEXTURES) log_error("invalid texture binding: " + std::to_string(conf.id)); else - texture_conf.try_emplace(name, conf); + texture_conf.try_emplace(uniformname, conf); } else log_error("invalid argument count to #texture"); @@ -252,7 +252,7 @@ void gl::shader::parse_param_entries(std::string &str) std::istringstream ss(str.substr(fp + 1, fe - fp - 1)); std::string token; - std::string name; + std::string uniformname; param_entry conf; size_t arg = 0; @@ -260,7 +260,7 @@ void gl::shader::parse_param_entries(std::string &str) { std::istringstream token_ss(token); if (arg == 0) - token_ss >> name; + token_ss >> uniformname; else if (arg == 1) token_ss >> conf.location; else if (arg == 2) @@ -280,7 +280,7 @@ void gl::shader::parse_param_entries(std::string &str) if (arg == 5) { - if (name.empty()) + if (uniformname.empty()) log_error("empty name"); else if (conf.location >= gl::MAX_PARAMS) log_error("invalid param binding: " + std::to_string(conf.location)); @@ -289,7 +289,7 @@ void gl::shader::parse_param_entries(std::string &str) else if (conf.offset + conf.size > 4) log_error("invalid size: " + std::to_string(conf.size)); else - param_conf.try_emplace(name, conf); + param_conf.try_emplace(uniformname, conf); } else log_error("invalid argument count to #param"); diff --git a/input/drivermouseinput.cpp b/input/drivermouseinput.cpp index 1a2c0883..1b481afe 100644 --- a/input/drivermouseinput.cpp +++ b/input/drivermouseinput.cpp @@ -355,19 +355,19 @@ drivermouse_input::button( int const Button, int const Action ) { // if not release then it's press m_pickwaiting = true; GfxRenderer->Pick_Control_Callback( - [this, Button, Action, &mousecommand](TSubModel const *control, const glm::vec2 pos) { + [this, Button, Action, &mousecommand](TSubModel const *controlsubmodel, const glm::vec2 pos) { bool pickwaiting = m_pickwaiting; m_pickwaiting = false; // click on python screen if (Button == GLFW_MOUSE_BUTTON_LEFT - && control && control->screen_touch_list) { + && controlsubmodel && controlsubmodel->screen_touch_list) { - control->screen_touch_list->emplace_back(pos); + controlsubmodel->screen_touch_list->emplace_back(pos); } - auto const [leftbinding, rightbinding]{ bindings( simulation::Train->GetLabel( control ) ) }; + auto const [leftbinding, rightbinding]{ bindings( simulation::Train->GetLabel( controlsubmodel ) ) }; // if the recognized element under the cursor has a command associated with the pressed button, notify the recipient mousecommand = Button == GLFW_MOUSE_BUTTON_LEFT ? leftbinding : rightbinding; diff --git a/input/messaging.cpp b/input/messaging.cpp index 30ad02ec..7680f8b2 100644 --- a/input/messaging.cpp +++ b/input/messaging.cpp @@ -62,13 +62,13 @@ OnCommandGet(multiplayer::DaneRozkaz *pRozkaz) std::string( pRozkaz->cString + 1, (unsigned)pRozkaz->cString[0] ) + " rcvd" ); if( Global.iMultiplayer ) { - auto *event = simulation::Events.FindEvent( std::string( pRozkaz->cString + 1, (unsigned)pRozkaz->cString[0] ) ); - if (event != nullptr && (typeid(*event) == typeid(multi_event) - || typeid(*event) == typeid(lights_event) - || event->m_sibling != nullptr)) { + auto *foundevent = simulation::Events.FindEvent( std::string( pRozkaz->cString + 1, (unsigned)pRozkaz->cString[0] ) ); + if (foundevent != nullptr && (typeid(*foundevent) == typeid(multi_event) + || typeid(*foundevent) == typeid(lights_event) + || foundevent->m_sibling != nullptr)) { // tylko jawne albo niejawne Multiple - command_relay relay; - relay.post(user_command::queueevent, 0.0, 0.0, GLFW_PRESS, 0, glm::vec3(0.0f), &event->name()); + command_relay commandrelay; + commandrelay.post(user_command::queueevent, 0.0, 0.0, GLFW_PRESS, 0, glm::vec3(0.0f), &foundevent->name()); } } break; diff --git a/launcher/textures_scanner.cpp b/launcher/textures_scanner.cpp index 0a0abcb8..a3b66c40 100644 --- a/launcher/textures_scanner.cpp +++ b/launcher/textures_scanner.cpp @@ -178,14 +178,14 @@ std::shared_ptr ui::vehicles_bank::parse_meta(const std::string & std::ranges::replace(meta->photo_author, '_', ' '); if (!meta->rev_date.empty() && meta->rev_date != "?") { - std::istringstream stream(meta->rev_date); + std::istringstream datestream(meta->rev_date); std::string day; std::string month; - std::getline(stream, day, '.'); - std::getline(stream, month, '.'); + std::getline(datestream, day, '.'); + std::getline(datestream, month, '.'); - stream >> meta->rev_year; + datestream >> meta->rev_year; } return meta; diff --git a/network/backend/asio.cpp b/network/backend/asio.cpp index bc7393a1..bf493750 100644 --- a/network/backend/asio.cpp +++ b/network/backend/asio.cpp @@ -183,17 +183,17 @@ void network::tcp::client::connect() if (this->conn) return; - auto conn = std::make_shared(io_ctx, true, resume_frame_counter); - conn->set_handler(std::bind(&client::handle_message, this, conn, std::placeholders::_1)); + auto newconnection = std::make_shared(io_ctx, true, resume_frame_counter); + newconnection->set_handler(std::bind(&client::handle_message, this, newconnection, std::placeholders::_1)); asio::ip::tcp::endpoint endpoint( asio::ip::make_address(host), static_cast(port)); - conn->m_socket.open(endpoint.protocol()); - conn->m_socket.set_option(asio::ip::tcp::no_delay(true)); - conn->m_socket.async_connect(endpoint, + newconnection->m_socket.open(endpoint.protocol()); + newconnection->m_socket.set_option(asio::ip::tcp::no_delay(true)); + newconnection->m_socket.async_connect(endpoint, std::bind(&client::handle_accept, this, std::placeholders::_1)); - this->conn = conn; + this->conn = newconnection; } diff --git a/network/message.cpp b/network/message.cpp index 8e5c48f6..a87269cd 100644 --- a/network/message.cpp +++ b/network/message.cpp @@ -62,7 +62,7 @@ void network::request_command::deserialize(std::istream &stream) uint32_t sequence_size = sn_utils::ld_uint32(stream); command_queue::commanddata_sequence sequence; - for (uint32_t i = 0; i < sequence_size; i++) + for (uint32_t j = 0; j < sequence_size; j++) { command_data data; data.command = (user_command)sn_utils::ld_uint32(stream); diff --git a/network/network.cpp b/network/network.cpp index 36fac946..2d467396 100644 --- a/network/network.cpp +++ b/network/network.cpp @@ -232,17 +232,17 @@ void network::client::send_commands(command_queue::commands_map commands) const conn->send_message(msg); } -void network::client::handle_message(std::shared_ptr conn, const message &msg) +void network::client::handle_message(std::shared_ptr Connection, const message &msg) { if (msg.type >= message::TYPE_MAX) { - conn->disconnect(); + Connection->disconnect(); return; } if (msg.type == message::SERVER_HELLO) { const auto& cmd = dynamic_cast(msg); - conn->state = connection::ACTIVE; + Connection->state = connection::ACTIVE; if (!Global.ready_to_load) { Global.random_seed = cmd.seed; @@ -253,14 +253,14 @@ void network::client::handle_message(std::shared_ptr conn, const mes Global.ready_to_load = true; } else if (Global.random_seed != cmd.seed) { ErrorLog("net: seed mismatch", logtype::net); - conn->disconnect(); + Connection->disconnect(); return; } WriteLog("net: accept received", logtype::net); } - if (conn->state != connection::ACTIVE) + if (Connection->state != connection::ACTIVE) return; if (msg.type == message::FRAME_INFO) { diff --git a/scripting/lua.cpp b/scripting/lua.cpp index 58cdd41a..14ecbb75 100644 --- a/scripting/lua.cpp +++ b/scripting/lua.cpp @@ -145,10 +145,10 @@ int lua::scriptapi_event_create(lua_State *L) int lua::scriptapi_event_find(lua_State *L) { std::string name = lua_tostring(L, 1); - basic_event *event = simulation::Events.FindEvent(name); - if (event) + basic_event *foundevent = simulation::Events.FindEvent(name); + if (foundevent) { - lua_pushlightuserdata(L, event); + lua_pushlightuserdata(L, foundevent); return 1; } ErrorLog("lua: missing event: " + name); @@ -158,8 +158,8 @@ int lua::scriptapi_event_find(lua_State *L) int lua::scriptapi_event_exists(lua_State *L) { std::string name = lua_tostring(L, 1); - basic_event *event = simulation::Events.FindEvent(name); - lua_pushboolean(L, event != nullptr); + basic_event *foundevent = simulation::Events.FindEvent(name); + lua_pushboolean(L, foundevent != nullptr); return 1; } @@ -189,9 +189,9 @@ int lua::scriptapi_event_dispatch_n(lua_State *L) std::string name = lua_tostring(L, 1); auto *activator = static_cast(lua_touserdata(L, 2)); double delay = lua_tonumber(L, 3); - basic_event *event = simulation::Events.FindEvent(name); - if (event) - simulation::Events.AddToQuery(event, activator, delay); + basic_event *foundevent = simulation::Events.FindEvent(name); + if (foundevent) + simulation::Events.AddToQuery(foundevent, activator, delay); else ErrorLog("lua: missing event: " + name); return 0; diff --git a/utilities/motiontelemetry.cpp b/utilities/motiontelemetry.cpp index 21fa6961..bbd6ff06 100644 --- a/utilities/motiontelemetry.cpp +++ b/utilities/motiontelemetry.cpp @@ -73,9 +73,9 @@ void motiontelemetry::update() double dt = Timer::GetDeltaTime(); - glm::dvec3 front = t->Dynamic()->VectorFront(); + glm::dvec3 frontvector = t->Dynamic()->VectorFront(); glm::dvec3 up = t->Dynamic()->VectorUp(); - glm::dvec3 left = t->Dynamic()->VectorLeft(); + glm::dvec3 leftvector = t->Dynamic()->VectorLeft(); glm::dvec3 pos = t->Dynamic()->GetPosition(); glm::dvec3 vel = (pos - last_pos) / dt; @@ -86,18 +86,18 @@ void motiontelemetry::update() if (conf.includegravity) { glm::dvec3 gravity(0.0, 9.81, 0.0); - local_acc = glm::dvec3(-glm::dot(gravity, left), glm::dot(gravity, up), glm::dot(gravity, front)); + local_acc = glm::dvec3(-glm::dot(gravity, leftvector), glm::dot(gravity, up), glm::dot(gravity, frontvector)); } if (conf.latposbased) - local_acc.x -= glm::dot(acc, left); + local_acc.x -= glm::dot(acc, leftvector); else local_acc.x -= t->Occupied()->AccN; local_acc.y += glm::dot(acc, up) + t->Occupied()->AccVert * conf.axlebumpscale; if (conf.fwdposbased) - local_acc.z += glm::dot(acc, front); + local_acc.z += glm::dot(acc, frontvector); else local_acc.z += t->Occupied()->AccSVBased; @@ -106,16 +106,16 @@ void motiontelemetry::update() // roll calculation, maybe too complicated? // transform to left-handed - front.z *= -1; + frontvector.z *= -1; up.z *= -1; // make sure that vectors are orthonormal - glm::dvec3 oright = glm::normalize(glm::cross(up, front)); - glm::dvec3 oup = glm::cross(front, oright); + glm::dvec3 oright = glm::normalize(glm::cross(up, frontvector)); + glm::dvec3 oup = glm::cross(frontvector, oright); // right and up vector without roll - glm::dvec3 right0 = glm::normalize(glm::cross(glm::dvec3(0.0, 1.0, 0.0), front)); - glm::dvec3 up0 = glm::cross(front, right0); + glm::dvec3 right0 = glm::normalize(glm::cross(glm::dvec3(0.0, 1.0, 0.0), frontvector)); + glm::dvec3 up0 = glm::cross(frontvector, right0); double cosroll = glm::dot(up0, oup); double sinroll; @@ -127,7 +127,7 @@ void motiontelemetry::update() else sinroll = (up0.z * cosroll - oup.z) / right0.z; - glm::dvec3 rot(asin(-front.y), atan2(front.x, front.z), asin(sinroll)); + glm::dvec3 rot(asin(-frontvector.y), atan2(frontvector.x, frontvector.z), asin(sinroll)); double velocity = t->Occupied()->V; double yaw_vel = (rot.y - last_yaw) / dt; diff --git a/vehicle/Train.cpp b/vehicle/Train.cpp index 095c9360..393d5657 100644 --- a/vehicle/Train.cpp +++ b/vehicle/Train.cpp @@ -902,19 +902,19 @@ std::shared_ptr TTrain::GetTrainState(dictionary_source const dict->insert("slip_" + caridx, bSlip[i]); } // ai state data - auto const *driver{(DynamicObject->ctOwner != nullptr ? DynamicObject->ctOwner : DynamicObject->Mechanik)}; + auto const *vehicledriver{(DynamicObject->ctOwner != nullptr ? DynamicObject->ctOwner : DynamicObject->Mechanik)}; - dict->insert("velocity_desired", driver->VelDesired); - dict->insert("velroad", driver->VelRoad); - dict->insert("vellimitlast", driver->VelLimitLast); - dict->insert("velsignallast", driver->VelSignalLast); - dict->insert("velsignalnext", driver->VelSignalNext); - dict->insert("velnext", driver->VelNext); - dict->insert("actualproximitydist", driver->ActualProximityDist); + dict->insert("velocity_desired", vehicledriver->VelDesired); + dict->insert("velroad", vehicledriver->VelRoad); + dict->insert("vellimitlast", vehicledriver->VelLimitLast); + dict->insert("velsignallast", vehicledriver->VelSignalLast); + dict->insert("velsignalnext", vehicledriver->VelSignalNext); + dict->insert("velnext", vehicledriver->VelNext); + dict->insert("actualproximitydist", vehicledriver->ActualProximityDist); // train data - driver->TrainTimetable().serialize(dict.get()); - dict->insert("train_atpassengerstop", driver->IsAtPassengerStop); - dict->insert("train_length", driver->fLength); + vehicledriver->TrainTimetable().serialize(dict.get()); + dict->insert("train_atpassengerstop", vehicledriver->IsAtPassengerStop); + dict->insert("train_length", vehicledriver->fLength); // world state data dict->insert("scenario", Global.SceneryFile); dict->insert("hours", static_cast(simulation::Time.data().wHour)); @@ -1075,10 +1075,10 @@ TDynamicObject *TTrain::find_nearest_consist_vehicle(bool freefly, glm::vec3 pos if (!freefly) return DynamicObject; - auto coupler{-2}; // scan for vehicle, not any specific coupler - auto *vehicle{DynamicObject->ABuScanNearestObject(pos, DynamicObject->GetTrack(), 1, 1500, coupler)}; + auto couplerindex{-2}; // scan for vehicle, not any specific coupler + auto *vehicle{DynamicObject->ABuScanNearestObject(pos, DynamicObject->GetTrack(), 1, 1500, couplerindex)}; if (vehicle == nullptr) - vehicle = DynamicObject->ABuScanNearestObject(pos, DynamicObject->GetTrack(), -1, 1500, coupler); + vehicle = DynamicObject->ABuScanNearestObject(pos, DynamicObject->GetTrack(), -1, 1500, couplerindex); // TBD, TODO: perform owner test for the located vehicle return vehicle; } @@ -7669,15 +7669,15 @@ void TTrain::OnCommand_nearestcarcouplingincrease(TTrain *Train, command_data co if (true == Command.freefly && Command.action == GLFW_PRESS) { // tryb freefly, press only - auto coupler{-1}; - auto *vehicle{Train->DynamicObject->ABuScanNearestObject(Command.location, Train->DynamicObject->GetTrack(), 1, 1500, coupler)}; + auto couplerindex{-1}; + auto *vehicle{Train->DynamicObject->ABuScanNearestObject(Command.location, Train->DynamicObject->GetTrack(), 1, 1500, couplerindex)}; if (vehicle == nullptr) - vehicle = Train->DynamicObject->ABuScanNearestObject(Command.location, Train->DynamicObject->GetTrack(), -1, 1500, coupler); + vehicle = Train->DynamicObject->ABuScanNearestObject(Command.location, Train->DynamicObject->GetTrack(), -1, 1500, couplerindex); - if (coupler != -1 && vehicle != nullptr) + if (couplerindex != -1 && vehicle != nullptr) { - vehicle->couple(coupler); + vehicle->couple(couplerindex); } if (Train->DynamicObject->Mechanik) { @@ -7693,15 +7693,15 @@ void TTrain::OnCommand_nearestcarcouplingdisconnect(TTrain *Train, command_data if (true == Command.freefly && Command.action == GLFW_PRESS) { // tryb freefly, press only - auto coupler{-1}; - auto *vehicle{Train->DynamicObject->ABuScanNearestObject(Command.location, Train->DynamicObject->GetTrack(), 1, 1500, coupler)}; + auto couplerindex{-1}; + auto *vehicle{Train->DynamicObject->ABuScanNearestObject(Command.location, Train->DynamicObject->GetTrack(), 1, 1500, couplerindex)}; if (vehicle == nullptr) - vehicle = Train->DynamicObject->ABuScanNearestObject(Command.location, Train->DynamicObject->GetTrack(), -1, 1500, coupler); + vehicle = Train->DynamicObject->ABuScanNearestObject(Command.location, Train->DynamicObject->GetTrack(), -1, 1500, couplerindex); - if (coupler != -1 && vehicle != nullptr) + if (couplerindex != -1 && vehicle != nullptr) { - vehicle->uncouple(coupler); + vehicle->uncouple(couplerindex); } if (Train->DynamicObject->Mechanik) { @@ -7723,10 +7723,10 @@ void TTrain::OnCommand_nearestcarcoupleradapterattach(TTrain * /*Train*/, comman return; } - auto const coupler = + auto const couplerindex = glm::length2(glm::vec3{vehicle->CouplerPosition(end::front)} - Command.location) < glm::length2(glm::vec3{vehicle->CouplerPosition(end::rear)} - Command.location) ? end::front : end::rear; - vehicle->attach_coupler_adapter(coupler); + vehicle->attach_coupler_adapter(couplerindex); } } @@ -7742,10 +7742,10 @@ void TTrain::OnCommand_nearestcarcoupleradapterremove(TTrain * /*Train*/, comman return; } - auto const coupler = + auto const couplerindex = glm::length2(glm::vec3{vehicle->CouplerPosition(end::front)} - Command.location) < glm::length2(glm::vec3{vehicle->CouplerPosition(end::rear)} - Command.location) ? end::front : end::rear; - vehicle->remove_coupler_adapter(coupler); + vehicle->remove_coupler_adapter(couplerindex); } } @@ -9964,8 +9964,8 @@ void TTrain::update_sounds(double const Deltatime) { if (fTachoCount >= 3.f) { - auto const frequency{(true == dsbHasler->is_combined() ? fTachoVelocity * 0.01 : dsbHasler->m_frequencyoffset + dsbHasler->m_frequencyfactor)}; - dsbHasler->pitch(static_cast(frequency)); + auto const soundfrequency{(true == dsbHasler->is_combined() ? fTachoVelocity * 0.01 : dsbHasler->m_frequencyoffset + dsbHasler->m_frequencyfactor)}; + dsbHasler->pitch(static_cast(soundfrequency)); dsbHasler->gain(dsbHasler->m_amplitudeoffset + dsbHasler->m_amplitudefactor); dsbHasler->play(sound_flags::exclusive | sound_flags::looping); } @@ -10067,14 +10067,14 @@ void TTrain::update_sounds_resonancenoise(sound_source &Sound) const { // frequency calculation auto const normalizer{mvOccupied->Vmax * 0.01f}; - auto const frequency{Sound.m_frequencyoffset + Sound.m_frequencyfactor * mvOccupied->Vel * normalizer}; + auto const soundfrequency{Sound.m_frequencyoffset + Sound.m_frequencyfactor * mvOccupied->Vel * normalizer}; // volume calculation auto volume = Sound.m_amplitudeoffset + Sound.m_amplitudefactor * std::lerp(mvOccupied->Vel / (1 + mvOccupied->Vmax), 1.0, 0.5); // scale base volume between 0.5-1.0 if (volume > 0.05) { - Sound.pitch(static_cast(frequency)).gain(static_cast(volume)).play(sound_flags::exclusive | sound_flags::looping); + Sound.pitch(static_cast(soundfrequency)).gain(static_cast(volume)).play(sound_flags::exclusive | sound_flags::looping); } else { @@ -10086,7 +10086,7 @@ void TTrain::update_sounds_runningnoise(sound_source &Sound) { // frequency calculation auto const normalizer{(true == Sound.is_combined() ? mvOccupied->Vmax * 0.01f : 1.f)}; - auto const frequency{Sound.m_frequencyoffset + Sound.m_frequencyfactor * mvOccupied->Vel * normalizer}; + auto const soundfrequency{Sound.m_frequencyoffset + Sound.m_frequencyfactor * mvOccupied->Vel * normalizer}; // volume calculation auto volume = Sound.m_amplitudeoffset + Sound.m_amplitudefactor * std::lerp(mvOccupied->Vel / (1 + mvOccupied->Vmax), 1.0, @@ -10109,7 +10109,7 @@ void TTrain::update_sounds_runningnoise(sound_source &Sound) if (volume > 0.05) { - Sound.pitch(static_cast(frequency)).gain(static_cast(volume)).play(sound_flags::exclusive | sound_flags::looping); + Sound.pitch(static_cast(soundfrequency)).gain(static_cast(volume)).play(sound_flags::exclusive | sound_flags::looping); } else { diff --git a/widgets/cameraview_extcam.cpp b/widgets/cameraview_extcam.cpp index 48d7c9da..0b7c1c41 100644 --- a/widgets/cameraview_extcam.cpp +++ b/widgets/cameraview_extcam.cpp @@ -164,9 +164,9 @@ void ui::cameraview_panel::record_func() if (!rec_name.empty()) { const std::string magic{"{RECORD}"}; - size_t pos = cmdline.find(magic); - if (pos != -1) - cmdline.replace(pos, magic.size(), rec_name); + size_t magicpos = cmdline.find(magic); + if (magicpos != -1) + cmdline.replace(magicpos, magic.size(), rec_name); } piped_proc proc(cmdline, true); diff --git a/world/MemCell.cpp b/world/MemCell.cpp index 919ad38a..5f1235f4 100644 --- a/world/MemCell.cpp +++ b/world/MemCell.cpp @@ -157,11 +157,11 @@ bool TMemCell::Compare( std::string const &szTestText, double const fTestValue1, if( TestFlag( CheckMask, basic_event::flags::text ) ) { // porównać teksty - auto range = szTestText.find( '*' ); + auto wildcardpos = szTestText.find( '*' ); auto const result { ( - range == std::string::npos ? + wildcardpos == std::string::npos ? compare( szText, szTestText, TextOperator ) : - compare( szText.substr( 0, range ), szTestText.substr( 0, range ), TextOperator ) ) }; + compare( szText.substr( 0, wildcardpos ), szTestText.substr( 0, wildcardpos ), TextOperator ) ) }; checkpassed |= result; checkfailed |= !result; } diff --git a/world/Traction.cpp b/world/Traction.cpp index 32c79317..d8be38d5 100644 --- a/world/Traction.cpp +++ b/world/Traction.cpp @@ -163,7 +163,7 @@ TTraction::endpoints() const { } std::size_t -TTraction::create_geometry( gfx::geometrybank_handle const &Bank ) { +TTraction::create_geometry( gfx::geometrybank_handle const &Geometrybank ) { if( m_geometry != null_handle ) { return GfxRenderer->Vertices( m_geometry ).size() / 2; } @@ -343,7 +343,7 @@ TTraction::create_geometry( gfx::geometrybank_handle const &Bank ) { auto const elementcount = vertices.size() / 2; gfx::userdata_array empty_userdata{}; - m_geometry = GfxRenderer->Insert( vertices, empty_userdata, Bank, GL_LINES ); + m_geometry = GfxRenderer->Insert( vertices, empty_userdata, Geometrybank, GL_LINES ); return elementcount; } diff --git a/world/mtable.cpp b/world/mtable.cpp index f47fee6d..7c567d31 100644 --- a/world/mtable.cpp +++ b/world/mtable.cpp @@ -227,7 +227,7 @@ void TTrainParameters::NewName(std::string const &NewTrainName) LocLoad = 0; } -void TTrainParameters::UpdateVelocity(int StationCount, double vActual) +void TTrainParameters::UpdateVelocity(int Stationcount, double vActual) // zapisywanie prędkości maksymalnej do wcześniejszych odcinków // wywoływane z numerem ostatniego przetworzonego przystanku { @@ -254,7 +254,7 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax) bool EndTable; double vActual; - int ConversionError = 0; + int conversionerror = 0; EndTable = false; if (TrainName == "") { // jeśli pusty rozkład @@ -277,15 +277,15 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax) { TTVmax = vmax; // Ra 2014-07: zamiast rozkładu można podać Vmax UpdateVelocity(StationCount, vmax); // ograniczenie do prędkości startowej - ConversionError = 0; + conversionerror = 0; } else - ConversionError = -8; /*Ra: ten błąd jest niepotrzebny*/ + conversionerror = -8; /*Ra: ten błąd jest niepotrzebny*/ } else { /*analiza rozkładu jazdy*/ - ConversionError = 0; - while (fin.good() && !(ConversionError != 0 || EndTable)) + conversionerror = 0; + while (fin.good() && !(conversionerror != 0 || EndTable)) { std::getline(fin, lines); /*wczytanie linii*/ if (contains( lines, "___________________") ) /*linia pozioma górna*/ @@ -353,7 +353,7 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax) win1250_to_ascii( Relation1 ); } else - ConversionError = -5; + conversionerror = -5; while (fin >> s || !fin.bad()) { if (s == "Relacja") @@ -408,7 +408,7 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax) if (s == "[") fin >> s; else - ConversionError = -4; + conversionerror = -4; if (false == contains( s,"|") ) { record->km = static_cast(atof(s.c_str())); @@ -565,7 +565,7 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax) } } // jeśli nazwa pierwszego zgodna z relacją - if (ConversionError == 0 && TimeTable[1].StationName == Relation1 && TimeTable[1].Ah < 0) // a nie podany czas przyjazdu + if (conversionerror == 0 && TimeTable[1].StationName == Relation1 && TimeTable[1].Ah < 0) // a nie podany czas przyjazdu { // to mamy zatrzymanie na pierwszym, a nie przelot TimeTable[1].Ah = TimeTable[1].Dh; TimeTable[1].Am = TimeTable[1].Dm; @@ -593,7 +593,7 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax) } } } - return ConversionError == 0; + return conversionerror == 0; } void