1966 * We cannot check the first of shared orders only, since the first vehicle in such a chain |
1966 * We cannot check the first of shared orders only, since the first vehicle in such a chain |
1967 * may have a different cargo type. |
1967 * may have a different cargo type. |
1968 */ |
1968 */ |
1969 const Order *o; |
1969 const Order *o; |
1970 FOR_VEHICLE_ORDERS(v, o) { |
1970 FOR_VEHICLE_ORDERS(v, o) { |
1971 if (o->IsType(OT_GOTO_STATION) && !HasBit(o->GetUnloadType(), OF_TRANSFER)) { |
1971 if (o->IsType(OT_GOTO_STATION) && !(o->GetUnloadType() & OUFB_TRANSFER)) { |
1972 /* Vehicle visits a station to load or unload */ |
1972 /* Vehicle visits a station to load or unload */ |
1973 Station *st = GetStation(o->GetDestination()); |
1973 Station *st = GetStation(o->GetDestination()); |
1974 if (!st->IsValid()) continue; |
1974 if (!st->IsValid()) continue; |
1975 |
1975 |
1976 /* Same cargo produced by industry is dropped here => not serviced by vehicle v */ |
1976 /* Same cargo produced by industry is dropped here => not serviced by vehicle v */ |
1977 if (HasBit(o->GetUnloadType(), OF_UNLOAD) && !c_accepts) break; |
1977 if ((o->GetUnloadType() & OUFB_UNLOAD) && !c_accepts) break; |
1978 |
1978 |
1979 if (stations.find(st) != stations.end()) { |
1979 if (stations.find(st) != stations.end()) { |
1980 if (v->owner == _local_player) return 2; // Player services industry |
1980 if (v->owner == _local_player) return 2; // Player services industry |
1981 result = 1; // Competitor services industry |
1981 result = 1; // Competitor services industry |
1982 } |
1982 } |