Index: simfab.cc =================================================================== --- simfab.cc (Revision 9593) +++ simfab.cc (Arbeitskopie) @@ -624,6 +624,8 @@ if( welt->get_settings().get_just_in_time() >= 2 ) { rebuild_inactive_cache(); } + + recalc_jit2_info(); } @@ -2969,10 +2971,10 @@ // adjust production base to be at least as large as fields productivity uint32 prodbase_adjust = 1; const field_group_desc_t *fd = desc->get_field_group(); - if(fd) { - for(uint32 i=0; iget_field_class( fields[i].field_class_index ); - if (fc) { + if( fd ) { + for( uint32 i = 0; i < fields.get_count(); i++ ) { + const field_class_desc_t *fc = fd->get_field_class( fields[ i ].field_class_index ); + if( fc ) { prodbase_adjust += fc->get_field_production(); } } @@ -2979,31 +2981,42 @@ } // set production, update all production related numbers - set_base_production( max(prodbase, prodbase_adjust) ); + set_base_production( max( prodbase, prodbase_adjust ) ); // now we have a valid storage limit - if( welt->get_settings().is_crossconnect_factories() ) { - FOR( slist_tpl, const fab, welt->get_fab_list() ) { - fab->add_supplier(this); + if( welt->get_settings().is_crossconnect_factories() ) { + FOR( slist_tpl, const fab, welt->get_fab_list() ) { + fab->add_supplier( this ); } } else { // add as supplier to target(s) - for(uint32 i=0; iadd_supplier(pos.get_2d()); - lieferziele[i] = fab2->get_pos().get_2d(); + for( uint32 i = 0; i < lieferziele.get_count(); i++ ) { + fabrik_t * fab2 = fabrik_t::get_fab( lieferziele[ i ] ); + if( fab2 ) { + fab2->add_supplier( pos.get_2d() ); + lieferziele[ i ] = fab2->get_pos().get_2d(); } else { // remove this ... - dbg->warning( "fabrik_t::finish_rd()", "No factory at expected position %s!", lieferziele[i].get_str() ); - lieferziele.remove_at(i); + dbg->warning( "fabrik_t::finish_rd()", "No factory at expected position %s!", lieferziele[ i ].get_str() ); + lieferziele.remove_at( i ); i--; } } } + recalc_jit2_info(); + + // set initial power boost + if( boost_type == BL_POWER ) { + prodfactor_electric = get_jit2_power_boost(); + } +} + + +void fabrik_t::recalc_jit2_info() +{ // Now rebuild input/output activity information. if( welt->get_settings().get_just_in_time() >= 2 ){ inactive_inputs = inactive_outputs = inactive_demands = 0; @@ -3039,10 +3052,6 @@ } } - // set initial power boost - if ( boost_type == BL_POWER ) { - prodfactor_electric = get_jit2_power_boost(); - } } Index: simfab.h =================================================================== --- simfab.h (Revision 9593) +++ simfab.h (Arbeitskopie) @@ -389,6 +389,11 @@ void recalc_storage_capacities(); /** + * Recalculate input/output activity information for JIT2 + */ + void recalc_jit2_info(); + + /** * Class for collecting arrival data and calculating pax/mail boost with fixed period length */ #define PERIOD_BITS (18) // determines period length on which boost calculation is based