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

Merge branch 'milek-dev' into udpnetwork

This commit is contained in:
milek7
2019-02-21 19:57:08 +01:00
30 changed files with 1467 additions and 1072 deletions

View File

@@ -886,9 +886,14 @@ whois_event::run_() {
auto *targetcell { static_cast<TMemCell *>( std::get<scene::basic_node *>( target ) ) };
if( targetcell == nullptr ) { continue; }
// event effect code
// +24: vehicle type, consist brake level, obstacle distance
// +16: load type, load amount, max load amount
// +8: destination, direction, engine power
// +0: train name, station count, stop on next station
if( m_input.flags & flags::load ) {
// +16 or +24
// jeśli pytanie o ładunek
if( m_input.flags & flags::mode_add ) {
if( m_input.flags & flags::mode_alt ) {
// jeśli typ pojazdu
// TODO: define and recognize individual request types
auto const owner { (
@@ -912,7 +917,7 @@ whois_event::run_() {
WriteLog(
"Type: WhoIs (" + to_string( m_input.flags ) + ") - "
+ "[name: " + m_activator->MoverParameters->TypeName + "], "
+ "[type: " + m_activator->MoverParameters->TypeName + "], "
+ "[consist brake level: " + to_string( consistbrakelevel, 2 ) + "], "
+ "[obstacle distance: " + to_string( collisiondistance, 2 ) + " m]" );
}
@@ -931,7 +936,8 @@ whois_event::run_() {
+ "[max load: " + to_string( m_activator->MoverParameters->MaxLoad, 2 ) + "]" );
}
}
else if( m_input.flags & flags::mode_add ) { // jeśli miejsce docelowe pojazdu
// +8
else if( m_input.flags & flags::mode_alt ) { // jeśli miejsce docelowe pojazdu
targetcell->UpdateValues(
m_activator->asDestination, // adres docelowy
m_activator->DirectionGet(), // kierunek pojazdu względem czoła składu (1=zgodny,-1=przeciwny)
@@ -944,6 +950,7 @@ whois_event::run_() {
+ "[direction: " + to_string( m_activator->DirectionGet() ) + "], "
+ "[engine power: " + to_string( m_activator->MoverParameters->Power, 2 ) + "]" );
}
// +0
else if( m_activator->Mechanik ) {
if( m_activator->Mechanik->Primary() ) { // tylko jeśli ktoś tam siedzi - nie powinno dotyczyć pasażera!
targetcell->UpdateValues(
@@ -1835,8 +1842,12 @@ lua_event::deserialize_( cParser &Input, scene::scratch_data &Scratchpad ) {
// run() subclass details
void
lua_event::run_() {
if (lua_func)
lua_func(this, m_activator);
try {
if (lua_func)
lua_func(this, m_activator);
} catch (...) {
ErrorLog(simulation::Lua.get_error());
}
}
// export_as_text() subclass details