Page 1 of 1
myList.valuate(AIStation.IsValidStation)
Posted: 09 Jul 2011 21:06
by Kev!
Howdy,
Is there a way to valuate my list of stations to leave only MY stations?
Please advise,
Kev!
Re: myList.valuate(AIStation.IsValidStation)
Posted: 09 Jul 2011 22:39
by Zuu
In fact your list of stations only includes your own stations. It is not even possible to (easily) obtain a list of opponent stations from the API.
Re: myList.valuate(AIStation.IsValidStation)
Posted: 09 Jul 2011 23:15
by Kev!
Hmm...
Perhaps I should define "my list of stations"?...Since I did not know how to get a list of my stations I did this...
I make a tilelist, add a rectangle around the town and valuate for IsRoadStationTile...this give me a list including other players stations? then I iterate and see if they are mine... using IsValidStaion...
I thought there must be an easier way, and so my question? Maybe I should ask how to get a list of my stations?
..other than keeping track of them as I build them?
Please advise,
Kev!
Re: myList.valuate(AIStation.IsValidStation)
Posted: 09 Jul 2011 23:39
by krinn
http://noai.openttd.org/docs/trunk/clas ... nList.html
and for your 2nd question:
from your stations list, valuate it by owner and keep only your own company as :
stationlist=yourlistoftiles
stationlist.Valuate(AITile.IsStationTile);
stationlist.KeepValue(1); // keep only tiles with a station on it
stationslist.Valuate(AITile.GetOwner)
local me=AICompany.ResolveCompanyID(AICompany.COMPANY_SELF);
stationslist.KeepValue(me); // keep only your own stations
Re: myList.valuate(AIStation.IsValidStation)
Posted: 09 Jul 2011 23:44
by Kev!
WOW!
I guess AIStationList would do the trick? and valuate on IsWithinTownInfluence...yeah...that's the ticket!
Sorry for the fuss, nothing to see here...heh...I'll just stop typing now?
Thanks,
Kev!
Re: myList.valuate(AIStation.IsValidStation)
Posted: 09 Jul 2011 23:56
by krinn
look here, i've done it for depot tiles (similar to you, but with depot, and this is easier this time than browsing depot list)
http://dev.openttdcoop.org/projects/ai- ... uilder.nut
look at line 175
Re: myList.valuate(AIStation.IsValidStation)
Posted: 10 Jul 2011 02:19
by Kev!
Krinn!
You da man.

Thank you so much! I could not figure out the depots...that was gonna be my next question!
You read my mind...
Now to buy a bus, give some orders and send it off! Very exciting!
Thanks again,
Kev!