@ -1536,7 +1536,8 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
if ( _settings_game . order . improved_load & & ( v - > current_order . GetLoadType ( ) & OLFB_FULL_LOAD ) ) {
if ( _settings_game . order . improved_load & & ( v - > current_order . GetLoadType ( ) & OLFB_FULL_LOAD ) ) {
/* 'Reserve' this cargo for this vehicle, because we were first. */
/* 'Reserve' this cargo for this vehicle, because we were first. */
for ( ; v ! = NULL ; v = v - > Next ( ) ) {
for ( ; v ! = NULL ; v = v - > Next ( ) ) {
if ( v - > cargo_cap ! = 0 ) cargo_left [ v - > cargo_type ] - = v - > cargo_cap - v - > cargo . Count ( ) ;
int cap_left = v - > cargo_cap - v - > cargo . Count ( ) ;
if ( cap_left > 0 ) cargo_left [ v - > cargo_type ] - = cap_left ;
}
}
}
}
return ;
return ;
@ -1555,7 +1556,6 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
int unloading_time = 0 ;
int unloading_time = 0 ;
Vehicle * u = v ;
Vehicle * u = v ;
int result = 0 ;
int result = 0 ;
uint cap ;
bool completely_emptied = true ;
bool completely_emptied = true ;
bool anything_unloaded = false ;
bool anything_unloaded = false ;
@ -1636,8 +1636,9 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
/* If there's goods waiting at the station, and the vehicle
/* If there's goods waiting at the station, and the vehicle
* has capacity for it , load it on the vehicle . */
* has capacity for it , load it on the vehicle . */
if ( ! ge - > cargo . Empty ( ) & &
int cap_left = v - > cargo_cap - v - > cargo . Count ( ) ;
( cap = v - > cargo_cap - v - > cargo . Count ( ) ) ! = 0 ) {
if ( ! ge - > cargo . Empty ( ) & & cap_left > 0 ) {
uint cap = cap_left ;
uint count = ge - > cargo . Count ( ) ;
uint count = ge - > cargo . Count ( ) ;
/* Skip loading this vehicle if another train/vehicle is already handling
/* Skip loading this vehicle if another train/vehicle is already handling
@ -1679,7 +1680,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
result | = 2 ;
result | = 2 ;
}
}
if ( v - > cargo . Count ( ) = = v - > cargo_cap ) {
if ( v - > cargo . Count ( ) > = v - > cargo_cap ) {
SetBit ( cargo_full , v - > cargo_type ) ;
SetBit ( cargo_full , v - > cargo_type ) ;
} else {
} else {
SetBit ( cargo_not_full , v - > cargo_type ) ;
SetBit ( cargo_not_full , v - > cargo_type ) ;
@ -1696,7 +1697,8 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
if ( _settings_game . order . improved_load & & ( u - > current_order . GetLoadType ( ) & OLFB_FULL_LOAD ) ) {
if ( _settings_game . order . improved_load & & ( u - > current_order . GetLoadType ( ) & OLFB_FULL_LOAD ) ) {
/* Update left cargo */
/* Update left cargo */
for ( v = u ; v ! = NULL ; v = v - > Next ( ) ) {
for ( v = u ; v ! = NULL ; v = v - > Next ( ) ) {
if ( v - > cargo_cap ! = 0 ) cargo_left [ v - > cargo_type ] - = v - > cargo_cap - v - > cargo . Count ( ) ;
int cap_left = v - > cargo_cap - v - > cargo . Count ( ) ;
if ( cap_left > 0 ) cargo_left [ v - > cargo_type ] - = cap_left ;
}
}
}
}
@ -1716,7 +1718,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
if ( v - > current_order . GetLoadType ( ) = = OLF_FULL_LOAD_ANY ) {
if ( v - > current_order . GetLoadType ( ) = = OLF_FULL_LOAD_ANY ) {
/* if the aircraft carries passengers and is NOT full, then
/* if the aircraft carries passengers and is NOT full, then
* continue loading , no matter how much mail is in */
* continue loading , no matter how much mail is in */
if ( ( v - > type = = VEH_AIRCRAFT & & IsCargoInClass ( v - > cargo_type , CC_PASSENGERS ) & & v - > cargo_cap != v - > cargo . Count ( ) ) | |
if ( ( v - > type = = VEH_AIRCRAFT & & IsCargoInClass ( v - > cargo_type , CC_PASSENGERS ) & & v - > cargo_cap > v - > cargo . Count ( ) ) | |
( cargo_not_full & & ( cargo_full & ~ cargo_not_full ) = = 0 ) ) { // There are stull non-full cargos
( cargo_not_full & & ( cargo_full & ~ cargo_not_full ) = = 0 ) ) { // There are stull non-full cargos
finished_loading = false ;
finished_loading = false ;
}
}