equal
deleted
inserted
replaced
38 #include "direction.h" |
38 #include "direction.h" |
39 #include "yapf/yapf.h" |
39 #include "yapf/yapf.h" |
40 #include "date.h" |
40 #include "date.h" |
41 #include "cargotype.h" |
41 #include "cargotype.h" |
42 #include "group.h" |
42 #include "group.h" |
|
43 #include "ai/ai.h" |
43 |
44 |
44 static bool TrainCheckIfLineEnds(Vehicle *v); |
45 static bool TrainCheckIfLineEnds(Vehicle *v); |
45 static void TrainController(Vehicle *v, bool update_image); |
46 static void TrainController(Vehicle *v, bool update_image); |
46 |
47 |
47 static const byte _vehicle_initial_x_fract[4] = {10, 8, 4, 8}; |
48 static const byte _vehicle_initial_x_fract[4] = {10, 8, 4, 8}; |
2762 VehicleFromPosXY(v->x_pos, v->y_pos, &tcc, FindTrainCollideEnum); |
2763 VehicleFromPosXY(v->x_pos, v->y_pos, &tcc, FindTrainCollideEnum); |
2763 |
2764 |
2764 /* any dead -> no crash */ |
2765 /* any dead -> no crash */ |
2765 if (tcc.num == 0) return; |
2766 if (tcc.num == 0) return; |
2766 |
2767 |
|
2768 AI_Event(v->owner, new AIEventVehicleCrash(v->index, v->tile)); |
2767 SetDParam(0, tcc.num); |
2769 SetDParam(0, tcc.num); |
2768 AddNewsItem(STR_8868_TRAIN_CRASH_DIE_IN_FIREBALL, |
2770 AddNewsItem(STR_8868_TRAIN_CRASH_DIE_IN_FIREBALL, |
2769 NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0), |
2771 NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0), |
2770 v->index, |
2772 v->index, |
2771 0 |
2773 0 |