author | tron |
Tue, 27 Jun 2006 21:25:53 +0000 | |
changeset 4077 | d4d440dd8925 |
parent 3644 | 7c9a6a91873b |
child 5380 | 8ea58542b6e0 |
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 |
|
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
19 |
uint x1 = TileX(tile_a); |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
20 |
uint x2 = TileX(tile_b); |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
21 |
uint x3 = TileX(tile_c); |
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
|
22 |
|
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
23 |
uint y1 = TileY(tile_a); |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
24 |
uint y2 = TileY(tile_b); |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
25 |
uint y3 = TileY(tile_c); |
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
|
26 |
|
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 |
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
|
28 |
if (x1 == x2 && x2 == x3) return 1; |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
29 |
if (y2 > y1) return x2 > x3 ? 2 : 4; |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
30 |
if (x2 > x1) return y2 > y3 ? 2 : 5; |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
31 |
if (y1 > y2) return x2 > x3 ? 5 : 3; |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
32 |
if (x1 > x2) return y2 > y3 ? 4 : 3; |
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
|
33 |
|
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 |
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
|
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 |
|
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 |
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
|
38 |
{ |
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 |
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
|
40 |
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
|
41 |
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
|
42 |
|
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 |
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
|
44 |
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
|
45 |
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
|
46 |
|
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 |
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
|
48 |
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
|
49 |
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
|
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 |
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
|
52 |
|
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 |
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
|
54 |
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
|
55 |
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
|
56 |
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
|
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 |
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
|
59 |
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
|
60 |
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
|
61 |
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
|
62 |
|
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 |
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
|
64 |
} |
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 |
// 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
|
67 |
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
|
68 |
{ |
3644
7c9a6a91873b
(svn r4553) int and magic numbers -> Slope and DiagDirection
tron
parents:
2381
diff
changeset
|
69 |
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
|
70 |
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
|
71 |
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
|
72 |
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
|
73 |
} |
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 |
|
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
75 |
|
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
|
76 |
// 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
|
77 |
// and returns his flag |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
78 |
uint AiNew_GetSpecialVehicleFlag(Player* p, Vehicle* v) |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
79 |
{ |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
80 |
uint i; |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
81 |
|
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
82 |
for (i = 0; i < AI_MAX_SPECIAL_VEHICLES; i++) { |
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 |
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
|
84 |
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
|
85 |
} |
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
|
86 |
} |
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
|
87 |
|
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 |
// 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
|
89 |
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
|
90 |
} |
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 |
|
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
92 |
|
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
93 |
bool AiNew_SetSpecialVehicleFlag(Player* p, Vehicle* v, uint flag) |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
94 |
{ |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
95 |
int new_id = -1; |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
96 |
uint i; |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
97 |
|
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
98 |
for (i = 0; i < AI_MAX_SPECIAL_VEHICLES; i++) { |
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
|
99 |
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
|
100 |
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
|
101 |
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
|
102 |
} |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
103 |
if (new_id == -1 && |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
104 |
p->ainew.special_vehicles[i].veh_id == 0 && |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
105 |
p->ainew.special_vehicles[i].flag == 0) { |
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
|
106 |
new_id = i; |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3644
diff
changeset
|
107 |
} |
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
|
108 |
} |
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 |
|
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 |
// 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
|
111 |
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
|
112 |
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
|
113 |
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
|
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 |
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
|
116 |
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
|
117 |
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
|
118 |
} |