diff options
author | glx <glx@openttd.org> | 2007-09-27 21:39:13 +0000 |
---|---|---|
committer | glx <glx@openttd.org> | 2007-09-27 21:39:13 +0000 |
commit | 5e45e730375743b5429215644b31d1bb1cfdcf3b (patch) | |
tree | dcfc4308edebdd200f9fae9daf09ec2601ae2212 /src/ai/default/default.cpp | |
parent | 02d23c27764c9ff01c3f370c7638012e4520afa1 (diff) | |
download | openttd-5e45e730375743b5429215644b31d1bb1cfdcf3b.tar.xz |
(svn r11176) -Revert (r9867): as it is needed for newgrf callbacks 14B and 14C
Diffstat (limited to 'src/ai/default/default.cpp')
-rw-r--r-- | src/ai/default/default.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp index 87306b6bc..92b852e43 100644 --- a/src/ai/default/default.cpp +++ b/src/ai/default/default.cpp @@ -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; } } |