author | Darkvater |
Wed, 17 Jan 2007 01:02:51 +0000 | |
branch | 0.5 |
changeset 5415 | a7e0e4e75be2 |
parent 4845 | 49105d3b5a9a |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1359
diff
changeset
|
4 |
#include "openttd.h" |
4356
bc52a48e2590
(svn r6057) -Codechange: made a function GetRandomXXX, that _always_ returns a valid XXX, unless there are none to pick from. Then NULL is returned.
truelight
parents:
4346
diff
changeset
|
5 |
#include "functions.h" |
3314
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
3269
diff
changeset
|
6 |
#include "industry_map.h" |
3315
1f65f8260092
(svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
3314
diff
changeset
|
7 |
#include "station_map.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
410
diff
changeset
|
8 |
#include "table/strings.h" |
679
e959706a3e4d
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
555
diff
changeset
|
9 |
#include "map.h" |
1209
a1ac96655b79
(svn r1713) Split off several functions which query/set information about a single tile from map.h and put them into a seperate file tile.h
tron
parents:
1093
diff
changeset
|
10 |
#include "tile.h" |
0 | 11 |
#include "vehicle.h" |
12 |
#include "command.h" |
|
13 |
#include "news.h" |
|
14 |
#include "station.h" |
|
2435
66742d77db13
(svn r2961) - Fix: [ 1219123 ] Fix for [ 1216203 ] UFO-broken waypoint (lucaspiller)
Darkvater
parents:
2360
diff
changeset
|
15 |
#include "waypoint.h" |
0 | 16 |
#include "town.h" |
17 |
#include "industry.h" |
|
18 |
#include "player.h" |
|
3701
13911c5df3e7
(svn r4642) - Codechange: reorganise airport.h and airport_movement.h to avoid having 8 copies of the airport FTAs, and make the enums used available elsewhere.
peter1138
parents:
3645
diff
changeset
|
19 |
#include "airport.h" |
337
66647f97e7c0
(svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents:
193
diff
changeset
|
20 |
#include "sound.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2140
diff
changeset
|
21 |
#include "variables.h" |
2535 | 22 |
#include "table/sprites.h" |
4261
2ec8f5a9747b
(svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
4249
diff
changeset
|
23 |
#include "date.h" |
0 | 24 |
|
1048 | 25 |
static void DisasterClearSquare(TileIndex tile) |
0 | 26 |
{ |
2639 | 27 |
if (!EnsureNoVehicle(tile)) return; |
0 | 28 |
|
1214
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1212
diff
changeset
|
29 |
switch (GetTileType(tile)) { |
1048 | 30 |
case MP_RAILWAY: |
4845
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4559
diff
changeset
|
31 |
if (IsHumanPlayer(GetTileOwner(tile)) && !IsRailWaypoint(tile)) { |
3900
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3701
diff
changeset
|
32 |
PlayerID p = _current_player; |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3701
diff
changeset
|
33 |
_current_player = OWNER_WATER; |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3701
diff
changeset
|
34 |
DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR); |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3701
diff
changeset
|
35 |
_current_player = p; |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3701
diff
changeset
|
36 |
} |
1048 | 37 |
break; |
0 | 38 |
|
1048 | 39 |
case MP_HOUSE: { |
2435
66742d77db13
(svn r2961) - Fix: [ 1219123 ] Fix for [ 1216203 ] UFO-broken waypoint (lucaspiller)
Darkvater
parents:
2360
diff
changeset
|
40 |
PlayerID p = _current_player; |
1048 | 41 |
_current_player = OWNER_NONE; |
3491
4c8427796c64
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3421
diff
changeset
|
42 |
DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR); |
1048 | 43 |
_current_player = p; |
44 |
break; |
|
45 |
} |
|
46 |
||
47 |
case MP_TREES: |
|
48 |
case MP_CLEAR: |
|
0 | 49 |
DoClearSquare(tile); |
1048 | 50 |
break; |
51 |
||
52 |
default: |
|
53 |
break; |
|
0 | 54 |
} |
55 |
} |
|
56 |
||
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
57 |
static const SpriteID _disaster_images_1[] = {0xF41, 0xF41, 0xF41, 0xF41, 0xF41, 0xF41, 0xF41, 0xF41}; |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
58 |
static const SpriteID _disaster_images_2[] = {0xF44, 0xF44, 0xF44, 0xF44, 0xF44, 0xF44, 0xF44, 0xF44}; |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
59 |
static const SpriteID _disaster_images_3[] = {0xF4E, 0xF4E, 0xF4E, 0xF4E, 0xF4E, 0xF4E, 0xF4E, 0xF4E}; |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
60 |
static const SpriteID _disaster_images_4[] = {0xF46, 0xF46, 0xF47, 0xF47, 0xF48, 0xF48, 0xF49, 0xF49}; |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
61 |
static const SpriteID _disaster_images_5[] = {0xF4A, 0xF4A, 0xF4B, 0xF4B, 0xF4C, 0xF4C, 0xF4D, 0xF4D}; |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
62 |
static const SpriteID _disaster_images_6[] = {0xF50, 0xF50, 0xF50, 0xF50, 0xF50, 0xF50, 0xF50, 0xF50}; |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
63 |
static const SpriteID _disaster_images_7[] = {0xF51, 0xF51, 0xF51, 0xF51, 0xF51, 0xF51, 0xF51, 0xF51}; |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
64 |
static const SpriteID _disaster_images_8[] = {0xF52, 0xF52, 0xF52, 0xF52, 0xF52, 0xF52, 0xF52, 0xF52}; |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
65 |
static const SpriteID _disaster_images_9[] = {0xF3E, 0xF3E, 0xF3E, 0xF3E, 0xF3E, 0xF3E, 0xF3E, 0xF3E}; |
0 | 66 |
|
67 |
static const SpriteID * const _disaster_images[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
68 |
_disaster_images_1, _disaster_images_1, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
69 |
_disaster_images_2, _disaster_images_2, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
70 |
_disaster_images_3, _disaster_images_3, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
71 |
_disaster_images_8, _disaster_images_8, _disaster_images_9, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
72 |
_disaster_images_6, _disaster_images_6, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
73 |
_disaster_images_7, _disaster_images_7, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
74 |
_disaster_images_4, _disaster_images_5, |
0 | 75 |
}; |
76 |
||
77 |
static void DisasterVehicleUpdateImage(Vehicle *v) |
|
78 |
{ |
|
79 |
int img = v->u.disaster.image_override; |
|
80 |
if (img == 0) |
|
81 |
img = _disaster_images[v->subtype][v->direction]; |
|
82 |
v->cur_image = img; |
|
83 |
} |
|
84 |
||
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
85 |
static void InitializeDisasterVehicle(Vehicle* v, int x, int y, byte z, Direction direction, byte subtype) |
0 | 86 |
{ |
87 |
v->type = VEH_Disaster; |
|
88 |
v->x_pos = x; |
|
89 |
v->y_pos = y; |
|
90 |
v->z_pos = z; |
|
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
91 |
v->tile = TileVirtXY(x, y); |
0 | 92 |
v->direction = direction; |
93 |
v->subtype = subtype; |
|
94 |
v->x_offs = -1; |
|
95 |
v->y_offs = -1; |
|
96 |
v->sprite_width = 2; |
|
97 |
v->sprite_height = 2; |
|
98 |
v->z_height = 5; |
|
99 |
v->owner = OWNER_NONE; |
|
100 |
v->vehstatus = VS_UNCLICKABLE; |
|
101 |
v->u.disaster.image_override = 0; |
|
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
541
diff
changeset
|
102 |
v->current_order.type = OT_NOTHING; |
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
541
diff
changeset
|
103 |
v->current_order.flags = 0; |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
104 |
v->current_order.dest = 0; |
0 | 105 |
|
106 |
DisasterVehicleUpdateImage(v); |
|
107 |
VehiclePositionChanged(v); |
|
108 |
BeginVehicleMove(v); |
|
109 |
EndVehicleMove(v); |
|
110 |
} |
|
111 |
||
112 |
static void DeleteDisasterVeh(Vehicle *v) |
|
113 |
{ |
|
114 |
DeleteVehicleChain(v); |
|
115 |
} |
|
116 |
||
117 |
static void SetDisasterVehiclePos(Vehicle *v, int x, int y, byte z) |
|
118 |
{ |
|
119 |
Vehicle *u; |
|
120 |
||
121 |
BeginVehicleMove(v); |
|
122 |
v->x_pos = x; |
|
123 |
v->y_pos = y; |
|
124 |
v->z_pos = z; |
|
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
125 |
v->tile = TileVirtXY(x, y); |
0 | 126 |
|
127 |
DisasterVehicleUpdateImage(v); |
|
128 |
VehiclePositionChanged(v); |
|
129 |
EndVehicleMove(v); |
|
130 |
||
131 |
if ( (u=v->next) != NULL) { |
|
4249
9eedb1473740
(svn r5841) -Fix r5794: use the height of the edge of the map for shadows of disasters that are outside the map
rubidium
parents:
4175
diff
changeset
|
132 |
int safe_x = clamp(x, 0, MapMaxX() * TILE_SIZE); |
9eedb1473740
(svn r5841) -Fix r5794: use the height of the edge of the map for shadows of disasters that are outside the map
rubidium
parents:
4175
diff
changeset
|
133 |
int safe_y = clamp(y - 1, 0, MapMaxY() * TILE_SIZE); |
0 | 134 |
BeginVehicleMove(u); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
135 |
|
0 | 136 |
u->x_pos = x; |
4249
9eedb1473740
(svn r5841) -Fix r5794: use the height of the edge of the map for shadows of disasters that are outside the map
rubidium
parents:
4175
diff
changeset
|
137 |
u->y_pos = y - 1 - (max(z - GetSlopeZ(safe_x, safe_y), 0) >> 3); |
9eedb1473740
(svn r5841) -Fix r5794: use the height of the edge of the map for shadows of disasters that are outside the map
rubidium
parents:
4175
diff
changeset
|
138 |
safe_y = clamp(u->y_pos, 0, MapMaxY() * TILE_SIZE); |
9eedb1473740
(svn r5841) -Fix r5794: use the height of the edge of the map for shadows of disasters that are outside the map
rubidium
parents:
4175
diff
changeset
|
139 |
u->z_pos = GetSlopeZ(safe_x, safe_y); |
0 | 140 |
u->direction = v->direction; |
141 |
||
142 |
DisasterVehicleUpdateImage(u); |
|
143 |
VehiclePositionChanged(u); |
|
144 |
EndVehicleMove(u); |
|
145 |
||
146 |
if ( (u=u->next) != NULL) { |
|
147 |
BeginVehicleMove(u); |
|
148 |
u->x_pos = x; |
|
149 |
u->y_pos = y; |
|
150 |
u->z_pos = z + 5; |
|
151 |
VehiclePositionChanged(u); |
|
152 |
EndVehicleMove(u); |
|
153 |
} |
|
154 |
} |
|
155 |
} |
|
156 |
||
157 |
||
158 |
static void DisasterTick_Zeppeliner(Vehicle *v) |
|
159 |
{ |
|
160 |
GetNewVehiclePosResult gp; |
|
161 |
Station *st; |
|
162 |
int x,y; |
|
163 |
byte z; |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
164 |
TileIndex tile; |
0 | 165 |
|
166 |
++v->tick_counter; |
|
167 |
||
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
168 |
if (v->current_order.dest < 2) { |
0 | 169 |
if (v->tick_counter&1) |
170 |
return; |
|
171 |
||
172 |
GetNewVehiclePos(v, &gp); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
173 |
|
0 | 174 |
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos); |
175 |
||
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
176 |
if (v->current_order.dest == 1) { |
0 | 177 |
if (++v->age == 38) { |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
178 |
v->current_order.dest = 2; |
0 | 179 |
v->age = 0; |
180 |
} |
|
181 |
||
182 |
if ((v->tick_counter&7)==0) { |
|
1359
8ba976aed634
(svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
tron
parents:
1214
diff
changeset
|
183 |
CreateEffectVehicleRel(v, 0, -17, 2, EV_SMOKE); |
0 | 184 |
} |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
185 |
} else if (v->current_order.dest == 0) { |
0 | 186 |
tile = v->tile; /**/ |
187 |
||
1212
e9fbf66a8af2
(svn r1716) Prevent zeppelins from accessing non-existent tiles when leaving the map
tron
parents:
1209
diff
changeset
|
188 |
if (IsValidTile(tile) && |
e9fbf66a8af2
(svn r1716) Prevent zeppelins from accessing non-existent tiles when leaving the map
tron
parents:
1209
diff
changeset
|
189 |
IsTileType(tile, MP_STATION) && |
3338
2c60ed0dcce3
(svn r4120) Use the new station functions where appropriate
tron
parents:
3315
diff
changeset
|
190 |
IsAirport(tile) && |
4845
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4559
diff
changeset
|
191 |
IsHumanPlayer(GetTileOwner(tile))) { |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
192 |
v->current_order.dest = 1; |
0 | 193 |
v->age = 0; |
194 |
||
3315
1f65f8260092
(svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
3314
diff
changeset
|
195 |
SetDParam(0, GetStationIndex(tile)); |
0 | 196 |
AddNewsItem(STR_B000_ZEPPELIN_DISASTER_AT, |
197 |
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0), |
|
198 |
v->index, |
|
199 |
0); |
|
200 |
} |
|
201 |
} |
|
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
202 |
if (v->y_pos >= ((int)MapSizeY() + 9) * TILE_SIZE - 1) |
0 | 203 |
DeleteDisasterVeh(v); |
204 |
return; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
205 |
} |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
206 |
|
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
207 |
if (v->current_order.dest > 2) { |
0 | 208 |
if (++v->age <= 13320) |
209 |
return; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
210 |
|
0 | 211 |
tile = v->tile; /**/ |
212 |
||
1212
e9fbf66a8af2
(svn r1716) Prevent zeppelins from accessing non-existent tiles when leaving the map
tron
parents:
1209
diff
changeset
|
213 |
if (IsValidTile(tile) && |
e9fbf66a8af2
(svn r1716) Prevent zeppelins from accessing non-existent tiles when leaving the map
tron
parents:
1209
diff
changeset
|
214 |
IsTileType(tile, MP_STATION) && |
3338
2c60ed0dcce3
(svn r4120) Use the new station functions where appropriate
tron
parents:
3315
diff
changeset
|
215 |
IsAirport(tile) && |
4845
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4559
diff
changeset
|
216 |
IsHumanPlayer(GetTileOwner(tile))) { |
3315
1f65f8260092
(svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
3314
diff
changeset
|
217 |
st = GetStationByTile(tile); |
0 | 218 |
CLRBITS(st->airport_flags, RUNWAY_IN_block); |
219 |
} |
|
220 |
||
221 |
SetDisasterVehiclePos(v, v->x_pos, v->y_pos, v->z_pos); |
|
222 |
DeleteDisasterVeh(v); |
|
223 |
return; |
|
224 |
} |
|
225 |
||
226 |
x = v->x_pos; |
|
227 |
y = v->y_pos; |
|
228 |
z = GetSlopeZ(x,y); |
|
229 |
if (z < v->z_pos) |
|
230 |
z = v->z_pos - 1; |
|
231 |
SetDisasterVehiclePos(v, x, y, z); |
|
232 |
||
233 |
if (++v->age == 1) { |
|
1359
8ba976aed634
(svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
tron
parents:
1214
diff
changeset
|
234 |
CreateEffectVehicleRel(v, 0, 7, 8, EV_EXPLOSION_LARGE); |
541 | 235 |
SndPlayVehicleFx(SND_12_EXPLOSION, v); |
2535 | 236 |
v->u.disaster.image_override = SPR_BLIMP_CRASHING; |
0 | 237 |
} else if (v->age == 70) { |
2535 | 238 |
v->u.disaster.image_override = SPR_BLIMP_CRASHED; |
0 | 239 |
} else if (v->age <= 300) { |
240 |
if (!(v->tick_counter&7)) { |
|
241 |
uint32 r = Random(); |
|
242 |
||
243 |
CreateEffectVehicleRel(v, |
|
2140
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2051
diff
changeset
|
244 |
GB(r, 0, 4) - 7, |
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2051
diff
changeset
|
245 |
GB(r, 4, 4) - 7, |
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2051
diff
changeset
|
246 |
GB(r, 8, 3) + 5, |
1359
8ba976aed634
(svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
tron
parents:
1214
diff
changeset
|
247 |
EV_EXPLOSION_SMALL); |
0 | 248 |
} |
249 |
} else if (v->age == 350) { |
|
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
250 |
v->current_order.dest = 3; |
0 | 251 |
v->age = 0; |
252 |
} |
|
253 |
||
254 |
tile = v->tile;/**/ |
|
1212
e9fbf66a8af2
(svn r1716) Prevent zeppelins from accessing non-existent tiles when leaving the map
tron
parents:
1209
diff
changeset
|
255 |
if (IsValidTile(tile) && |
e9fbf66a8af2
(svn r1716) Prevent zeppelins from accessing non-existent tiles when leaving the map
tron
parents:
1209
diff
changeset
|
256 |
IsTileType(tile, MP_STATION) && |
3338
2c60ed0dcce3
(svn r4120) Use the new station functions where appropriate
tron
parents:
3315
diff
changeset
|
257 |
IsAirport(tile) && |
4845
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4559
diff
changeset
|
258 |
IsHumanPlayer(GetTileOwner(tile))) { |
3315
1f65f8260092
(svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
3314
diff
changeset
|
259 |
st = GetStationByTile(tile); |
0 | 260 |
SETBITS(st->airport_flags, RUNWAY_IN_block); |
261 |
} |
|
262 |
} |
|
263 |
||
264 |
// UFO starts in the middle, and flies around a bit until it locates |
|
265 |
// a road vehicle which it targets. |
|
266 |
static void DisasterTick_UFO(Vehicle *v) |
|
267 |
{ |
|
268 |
GetNewVehiclePosResult gp; |
|
269 |
Vehicle *u; |
|
270 |
uint dist; |
|
271 |
byte z; |
|
272 |
||
2535 | 273 |
v->u.disaster.image_override = (++v->tick_counter & 8) ? SPR_UFO_SMALL_SCOUT_DARKER : SPR_UFO_SMALL_SCOUT; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
274 |
|
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
275 |
if (v->current_order.dest == 0) { |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
276 |
// fly around randomly |
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
277 |
int x = TileX(v->dest_tile) * TILE_SIZE; |
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
278 |
int y = TileY(v->dest_tile) * TILE_SIZE; |
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
279 |
if (abs(x - v->x_pos) + abs(y - v->y_pos) >= TILE_SIZE) { |
0 | 280 |
v->direction = GetDirectionTowards(v, x, y); |
281 |
GetNewVehiclePos(v, &gp); |
|
282 |
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos); |
|
283 |
return; |
|
284 |
} |
|
285 |
if (++v->age < 6) { |
|
2051 | 286 |
v->dest_tile = RandomTile(); |
0 | 287 |
return; |
288 |
} |
|
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
289 |
v->current_order.dest = 1; |
0 | 290 |
|
291 |
FOR_ALL_VEHICLES(u) { |
|
4845
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4559
diff
changeset
|
292 |
if (u->type == VEH_Road && IsHumanPlayer(u->owner)) { |
0 | 293 |
v->dest_tile = u->index; |
294 |
v->age = 0; |
|
295 |
return; |
|
296 |
} |
|
297 |
} |
|
298 |
||
299 |
DeleteDisasterVeh(v); |
|
300 |
} else { |
|
301 |
// target a vehicle |
|
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
909
diff
changeset
|
302 |
u = GetVehicle(v->dest_tile); |
0 | 303 |
if (u->type != VEH_Road) { |
304 |
DeleteDisasterVeh(v); |
|
305 |
return; |
|
306 |
} |
|
307 |
||
308 |
dist = abs(v->x_pos - u->x_pos) + abs(v->y_pos - u->y_pos); |
|
309 |
||
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
310 |
if (dist < TILE_SIZE && !(u->vehstatus&VS_HIDDEN) && u->breakdown_ctr==0) { |
0 | 311 |
u->breakdown_ctr = 3; |
312 |
u->breakdown_delay = 140; |
|
313 |
} |
|
314 |
||
315 |
v->direction = GetDirectionTowards(v, u->x_pos, u->y_pos); |
|
316 |
GetNewVehiclePos(v, &gp); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
317 |
|
0 | 318 |
z = v->z_pos; |
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
319 |
if (dist <= TILE_SIZE && z > u->z_pos) z--; |
0 | 320 |
SetDisasterVehiclePos(v, gp.x, gp.y, z); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
321 |
|
0 | 322 |
if (z <= u->z_pos && (u->vehstatus&VS_HIDDEN)==0) { |
323 |
v->age++; |
|
324 |
if (u->u.road.crashed_ctr == 0) { |
|
325 |
u->u.road.crashed_ctr++; |
|
326 |
u->vehstatus |= VS_CRASHED; |
|
327 |
||
328 |
AddNewsItem(STR_B001_ROAD_VEHICLE_DESTROYED, |
|
329 |
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0), |
|
330 |
u->index, |
|
331 |
0); |
|
332 |
} |
|
333 |
} |
|
334 |
||
335 |
// destroy? |
|
336 |
if (v->age > 50) { |
|
1359
8ba976aed634
(svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
tron
parents:
1214
diff
changeset
|
337 |
CreateEffectVehicleRel(v, 0, 7, 8, EV_EXPLOSION_LARGE); |
541 | 338 |
SndPlayVehicleFx(SND_12_EXPLOSION, v); |
0 | 339 |
DeleteDisasterVeh(v); |
340 |
} |
|
341 |
} |
|
342 |
} |
|
343 |
||
344 |
static void DestructIndustry(Industry *i) |
|
345 |
{ |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
346 |
TileIndex tile; |
0 | 347 |
|
2026 | 348 |
for (tile = 0; tile != MapSize(); tile++) { |
3314
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
3269
diff
changeset
|
349 |
if (IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == i->index) { |
3495
f7d3ae07f4aa
(svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents:
3491
diff
changeset
|
350 |
ResetIndustryConstructionStage(tile); |
0 | 351 |
MarkTileDirtyByTile(tile); |
352 |
} |
|
353 |
} |
|
354 |
} |
|
355 |
||
356 |
// Airplane which destroys an oil refinery |
|
357 |
static void DisasterTick_2(Vehicle *v) |
|
358 |
{ |
|
359 |
GetNewVehiclePosResult gp; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
360 |
|
0 | 361 |
v->tick_counter++; |
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
541
diff
changeset
|
362 |
v->u.disaster.image_override = |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
363 |
(v->current_order.dest == 1 && v->tick_counter & 4) ? SPR_F_15_FIRING : 0; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
364 |
|
0 | 365 |
GetNewVehiclePos(v, &gp); |
366 |
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos); |
|
367 |
||
368 |
if (gp.x < -160) { |
|
369 |
DeleteDisasterVeh(v); |
|
370 |
return; |
|
371 |
} |
|
372 |
||
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
373 |
if (v->current_order.dest == 2) { |
0 | 374 |
if (!(v->tick_counter&3)) { |
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
909
diff
changeset
|
375 |
Industry *i = GetIndustry(v->dest_tile); |
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
376 |
int x = TileX(i->xy) * TILE_SIZE; |
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
377 |
int y = TileY(i->xy) * TILE_SIZE; |
0 | 378 |
uint32 r = Random(); |
379 |
||
380 |
CreateEffectVehicleAbove( |
|
2140
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2051
diff
changeset
|
381 |
GB(r, 0, 6) + x, |
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2051
diff
changeset
|
382 |
GB(r, 6, 6) + y, |
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2051
diff
changeset
|
383 |
GB(r, 12, 4), |
1359
8ba976aed634
(svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
tron
parents:
1214
diff
changeset
|
384 |
EV_EXPLOSION_SMALL); |
0 | 385 |
|
386 |
if (++v->age >= 55) |
|
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
387 |
v->current_order.dest = 3; |
0 | 388 |
} |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
389 |
} else if (v->current_order.dest == 1) { |
0 | 390 |
if (++v->age == 112) { |
391 |
Industry *i; |
|
392 |
||
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
393 |
v->current_order.dest = 2; |
0 | 394 |
v->age = 0; |
395 |
||
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
909
diff
changeset
|
396 |
i = GetIndustry(v->dest_tile); |
0 | 397 |
DestructIndustry(i); |
398 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
399 |
SetDParam(0, i->town->index); |
0 | 400 |
AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy, 0); |
541 | 401 |
SndPlayTileFx(SND_12_EXPLOSION, i->xy); |
0 | 402 |
} |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
403 |
} else if (v->current_order.dest == 0) { |
0 | 404 |
int x,y; |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
405 |
TileIndex tile; |
3314
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
3269
diff
changeset
|
406 |
uint ind; |
0 | 407 |
|
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
408 |
x = v->x_pos - 15 * TILE_SIZE; |
0 | 409 |
y = v->y_pos; |
410 |
||
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
411 |
if ( (uint)x > MapMaxX() * TILE_SIZE - 1) |
0 | 412 |
return; |
413 |
||
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
414 |
tile = TileVirtXY(x, y); |
1035
0a170deb6e33
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents:
926
diff
changeset
|
415 |
if (!IsTileType(tile, MP_INDUSTRY)) |
0 | 416 |
return; |
417 |
||
3314
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
3269
diff
changeset
|
418 |
ind = GetIndustryIndex(tile); |
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
3269
diff
changeset
|
419 |
v->dest_tile = ind; |
0 | 420 |
|
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
909
diff
changeset
|
421 |
if (GetIndustry(ind)->type == IT_OIL_REFINERY) { |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
422 |
v->current_order.dest = 1; |
0 | 423 |
v->age = 0; |
424 |
} |
|
425 |
} |
|
426 |
} |
|
427 |
||
428 |
// Helicopter which destroys a factory |
|
429 |
static void DisasterTick_3(Vehicle *v) |
|
430 |
{ |
|
431 |
GetNewVehiclePosResult gp; |
|
432 |
||
433 |
v->tick_counter++; |
|
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
541
diff
changeset
|
434 |
v->u.disaster.image_override = |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
435 |
(v->current_order.dest == 1 && v->tick_counter & 4) ? SPR_AH_64A_FIRING : 0; |
0 | 436 |
|
437 |
GetNewVehiclePos(v, &gp); |
|
438 |
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos); |
|
439 |
||
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
440 |
if (gp.x > (int)MapSizeX() * TILE_SIZE + 9 * TILE_SIZE - 1) { |
0 | 441 |
DeleteDisasterVeh(v); |
442 |
return; |
|
443 |
} |
|
444 |
||
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
445 |
if (v->current_order.dest == 2) { |
0 | 446 |
if (!(v->tick_counter&3)) { |
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
909
diff
changeset
|
447 |
Industry *i = GetIndustry(v->dest_tile); |
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
448 |
int x = TileX(i->xy) * TILE_SIZE; |
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
449 |
int y = TileY(i->xy) * TILE_SIZE; |
0 | 450 |
uint32 r = Random(); |
451 |
||
452 |
CreateEffectVehicleAbove( |
|
2140
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2051
diff
changeset
|
453 |
GB(r, 0, 6) + x, |
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2051
diff
changeset
|
454 |
GB(r, 6, 6) + y, |
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2051
diff
changeset
|
455 |
GB(r, 12, 4), |
1359
8ba976aed634
(svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
tron
parents:
1214
diff
changeset
|
456 |
EV_EXPLOSION_SMALL); |
0 | 457 |
|
458 |
if (++v->age >= 55) |
|
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
459 |
v->current_order.dest = 3; |
0 | 460 |
} |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
461 |
} else if (v->current_order.dest == 1) { |
0 | 462 |
if (++v->age == 112) { |
463 |
Industry *i; |
|
464 |
||
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
465 |
v->current_order.dest = 2; |
0 | 466 |
v->age = 0; |
467 |
||
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
909
diff
changeset
|
468 |
i = GetIndustry(v->dest_tile); |
0 | 469 |
DestructIndustry(i); |
470 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
471 |
SetDParam(0, i->town->index); |
0 | 472 |
AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy, 0); |
541 | 473 |
SndPlayTileFx(SND_12_EXPLOSION, i->xy); |
0 | 474 |
} |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
475 |
} else if (v->current_order.dest == 0) { |
0 | 476 |
int x,y; |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
477 |
TileIndex tile; |
3314
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
3269
diff
changeset
|
478 |
uint ind; |
0 | 479 |
|
5415
a7e0e4e75be2
(svn r8179) -Backport from trunk (r8065, r8101, r8119, r8123, r8140, r8150):
Darkvater
parents:
4845
diff
changeset
|
480 |
x = v->x_pos + (15 * TILE_SIZE); |
0 | 481 |
y = v->y_pos; |
482 |
||
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
483 |
if ( (uint)x > MapMaxX() * TILE_SIZE - 1) |
0 | 484 |
return; |
485 |
||
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
486 |
tile = TileVirtXY(x, y); |
1035
0a170deb6e33
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents:
926
diff
changeset
|
487 |
if (!IsTileType(tile, MP_INDUSTRY)) |
0 | 488 |
return; |
489 |
||
3314
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
3269
diff
changeset
|
490 |
ind = GetIndustryIndex(tile); |
b8b234d4584f
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
3269
diff
changeset
|
491 |
v->dest_tile = ind; |
0 | 492 |
|
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
909
diff
changeset
|
493 |
if (GetIndustry(ind)->type == IT_FACTORY) { |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
494 |
v->current_order.dest = 1; |
0 | 495 |
v->age = 0; |
496 |
} |
|
497 |
} |
|
498 |
} |
|
499 |
||
500 |
// Helicopter rotor blades |
|
501 |
static void DisasterTick_3b(Vehicle *v) |
|
502 |
{ |
|
503 |
if (++v->tick_counter & 1) |
|
504 |
return; |
|
505 |
||
2535 | 506 |
if (++v->cur_image > SPR_ROTOR_MOVING_3) v->cur_image = SPR_ROTOR_MOVING_1; |
0 | 507 |
|
508 |
VehiclePositionChanged(v); |
|
509 |
BeginVehicleMove(v); |
|
510 |
EndVehicleMove(v); |
|
511 |
} |
|
512 |
||
513 |
// Big UFO which lands on a piece of rail. |
|
514 |
// Will be shot down by a plane |
|
515 |
static void DisasterTick_4(Vehicle *v) |
|
516 |
{ |
|
517 |
GetNewVehiclePosResult gp; |
|
518 |
byte z; |
|
519 |
Vehicle *u,*w; |
|
520 |
Town *t; |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
521 |
TileIndex tile; |
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
522 |
TileIndex tile_org; |
0 | 523 |
|
524 |
v->tick_counter++; |
|
525 |
||
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
526 |
if (v->current_order.dest == 1) { |
3645
86af43f87885
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
tron
parents:
3495
diff
changeset
|
527 |
int x = TileX(v->dest_tile) * TILE_SIZE + TILE_SIZE / 2; |
86af43f87885
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
tron
parents:
3495
diff
changeset
|
528 |
int y = TileY(v->dest_tile) * TILE_SIZE + TILE_SIZE / 2; |
0 | 529 |
if (abs(v->x_pos - x) + abs(v->y_pos - y) >= 8) { |
530 |
v->direction = GetDirectionTowards(v, x, y); |
|
531 |
||
532 |
GetNewVehiclePos(v, &gp); |
|
533 |
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos); |
|
534 |
return; |
|
535 |
} |
|
536 |
||
537 |
z = GetSlopeZ(v->x_pos, v->y_pos); |
|
538 |
if (z < v->z_pos) { |
|
539 |
SetDisasterVehiclePos(v, v->x_pos, v->y_pos, v->z_pos - 1); |
|
540 |
return; |
|
541 |
} |
|
542 |
||
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
543 |
v->current_order.dest = 2; |
0 | 544 |
|
545 |
FOR_ALL_VEHICLES(u) { |
|
546 |
if (u->type == VEH_Train || u->type == VEH_Road) { |
|
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
547 |
if (abs(u->x_pos - v->x_pos) + abs(u->y_pos - v->y_pos) <= 12 * TILE_SIZE) { |
0 | 548 |
u->breakdown_ctr = 5; |
549 |
u->breakdown_delay = 0xF0; |
|
550 |
} |
|
551 |
} |
|
552 |
} |
|
553 |
||
554 |
t = ClosestTownFromTile(v->dest_tile, (uint)-1); |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
555 |
SetDParam(0, t->index); |
0 | 556 |
AddNewsItem(STR_B004_UFO_LANDS_NEAR, |
557 |
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ACCIDENT, 0), |
|
558 |
v->tile, |
|
559 |
0); |
|
560 |
||
561 |
u = ForceAllocateSpecialVehicle(); |
|
562 |
if (u == NULL) { |
|
563 |
DeleteDisasterVeh(v); |
|
564 |
return; |
|
565 |
} |
|
566 |
||
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
567 |
InitializeDisasterVehicle(u, -6 * TILE_SIZE, v->y_pos, 135, DIR_SW, 11); |
0 | 568 |
u->u.disaster.unk2 = v->index; |
569 |
||
570 |
w = ForceAllocateSpecialVehicle(); |
|
571 |
if (w == NULL) |
|
572 |
return; |
|
573 |
||
574 |
u->next = w; |
|
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
575 |
InitializeDisasterVehicle(w, -6 * TILE_SIZE, v->y_pos, 0, DIR_SW, 12); |
4175
c0bcc65f36d4
(svn r5613) Rename VS_DISASTER to VS_SHADOW, because this is what this flag actually means
tron
parents:
4077
diff
changeset
|
576 |
w->vehstatus |= VS_SHADOW; |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
577 |
} else if (v->current_order.dest < 1) { |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
578 |
|
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
579 |
int x = TileX(v->dest_tile) * TILE_SIZE; |
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
580 |
int y = TileY(v->dest_tile) * TILE_SIZE; |
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
581 |
if (abs(x - v->x_pos) + abs(y - v->y_pos) >= TILE_SIZE) { |
0 | 582 |
v->direction = GetDirectionTowards(v, x, y); |
583 |
GetNewVehiclePos(v, &gp); |
|
584 |
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos); |
|
585 |
return; |
|
586 |
} |
|
587 |
||
588 |
if (++v->age < 6) { |
|
2051 | 589 |
v->dest_tile = RandomTile(); |
0 | 590 |
return; |
591 |
} |
|
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
592 |
v->current_order.dest = 1; |
0 | 593 |
|
2051 | 594 |
tile_org = tile = RandomTile(); |
0 | 595 |
do { |
1035
0a170deb6e33
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents:
926
diff
changeset
|
596 |
if (IsTileType(tile, MP_RAILWAY) && |
3269
95e7bffcb3c5
(svn r3981) More work for the rail accessing functions and enums
tron
parents:
3161
diff
changeset
|
597 |
IsPlainRailTile(tile) && |
4845
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4559
diff
changeset
|
598 |
IsHumanPlayer(GetTileOwner(tile))) { |
1901
fb05044cf5c3
(svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner
tron
parents:
1891
diff
changeset
|
599 |
break; |
3269
95e7bffcb3c5
(svn r3981) More work for the rail accessing functions and enums
tron
parents:
3161
diff
changeset
|
600 |
} |
0 | 601 |
tile = TILE_MASK(tile+1); |
602 |
} while (tile != tile_org); |
|
603 |
v->dest_tile = tile; |
|
604 |
v->age = 0; |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3900
diff
changeset
|
605 |
} else { |
0 | 606 |
return; |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3900
diff
changeset
|
607 |
} |
0 | 608 |
} |
609 |
||
610 |
// The plane which will shoot down the UFO |
|
611 |
static void DisasterTick_4b(Vehicle *v) |
|
612 |
{ |
|
613 |
GetNewVehiclePosResult gp; |
|
614 |
Vehicle *u; |
|
615 |
int i; |
|
616 |
||
617 |
v->tick_counter++; |
|
618 |
||
619 |
GetNewVehiclePos(v, &gp); |
|
620 |
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos); |
|
621 |
||
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
622 |
if (gp.x > (int)MapSizeX() * TILE_SIZE + 9 * TILE_SIZE - 1) { |
0 | 623 |
DeleteDisasterVeh(v); |
624 |
return; |
|
625 |
} |
|
626 |
||
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
627 |
if (v->current_order.dest == 0) { |
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
909
diff
changeset
|
628 |
u = GetVehicle(v->u.disaster.unk2); |
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
629 |
if (abs(v->x_pos - u->x_pos) > TILE_SIZE) |
0 | 630 |
return; |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4389
diff
changeset
|
631 |
v->current_order.dest = 1; |
0 | 632 |
|
1359
8ba976aed634
(svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
tron
parents:
1214
diff
changeset
|
633 |
CreateEffectVehicleRel(u, 0, 7, 8, EV_EXPLOSION_LARGE); |
541 | 634 |
SndPlayVehicleFx(SND_12_EXPLOSION, u); |
0 | 635 |
|
636 |
DeleteDisasterVeh(u); |
|
637 |
||
2952 | 638 |
for (i = 0; i != 80; i++) { |
0 | 639 |
uint32 r = Random(); |
640 |
CreateEffectVehicleAbove( |
|
2140
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2051
diff
changeset
|
641 |
GB(r, 0, 6) + v->x_pos - 32, |
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2051
diff
changeset
|
642 |
GB(r, 5, 6) + v->y_pos - 32, |
0 | 643 |
0, |
1359
8ba976aed634
(svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
tron
parents:
1214
diff
changeset
|
644 |
EV_EXPLOSION_SMALL); |
0 | 645 |
} |
646 |
||
1981 | 647 |
BEGIN_TILE_LOOP(tile, 6, 6, v->tile - TileDiffXY(3, 3)) |
0 | 648 |
tile = TILE_MASK(tile); |
649 |
DisasterClearSquare(tile); |
|
1981 | 650 |
END_TILE_LOOP(tile, 6, 6, v->tile - TileDiffXY(3, 3)) |
0 | 651 |
} |
652 |
} |
|
653 |
||
654 |
// Submarine handler |
|
655 |
static void DisasterTick_5_and_6(Vehicle *v) |
|
656 |
{ |
|
657 |
uint32 r; |
|
658 |
GetNewVehiclePosResult gp; |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
659 |
TileIndex tile; |
0 | 660 |
|
661 |
v->tick_counter++; |
|
662 |
||
663 |
if (++v->age > 8880) { |
|
664 |
VehiclePositionChanged(v); |
|
665 |
BeginVehicleMove(v); |
|
666 |
EndVehicleMove(v); |
|
667 |
DeleteVehicle(v); |
|
668 |
return; |
|
669 |
} |
|
670 |
||
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3900
diff
changeset
|
671 |
if (!(v->tick_counter & 1)) return; |
0 | 672 |
|
4559
c853d2440065
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents:
4527
diff
changeset
|
673 |
tile = v->tile + TileOffsByDiagDir(DirToDiagDir(v->direction)); |
0 | 674 |
if (IsValidTile(tile) && |
5415
a7e0e4e75be2
(svn r8179) -Backport from trunk (r8065, r8101, r8119, r8123, r8140, r8150):
Darkvater
parents:
4845
diff
changeset
|
675 |
(r=GetTileTrackStatus(tile,TRANSPORT_WATER),(byte)(r|(r >> 8)) == 0x3F) && |
0 | 676 |
!CHANCE16(1,90)) { |
677 |
GetNewVehiclePos(v, &gp); |
|
678 |
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos); |
|
679 |
return; |
|
680 |
} |
|
681 |
||
3160 | 682 |
v->direction = ChangeDir(v->direction, GB(Random(), 0, 1) ? DIRDIFF_90RIGHT : DIRDIFF_90LEFT); |
0 | 683 |
} |
684 |
||
685 |
||
686 |
static void DisasterTick_NULL(Vehicle *v) {} |
|
687 |
typedef void DisasterVehicleTickProc(Vehicle *v); |
|
688 |
||
689 |
static DisasterVehicleTickProc * const _disastervehicle_tick_procs[] = { |
|
690 |
DisasterTick_Zeppeliner,DisasterTick_NULL, |
|
691 |
DisasterTick_UFO,DisasterTick_NULL, |
|
692 |
DisasterTick_2,DisasterTick_NULL, |
|
693 |
DisasterTick_3,DisasterTick_NULL,DisasterTick_3b, |
|
694 |
DisasterTick_4,DisasterTick_NULL, |
|
695 |
DisasterTick_4b,DisasterTick_NULL, |
|
696 |
DisasterTick_5_and_6, |
|
697 |
DisasterTick_5_and_6, |
|
698 |
}; |
|
699 |
||
700 |
||
701 |
void DisasterVehicle_Tick(Vehicle *v) |
|
702 |
{ |
|
703 |
_disastervehicle_tick_procs[v->subtype](v); |
|
704 |
} |
|
705 |
||
706 |
||
707 |
void OnNewDay_DisasterVehicle(Vehicle *v) |
|
708 |
{ |
|
709 |
// not used |
|
710 |
} |
|
711 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
712 |
typedef void DisasterInitProc(void); |
0 | 713 |
|
714 |
// Zeppeliner which crashes on a small airport |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
715 |
static void Disaster0_Init(void) |
0 | 716 |
{ |
717 |
Vehicle *v = ForceAllocateSpecialVehicle(), *u; |
|
718 |
Station *st; |
|
719 |
int x; |
|
720 |
||
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3900
diff
changeset
|
721 |
if (v == NULL) return; |
0 | 722 |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3900
diff
changeset
|
723 |
/* Pick a random place, unless we find a small airport */ |
3645
86af43f87885
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
tron
parents:
3495
diff
changeset
|
724 |
x = TileX(Random()) * TILE_SIZE + TILE_SIZE / 2; |
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
909
diff
changeset
|
725 |
|
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
909
diff
changeset
|
726 |
FOR_ALL_STATIONS(st) { |
4346
3f00094f2670
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
727 |
if (st->airport_tile != 0 && |
0 | 728 |
st->airport_type <= 1 && |
4845
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4559
diff
changeset
|
729 |
IsHumanPlayer(st->owner)) { |
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
730 |
x = (TileX(st->xy) + 2) * TILE_SIZE; |
0 | 731 |
break; |
732 |
} |
|
733 |
} |
|
734 |
||
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
735 |
InitializeDisasterVehicle(v, x, 0, 135, DIR_SE, 0); |
0 | 736 |
|
737 |
// Allocate shadow too? |
|
738 |
u = ForceAllocateSpecialVehicle(); |
|
739 |
if (u != NULL) { |
|
740 |
v->next = u; |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
741 |
InitializeDisasterVehicle(u, x, 0, 0, DIR_SE, 1); |
4175
c0bcc65f36d4
(svn r5613) Rename VS_DISASTER to VS_SHADOW, because this is what this flag actually means
tron
parents:
4077
diff
changeset
|
742 |
u->vehstatus |= VS_SHADOW; |
0 | 743 |
} |
744 |
} |
|
745 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
746 |
static void Disaster1_Init(void) |
0 | 747 |
{ |
748 |
Vehicle *v = ForceAllocateSpecialVehicle(), *u; |
|
749 |
int x; |
|
750 |
||
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3900
diff
changeset
|
751 |
if (v == NULL) return; |
0 | 752 |
|
3645
86af43f87885
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
tron
parents:
3495
diff
changeset
|
753 |
x = TileX(Random()) * TILE_SIZE + TILE_SIZE / 2; |
0 | 754 |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
755 |
InitializeDisasterVehicle(v, x, 0, 135, DIR_SE, 2); |
1981 | 756 |
v->dest_tile = TileXY(MapSizeX() / 2, MapSizeY() / 2); |
0 | 757 |
v->age = 0; |
758 |
||
759 |
// Allocate shadow too? |
|
760 |
u = ForceAllocateSpecialVehicle(); |
|
761 |
if (u != NULL) { |
|
762 |
v->next = u; |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
763 |
InitializeDisasterVehicle(u, x, 0, 0, DIR_SE, 3); |
4175
c0bcc65f36d4
(svn r5613) Rename VS_DISASTER to VS_SHADOW, because this is what this flag actually means
tron
parents:
4077
diff
changeset
|
764 |
u->vehstatus |= VS_SHADOW; |
0 | 765 |
} |
766 |
} |
|
767 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
768 |
static void Disaster2_Init(void) |
0 | 769 |
{ |
770 |
Industry *i, *found; |
|
771 |
Vehicle *v,*u; |
|
772 |
int x,y; |
|
773 |
||
830
8114845804c9
(svn r1301) -Codechange: _industries finally has FOR_ALL_INDUSTRIES too
truelight
parents:
679
diff
changeset
|
774 |
found = NULL; |
8114845804c9
(svn r1301) -Codechange: _industries finally has FOR_ALL_INDUSTRIES too
truelight
parents:
679
diff
changeset
|
775 |
|
8114845804c9
(svn r1301) -Codechange: _industries finally has FOR_ALL_INDUSTRIES too
truelight
parents:
679
diff
changeset
|
776 |
FOR_ALL_INDUSTRIES(i) { |
4346
3f00094f2670
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
777 |
if (i->type == IT_OIL_REFINERY && |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3900
diff
changeset
|
778 |
(found == NULL || CHANCE16(1, 2))) { |
0 | 779 |
found = i; |
780 |
} |
|
781 |
} |
|
782 |
||
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3900
diff
changeset
|
783 |
if (found == NULL) return; |
0 | 784 |
|
785 |
v = ForceAllocateSpecialVehicle(); |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3900
diff
changeset
|
786 |
if (v == NULL) return; |
0 | 787 |
|
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
788 |
x = (MapSizeX() + 9) * TILE_SIZE - 1; |
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
789 |
y = TileY(found->xy) * TILE_SIZE + 37; |
0 | 790 |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
791 |
InitializeDisasterVehicle(v, x, y, 135, DIR_NE, 4); |
0 | 792 |
|
793 |
u = ForceAllocateSpecialVehicle(); |
|
794 |
if (u != NULL) { |
|
795 |
v->next = u; |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
796 |
InitializeDisasterVehicle(u, x, y, 0, DIR_SE, 5); |
4175
c0bcc65f36d4
(svn r5613) Rename VS_DISASTER to VS_SHADOW, because this is what this flag actually means
tron
parents:
4077
diff
changeset
|
797 |
u->vehstatus |= VS_SHADOW; |
0 | 798 |
} |
799 |
} |
|
800 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
801 |
static void Disaster3_Init(void) |
0 | 802 |
{ |
803 |
Industry *i, *found; |
|
804 |
Vehicle *v,*u,*w; |
|
805 |
int x,y; |
|
806 |
||
830
8114845804c9
(svn r1301) -Codechange: _industries finally has FOR_ALL_INDUSTRIES too
truelight
parents:
679
diff
changeset
|
807 |
found = NULL; |
8114845804c9
(svn r1301) -Codechange: _industries finally has FOR_ALL_INDUSTRIES too
truelight
parents:
679
diff
changeset
|
808 |
|
8114845804c9
(svn r1301) -Codechange: _industries finally has FOR_ALL_INDUSTRIES too
truelight
parents:
679
diff
changeset
|
809 |
FOR_ALL_INDUSTRIES(i) { |
4346
3f00094f2670
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
810 |
if (i->type == IT_FACTORY && |
0 | 811 |
(found==NULL || CHANCE16(1,2))) { |
812 |
found = i; |
|
813 |
} |
|
814 |
} |
|
815 |
||
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3900
diff
changeset
|
816 |
if (found == NULL) return; |
0 | 817 |
|
818 |
v = ForceAllocateSpecialVehicle(); |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3900
diff
changeset
|
819 |
if (v == NULL) return; |
0 | 820 |
|
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
821 |
x = -16 * TILE_SIZE; |
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
822 |
y = TileY(found->xy) * TILE_SIZE + 37; |
0 | 823 |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
824 |
InitializeDisasterVehicle(v, x, y, 135, DIR_SW, 6); |
0 | 825 |
|
826 |
u = ForceAllocateSpecialVehicle(); |
|
827 |
if (u != NULL) { |
|
828 |
v->next = u; |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
829 |
InitializeDisasterVehicle(u, x, y, 0, DIR_SW, 7); |
4175
c0bcc65f36d4
(svn r5613) Rename VS_DISASTER to VS_SHADOW, because this is what this flag actually means
tron
parents:
4077
diff
changeset
|
830 |
u->vehstatus |= VS_SHADOW; |
0 | 831 |
|
832 |
w = ForceAllocateSpecialVehicle(); |
|
833 |
if (w != NULL) { |
|
834 |
u->next = w; |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
835 |
InitializeDisasterVehicle(w, x, y, 140, DIR_SW, 8); |
0 | 836 |
} |
837 |
} |
|
838 |
} |
|
839 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
840 |
static void Disaster4_Init(void) |
0 | 841 |
{ |
842 |
Vehicle *v = ForceAllocateSpecialVehicle(), *u; |
|
843 |
int x,y; |
|
844 |
||
2639 | 845 |
if (v == NULL) return; |
0 | 846 |
|
3645
86af43f87885
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
tron
parents:
3495
diff
changeset
|
847 |
x = TileX(Random()) * TILE_SIZE + TILE_SIZE / 2; |
0 | 848 |
|
3421
8ab76c47c72c
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3338
diff
changeset
|
849 |
y = MapMaxX() * TILE_SIZE - 1; |
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
850 |
InitializeDisasterVehicle(v, x, y, 135, DIR_NW, 9); |
1981 | 851 |
v->dest_tile = TileXY(MapSizeX() / 2, MapSizeY() / 2); |
0 | 852 |
v->age = 0; |
853 |
||
854 |
// Allocate shadow too? |
|
855 |
u = ForceAllocateSpecialVehicle(); |
|
856 |
if (u != NULL) { |
|
857 |
v->next = u; |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
858 |
InitializeDisasterVehicle(u, x, y, 0, DIR_NW, 10); |
4175
c0bcc65f36d4
(svn r5613) Rename VS_DISASTER to VS_SHADOW, because this is what this flag actually means
tron
parents:
4077
diff
changeset
|
859 |
u->vehstatus |= VS_SHADOW; |
0 | 860 |
} |
861 |
} |
|
862 |
||
863 |
// Submarine type 1 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
864 |
static void Disaster5_Init(void) |
0 | 865 |
{ |
866 |
Vehicle *v = ForceAllocateSpecialVehicle(); |
|
867 |
int x,y; |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
868 |
Direction dir; |
0 | 869 |
uint32 r; |
870 |
||
2639 | 871 |
if (v == NULL) return; |
0 | 872 |
|
873 |
r = Random(); |
|
3645
86af43f87885
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
tron
parents:
3495
diff
changeset
|
874 |
x = TileX(r) * TILE_SIZE + TILE_SIZE / 2; |
0 | 875 |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
876 |
if (r & 0x80000000) { |
3645
86af43f87885
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
tron
parents:
3495
diff
changeset
|
877 |
y = MapMaxX() * TILE_SIZE - TILE_SIZE / 2 - 1; |
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
878 |
dir = DIR_NW; |
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
879 |
} else { |
3645
86af43f87885
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
tron
parents:
3495
diff
changeset
|
880 |
y = TILE_SIZE / 2; |
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
881 |
dir = DIR_SE; |
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
882 |
} |
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
883 |
InitializeDisasterVehicle(v, x, y, 0, dir, 13); |
0 | 884 |
v->age = 0; |
885 |
} |
|
886 |
||
887 |
// Submarine type 2 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
888 |
static void Disaster6_Init(void) |
0 | 889 |
{ |
890 |
Vehicle *v = ForceAllocateSpecialVehicle(); |
|
891 |
int x,y; |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
892 |
Direction dir; |
0 | 893 |
uint32 r; |
894 |
||
2639 | 895 |
if (v == NULL) return; |
0 | 896 |
|
897 |
r = Random(); |
|
3645
86af43f87885
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
tron
parents:
3495
diff
changeset
|
898 |
x = TileX(r) * TILE_SIZE + TILE_SIZE / 2; |
0 | 899 |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
900 |
if (r & 0x80000000) { |
3645
86af43f87885
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
tron
parents:
3495
diff
changeset
|
901 |
y = MapMaxX() * TILE_SIZE - TILE_SIZE / 2 - 1; |
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
902 |
dir = DIR_NW; |
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
903 |
} else { |
3645
86af43f87885
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
tron
parents:
3495
diff
changeset
|
904 |
y = TILE_SIZE / 2; |
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
905 |
dir = DIR_SE; |
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
906 |
} |
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2989
diff
changeset
|
907 |
InitializeDisasterVehicle(v, x, y, 0, dir, 14); |
0 | 908 |
v->age = 0; |
909 |
} |
|
910 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
911 |
static void Disaster7_Init(void) |
0 | 912 |
{ |
2642 | 913 |
int index = GB(Random(), 0, 4); |
2648
72973ab76048
(svn r3190) Turn some loops into canonical for loop form
tron
parents:
2642
diff
changeset
|
914 |
uint m; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
915 |
|
2648
72973ab76048
(svn r3190) Turn some loops into canonical for loop form
tron
parents:
2642
diff
changeset
|
916 |
for (m = 0; m < 15; m++) { |
2989 | 917 |
const Industry* i; |
918 |
||
830
8114845804c9
(svn r1301) -Codechange: _industries finally has FOR_ALL_INDUSTRIES too
truelight
parents:
679
diff
changeset
|
919 |
FOR_ALL_INDUSTRIES(i) { |
4346
3f00094f2670
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
920 |
if (i->type == IT_COAL_MINE && --index < 0) { |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
921 |
SetDParam(0, i->town->index); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
922 |
AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES, |
1981 | 923 |
NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TileDiffXY(1, 1), 0); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
924 |
|
0 | 925 |
{ |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
926 |
TileIndex tile = i->xy; |
4559
c853d2440065
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents:
4527
diff
changeset
|
927 |
TileIndexDiff step = TileOffsByDiagDir(GB(Random(), 0, 2)); |
2648
72973ab76048
(svn r3190) Turn some loops into canonical for loop form
tron
parents:
2642
diff
changeset
|
928 |
uint n; |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
929 |
|
2674
1d68ffc9f406
(svn r3216) - Fix (regression): endless loop introduced in revision 3190
Darkvater
parents:
2668
diff
changeset
|
930 |
for (n = 0; n < 30; n++) { |
0 | 931 |
DisasterClearSquare(tile); |
932 |
tile = TILE_MASK(tile + step); |
|
2648
72973ab76048
(svn r3190) Turn some loops into canonical for loop form
tron
parents:
2642
diff
changeset
|
933 |
} |
0 | 934 |
} |
935 |
return; |
|
936 |
} |
|
937 |
} |
|
2648
72973ab76048
(svn r3190) Turn some loops into canonical for loop form
tron
parents:
2642
diff
changeset
|
938 |
} |
0 | 939 |
} |
940 |
||
941 |
static DisasterInitProc * const _disaster_initprocs[] = { |
|
942 |
Disaster0_Init, |
|
943 |
Disaster1_Init, |
|
944 |
Disaster2_Init, |
|
945 |
Disaster3_Init, |
|
946 |
Disaster4_Init, |
|
947 |
Disaster5_Init, |
|
948 |
Disaster6_Init, |
|
949 |
Disaster7_Init, |
|
950 |
}; |
|
951 |
||
2655
807e49a44ace
(svn r3197) Use a better bias so you can directly see the date range a disaster can happen in
tron
parents:
2648
diff
changeset
|
952 |
static const struct { |
4293
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
953 |
Year min; |
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
954 |
Year max; |
2655
807e49a44ace
(svn r3197) Use a better bias so you can directly see the date range a disaster can happen in
tron
parents:
2648
diff
changeset
|
955 |
} _dis_years[] = { |
4293
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
956 |
{ 1930, 1955 }, |
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
957 |
{ 1940, 1970 }, |
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
958 |
{ 1960, 1990 }, |
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
959 |
{ 1970, 2000 }, |
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
960 |
{ 2000, 2100 }, |
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
961 |
{ 1940, 1965 }, |
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
962 |
{ 1975, 2010 }, |
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
963 |
{ 1950, 1985 } |
0 | 964 |
}; |
965 |
||
966 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
967 |
static void DoDisaster(void) |
0 | 968 |
{ |
2639 | 969 |
byte buf[lengthof(_dis_years)]; |
970 |
uint i; |
|
971 |
uint j; |
|
0 | 972 |
|
2639 | 973 |
j = 0; |
974 |
for (i = 0; i != lengthof(_dis_years); i++) { |
|
4293
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
975 |
if (_cur_year >= _dis_years[i].min && _cur_year < _dis_years[i].max) buf[j++] = i; |
0 | 976 |
} |
977 |
||
2639 | 978 |
if (j == 0) return; |
0 | 979 |
|
2637
8807e6a63f89
(svn r3179) - RandomRange() and RandomTile() instead of home brewed versions
tron
parents:
2635
diff
changeset
|
980 |
_disaster_initprocs[buf[RandomRange(j)]](); |
0 | 981 |
} |
982 |
||
983 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
984 |
static void ResetDisasterDelay(void) |
0 | 985 |
{ |
2484
8e0c88a833fb
(svn r3010) Get rid of quite some dubious casts, either by using GB(), proper types or just removing them
tron
parents:
2435
diff
changeset
|
986 |
_disaster_delay = GB(Random(), 0, 9) + 730; |
0 | 987 |
} |
988 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
989 |
void DisasterDailyLoop(void) |
0 | 990 |
{ |
2639 | 991 |
if (--_disaster_delay != 0) return; |
0 | 992 |
|
993 |
ResetDisasterDelay(); |
|
994 |
||
2639 | 995 |
if (_opt.diff.disasters != 0) DoDisaster(); |
0 | 996 |
} |
997 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
998 |
void StartupDisasters(void) |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1048
diff
changeset
|
999 |
{ |
0 | 1000 |
ResetDisasterDelay(); |
1001 |
} |