16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 07:49:19 +02:00

ai alert mode

This commit is contained in:
milek7
2019-04-10 10:45:22 +02:00
parent ef3a66dc0b
commit 7261fe9fbd
9 changed files with 172 additions and 14 deletions

View File

@@ -24,6 +24,7 @@ http://mozilla.org/MPL/2.0/.
#include "scene.h"
#include "Train.h"
#include "application.h"
#include "Driver.h"
namespace simulation {
@@ -263,12 +264,30 @@ void state_manager::process_commands() {
}
}
if (commanddata.command == user_command::spawntrainset) {
}
if (commanddata.command == user_command::pullalarmchain) {
TDynamicObject *vehicle = simulation::Vehicles.find(commanddata.payload);
if (vehicle)
vehicle->MoverParameters->AlarmChainSwitch(true);
}
if (commanddata.command == user_command::sendaicommand) {
std::istringstream ss(commanddata.payload);
std::string vehicle_name;
std::string command;
std::getline(ss, vehicle_name, '%');
std::getline(ss, command, '%');
TDynamicObject *vehicle = simulation::Vehicles.find(vehicle_name);
glm::dvec3 location = commanddata.location;
if (vehicle && vehicle->Mechanik)
vehicle->Mechanik->PutCommand(command, commanddata.param1, commanddata.param2, &location);
}
if (commanddata.command == user_command::quitsimulation) {
Application.queue_quit();
}