author | tron |
Sun, 23 Apr 2006 19:08:33 +0000 | |
changeset 3644 | 7c9a6a91873b |
parent 2381 | 9a5ed6c0a2e6 |
child 4077 | d4d440dd8925 |
permissions | -rw-r--r-- |
2381
9a5ed6c0a2e6
(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:
diff
changeset
|
1 |
/* $Id$ */ |
9a5ed6c0a2e6
(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:
diff
changeset
|
2 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
3 |
#include "../../stdafx.h" |
9a5ed6c0a2e6
(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:
diff
changeset
|
4 |
#include "../../openttd.h" |
9a5ed6c0a2e6
(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:
diff
changeset
|
5 |
#include "../../debug.h" |
9a5ed6c0a2e6
(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:
diff
changeset
|
6 |
#include "../../map.h" |
9a5ed6c0a2e6
(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:
diff
changeset
|
7 |
#include "trolly.h" |
9a5ed6c0a2e6
(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:
diff
changeset
|
8 |
#include "../../vehicle.h" |
9a5ed6c0a2e6
(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:
diff
changeset
|
9 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
10 |
int AiNew_GetRailDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c) |
9a5ed6c0a2e6
(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:
diff
changeset
|
11 |
{ |
9a5ed6c0a2e6
(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:
diff
changeset
|
12 |
// 0 = vert |
9a5ed6c0a2e6
(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:
diff
changeset
|
13 |
// 1 = horz |
9a5ed6c0a2e6
(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:
diff
changeset
|
14 |
// 2 = dig up-left |
9a5ed6c0a2e6
(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:
diff
changeset
|
15 |
// 3 = dig down-right |
9a5ed6c0a2e6
(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:
diff
changeset
|
16 |
// 4 = dig down-left |
9a5ed6c0a2e6
(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:
diff
changeset
|
17 |
// 5 = dig up-right |
9a5ed6c0a2e6
(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:
diff
changeset
|
18 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
19 |
int x1, x2, x3; |
9a5ed6c0a2e6
(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:
diff
changeset
|
20 |
int y1, y2, y3; |
9a5ed6c0a2e6
(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:
diff
changeset
|
21 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
22 |
x1 = TileX(tile_a); |
9a5ed6c0a2e6
(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:
diff
changeset
|
23 |
x2 = TileX(tile_b); |
9a5ed6c0a2e6
(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:
diff
changeset
|
24 |
x3 = TileX(tile_c); |
9a5ed6c0a2e6
(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:
diff
changeset
|
25 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
26 |
y1 = TileY(tile_a); |
9a5ed6c0a2e6
(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:
diff
changeset
|
27 |
y2 = TileY(tile_b); |
9a5ed6c0a2e6
(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:
diff
changeset
|
28 |
y3 = TileY(tile_c); |
9a5ed6c0a2e6
(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:
diff
changeset
|
29 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
30 |
if (y1 == y2 && y2 == y3) return 0; |
9a5ed6c0a2e6
(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:
diff
changeset
|
31 |
if (x1 == x2 && x2 == x3) return 1; |
9a5ed6c0a2e6
(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:
diff
changeset
|
32 |
if (y2 > y1) { |
9a5ed6c0a2e6
(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:
diff
changeset
|
33 |
if (x2 > x3) return 2; |
9a5ed6c0a2e6
(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:
diff
changeset
|
34 |
else return 4; |
9a5ed6c0a2e6
(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:
diff
changeset
|
35 |
} |
9a5ed6c0a2e6
(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:
diff
changeset
|
36 |
if (x2 > x1) { |
9a5ed6c0a2e6
(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:
diff
changeset
|
37 |
if (y2 > y3) return 2; |
9a5ed6c0a2e6
(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:
diff
changeset
|
38 |
else return 5; |
9a5ed6c0a2e6
(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:
diff
changeset
|
39 |
} |
9a5ed6c0a2e6
(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:
diff
changeset
|
40 |
if (y1 > y2) { |
9a5ed6c0a2e6
(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:
diff
changeset
|
41 |
if (x2 > x3) return 5; |
9a5ed6c0a2e6
(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:
diff
changeset
|
42 |
else return 3; |
9a5ed6c0a2e6
(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:
diff
changeset
|
43 |
} |
9a5ed6c0a2e6
(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:
diff
changeset
|
44 |
if (x1 > x2) { |
9a5ed6c0a2e6
(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:
diff
changeset
|
45 |
if (y2 > y3) return 4; |
9a5ed6c0a2e6
(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:
diff
changeset
|
46 |
else return 3; |
9a5ed6c0a2e6
(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:
diff
changeset
|
47 |
} |
9a5ed6c0a2e6
(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:
diff
changeset
|
48 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
49 |
return 0; |
9a5ed6c0a2e6
(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:
diff
changeset
|
50 |
} |
9a5ed6c0a2e6
(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:
diff
changeset
|
51 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
52 |
int AiNew_GetRoadDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c) |
9a5ed6c0a2e6
(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:
diff
changeset
|
53 |
{ |
9a5ed6c0a2e6
(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:
diff
changeset
|
54 |
int x1, x2, x3; |
9a5ed6c0a2e6
(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:
diff
changeset
|
55 |
int y1, y2, y3; |
9a5ed6c0a2e6
(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:
diff
changeset
|
56 |
int r; |
9a5ed6c0a2e6
(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:
diff
changeset
|
57 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
58 |
x1 = TileX(tile_a); |
9a5ed6c0a2e6
(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:
diff
changeset
|
59 |
x2 = TileX(tile_b); |
9a5ed6c0a2e6
(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:
diff
changeset
|
60 |
x3 = TileX(tile_c); |
9a5ed6c0a2e6
(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:
diff
changeset
|
61 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
62 |
y1 = TileY(tile_a); |
9a5ed6c0a2e6
(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:
diff
changeset
|
63 |
y2 = TileY(tile_b); |
9a5ed6c0a2e6
(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:
diff
changeset
|
64 |
y3 = TileY(tile_c); |
9a5ed6c0a2e6
(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:
diff
changeset
|
65 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
66 |
r = 0; |
9a5ed6c0a2e6
(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:
diff
changeset
|
67 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
68 |
if (x1 < x2) r += 8; |
9a5ed6c0a2e6
(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:
diff
changeset
|
69 |
if (y1 < y2) r += 1; |
9a5ed6c0a2e6
(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:
diff
changeset
|
70 |
if (x1 > x2) r += 2; |
9a5ed6c0a2e6
(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:
diff
changeset
|
71 |
if (y1 > y2) r += 4; |
9a5ed6c0a2e6
(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:
diff
changeset
|
72 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
73 |
if (x2 < x3) r += 2; |
9a5ed6c0a2e6
(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:
diff
changeset
|
74 |
if (y2 < y3) r += 4; |
9a5ed6c0a2e6
(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:
diff
changeset
|
75 |
if (x2 > x3) r += 8; |
9a5ed6c0a2e6
(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:
diff
changeset
|
76 |
if (y2 > y3) r += 1; |
9a5ed6c0a2e6
(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:
diff
changeset
|
77 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
78 |
return r; |
9a5ed6c0a2e6
(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:
diff
changeset
|
79 |
} |
9a5ed6c0a2e6
(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:
diff
changeset
|
80 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
81 |
// Get's the direction between 2 tiles seen from tile_a |
3644
7c9a6a91873b
(svn r4553) int and magic numbers -> Slope and DiagDirection
tron
parents:
2381
diff
changeset
|
82 |
DiagDirection AiNew_GetDirection(TileIndex tile_a, TileIndex tile_b) |
2381
9a5ed6c0a2e6
(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:
diff
changeset
|
83 |
{ |
3644
7c9a6a91873b
(svn r4553) int and magic numbers -> Slope and DiagDirection
tron
parents:
2381
diff
changeset
|
84 |
if (TileY(tile_a) < TileY(tile_b)) return DIAGDIR_SE; |
7c9a6a91873b
(svn r4553) int and magic numbers -> Slope and DiagDirection
tron
parents:
2381
diff
changeset
|
85 |
if (TileY(tile_a) > TileY(tile_b)) return DIAGDIR_NW; |
7c9a6a91873b
(svn r4553) int and magic numbers -> Slope and DiagDirection
tron
parents:
2381
diff
changeset
|
86 |
if (TileX(tile_a) < TileX(tile_b)) return DIAGDIR_SW; |
7c9a6a91873b
(svn r4553) int and magic numbers -> Slope and DiagDirection
tron
parents:
2381
diff
changeset
|
87 |
return DIAGDIR_NE; |
2381
9a5ed6c0a2e6
(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:
diff
changeset
|
88 |
} |
9a5ed6c0a2e6
(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:
diff
changeset
|
89 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
90 |
// This functions looks up if this vehicle is special for this AI |
9a5ed6c0a2e6
(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:
diff
changeset
|
91 |
// and returns his flag |
9a5ed6c0a2e6
(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:
diff
changeset
|
92 |
uint AiNew_GetSpecialVehicleFlag(Player *p, Vehicle *v) { |
9a5ed6c0a2e6
(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:
diff
changeset
|
93 |
int i; |
9a5ed6c0a2e6
(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:
diff
changeset
|
94 |
for (i=0;i<AI_MAX_SPECIAL_VEHICLES;i++) { |
9a5ed6c0a2e6
(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:
diff
changeset
|
95 |
if (p->ainew.special_vehicles[i].veh_id == v->index) { |
9a5ed6c0a2e6
(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:
diff
changeset
|
96 |
return p->ainew.special_vehicles[i].flag; |
9a5ed6c0a2e6
(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:
diff
changeset
|
97 |
} |
9a5ed6c0a2e6
(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:
diff
changeset
|
98 |
} |
9a5ed6c0a2e6
(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:
diff
changeset
|
99 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
100 |
// Not found :( |
9a5ed6c0a2e6
(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:
diff
changeset
|
101 |
return 0; |
9a5ed6c0a2e6
(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:
diff
changeset
|
102 |
} |
9a5ed6c0a2e6
(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:
diff
changeset
|
103 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
104 |
bool AiNew_SetSpecialVehicleFlag(Player *p, Vehicle *v, uint flag) { |
9a5ed6c0a2e6
(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:
diff
changeset
|
105 |
int i, new_id = -1; |
9a5ed6c0a2e6
(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:
diff
changeset
|
106 |
for (i=0;i<AI_MAX_SPECIAL_VEHICLES;i++) { |
9a5ed6c0a2e6
(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:
diff
changeset
|
107 |
if (p->ainew.special_vehicles[i].veh_id == v->index) { |
9a5ed6c0a2e6
(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:
diff
changeset
|
108 |
p->ainew.special_vehicles[i].flag |= flag; |
9a5ed6c0a2e6
(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:
diff
changeset
|
109 |
return true; |
9a5ed6c0a2e6
(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:
diff
changeset
|
110 |
} |
9a5ed6c0a2e6
(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:
diff
changeset
|
111 |
if (new_id == -1 && p->ainew.special_vehicles[i].veh_id == 0 && |
9a5ed6c0a2e6
(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:
diff
changeset
|
112 |
p->ainew.special_vehicles[i].flag == 0) |
9a5ed6c0a2e6
(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:
diff
changeset
|
113 |
new_id = i; |
9a5ed6c0a2e6
(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:
diff
changeset
|
114 |
} |
9a5ed6c0a2e6
(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:
diff
changeset
|
115 |
|
9a5ed6c0a2e6
(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:
diff
changeset
|
116 |
// Out of special_vehicle spots :s |
9a5ed6c0a2e6
(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:
diff
changeset
|
117 |
if (new_id == -1) { |
9a5ed6c0a2e6
(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:
diff
changeset
|
118 |
DEBUG(ai, 1)("special_vehicles list is too small :("); |
9a5ed6c0a2e6
(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:
diff
changeset
|
119 |
return false; |
9a5ed6c0a2e6
(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:
diff
changeset
|
120 |
} |
9a5ed6c0a2e6
(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:
diff
changeset
|
121 |
p->ainew.special_vehicles[new_id].veh_id = v->index; |
9a5ed6c0a2e6
(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:
diff
changeset
|
122 |
p->ainew.special_vehicles[new_id].flag = flag; |
9a5ed6c0a2e6
(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:
diff
changeset
|
123 |
return true; |
9a5ed6c0a2e6
(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:
diff
changeset
|
124 |
} |