training changes

This commit is contained in:
milek7
2019-04-01 23:51:57 +02:00
parent e5e85344ea
commit 851deb9142
7 changed files with 46 additions and 7 deletions

View File

@@ -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 },

View File

@@ -237,7 +237,9 @@ enum class user_command {
focuspauseset,
pausetoggle,
entervehicle,
resettrainset,
resetconsist,
fillcompressor,
consistreleaser,
queueevent,
setlight,
insertmodel,

View File

@@ -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)

View File

@@ -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",

View File

@@ -106,6 +106,7 @@ enum string {
vehicleparams_window,
vehicleparams_radiostop,
vehicleparams_reset,
vehicleparams_resetpipe,
vehicleparams_move500f,
vehicleparams_move500b,

View File

@@ -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 << "<!DOCTYPE html>" << std::endl;
temp << "<!DOCTYPE html><meta charset=\"utf-8\"> " << std::endl;
temp << "<body>" << std::endl;
temp << "<div><b>Miejsce: </b>" << (std::string(place.c_str())) << "</div><br>" << std::endl;
temp << "<div><b>Data: </b>" << (date) << "</div><br>" << std::endl;

View File

@@ -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)))