(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.

This commit is contained in:
peter1138
2007-02-20 22:09:21 +00:00
parent 6621beb126
commit ef2daa5060
24 changed files with 315 additions and 371 deletions

View File

@@ -33,6 +33,7 @@
#include "direction.h"
#include "yapf/yapf.h"
#include "date.h"
#include "cargotype.h"
static bool TrainCheckIfLineEnds(Vehicle *v);
static void TrainController(Vehicle *v, bool update_image);
@@ -106,7 +107,7 @@ static void TrainCargoChanged(Vehicle* v)
for (u = v; u != NULL; u = u->next) {
const RailVehicleInfo *rvi = RailVehInfo(u->engine_type);
uint32 vweight = (_cargoc.weights[u->cargo_type] * u->cargo_count * FreightWagonMult(u->cargo_type)) / 16;
uint32 vweight = (GetCargo(u->cargo_type)->weight * u->cargo_count * FreightWagonMult(u->cargo_type)) / 16;
// Vehicle weight is not added for articulated parts.
if (!IsArticulatedPart(u)) {