author | bjarni |
Mon, 05 Feb 2007 21:16:56 +0000 | |
changeset 6192 | c6adfc929c6b |
parent 5726 | 8f399788f6c9 |
child 6720 | 35756db7e577 |
permissions | -rw-r--r-- |
2925
0fea187a09f5
(svn r3481) - Try and fix an svn discrepancy of trolly.h #2
Darkvater
parents:
2924
diff
changeset
|
1 |
/* $Id$ */ |
0fea187a09f5
(svn r3481) - Try and fix an svn discrepancy of trolly.h #2
Darkvater
parents:
2924
diff
changeset
|
2 |
|
2381
de9053fe2a2c
(svn r2907) -Codechange: splitted the AIs to their own directory. AINew becomes 'trolly', AIOld becomes 'default', both in their own dir in the 'ai' dir. More AIs to come.
truelight
parents:
2366
diff
changeset
|
3 |
#ifndef AI_TROLLY_H |
de9053fe2a2c
(svn r2907) -Codechange: splitted the AIs to their own directory. AINew becomes 'trolly', AIOld becomes 'default', both in their own dir in the 'ai' dir. More AIs to come.
truelight
parents:
2366
diff
changeset
|
4 |
#define AI_TROLLY_H |
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
5 |
|
2381
de9053fe2a2c
(svn r2907) -Codechange: splitted the AIs to their own directory. AINew becomes 'trolly', AIOld becomes 'default', both in their own dir in the 'ai' dir. More AIs to come.
truelight
parents:
2366
diff
changeset
|
6 |
#include "../../aystar.h" |
de9053fe2a2c
(svn r2907) -Codechange: splitted the AIs to their own directory. AINew becomes 'trolly', AIOld becomes 'default', both in their own dir in the 'ai' dir. More AIs to come.
truelight
parents:
2366
diff
changeset
|
7 |
#include "../../player.h" |
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
8 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
9 |
/* |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
10 |
* These defines can be altered to change the behavoir of the AI |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
11 |
* |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
12 |
* WARNING: |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
13 |
* This can also alter the AI in a negative way. I will never claim these settings |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
14 |
* are perfect, but don't change them if you don't know what the effect is. |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
15 |
*/ |
145 | 16 |
|
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
17 |
// How many times it the H multiplied. The higher, the more it will go straight to the |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
18 |
// end point. The lower, how more it will find the route with the lowest cost. |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
19 |
// also: the lower, the longer it takes before route is calculated.. |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
20 |
#define AI_PATHFINDER_H_MULTIPLER 100 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
21 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
22 |
// How many loops may AyStar do before it stops |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
23 |
// 0 = infinite |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
24 |
#define AI_PATHFINDER_LOOPS_PER_TICK 5 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
25 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
26 |
// How long may the AI search for one route? |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
27 |
// 0 = infinite |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
28 |
// This number is the number of tiles tested. |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
29 |
// It takes (AI_PATHFINDER_MAX_SEARCH_NODES / AI_PATHFINDER_LOOPS_PER_TICK) ticks |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
30 |
// to get here.. with 5000 / 10 = 500. 500 / 74 (one day) = 8 days till it aborts |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
31 |
// (that is: if the AI is on VERY FAST! :p |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
32 |
#define AI_PATHFINDER_MAX_SEARCH_NODES 5000 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
33 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
34 |
// If you enable this, the AI is not allowed to make 90degree turns |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
35 |
#define AI_PATHFINDER_NO_90DEGREES_TURN |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
36 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
37 |
// Below are defines for the g-calculation |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
38 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
39 |
// Standard penalty given to a tile |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
40 |
#define AI_PATHFINDER_PENALTY 150 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
41 |
// The penalty given to a tile that is going up |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
42 |
#define AI_PATHFINDER_TILE_GOES_UP_PENALTY 450 |
1494
36882c64a497
(svn r1998) Give penalty 100 to the AI for using foundations (buildonslopes). This prevents it from building long road lines on foundations unless really necessary.
pasky
parents:
1047
diff
changeset
|
43 |
// The penalty given to a tile which would have to use fundation |
36882c64a497
(svn r1998) Give penalty 100 to the AI for using foundations (buildonslopes). This prevents it from building long road lines on foundations unless really necessary.
pasky
parents:
1047
diff
changeset
|
44 |
#define AI_PATHFINDER_FOUNDATION_PENALTY 100 |
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
45 |
// Changing direction is a penalty, to prevent curved ways (with that: slow ways) |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
46 |
#define AI_PATHFINDER_DIRECTION_CHANGE_PENALTY 200 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
47 |
// Same penalty, only for when road already exists |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
48 |
#define AI_PATHFINDER_DIRECTION_CHANGE_ON_EXISTING_ROAD_PENALTY 50 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
49 |
// A diagonal track cost the same as a straigh, but a diagonal is faster... so give |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
50 |
// a bonus for using diagonal track |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
51 |
#ifdef AI_PATHFINDER_NO_90DEGREES_TURN |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
52 |
#define AI_PATHFINDER_DIAGONAL_BONUS 95 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
53 |
#else |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
54 |
#define AI_PATHFINDER_DIAGONAL_BONUS 75 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
55 |
#endif |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
56 |
// If a roadblock already exists, it gets a bonus |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
57 |
#define AI_PATHFINDER_ROAD_ALREADY_EXISTS_BONUS 140 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
58 |
// To prevent 3 direction changes in 3 tiles, this penalty is given in such situation |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
59 |
#define AI_PATHFINDER_CURVE_PENALTY 200 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
60 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
61 |
// Penalty a bridge gets per length |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
62 |
#define AI_PATHFINDER_BRIDGE_PENALTY 180 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
63 |
// The penalty for a bridge going up |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
64 |
#define AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY 1000 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
65 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
66 |
// Tunnels are expensive... |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
67 |
// Because of that, every tile the cost is increased with 1/8th of his value |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
68 |
// This is also true if you are building a tunnel yourself |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
69 |
#define AI_PATHFINDER_TUNNEL_PENALTY 350 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
70 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
71 |
/* |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
72 |
* Ai_New defines |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
73 |
*/ |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
74 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
75 |
// How long may we search cities and industry for a new route? |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
76 |
#define AI_LOCATE_ROUTE_MAX_COUNTER 200 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
77 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
78 |
// How many days must there be between building the first station and the second station |
826 | 79 |
// within one city. This number is in days and should be more than 4 months. |
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
80 |
#define AI_CHECKCITY_DATE_BETWEEN 180 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
81 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
82 |
// How many cargo is needed for one station in a city? |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
83 |
#define AI_CHECKCITY_CARGO_PER_STATION 60 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
84 |
// How much cargo must there not be used in a city before we can build a new station? |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
85 |
#define AI_CHECKCITY_NEEDED_CARGO 50 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
86 |
// When there is already a station which takes the same good and the rating of that |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
87 |
// city is higher then this numer, we are not going to attempt to build anything |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
88 |
// there |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
89 |
#define AI_CHECKCITY_CARGO_RATING 50 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
90 |
// But, there is a chance of 1 out of this number, that we do ;) |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
91 |
#define AI_CHECKCITY_CARGO_RATING_CHANCE 5 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
92 |
// If a city is too small to contain a station, there is a small chance |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
93 |
// that we still do so.. just to make the city bigger! |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
94 |
#define AI_CHECKCITY_CITY_CHANCE 5 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
95 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
96 |
// This number indicates for every unit of cargo, how many tiles two stations maybe be away |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
97 |
// from eachother. In other words: if we have 120 units of cargo in one station, and 120 units |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
98 |
// of the cargo in the other station, both stations can be 96 units away from eachother, if the |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
99 |
// next number is 0.4. |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
100 |
#define AI_LOCATEROUTE_BUS_CARGO_DISTANCE 0.4 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
101 |
#define AI_LOCATEROUTE_TRUCK_CARGO_DISTANCE 0.7 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
102 |
// In whole tiles, the minimum distance for a truck route |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
103 |
#define AI_LOCATEROUTE_TRUCK_MIN_DISTANCE 30 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
104 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
105 |
// The amount of tiles in a square from -X to +X that is scanned for a station spot |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
106 |
// (so if this number is 10, 20x20 = 400 tiles are scanned for _the_ perfect spot |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
107 |
// Safe values are between 15 and 5 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
108 |
#define AI_FINDSTATION_TILE_RANGE 10 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
109 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
110 |
// Building on normal speed goes very fast. Idle this amount of ticks between every |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
111 |
// building part. It is calculated like this: (4 - competitor_speed) * num + 1 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
112 |
// where competitor_speed is between 0 (very slow) to 4 (very fast) |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
113 |
#define AI_BUILDPATH_PAUSE 10 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
114 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
115 |
// Minimum % of reliabilty a vehicle has to have before the AI buys it |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
116 |
#define AI_VEHICLE_MIN_RELIABILTY 60 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
117 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
118 |
// The minimum amount of money a player should always have |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
119 |
#define AI_MINIMUM_MONEY 15000 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
120 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
121 |
// If the most cheap route is build, how much is it going to cost.. |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
122 |
// This is to prevent the AI from trying to build a route which can not be paid for |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
123 |
#define AI_MINIMUM_BUS_ROUTE_MONEY 25000 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
124 |
#define AI_MINIMUM_TRUCK_ROUTE_MONEY 35000 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
125 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
126 |
// The minimum amount of money before we are going to repay any money |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
127 |
#define AI_MINIMUM_LOAN_REPAY_MONEY 40000 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
128 |
// How many repays do we do if we have enough money to do so? |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
129 |
// Every repay is 10000 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
130 |
#define AI_LOAN_REPAY 2 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
131 |
// How much income must we have before paying back a loan? Month-based (and looked at the last month) |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
132 |
#define AI_MINIMUM_INCOME_FOR_LOAN 7000 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
133 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
134 |
// If there is <num> time as much cargo in the station then the vehicle can handle |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
135 |
// reuse the station instead of building a new one! |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
136 |
#define AI_STATION_REUSE_MULTIPLER 2 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
137 |
|
826 | 138 |
// No more than this amount of vehicles per station.. |
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
139 |
#define AI_CHECK_MAX_VEHICLE_PER_STATION 10 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
140 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
141 |
// How many thick between building 2 vehicles |
165
f81fa8c27236
(svn r166) -Codechange: change 74 for constant DAY_TICKS
darkvater
parents:
145
diff
changeset
|
142 |
#define AI_BUILD_VEHICLE_TIME_BETWEEN DAY_TICKS |
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
143 |
|
145 | 144 |
// How many days must there between vehicle checks |
145 |
// The more often, the less non-money-making lines there will be |
|
146 |
// but the unfair it may seem to a human player |
|
147 |
#define AI_DAYS_BETWEEN_VEHICLE_CHECKS 30 |
|
148 |
||
149 |
// How money profit does a vehicle needs to make to stay in order |
|
150 |
// This is the profit of this year + profit of last year |
|
151 |
// But also for vehicles that are just one year old. In other words: |
|
152 |
// Vehicles of 2 years do easier meet this setting then vehicles |
|
153 |
// of one year. This is a very good thing. New vehicles are filtered, |
|
154 |
// while old vehicles stay longer, because we do get less in return. |
|
155 |
#define AI_MINIMUM_ROUTE_PROFIT 1000 |
|
156 |
||
826 | 157 |
// A vehicle is considered lost when he his cargo is more than 180 days old |
145 | 158 |
#define AI_VEHICLE_LOST_DAYS 180 |
159 |
||
160 |
// How many times may the AI try to find a route before it gives up |
|
161 |
#define AI_MAX_TRIES_FOR_SAME_ROUTE 8 |
|
162 |
||
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
163 |
/* |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
164 |
* End of defines |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
165 |
*/ |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
166 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
167 |
// This stops 90degrees curves |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
168 |
static const byte _illegal_curves[6] = { |
2366 | 169 |
255, 255, // Horz and vert, don't have the effect |
170 |
5, // upleft and upright are not valid |
|
171 |
4, // downright and downleft are not valid |
|
172 |
2, // downleft and upleft are not valid |
|
173 |
3, // upright and downright are not valid |
|
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
174 |
}; |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
175 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
176 |
enum { |
2366 | 177 |
AI_STATE_STARTUP = 0, |
178 |
AI_STATE_FIRST_TIME, |
|
179 |
AI_STATE_NOTHING, |
|
180 |
AI_STATE_WAKE_UP, |
|
181 |
AI_STATE_LOCATE_ROUTE, |
|
182 |
AI_STATE_FIND_STATION, |
|
183 |
AI_STATE_FIND_PATH, |
|
184 |
AI_STATE_FIND_DEPOT, |
|
185 |
AI_STATE_VERIFY_ROUTE, |
|
186 |
AI_STATE_BUILD_STATION, |
|
187 |
AI_STATE_BUILD_PATH, |
|
188 |
AI_STATE_BUILD_DEPOT, |
|
189 |
AI_STATE_BUILD_VEHICLE, |
|
3946
c9e039a60682
(svn r5092) -Fix: There was a gross race condition in the AI code which made it pretty random if the AI could give a new vehicle its orders
tron
parents:
3885
diff
changeset
|
190 |
AI_STATE_WAIT_FOR_BUILD, |
2366 | 191 |
AI_STATE_GIVE_ORDERS, |
192 |
AI_STATE_START_VEHICLE, |
|
193 |
AI_STATE_REPAY_MONEY, |
|
145 | 194 |
AI_STATE_CHECK_ALL_VEHICLES, |
2366 | 195 |
AI_STATE_ACTION_DONE, |
196 |
AI_STATE_STOP, // Temporary function to stop the AI |
|
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
197 |
}; |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
198 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
199 |
// Used for tbt (train/bus/truck) |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
200 |
enum { |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
201 |
AI_TRAIN = 0, |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
202 |
AI_BUS, |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
203 |
AI_TRUCK, |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
204 |
}; |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
205 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
206 |
enum { |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
207 |
AI_ACTION_NONE = 0, |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
208 |
AI_ACTION_BUS_ROUTE, |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
209 |
AI_ACTION_TRUCK_ROUTE, |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
210 |
AI_ACTION_REPAY_LOAN, |
145 | 211 |
AI_ACTION_CHECK_ALL_VEHICLES, |
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
212 |
}; |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
213 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
214 |
// Used for from_type/to_type |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
215 |
enum { |
2366 | 216 |
AI_NO_TYPE = 0, |
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
217 |
AI_CITY, |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
218 |
AI_INDUSTRY, |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
219 |
}; |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
220 |
|
145 | 221 |
// Flags for in the vehicle |
222 |
enum { |
|
223 |
AI_VEHICLEFLAG_SELL = 1, |
|
224 |
// Remember, flags must be in power of 2 |
|
225 |
}; |
|
226 |
||
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
227 |
#define AI_NO_CARGO 0xFF // Means that there is no cargo defined yet (used for industry) |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
228 |
#define AI_NEED_CARGO 0xFE // Used when the AI needs to find out a cargo for the route |
1981 | 229 |
#define AI_STATION_RANGE TileXY(MapMaxX(), MapMaxY()) |
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
230 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
231 |
#define AI_PATHFINDER_NO_DIRECTION (byte)-1 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
232 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
233 |
// Flags used in user_data |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
234 |
#define AI_PATHFINDER_FLAG_BRIDGE 1 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
235 |
#define AI_PATHFINDER_FLAG_TUNNEL 2 |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
236 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
237 |
typedef void AiNew_StateFunction(Player *p); |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
238 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
239 |
// ai_new.c |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
240 |
void AiNewDoGameLoop(Player *p); |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
241 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
242 |
// ai_pathfinder.c |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
243 |
AyStar *new_AyStar_AiPathFinder(int max_tiles_around, Ai_PathFinderInfo *PathFinderInfo); |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
244 |
void clean_AyStar_AiPathFinder(AyStar *aystar, Ai_PathFinderInfo *PathFinderInfo); |
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
245 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
246 |
// ai_shared.c |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1494
diff
changeset
|
247 |
int AiNew_GetRailDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c); |
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1494
diff
changeset
|
248 |
int AiNew_GetRoadDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c); |
3644
45a307767dc1
(svn r4553) int and magic numbers -> Slope and DiagDirection
tron
parents:
3157
diff
changeset
|
249 |
DiagDirection AiNew_GetDirection(TileIndex tile_a, TileIndex tile_b); |
145 | 250 |
bool AiNew_SetSpecialVehicleFlag(Player *p, Vehicle *v, uint flag); |
251 |
uint AiNew_GetSpecialVehicleFlag(Player *p, Vehicle *v); |
|
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
252 |
|
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
253 |
// ai_build.c |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1494
diff
changeset
|
254 |
bool AiNew_Build_CompanyHQ(Player *p, TileIndex tile); |
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1494
diff
changeset
|
255 |
int AiNew_Build_Station(Player *p, byte type, TileIndex tile, byte length, byte numtracks, byte direction, byte flag); |
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1494
diff
changeset
|
256 |
int AiNew_Build_Bridge(Player *p, TileIndex tile_a, TileIndex tile_b, byte flag); |
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
257 |
int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte flag); |
3885
327cdee1f0b6
(svn r4941) Replace some ints and magic numbers by proper types and enums
tron
parents:
3644
diff
changeset
|
258 |
EngineID AiNew_PickVehicle(Player *p); |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1494
diff
changeset
|
259 |
int AiNew_Build_Vehicle(Player *p, TileIndex tile, byte flag); |
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2925
diff
changeset
|
260 |
int AiNew_Build_Depot(Player* p, TileIndex tile, DiagDirection direction, byte flag); |
110
a22a6b07904b
(svn r111) -Fix: converted all linebreaks to UNIX-linebreak (\n)
truelight
parents:
84
diff
changeset
|
261 |
|
2381
de9053fe2a2c
(svn r2907) -Codechange: splitted the AIs to their own directory. AINew becomes 'trolly', AIOld becomes 'default', both in their own dir in the 'ai' dir. More AIs to come.
truelight
parents:
2366
diff
changeset
|
262 |
#endif /* AI_TROLLY_H */ |