As a matter of design philosophy, I was under the impression that we want to have an AI that does not cheat, but at the same time is not handicapped by missing abilities that a human player has. I may be wrong, but this would be my philosophy.
As such, I am trying to implement what is relatively simple for a human to do, to see how many stations compete for the same cargo at an industry. This is turning into a major undertaking, because we don't have an AIStationList_IndustryCargoTaken(iid,cargo) or some-such. However, that is not at issue here.
With the tools that we have it is not possible to determine if a station is taking a particular cargo. A human can take a look at the cargo rating for a station --- any station --- but the AI can only do this for its own stations, because GetCargoRating is restricted by IsValidStation, which returns false if the station is not the AI's. A number of other AIStation functions are similarly restricted.
I am hoping this is an oversight and not a design decision and that it can be fixed. My view is that IsValidStation should not check if the station is owned by the AI, just that it is a valid station that exists.
While I am at this, can we also get a AIStationList_IndustryCargoTaken(iid,cargo) or something similar.
It should be fairly simple for the game to produce this, as it must already have such a list to distribute cargo to each station.