author | truelight |
Thu, 19 Jul 2007 22:39:43 +0000 | |
branch | noai |
changeset 9682 | d031eb183733 |
parent 9672 | 18c71ca987e4 |
child 9691 | 1231d4e5f5aa |
permissions | -rw-r--r-- |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
1 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
2 |
class WrightAI extends AIController { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
3 |
airport = null; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
4 |
company = null; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
5 |
map = null; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
6 |
order = null; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
7 |
station = null; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
8 |
vehicle = null; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
9 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
10 |
name = null; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
11 |
towns_used = null; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
12 |
route_1 = null; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
13 |
route_2 = null; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
14 |
distance_of_route = {}; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
15 |
vehicle_to_depot = {}; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
16 |
delay_build_airport_route = 1000; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
17 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
18 |
function Start(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
19 |
function Stop(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
20 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
21 |
constructor() { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
22 |
this.airport = AIAirport(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
23 |
this.company = AICompany(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
24 |
this.map = AIMap(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
25 |
this.order = AIOrder(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
26 |
this.station = AIStation(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
27 |
this.vehicle = AIVehicle(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
28 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
29 |
this.towns_used = AIList(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
30 |
this.route_1 = AIList(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
31 |
this.route_2 = AIList(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
32 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
33 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
34 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
35 |
/** |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
36 |
* Check if we have enough money (via loan and on bank). |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
37 |
*/ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
38 |
function WrightAI::HasMoney(money) |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
39 |
{ |
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9667
diff
changeset
|
40 |
if (this.company.GetBankBalance(AICompany.MY_COMPANY) + (this.company.GetMaxLoanAmount() - this.company.GetLoanAmount()) > money) return true; |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
41 |
return false; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
42 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
43 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
44 |
/** |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
45 |
* Get the amount of money requested, loan if needed. |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
46 |
*/ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
47 |
function WrightAI::GetMoney(money) |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
48 |
{ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
49 |
if (!this.HasMoney(money)) return; |
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9667
diff
changeset
|
50 |
if (this.company.GetBankBalance(AICompany.MY_COMPANY) > money) return; |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
51 |
|
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9667
diff
changeset
|
52 |
local loan = money - this.company.GetBankBalance(AICompany.MY_COMPANY) + this.company.GetLoanInterval() + this.company.GetLoanAmount(); |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
53 |
loan = loan - loan % this.company.GetLoanInterval(); |
9682
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
54 |
print(this.name + ": [INFO] Need a loan to get " + money + ": " + loan); |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
55 |
this.company.SetLoanAmount(loan); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
56 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
57 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
58 |
/** |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
59 |
* Build an airport route. Find 2 cities that are big enough and try to build airport in both cities. |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
60 |
* Then we can build an aircraft and make some money. |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
61 |
*/ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
62 |
function WrightAI::BuildAirportRoute() |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
63 |
{ |
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
64 |
local airport_type = (AIAirport.AiportAvailable(AIAirport.AT_SMALL) ? AIAirport.AT_SMALL : AIAirport.AT_LARGE); |
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
65 |
|
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
66 |
/* Get enough money to work with */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
67 |
this.GetMoney(150000); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
68 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
69 |
print(this.name + ": [INFO] Trying to build an airport route"); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
70 |
|
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
71 |
local tile_1 = this.FindSuitableAirportSpot(airport_type, 0); |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
72 |
if (tile_1 < 0) return -1; |
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
73 |
local tile_2 = this.FindSuitableAirportSpot(airport_type, tile_1); |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
74 |
/* XXX -- If tile_2 isn't found, tile_1 town is added to used list, but never really used */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
75 |
if (tile_2 < 0) return -2; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
76 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
77 |
/* Build the airports for real */ |
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
78 |
if (!this.airport.BuildAirport(tile_1, airport_type)) { |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
79 |
print(this.name + ": [ERROR] Although the testing told us we could build 2 airports, it still failed on the first airport at tile " + tile_1 + "."); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
80 |
/* XXX -- We should free the towns again for an other day */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
81 |
return -3; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
82 |
} |
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
83 |
if (!this.airport.BuildAirport(tile_2, airport_type)) { |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
84 |
print(this.name + ": [ERROR] Although the testing told us we could build 2 airports, it still failed on the second airport at tile " + tile_2 + "."); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
85 |
this.airport.RemoveAirport(tile_1); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
86 |
/* XXX -- We should free the towns again for an other day */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
87 |
return -4; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
88 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
89 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
90 |
local ret = this.BuildAircraft(tile_1, tile_2); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
91 |
if (ret < 0) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
92 |
this.airport.RemoveAirport(tile_1); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
93 |
this.airport.RemoveAirport(tile_2); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
94 |
/* XXX -- We should free the towns again for an other day */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
95 |
return ret; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
96 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
97 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
98 |
print(this.name + ": [INFO] Done building a route"); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
99 |
return ret; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
100 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
101 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
102 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
103 |
/** |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
104 |
* Build an aircraft with orders from tile_1 to tile_2. |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
105 |
* The best available aircraft of that time will be bought. |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
106 |
*/ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
107 |
function WrightAI::BuildAircraft(tile_1, tile_2) |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
108 |
{ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
109 |
/* Build an aircraft */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
110 |
local hangar = this.airport.GetHangarOfAirport(tile_1); |
9672
18c71ca987e4
(svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents:
9671
diff
changeset
|
111 |
/* When bank balance < 300000, buy cheaper planes */ |
18c71ca987e4
(svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents:
9671
diff
changeset
|
112 |
local balance = this.company.GetBankBalance(AICompany.MY_COMPANY); |
18c71ca987e4
(svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents:
9671
diff
changeset
|
113 |
local engine = this.vehicle.FindBestAircraftVehicle(0, 0, (balance < 300000 ? 50000 : (balance < 1000000 ? 300000 : 1000000))); |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
114 |
if (!this.vehicle.IsValidEngine(engine)) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
115 |
print(this.name + ": [ERROR] Couldn't find a suitable engine"); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
116 |
return -5; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
117 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
118 |
local vehicle = this.vehicle.BuildVehicle(hangar, engine); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
119 |
if (!this.vehicle.IsValidVehicle(vehicle)) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
120 |
print(this.name + ": [ERROR] Couldn't build the aircraft"); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
121 |
return -6; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
122 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
123 |
/* Send him on his way */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
124 |
this.order.AppendOrder(vehicle, tile_1, AIOrder.AIOF_NONE); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
125 |
this.order.AppendOrder(vehicle, tile_2, AIOrder.AIOF_NONE); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
126 |
this.vehicle.StartStopVehicle(vehicle); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
127 |
this.distance_of_route.rawset(vehicle, AIMap.DistanceManhattan(tile_1, tile_2)); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
128 |
this.route_1.AddItem(vehicle, tile_1); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
129 |
this.route_2.AddItem(vehicle, tile_2); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
130 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
131 |
print(this.name + ": [INFO] Done building an aircraft"); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
132 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
133 |
return 0; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
134 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
135 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
136 |
/** |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
137 |
* Find a suitable spot for an airport, walking all towns hoping to find one. |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
138 |
* When a town is used, it is marked as such and not re-used. |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
139 |
*/ |
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
140 |
function WrightAI::FindSuitableAirportSpot(airport_type, center_tile) |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
141 |
{ |
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
142 |
local airport_x, airport_y, airport_rad; |
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
143 |
|
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
144 |
airport_x = AIAirport.GetAirportWidth(airport_type); |
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
145 |
airport_y = AIAirport.GetAirportHeight(airport_type); |
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
146 |
airport_rad = AIAirport.GetAirportCoverageRadius(airport_type); |
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
147 |
|
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
148 |
local town_list = AITownList(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
149 |
/* Remove all the towns we already used */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
150 |
town_list.RemoveList(this.towns_used); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
151 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
152 |
town_list.Valuate(AITownListPopulation()); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
153 |
town_list.KeepAboveValue(500); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
154 |
/* Keep the best 10, if we can't find 2 stations in there, just leave it anyway */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
155 |
town_list.KeepTop(10); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
156 |
town_list.Valuate(AIListRandomize()); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
157 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
158 |
/* Now find 2 suitable towns */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
159 |
for (local town = town_list.Begin(); town_list.HasNext(); town = town_list.Next()) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
160 |
/* Don't make this a CPU hog */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
161 |
Sleep(1); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
162 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
163 |
local tile = AITown.GetLocation(town); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
164 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
165 |
/* Create a 30x30 grid around the core of the town and see if we can find a spot for a small airport */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
166 |
local list = AITileList(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
167 |
/* XXX -- We assume we are more than 15 tiles away from the border! */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
168 |
list.AddRectangle(tile - this.map.GetTileIndex(15, 15), tile + this.map.GetTileIndex(15, 15)); |
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
169 |
list.Valuate(AITileListBuildableRectangle(airport_x, airport_y)); |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
170 |
list.KeepValue(1); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
171 |
if (center_tile != 0) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
172 |
/* If we have a tile defined, we don't want to be within 25 tiles of this tile */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
173 |
list.Valuate(AITileListDistanceSquareToTile(center_tile)); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
174 |
list.KeepAboveValue(625); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
175 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
176 |
/* Sort on acceptance, remove places that don't have acceptance */ |
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
177 |
list.Valuate(AITileListCargoAcceptance(0, airport_x, airport_y, airport_rad)); |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
178 |
list.RemoveBelowValue(10); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
179 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
180 |
/* Couldn't find a suitable place for this town, skip to the next */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
181 |
if (list.Count() == 0) continue; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
182 |
/* Walk all the tiles and see if we can build the airport at all */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
183 |
{ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
184 |
local test = AITestMode(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
185 |
local good_tile = 0; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
186 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
187 |
for (tile = list.Begin(); list.HasNext(); tile = list.Next()) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
188 |
Sleep(1); |
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9668
diff
changeset
|
189 |
if (!this.airport.BuildAirport(tile, airport_type)) continue; |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
190 |
good_tile = tile; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
191 |
break; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
192 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
193 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
194 |
/* Did we found a place to build the airport on? */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
195 |
if (good_tile == 0) continue; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
196 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
197 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
198 |
print(this.name + ": [INFO] Found a good spot for an airport in town " + town + " at tile " + tile); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
199 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
200 |
/* Make the town as used, so we don't use it again */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
201 |
this.towns_used.AddItem(town, tile); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
202 |
return tile; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
203 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
204 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
205 |
print(this.name + ": [INFO] Couldn't find a suitable town to build an airport in"); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
206 |
return -1; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
207 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
208 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
209 |
function WrightAI::ManageAirRoutes() |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
210 |
{ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
211 |
local list = AIVehicleList(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
212 |
list.Valuate(AIVehicleListAge()); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
213 |
/* Give the plane at least 2 years to make a difference */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
214 |
list.KeepAboveValue(365 * 2); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
215 |
list.Valuate(AIVehicleListProfitLastYear()); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
216 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
217 |
for (local i = list.Begin(); list.HasNext(); i = list.Next()) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
218 |
local profit = list.GetValue(i); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
219 |
/* Profit last year and this year bad? Let's sell the vehicle */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
220 |
if (profit < 10000 && this.vehicle.GetProfitThisYear(i) < 10000) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
221 |
/* Send the vehicle to depot if we didn't do so yet */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
222 |
if (!this.vehicle_to_depot.rawin(i) || this.vehicle_to_depot.rawget(i) != true) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
223 |
print(this.name + ": [INFO] Sending " + i + " to depot as profit is: " + profit + " / " + this.vehicle.GetProfitThisYear(i)); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
224 |
this.vehicle.SendVehicleToDepot(i); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
225 |
this.vehicle_to_depot.rawset(i, true); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
226 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
227 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
228 |
/* Try to sell it over and over till it really is in the depot */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
229 |
if (this.vehicle_to_depot.rawin(i) && this.vehicle_to_depot.rawget(i) == true) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
230 |
if (this.vehicle.SellVehicle(i)) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
231 |
print(this.name + ": [INFO] Selling " + i + " as it finally is in a depot."); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
232 |
/* Check if we are the last one serving those airports; else sell the airports */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
233 |
local list2 = AIStationVehicleList(this.station.GetStationID(this.route_1.GetValue(i))); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
234 |
if (list2.Count() == 0) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
235 |
/* Remove the airports */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
236 |
print(this.name + ": [INFO] Removing airports as nobody serves them anymore."); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
237 |
this.airport.RemoveAirport(this.route_1.GetValue(i)); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
238 |
this.airport.RemoveAirport(this.route_2.GetValue(i)); |
9682
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
239 |
this.route_1.RemoveItem(i); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
240 |
this.route_2.RemoveItem(i); |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
241 |
/* XXX -- We should free the towns_used entries too */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
242 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
243 |
this.vehicle_to_depot.rawdelete(i); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
244 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
245 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
246 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
247 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
248 |
/* Don't try to add planes when we are short on cash */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
249 |
if (!this.HasMoney(50000)) return; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
250 |
|
9671
ad29df0de918
(svn r10610) [NoAI] -Fix r10609: typo in WrightAI
truelight
parents:
9670
diff
changeset
|
251 |
list = AIStationList(AIStation.STATION_AIRPORT); |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
252 |
list.Valuate(AIStationListCargoWaiting(0)); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
253 |
list.KeepAboveValue(250); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
254 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
255 |
for (local i = list.Begin(); list.HasNext(); i = list.Next()) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
256 |
local list2 = AIStationVehicleList(i); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
257 |
/* No vehicles going to this station, abort */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
258 |
/* TODO -- Sell station */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
259 |
if (list2.Count() == 0) continue; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
260 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
261 |
/* Find the first vehicle that is going to this station */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
262 |
local v = list2.Begin(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
263 |
local dist = this.distance_of_route.rawget(v); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
264 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
265 |
list2.Valuate(AIVehicleListAge()); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
266 |
list2.KeepBelowValue(dist); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
267 |
/* Do not build a new vehicle if we bought a new one in the last DISTANCE days */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
268 |
if (list2.Count() != 0) continue; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
269 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
270 |
print(this.name + ": [INFO] Station " + i + " (" + this.station.GetLocation(i) + ") has too many cargo, adding a new vehicle for the route."); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
271 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
272 |
/* Make sure we have enough money */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
273 |
this.GetMoney(50000); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
274 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
275 |
return this.BuildAircraft(this.route_1.GetValue(v), this.route_2.GetValue(v)); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
276 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
277 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
278 |
|
9682
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
279 |
function WrightAI::HandleEvents() |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
280 |
{ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
281 |
while (AIEventController.IsEventWaiting()) { |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
282 |
local e = AIEventController.GetNextEvent(); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
283 |
switch (e.GetEventType()) { |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
284 |
case AIEvent.AI_ET_CRASHED_VEHICLE: |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
285 |
local ec = AIEventVehicleCrash.Convert(e); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
286 |
local v = ec.GetVehicleID(); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
287 |
print(this.name + ": [INFO] We have a crashed vehicle (" + v + "), buying a new one as replacement"); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
288 |
this.BuildAircraft(this.route_1.GetValue(v), this.route_2.GetValue(v)); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
289 |
this.route_1.RemoveItem(v); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
290 |
this.route_2.RemoveItem(v); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
291 |
break; |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
292 |
|
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
293 |
default: |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
294 |
break; |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
295 |
} |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
296 |
} |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
297 |
} |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
298 |
|
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
299 |
function WrightAI::Start() |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
300 |
{ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
301 |
/* Sleep 1 tick, as we can't execute anything in tick 0 */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
302 |
Sleep(1); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
303 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
304 |
/* Give the boy a name */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
305 |
if (!this.company.SetCompanyName("WrightAI")) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
306 |
local i = 2; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
307 |
while (!this.company.SetCompanyName("WrightAI #" + i)) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
308 |
i++; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
309 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
310 |
} |
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9667
diff
changeset
|
311 |
this.name = this.company.GetCompanyName(AICompany.MY_COMPANY); |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
312 |
print(this.name + ": Welcome to WrightAI. I will be building airports all day long."); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
313 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
314 |
/* We start with almost no loan, and we take a loan when we want to build something */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
315 |
this.company.SetLoanAmount(this.company.GetLoanInterval()); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
316 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
317 |
/* We need our local ticker, as GetTick() will skip ticks */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
318 |
local ticker = 0; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
319 |
/* Let's go on for ever */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
320 |
while (true) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
321 |
ticker++; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
322 |
/* Once in a while, with enough money, try to build something */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
323 |
if (ticker % this.delay_build_airport_route == 0 && this.HasMoney(100000)) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
324 |
local ret = this.BuildAirportRoute(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
325 |
if (ret == -1) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
326 |
/* No more route found, delay even more before trying to find an other */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
327 |
this.delay_build_airport_route = 10000; |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
328 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
329 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
330 |
/* Manage the routes once in a while */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
331 |
if (ticker % 2000 == 0) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
332 |
this.ManageAirRoutes(); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
333 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
334 |
/* Try to get ride of our loan once in a while */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
335 |
if (ticker % 5000 == 0) { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
336 |
this.company.SetLoanAmount(0); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
337 |
} |
9682
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
338 |
/* Check for events once in a while */ |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
339 |
if (ticker % 100 == 0) { |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
340 |
this.HandleEvents(); |
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9672
diff
changeset
|
341 |
} |
9667
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
342 |
/* Make sure we do not create infinite loops */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
343 |
Sleep(1); |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
344 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
345 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
346 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
347 |
function WrightAI::Stop() |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
348 |
{ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
349 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
350 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
351 |
class FWrightAI extends AIFactory { |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
352 |
function GetAuthor() { return "OpenTTD Dev Team"; } |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
353 |
function GetName() { return "WrightAI"; } |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
354 |
function GetDescription() { return "A simple AI that tries to beat you with only aircrafts"; } |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
355 |
function GetVersion() { return 1; } |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
356 |
function GetDate() { return "2007-07-15"; } |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
357 |
function CreateInstance() { return "WrightAI"; } |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
358 |
} |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
359 |
|
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
360 |
/* Tell the core we are an AI */ |
053afa64f977
(svn r10581) [NoAI] -Add: added WrightAI, and even though it is an aircraft only AI, it is the first NoAI that actually builds something useful and that is where the name came from (wright is archaic English for craftsman or builder)
truelight
parents:
diff
changeset
|
361 |
iFWrightAI <- FWrightAI(); |