(svn r11176) -Revert (r9867): as it is needed for newgrf callbacks 14B and 14C
This commit is contained in:
@@ -533,7 +533,6 @@ static void AiFindSubsidyPassengerRoute(FoundRoute *fr)
|
||||
static void AiFindRandomIndustryRoute(FoundRoute *fr)
|
||||
{
|
||||
Industry* i;
|
||||
const IndustrySpec *indsp;
|
||||
uint32 r;
|
||||
CargoID cargo;
|
||||
|
||||
@@ -547,9 +546,8 @@ static void AiFindRandomIndustryRoute(FoundRoute *fr)
|
||||
if (i == NULL) return;
|
||||
|
||||
// pick a random produced cargo
|
||||
indsp = GetIndustrySpec(i->type);
|
||||
cargo = indsp->produced_cargo[0];
|
||||
if (r & 1 && indsp->produced_cargo[1] != CT_INVALID) cargo = indsp->produced_cargo[1];
|
||||
cargo = i->produced_cargo[0];
|
||||
if (r & 1 && i->produced_cargo[1] != CT_INVALID) cargo = i->produced_cargo[1];
|
||||
|
||||
fr->cargo = cargo;
|
||||
|
||||
@@ -559,16 +557,10 @@ static void AiFindRandomIndustryRoute(FoundRoute *fr)
|
||||
if (cargo != CT_GOODS && cargo != CT_FOOD) {
|
||||
// pick a dest, and see if it can receive
|
||||
Industry* i2 = AiFindRandomIndustry();
|
||||
if (i2 == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
indsp = GetIndustrySpec(i2->type);
|
||||
|
||||
if (i == i2 ||
|
||||
(indsp->accepts_cargo[0] != cargo &&
|
||||
indsp->accepts_cargo[1] != cargo &&
|
||||
indsp->accepts_cargo[2] != cargo)) {
|
||||
if (i2 == NULL || i == i2 ||
|
||||
(i2->accepts_cargo[0] != cargo &&
|
||||
i2->accepts_cargo[1] != cargo &&
|
||||
i2->accepts_cargo[2] != cargo)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -671,10 +663,9 @@ static bool AiCheckIfRouteIsGood(Player *p, FoundRoute *fr, byte bitmask)
|
||||
}
|
||||
} else {
|
||||
const Industry* i = (const Industry*)fr->from;
|
||||
const IndustrySpec *indsp = GetIndustrySpec(i->type);
|
||||
|
||||
if (i->last_month_pct_transported[fr->cargo != indsp->produced_cargo[0]] > 0x99 ||
|
||||
i->last_month_production[fr->cargo != indsp->produced_cargo[0]] == 0) {
|
||||
if (i->last_month_pct_transported[fr->cargo != i->produced_cargo[0]] > 0x99 ||
|
||||
i->last_month_production[fr->cargo != i->produced_cargo[0]] == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user