equal
deleted
inserted
replaced
31 #include "newgrf_sound.h" |
31 #include "newgrf_sound.h" |
32 #include "newgrf_text.h" |
32 #include "newgrf_text.h" |
33 #include "direction.h" |
33 #include "direction.h" |
34 #include "yapf/yapf.h" |
34 #include "yapf/yapf.h" |
35 #include "date.h" |
35 #include "date.h" |
|
36 #include "cargotype.h" |
36 |
37 |
37 static bool TrainCheckIfLineEnds(Vehicle *v); |
38 static bool TrainCheckIfLineEnds(Vehicle *v); |
38 static void TrainController(Vehicle *v, bool update_image); |
39 static void TrainController(Vehicle *v, bool update_image); |
39 |
40 |
40 static const byte _vehicle_initial_x_fract[4] = {10, 8, 4, 8}; |
41 static const byte _vehicle_initial_x_fract[4] = {10, 8, 4, 8}; |
104 Vehicle *u; |
105 Vehicle *u; |
105 uint32 weight = 0; |
106 uint32 weight = 0; |
106 |
107 |
107 for (u = v; u != NULL; u = u->next) { |
108 for (u = v; u != NULL; u = u->next) { |
108 const RailVehicleInfo *rvi = RailVehInfo(u->engine_type); |
109 const RailVehicleInfo *rvi = RailVehInfo(u->engine_type); |
109 uint32 vweight = (_cargoc.weights[u->cargo_type] * u->cargo_count * FreightWagonMult(u->cargo_type)) / 16; |
110 uint32 vweight = (GetCargo(u->cargo_type)->weight * u->cargo_count * FreightWagonMult(u->cargo_type)) / 16; |
110 |
111 |
111 // Vehicle weight is not added for articulated parts. |
112 // Vehicle weight is not added for articulated parts. |
112 if (!IsArticulatedPart(u)) { |
113 if (!IsArticulatedPart(u)) { |
113 // vehicle weight is the sum of the weight of the vehicle and the weight of its cargo |
114 // vehicle weight is the sum of the weight of the vehicle and the weight of its cargo |
114 vweight += rvi->weight; |
115 vweight += rvi->weight; |