mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 11:47:06 +01:00
9568dba9e4
What changes for the player: - the OFF position of the headlights dimmer puts out the headlights at the end of the active cab: A from cab 1, B from cab -1. It took the numbers of the ends for the numbers of the cabs, so cab 1 put out B, the end behind the driver, and cab -1 nothing (eff9fe88) - each pantograph meters the energy it draws at its own voltage; it took the voltage of the other one, so a vehicle of one pantograph metered none - with the live traction, a pantograph counts as touching the wire by the switch of its own end (the current shared between the pantographs); every one was counted by the switch of the front one - radiatorfan2: in the sounds of the .mmd is read as radiatorfan1: is; only radiatorfan2 without the colon was. No vehicle of the game data uses either form of it, so no vehicle sounds different, and the old form is still read Faults that couldn't show in a usual consist, fixed: - the pantographs of more than 8 units in multiple went past the end of the table of the cab (TTrain::bPants), the compressors next to them had the check already - the overload relay of the converter dereferenced the driver of the vehicle without checking there is one - an empty row of the table of the consist kept the spring brake pressure of the vehicle there before - more than 8 wipers went past the end of the state of the wipers And a tidy-up of no effect: a motor blower sound looks at the speed of its own blower, not of the front one (both are the speed of the .fiz). CabEnd() and PantographEnd() (physics/vehicletypes.h) give the end of a cab and of a pantograph of the model; test_vehicle_ends.cpp tests them and the rest of the vocabulary of the ends. Left as they are, for someone who knows what they should do: FfulED of the braking of a consist of induction motors (TDynamicObject::Update) is assigned rather than summed and is never above 0, so with ScndS above fullSpeed the force asked of the ED brake is 0; and the calibration check of the brake handle of the PoKeys desk (TTrain::updateBrakeControllers) is never tested, by the precedence of ?: and &&. 1149/1149 tests; golden traces exact against staging62f7a29b.
64 lines
2.5 KiB
C++
64 lines
2.5 KiB
C++
#include "stdafx.h"
|
|
#include "doctest.h"
|
|
|
|
#include "physics/vehicletypes.h"
|
|
|
|
// the ends and the sides of a vehicle: the numbers the formats give them, the other one, the arrays indexed by them,
|
|
// the end of a cab and of a pantograph of the model
|
|
|
|
TEST_CASE("vehicle ends and sides keep the numbers of the formats") {
|
|
CHECK(NumberOf(VehicleEnd::front) == 0);
|
|
CHECK(NumberOf(VehicleEnd::rear) == 1);
|
|
CHECK(NumberOf(VehicleSide::right) == 0);
|
|
CHECK(NumberOf(VehicleSide::left) == 1);
|
|
// a number goes through as it is, also the -1 and the 2 some fields hold for "none"
|
|
for (auto const number : {-1, 0, 1, 2}) {
|
|
CAPTURE(number);
|
|
CHECK(NumberOf(EndOf(number)) == number);
|
|
CHECK(NumberOf(SideOf(number)) == number);
|
|
}
|
|
}
|
|
|
|
TEST_CASE("vehicle ends and sides: the other one") {
|
|
CHECK(Opposite(VehicleEnd::front) == VehicleEnd::rear);
|
|
CHECK(Opposite(VehicleEnd::rear) == VehicleEnd::front);
|
|
CHECK(Opposite(VehicleSide::right) == VehicleSide::left);
|
|
CHECK(Opposite(VehicleSide::left) == VehicleSide::right);
|
|
CHECK(VehicleEnds[0] == VehicleEnd::front);
|
|
CHECK(VehicleEnds[1] == VehicleEnd::rear);
|
|
CHECK(VehicleSides[0] == VehicleSide::right);
|
|
CHECK(VehicleSides[1] == VehicleSide::left);
|
|
}
|
|
|
|
TEST_CASE("an array of the ends is indexed by the end and by its number alike") {
|
|
ByEnd<int> values{10, 20};
|
|
CHECK(values[VehicleEnd::front] == 10);
|
|
CHECK(values[VehicleEnd::rear] == 20);
|
|
CHECK(values[0] == 10);
|
|
CHECK(values[1] == 20);
|
|
values[VehicleEnd::rear] = 30;
|
|
CHECK(values[1] == 30);
|
|
BySide<bool> doors{};
|
|
doors[VehicleSide::left] = true;
|
|
CHECK_FALSE(doors[VehicleSide::right]);
|
|
CHECK(doors[1]);
|
|
}
|
|
|
|
TEST_CASE("the cab of a vehicle is at its front for cab 1, at its rear for cab -1") {
|
|
// the OFF position of the headlights dimmer puts out the headlights at the end of the active cab (A at the front,
|
|
// B at the rear); with the numbers of the ends taken for the numbers of the cabs, cab 1 put out B and cab -1 nothing
|
|
CHECK(CabEnd(1) == VehicleEnd::front);
|
|
CHECK(CabEnd(-1) == VehicleEnd::rear);
|
|
CHECK_FALSE(CabEnd(0).has_value());
|
|
}
|
|
|
|
TEST_CASE("the pantographs of a model count for the front and the rear in turn") {
|
|
// each pantograph has the voltage, the switch and the energy of its own end: the first one the front's, the second
|
|
// one the rear's. the energy meter took the voltage of the other one, the count of the pantographs touching the
|
|
// wire the switch of the front for both
|
|
CHECK(PantographEnd(0) == VehicleEnd::front);
|
|
CHECK(PantographEnd(1) == VehicleEnd::rear);
|
|
CHECK(PantographEnd(2) == VehicleEnd::front);
|
|
CHECK(PantographEnd(3) == VehicleEnd::rear);
|
|
}
|