equal
deleted
inserted
replaced
114 if (img == 0) img = _disaster_images[v->subtype][v->direction]; |
114 if (img == 0) img = _disaster_images[v->subtype][v->direction]; |
115 v->cur_image = img; |
115 v->cur_image = img; |
116 } |
116 } |
117 |
117 |
118 |
118 |
119 /** Initialize a disaster vehicle. These vehicles are of type VEH_Disaster, are unclickable |
119 /** Initialize a disaster vehicle. These vehicles are of type VEH_DISASTER, are unclickable |
120 * and owned by nobody */ |
120 * and owned by nobody */ |
121 static void InitializeDisasterVehicle(Vehicle *v, int x, int y, byte z, Direction direction, byte subtype) |
121 static void InitializeDisasterVehicle(Vehicle *v, int x, int y, byte z, Direction direction, byte subtype) |
122 { |
122 { |
123 v->type = VEH_Disaster; |
123 v->type = VEH_DISASTER; |
124 v->x_pos = x; |
124 v->x_pos = x; |
125 v->y_pos = y; |
125 v->y_pos = y; |
126 v->z_pos = z; |
126 v->z_pos = z; |
127 v->tile = TileVirtXY(x, y); |
127 v->tile = TileVirtXY(x, y); |
128 v->direction = direction; |
128 v->direction = direction; |
328 return; |
328 return; |
329 } |
329 } |
330 v->current_order.dest = 1; |
330 v->current_order.dest = 1; |
331 |
331 |
332 FOR_ALL_VEHICLES(u) { |
332 FOR_ALL_VEHICLES(u) { |
333 if (u->type == VEH_Road && IsHumanPlayer(u->owner)) { |
333 if (u->type == VEH_ROAD && IsHumanPlayer(u->owner)) { |
334 v->dest_tile = u->index; |
334 v->dest_tile = u->index; |
335 v->age = 0; |
335 v->age = 0; |
336 return; |
336 return; |
337 } |
337 } |
338 } |
338 } |
339 |
339 |
340 DeleteDisasterVeh(v); |
340 DeleteDisasterVeh(v); |
341 } else { |
341 } else { |
342 /* Target a vehicle */ |
342 /* Target a vehicle */ |
343 u = GetVehicle(v->dest_tile); |
343 u = GetVehicle(v->dest_tile); |
344 if (u->type != VEH_Road) { |
344 if (u->type != VEH_ROAD) { |
345 DeleteDisasterVeh(v); |
345 DeleteDisasterVeh(v); |
346 return; |
346 return; |
347 } |
347 } |
348 |
348 |
349 dist = delta(v->x_pos, u->x_pos) + delta(v->y_pos, u->y_pos); |
349 dist = delta(v->x_pos, u->x_pos) + delta(v->y_pos, u->y_pos); |
588 } |
588 } |
589 |
589 |
590 v->current_order.dest = 2; |
590 v->current_order.dest = 2; |
591 |
591 |
592 FOR_ALL_VEHICLES(u) { |
592 FOR_ALL_VEHICLES(u) { |
593 if (u->type == VEH_Train || u->type == VEH_Road) { |
593 if (u->type == VEH_TRAIN || u->type == VEH_ROAD) { |
594 if (delta(u->x_pos, v->x_pos) + delta(u->y_pos, v->y_pos) <= 12 * TILE_SIZE) { |
594 if (delta(u->x_pos, v->x_pos) + delta(u->y_pos, v->y_pos) <= 12 * TILE_SIZE) { |
595 u->breakdown_ctr = 5; |
595 u->breakdown_ctr = 5; |
596 u->breakdown_delay = 0xF0; |
596 u->breakdown_delay = 0xF0; |
597 } |
597 } |
598 } |
598 } |