mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 22:07:55 +01:00
5a537e69f2
The folder of the vehicle physics was named after the author of its first
version (2001). Its name now says what it holds, and so do its files:
McZapkie/MOVER.h, Mover.cpp -> physics/mover.h, mover.cpp
McZapkie/hamulce.h, hamulce.cpp -> physics/brakes.h, brakes.cpp
McZapkie/Oerlikon_ESt.h, .cpp -> physics/oerlikonest.h, .cpp
friction, collision, couplerphysics, derailment: same names in physics/
Every include names the folder ("physics/mover.h"); the McZapkie include
directory is gone from CMakeLists.txt. The comments and documents that
named the old paths name the new ones. The credits to McZapkie stay.
Renames only: git sees every file as renamed (98-100%). 1142/1142 tests,
golden traces exact against staging 62f7a29b.
42 lines
1.8 KiB
C++
42 lines
1.8 KiB
C++
/*
|
|
This Source Code Form is subject to the
|
|
terms of the Mozilla Public License, v.
|
|
2.0. If a copy of the MPL was not
|
|
distributed with this file, You can
|
|
obtain one at
|
|
http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <array>
|
|
|
|
#include "physics/mover.h"
|
|
|
|
// the lights the light preset selector (programmer) of the occupied cab gives one vehicle of the consist
|
|
namespace lights_programmer {
|
|
|
|
// the lights for the vehicle's two ends, in the terms of TDynamicObject::RaLightsSet(): head is the end
|
|
// towards the head of the consist (TDynamicObject::Prev()), rear the end towards its tail (Next())
|
|
struct consist_lights {
|
|
int head;
|
|
int rear;
|
|
};
|
|
|
|
// Cablights: the selector's lights for the occupied cab's front and back (Lights[end::front / end::rear]).
|
|
// Cabfacinghead: the occupied cab faces the head of the consist.
|
|
// Direction: the vehicle's iDirection, 1 when its end::front is towards the head of the consist.
|
|
// Coupled: whether another vehicle is coupled at the vehicle's end::front / end::rear; an end with a coupled
|
|
// vehicle stays dark
|
|
inline consist_lights vehicle_lights(std::array<int, 2> const &Cablights, bool const Cabfacinghead, int const Direction, std::array<bool, 2> const &Coupled) {
|
|
auto const headlights{Cablights[Cabfacinghead ? end::front : end::rear]};
|
|
auto const rearlights{Cablights[Cabfacinghead ? end::rear : end::front]};
|
|
// the head lights go to the vehicle's end towards the head of the consist whichever way the cab faces,
|
|
// so the coupling which keeps them dark is the one at that same end (eu07/maszyna#395)
|
|
auto const headend{Direction > 0 ? end::front : end::rear};
|
|
auto const rearend{Direction > 0 ? end::rear : end::front};
|
|
return {Coupled[headend] ? 0 : headlights, Coupled[rearend] ? 0 : rearlights};
|
|
}
|
|
|
|
} // namespace lights_programmer
|