17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-12 02:58:14 +01:00

Merge master into fix/ai-braking-split

Resolve the conflicts with the merged nested ifs (#194) in
control_tractive_force() and control_braking_force(): the conditions keep
the new flattened form, with this branch's changes carried into them.
This commit is contained in:
pwarszawski
2026-10-02 15:22:39 +02:00
44 changed files with 2352 additions and 1306 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -550,8 +550,9 @@ private:
double fLastVel = 0.0; // prędkość na poprzednio sprawdzonym torze
TTrack *tLast = nullptr; // ostatni analizowany tor
basic_event *eSignSkip = nullptr; // można pominąć ten SBL po zatrzymaniu
std::size_t SemNextIndex{ std::size_t( -1 ) };
std::size_t SemNextStopIndex{ std::size_t( -1 ) };
static constexpr std::size_t npos{ std::size_t( -1 ) };
std::size_t SemNextIndex{ npos };
std::size_t SemNextStopIndex{ npos };
double dMoveLen = 0.0; // odległość przejechana od ostatniego sprawdzenia tabelki
basic_event *eSignNext = nullptr; // sygnał zmieniający prędkość, do pokazania na [F2]
neighbour_data Obstacle; // nearest vehicle detected ahead on current route
@@ -630,7 +631,6 @@ private:
// logs
// methods
void PhysicsLog();
void CloseLog();
// members
std::ofstream LogFile; // zapis parametrow fizycznych
double LastUpdatedTime = 0.0; // czas od ostatniego logu

View File

@@ -800,6 +800,19 @@ TDynamicObject::set_cab_lights( int const Cab, float const Level ) {
}
}
// aktualizujemy submodele w zaleznosci od aktualnej pory roku
void TDynamicObject::on_season_update()
{
if (sm_winter_variant != nullptr) // pokazujemy wariant zimowy
sm_winter_variant->SetVisibilityLevel(Global.Season == "winter:" ? 1 : 0, true, false);
if (sm_spring_variant != nullptr) // pokazujemy wariant wiosenny
sm_spring_variant->SetVisibilityLevel(Global.Season == "spring:" ? 1 : 0, true, false);
if (sm_summer_variant != nullptr) // pokazujemy wariant letni
sm_summer_variant->SetVisibilityLevel(Global.Season == "summer:" ? 1 : 0, true, false);
if (sm_autumn_variant != nullptr) // pokazujemy wariant jesienny
sm_autumn_variant->SetVisibilityLevel(Global.Season == "autumn:" ? 1 : 0, true, false);
}
// ABu 29.01.05 przeklejone z render i renderalpha: *********************
void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
{ // ABu290105: pozbierane i uporzadkowane powtarzajace
@@ -814,6 +827,10 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
if (vFloor.z > 0.0)
mdLoad->GetSMRoot()->SetTranslate(modelShake + vFloor);
// model jest współdzielony przez pojazdy, a pora roku może się zmienić w trakcie symulacji
if (Global.UpdateMaterials)
on_season_update();
if (ObjSqrDist < 400 * 400 ) // gdy bliżej niż 400m
{
for( auto &animation : pAnimations ) {
@@ -1934,6 +1951,10 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
iDirection = Reversed ? 0 : 1; // Ra: 0, jeśli ma być wstawiony jako obrócony tyłem
asBaseDir = paths::dynamic + BaseDir + "/"; // McZapkie-310302
asName = Name;
// derived from the name and the seed of the simulation rather than drawn at random, so that the vehicle
// keeps the same look for the whole session and looks the same for everyone in a multiplayer game, while
// another run of the same scenario, with another seed, dresses it differently
m_variantseed = hash_string( asName, Global.random_seed );
std::string asAnimName; // zmienna robocza do wyszukiwania osi i wózków
// Ra: zmieniamy znaczenie obsady na jednoliterowe, żeby dosadzić kierownika
if (DriverType == "headdriver")
@@ -2489,6 +2510,10 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
smBogie[0]->WillBeAnimated();
if (smBogie[1])
smBogie[1]->WillBeAnimated();
sm_winter_variant = mdModel->GetFromName("winter_variant");
sm_spring_variant = mdModel->GetFromName("spring_variant");
sm_summer_variant = mdModel->GetFromName("summer_variant");
sm_autumn_variant = mdModel->GetFromName("autumn_variant");
}
// ABu: zainicjowanie zmiennej, zeby nic sie nie ruszylo w pierwszej klatce,
// potem juz liczona prawidlowa wartosc masy
@@ -3020,7 +3045,8 @@ TDynamicObject::update_load_offset() {
void
TDynamicObject::shuffle_load_order() {
std::shuffle( std::begin( SectionLoadOrder ), std::end( SectionLoadOrder ), Global.random_engine );
// order of visible load chunks, nothing security related -- see the engines in Globals.h
std::shuffle( std::begin( SectionLoadOrder ), std::end( SectionLoadOrder ), Global.random_engine ); // NOSONAR
// shift chunks assigned to corridors to the end of the list, so they show up last
std::stable_partition(
std::begin( SectionLoadOrder ), std::end( SectionLoadOrder ),

View File

@@ -310,6 +310,10 @@ private:
TSubModel *smWahacze[4]; // wahacze (np. nogi, dźwignia w drezynie)
TSubModel *smBrakeMode; // Ra 15-01: nastawa hamulca też
TSubModel *smLoadMode; // Ra 15-01: nastawa próżny/ładowny
TSubModel *sm_winter_variant {}; // submodel zimowego wariantu
TSubModel *sm_spring_variant {}; // submodel wiosennego wariantu
TSubModel *sm_summer_variant {}; // submodel letniego wariantu
TSubModel *sm_autumn_variant {}; // submodel jesiennego wariantu
double fWahaczeAmp;
// Winger 160204 - pantografy
double pantspeedfactor;
@@ -462,6 +466,7 @@ private:
void ABuLittleUpdate(double ObjSqrDist);
void ABuBogies();
void ABuModelRoll();
void on_season_update();
void TurnOff();
// update state of load exchange operation
void update_exchange( double const Deltatime );
@@ -634,6 +639,10 @@ private:
std::string asName;
const std::string &name() const {
return asName; }
// seed for texture variants of materials used by this vehicle and its load
std::uint32_t m_variantseed { 0 };
std::uint32_t variant_seed() const {
return m_variantseed; }
std::string asBaseDir;
// std::ofstream PneuLogFile; //zapis parametrow pneumatycznych