StationList_AroundIndustry(IndustryID)

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
User avatar
Xander
Route Supervisor
Route Supervisor
Posts: 485
Joined: 18 May 2007 12:47
Location: Oxford
Contact:

StationList_AroundIndustry(IndustryID)

Post by Xander »

How difficult would this be to add to the API? It's great knowing there's 5 stations "around" an industry, but it'd be much more useful to have a StationList of them...
Real Tycoons do it on Trains!

JAMI: Just Another Moronic Intelligence
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: StationList_AroundIndustry(IndustryID)

Post by Kogut »

You can get it by yourself - iterate/valuate through list of your stations.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
User avatar
Xander
Route Supervisor
Route Supervisor
Posts: 485
Joined: 18 May 2007 12:47
Location: Oxford
Contact:

Re: StationList_AroundIndustry(IndustryID)

Post by Xander »

Kogut wrote:You can get it by yourself - iterate/valuate through list of your stations.
Would you mind explaining that one in (at least pseudo) code?
Real Tycoons do it on Trains!

JAMI: Just Another Moronic Intelligence
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: StationList_AroundIndustry(IndustryID)

Post by Kogut »

Xander wrote:
Kogut wrote:You can get it by yourself - iterate/valuate through list of your stations.
Would you mind explaining that one in (at least pseudo) code?
I found in my AIAI a bit another way to do it

Code: Select all

local range = 3;
local tile_list=AITileList_IndustryProducing(i, range);
for (local q = tile_list.Begin(); tile_list.HasNext(); q = tile_list.Next()) //from Chopper 
   {
   local station_id = AIStation.GetStationID(q);
   if(AIStation.IsValidStation(station_id))
      {
      //Station found: you can print it, compare, add to list etc
      }
   }
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 7 guests