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

door operation permit preset cab control, door control system enhancements, minor bug fixes

This commit is contained in:
tmj-fstate
2019-02-15 16:07:02 +01:00
parent 852fdcfa0e
commit 6947107f3c
13 changed files with 203 additions and 82 deletions

View File

@@ -2287,18 +2287,19 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
int
TDynamicObject::init_sections( TModel3d const *Model, std::string const &Nameprefix ) {
std::string sectionname;
auto sectioncount = 0;
auto sectionindex = 0;
TSubModel *sectionsubmodel { nullptr };
do {
sectionname =
Nameprefix + (
sectionindex < 10 ?
"0" + std::to_string( sectionindex ) :
std::to_string( sectionindex ) );
sectionsubmodel = Model->GetFromName( sectionname );
// section names for index < 10 match either prefix0X or prefixX
// section names above 10 match prefixX
auto const sectionindexname { std::to_string( sectionindex ) };
sectionsubmodel = Model->GetFromName( Nameprefix + sectionindexname );
if( ( sectionsubmodel == nullptr )
&& ( sectionindex < 10 ) ) {
sectionsubmodel = Model->GetFromName( Nameprefix + "0" + sectionindexname );
}
if( sectionsubmodel != nullptr ) {
Sections.push_back( {
sectionsubmodel,
@@ -2771,10 +2772,7 @@ TDynamicObject::update_load_sections() {
for( auto &section : Sections ) {
section.load = (
mdLoad != nullptr ?
mdLoad->GetFromName( section.compartment->pName ) :
nullptr );
section.load = GetSubmodelFromName( mdLoad, section.compartment->pName );
if( ( section.load != nullptr )
&& ( section.load->count_children() > 0 ) ) {