mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-11 09:04:37 +01:00
Merge master into whois-station-ahead
This commit is contained in:
@@ -1014,6 +1014,13 @@ whois_event::deserialize_( cParser &Input, scene::scratch_data &Scratchpad ) {
|
||||
void
|
||||
whois_event::run_() {
|
||||
|
||||
if( m_activator == nullptr ) {
|
||||
// no triggering vehicle to report on - most likely whois was launched from a
|
||||
// scenery event chain rather than a track/isolation crossing
|
||||
WriteLog( "Type: WhoIs (" + std::to_string( m_input.flags ) + ") - no activator, event ignored" );
|
||||
return;
|
||||
}
|
||||
|
||||
for( auto &target : m_targets ) {
|
||||
auto *targetcell { static_cast<TMemCell *>( std::get<scene::basic_node *>( target ) ) };
|
||||
if( targetcell == nullptr ) { continue; }
|
||||
@@ -1158,20 +1165,28 @@ whois_event::run_() {
|
||||
+ "[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!
|
||||
else {
|
||||
// same owner selection as the +8/+16/+24/+32/+40/+48 branches above: fall back to
|
||||
// the consist's controlling vehicle if the activator itself isn't one (e.g. a wagon
|
||||
// triggered the event ahead of its locomotive) - +0 used to require the activator's
|
||||
// own Mechanik and silently produce nothing for a wagon-triggered whois
|
||||
auto const *owner { (
|
||||
m_activator->Mechanik != nullptr && m_activator->Mechanik->primary() ?
|
||||
m_activator->Mechanik :
|
||||
m_activator->ctOwner ) };
|
||||
if( owner != nullptr ) {
|
||||
targetcell->UpdateValues(
|
||||
m_activator->Mechanik->TrainName(),
|
||||
m_activator->Mechanik->StationCount() - m_activator->Mechanik->StationIndex(), // ile przystanków do końca
|
||||
m_activator->Mechanik->IsStop() ?
|
||||
owner->TrainName(),
|
||||
owner->StationCount() - owner->StationIndex(), // ile przystanków do końca
|
||||
owner->IsStop() ?
|
||||
1 :
|
||||
0, // 1, gdy ma tu zatrzymanie
|
||||
m_input.flags & ( flags::text | flags::value1 | flags::value2 ) );
|
||||
WriteLog(
|
||||
"Type: WhoIs (" + std::to_string( m_input.flags ) + ") - "
|
||||
+ "[train: " + m_activator->Mechanik->TrainName() + "], "
|
||||
+ "[stations left: " + std::to_string( m_activator->Mechanik->StationCount() - m_activator->Mechanik->StationIndex() ) + "], "
|
||||
+ "[stop at next station: " + ( m_activator->Mechanik->IsStop() ? "yes" : "no") + "]" );
|
||||
+ "[train: " + owner->TrainName() + "], "
|
||||
+ "[stations left: " + std::to_string( owner->StationCount() - owner->StationIndex() ) + "], "
|
||||
+ "[stop at next station: " + ( owner->IsStop() ? "yes" : "no") + "]" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2224,7 +2239,13 @@ message_event::export_as_text_( std::ostream &Output ) const {
|
||||
basic_event *
|
||||
make_event( cParser &Input, scene::scratch_data &Scratchpad ) {
|
||||
|
||||
auto const name = ToLower( Input.getToken<std::string>() );
|
||||
// getToken() already lowercases ASCII letters via the parser's toLowerChar(),
|
||||
// which deliberately leaves bytes >= 0x80 untouched. The extra ToLower() here
|
||||
// ran std::tolower() over every byte, so under a non-"C" global locale it
|
||||
// remapped cp1250 uppercase accented letters (e.g. 0xAF -> 0xBF) - producing a
|
||||
// registered name that no lookup site (Track::AssignEvents, child-event and
|
||||
// launcher resolution) could match, since those normalize with the parser only.
|
||||
auto const name = Input.getToken<std::string>();
|
||||
auto const type = Input.getToken<std::string>();
|
||||
|
||||
basic_event *event { nullptr };
|
||||
|
||||
Reference in New Issue
Block a user