From 851deb91421ab21e48db5562cd2d2ff4ed7b01ac Mon Sep 17 00:00:00 2001 From: milek7 Date: Mon, 1 Apr 2019 23:51:57 +0200 Subject: [PATCH] training changes --- command.cpp | 4 +++- command.h | 4 +++- simulation.cpp | 27 ++++++++++++++++++++++++--- translation.cpp | 2 ++ translation.h | 1 + widgets/trainingcard.cpp | 2 +- widgets/vehicleparams.cpp | 13 ++++++++++++- 7 files changed, 46 insertions(+), 7 deletions(-) diff --git a/command.cpp b/command.cpp index 18df88b3..e918a613 100644 --- a/command.cpp +++ b/command.cpp @@ -243,7 +243,9 @@ commanddescription_sequence Commands_descriptions = { { "focuspauseset", command_target::simulation, command_mode::oneoff }, { "pausetoggle", command_target::simulation, command_mode::oneoff }, { "entervehicle", command_target::simulation, command_mode::oneoff }, - { "resettrainset", command_target::simulation, command_mode::oneoff }, + { "resetconsist", command_target::simulation, command_mode::oneoff }, + { "fillcompressor", command_target::simulation, command_mode::oneoff }, + { "consistreleaser", command_target::simulation, command_mode::oneoff }, { "queueevent", command_target::simulation, command_mode::oneoff }, { "setlight", command_target::simulation, command_mode::oneoff }, { "insertmodel", command_target::simulation, command_mode::oneoff }, diff --git a/command.h b/command.h index c53d8f65..d322ae8e 100644 --- a/command.h +++ b/command.h @@ -237,7 +237,9 @@ enum class user_command { focuspauseset, pausetoggle, entervehicle, - resettrainset, + resetconsist, + fillcompressor, + consistreleaser, queueevent, setlight, insertmodel, diff --git a/simulation.cpp b/simulation.cpp index 44b759f3..12d66a4f 100644 --- a/simulation.cpp +++ b/simulation.cpp @@ -78,6 +78,22 @@ state_manager::update( double const Deltatime, int Iterationcount ) { void state_manager::process_commands() { command_data commanddata; while( Commands.pop( commanddata, (uint32_t)command_target::simulation )) { + if (commanddata.command == user_command::consistreleaser) { + TDynamicObject *found_vehicle = simulation::Vehicles.find(commanddata.payload); + TDynamicObject *vehicle = found_vehicle; + + while (vehicle) { + vehicle->MoverParameters->Hamulec->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 = vehicle->Prev(); + } + } + if (commanddata.action == GLFW_RELEASE) continue; @@ -181,7 +197,7 @@ void state_manager::process_commands() { simulation::Region->RadioStop( commanddata.location ); } - if (commanddata.command == user_command::resettrainset) { + if (commanddata.command == user_command::resetconsist) { TDynamicObject *found_vehicle = simulation::Vehicles.find(commanddata.payload); TDynamicObject *vehicle = found_vehicle; @@ -190,7 +206,7 @@ void state_manager::process_commands() { vehicle->MoverParameters->EngDmgFlag = 0; vehicle->MoverParameters->V = 0.0; vehicle->MoverParameters->DistCounter = 0.0; - vehicle->MoverParameters->PipePress = 4.5; + vehicle->MoverParameters->WheelFlat = 0.0; vehicle = vehicle->Next(); } @@ -200,11 +216,16 @@ void state_manager::process_commands() { vehicle->MoverParameters->EngDmgFlag = 0; vehicle->MoverParameters->V = 0.0; vehicle->MoverParameters->DistCounter = 0.0; - vehicle->MoverParameters->PipePress = 4.5; + vehicle->MoverParameters->WheelFlat = 0.0; vehicle = vehicle->Prev(); } } + if (commanddata.command == user_command::fillcompressor) { + TDynamicObject *found_vehicle = simulation::Vehicles.find(commanddata.payload); + found_vehicle->MoverParameters->CompressedVolume = 8.0f * found_vehicle->MoverParameters->VeselVolume; + } + if (commanddata.command == user_command::dynamicmove) { TDynamicObject *vehicle = simulation::Vehicles.find(commanddata.payload); if (vehicle) diff --git a/translation.cpp b/translation.cpp index e6346076..6d7edb67 100644 --- a/translation.cpp +++ b/translation.cpp @@ -117,6 +117,7 @@ init() { "Vehicle parameters", "Radiostop", "Reset trainset", + "Reset main pipe", "Move +500m", "Move -500m", @@ -322,6 +323,7 @@ init() { u8"Parametry pojazdu", u8"Radiostop", u8"Zresetuj skład", + u8"Napełnij ZG", u8"Przesuń +500m", u8"Przesuń -500m", diff --git a/translation.h b/translation.h index 15bede4f..ca7e8fd4 100644 --- a/translation.h +++ b/translation.h @@ -106,6 +106,7 @@ enum string { vehicleparams_window, vehicleparams_radiostop, vehicleparams_reset, + vehicleparams_resetpipe, vehicleparams_move500f, vehicleparams_move500b, diff --git a/widgets/trainingcard.cpp b/widgets/trainingcard.cpp index 32e2c3a8..13fe3f13 100644 --- a/widgets/trainingcard.cpp +++ b/widgets/trainingcard.cpp @@ -67,7 +67,7 @@ void trainingcard_panel::save_thread_func() std::fstream temp("reports/" + rep + ".html", std::ios_base::out | std::ios_base::binary); - temp << "" << std::endl; + temp << " " << std::endl; temp << "" << std::endl; temp << "
Miejsce: " << (std::string(place.c_str())) << "

" << std::endl; temp << "
Data: " << (date) << "

" << std::endl; diff --git a/widgets/vehicleparams.cpp b/widgets/vehicleparams.cpp index f5db36c6..d500c6e5 100644 --- a/widgets/vehicleparams.cpp +++ b/widgets/vehicleparams.cpp @@ -189,7 +189,18 @@ void ui::vehicleparams_panel::render_contents() ImGui::SameLine(); if (ImGui::Button(LOC_STR(vehicleparams_reset))) - m_relay.post(user_command::resettrainset, 0.0, 0.0, GLFW_PRESS, 0, glm::vec3(0.0f), &vehicle_ptr->name()); + m_relay.post(user_command::resetconsist, 0.0, 0.0, GLFW_PRESS, 0, glm::vec3(0.0f), &vehicle_ptr->name()); + ImGui::SameLine(); + + if (ImGui::Button(LOC_STR(vehicleparams_resetpipe))) + m_relay.post(user_command::fillcompressor, 0.0, 0.0, GLFW_PRESS, 0, glm::vec3(0.0f), &vehicle_ptr->name()); + ImGui::SameLine(); + + ImGui::Button(LOC_STR(cab_releaser_bt)); + if (ImGui::IsItemClicked()) + m_relay.post(user_command::consistreleaser, 0.0, 0.0, GLFW_PRESS, 0, glm::vec3(0.0f), &vehicle_ptr->name()); + if (ImGui::IsItemDeactivated()) + m_relay.post(user_command::consistreleaser, 0.0, 0.0, GLFW_RELEASE, 0, glm::vec3(0.0f), &vehicle_ptr->name()); ImGui::SameLine(); if (ImGui::Button(LOC_STR(vehicleparams_move500f)))