@ -882,12 +882,11 @@ static void FindSubsidyPassengerRoute(FoundRoute *fr)
fr - > distance = ( uint ) - 1 ;
fr - > from = from = GetTown ( RandomRange ( GetTownArraySize ( ) ) ) ;
if ( ! IsValidTown ( from ) | | from - > population < 400 )
return ;
fr - > from = from = GetRandomTown ( ) ;
if ( from = = NULL | | from - > population < 400 ) return ;
fr - > to = to = Get Town( RandomRange( Get TownArraySize ( ) ) ) ;
if ( from = = to | | ! IsValidTown ( to ) | | to - > population < 400 | | to - > pct_pass_transported > 42 )
fr - > to = to = Get RandomTown( ) ;
if ( from = = to | | to = = NULL | | to - > population < 400 | | to - > pct_pass_transported > 42 )
return ;
fr - > distance = DistanceManhattan ( from - > xy , to - > xy ) ;
@ -901,8 +900,8 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
fr - > distance = ( uint ) - 1 ;
fr - > from = i = Get Industry( RandomRange( Get IndustryArraySize ( ) ) ) ;
if ( ! IsValidIndustry ( i ) ) return ;
fr - > from = i = Get RandomIndustry( ) ;
if ( i = = NULL ) return ;
// Randomize cargo type
if ( Random ( ) & 1 & & i - > produced_cargo [ 1 ] ! = CT_INVALID ) {
@ -925,19 +924,19 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
if ( cargo = = CT_GOODS | | cargo = = CT_FOOD ) {
// The destination is a town
Town * t = Get Town( RandomRange( Get TownArraySize ( ) ) ) ;
Town * t = Get RandomTown( ) ;
// Only want big towns
if ( ! IsValidTown ( t ) | | t - > population < 900 ) return ;
if ( t = = NULL | | t - > population < 900 ) return ;
fr - > distance = DistanceManhattan ( i - > xy , t - > xy ) ;
fr - > to = t ;
} else {
// The destination is an industry
Industry * i2 = Get Industry( RandomRange( Get IndustryArraySize ( ) ) ) ;
Industry * i2 = Get RandomIndustry( ) ;
// The industry must accept the cargo
if ( i = = i2 | | ! IsValidIndustry ( i2 ) | |
if ( i = = i2 | | i = = NULL | |
( cargo ! = i2 - > accepts_cargo [ 0 ] & &
cargo ! = i2 - > accepts_cargo [ 1 ] & &
cargo ! = i2 - > accepts_cargo [ 2 ] ) )