18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-03 12:25:27 +01:00

merge: staging (6a716b67) into feat/flashlight-gl46

The flashlight's command stays the last one in input/command.h and both lists of input/command.cpp,
after the genericset and the traction mode commands staging added; local_lights keeps both forget()
of staging and add_flashlight().
This commit is contained in:
miloszunio
2026-11-30 12:33:36 +00:00
787 changed files with 119698 additions and 57002 deletions
+16 -15
View File
@@ -37,6 +37,7 @@ http://mozilla.org/MPL/2.0/.
#include "utilities/Timer.h"
#include "vehicle/Driver.h"
#include "world/catenary_scene.h"
#include "physics/vehicle.h"
namespace simulation {
@@ -148,6 +149,8 @@ state_manager::update( double const Deltatime, int Iterationcount ) {
simulation::Roadpoints.update( totaltime );
Timer::subsystem.sim_roads.stop();
simulation::Vehicles.update( Deltatime, Iterationcount );
// the tracks the heat buckles, by itself or under the trains just moved
TTrack::update_buckling( totaltime );
}
void
@@ -241,13 +244,13 @@ void state_manager::process_commands() {
TDynamicObject *vehicle = found_vehicle;
while (vehicle) {
vehicle->MoverParameters->Hamulec->Releaser(commanddata.action != GLFW_RELEASE ? 1 : 0);
vehicle->physics->brakes.distributor->Releaser(commanddata.action != GLFW_RELEASE ? 1 : 0);
vehicle = vehicle->Next();
}
vehicle = found_vehicle;
while (vehicle) {
vehicle->MoverParameters->Hamulec->Releaser(commanddata.action != GLFW_RELEASE ? 1 : 0);
vehicle->physics->brakes.distributor->Releaser(commanddata.action != GLFW_RELEASE ? 1 : 0);
vehicle = vehicle->Prev();
}
}
@@ -312,7 +315,7 @@ void state_manager::process_commands() {
targetvehicle->ctOwner == currentvehicle->Mechanik
|| targetvehicle->ctOwner == currentvehicle->ctOwner };
auto const isincharge{ currentvehicle->Mechanik->primary() };
auto const aidriveractive{ currentvehicle->Mechanik->AIControllFlag };
auto const aidriveractive{ currentvehicle->Mechanik->AIControllFlag() };
// TODO: support for primary mode request passed as commanddata.param1
if( !sameconsist && isincharge ) {
// oddajemy dotychczasowy AI
@@ -435,14 +438,12 @@ void state_manager::process_commands() {
}
while (vehicle) {
vehicle->MoverParameters->DamageFlag = 0;
vehicle->MoverParameters->EngDmgFlag = 0;
vehicle->MoverParameters->V = 0.000001; // HACK: force vehicle position re-calculation
vehicle->MoverParameters->DistCounter = 0.0;
vehicle->MoverParameters->WheelFlat = 0.0;
vehicle->MoverParameters->AlarmChainFlag = false;
vehicle->MoverParameters->OffsetTrackH = 0.0;
vehicle->MoverParameters->OffsetTrackV = 0.0;
// no damage, back on the rails with the state of the derailment cleared
vehicle->physics->repair_damage();
vehicle->physics->SetV(0.000001); // HACK: force vehicle position re-calculation
vehicle->physics->SetDistCounter(0.0);
vehicle->physics->SetOffsetTrackH(0.0);
vehicle->physics->SetOffsetTrackV(0.0);
// pantographs
for( auto idx = 0; idx < vehicle->iAnimType[ ANIM_PANTS ]; ++idx ) {
@@ -463,13 +464,13 @@ void state_manager::process_commands() {
if (commanddata.command == user_command::repaircoupler) {
if (auto *vehicle{simulation::Vehicles.find(commanddata.payload)}; vehicle != nullptr) {
vehicle->MoverParameters->repair_coupler(static_cast<int>(commanddata.param1) == end::rear ? end::rear : end::front);
vehicle->physics->repair_coupler(EndOf(static_cast<int>(commanddata.param1)) == VehicleEnd::rear ? VehicleEnd::rear : VehicleEnd::front);
}
}
if (commanddata.command == user_command::fillcompressor) {
TDynamicObject *vehicle = simulation::Vehicles.find(commanddata.payload);
vehicle->MoverParameters->CompressedVolume = 8.0f * vehicle->MoverParameters->VeselVolume;
vehicle->physics->air.Fill(8.0f * vehicle->physics->air.config.mainReservoirVolume);
}
if (commanddata.command == user_command::dynamicmove) {
@@ -499,7 +500,7 @@ void state_manager::process_commands() {
double offset = 0.0;
while (vehicle) {
offset += vehicle->MoverParameters->Dim.L;
offset += vehicle->physics->Dim.L;
vehicle->place_on_track(track, offset, false);
vehicle = vehicle->Prev();
}
@@ -512,7 +513,7 @@ void state_manager::process_commands() {
if (commanddata.command == user_command::pullalarmchain) {
TDynamicObject *vehicle = simulation::Vehicles.find(commanddata.payload);
if (vehicle)
vehicle->MoverParameters->AlarmChainSwitch(true);
vehicle->physics->AlarmChainSwitch(true);
}
if (commanddata.command == user_command::sendaicommand) {