mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Make repair button vehicle in debug mode instead call resetconsist command, add pantograph damage flag, repair pantographs in resetconsist command
This commit is contained in:
@@ -121,6 +121,7 @@ static int const dtrain_engine = 32; /*dla lokomotyw*/
|
||||
static int const dtrain_loaddestroyed = 32;/*dla wagonow*/
|
||||
static int const dtrain_axle = 64;
|
||||
static int const dtrain_out = 128; /*wykolejenie*/
|
||||
static int const dtrain_pantograph = 256; /*polamanie pantografu*/
|
||||
|
||||
/*wagi prawdopodobienstwa dla funkcji FuzzyLogic*/
|
||||
#define p_elengproblem (1e-02)
|
||||
|
||||
@@ -546,18 +546,10 @@ debug_panel::render() {
|
||||
// sections
|
||||
ImGui::Separator();
|
||||
if( true == render_section( "Vehicle", m_vehiclelines ) ) {
|
||||
if( ( m_input.mover )
|
||||
&& ( m_input.mover->DamageFlag != 0 ) ) {
|
||||
if( true == ImGui::Button( "Fix Status" ) ) {
|
||||
// TODO: refactor status reset into mover method
|
||||
m_input.mover->DamageFlag = 0;
|
||||
m_input.mover->EngDmgFlag = 0;
|
||||
m_input.mover->V = 0.0001; // HACK: force vehicle position re-calculation
|
||||
m_input.mover->DistCounter = 0.0;
|
||||
m_input.mover->WheelFlat = 0.0;
|
||||
m_input.mover->AlarmChainFlag = false;
|
||||
m_input.mover->OffsetTrackH = 0.0;
|
||||
m_input.mover->OffsetTrackV = 0.0;
|
||||
if( DebugModeFlag && ( m_input.mover ) && ( m_input.mover->DamageFlag != 0 ) ) {
|
||||
if( 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ basic_cell::update_traction( TDynamicObject *Vehicle, int const Pantographindex
|
||||
// i do tego jeszcze wejdzie pod ślizg
|
||||
if( fHorizontal <= 0.0 ) {
|
||||
// 0.635 dla AKP-1 AKP-4E
|
||||
SetFlag( Vehicle->MoverParameters->DamageFlag, dtrain_pantograph );
|
||||
pantograph->PantWys = -1.0; // ujemna liczba oznacza połamanie
|
||||
pantograph->hvPowerWire = nullptr; // bo inaczej się zasila w nieskończoność z połamanego
|
||||
if( Vehicle->MoverParameters->EnginePowerSource.CollectorParameters.CollectorsNo > 0 ) {
|
||||
|
||||
@@ -369,12 +369,27 @@ void state_manager::process_commands() {
|
||||
while (vehicle) {
|
||||
vehicle->MoverParameters->DamageFlag = 0;
|
||||
vehicle->MoverParameters->EngDmgFlag = 0;
|
||||
vehicle->MoverParameters->V = 0.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;
|
||||
|
||||
// pantographs
|
||||
for( auto idx = 0; idx < vehicle->iAnimType[ ANIM_PANTS ]; ++idx ) {
|
||||
auto &pantograph { *( vehicle->pants[ idx ].fParamPants ) };
|
||||
if( pantograph.PantWys >= 0.0 ) // negative value means pantograph is broken
|
||||
continue;
|
||||
pantograph.fAngleL = pantograph.fAngleL0;
|
||||
pantograph.fAngleU = pantograph.fAngleU0;
|
||||
pantograph.PantWys =
|
||||
pantograph.fLenL1 * std::sin( pantograph.fAngleL )
|
||||
+ pantograph.fLenU1 * std::sin( pantograph.fAngleU )
|
||||
+ pantograph.fHeight;
|
||||
vehicle->MoverParameters->EnginePowerSource.CollectorParameters.CollectorsNo;
|
||||
}
|
||||
|
||||
vehicle = vehicle->Prev();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user