equal
deleted
inserted
replaced
547 /** Sort vehicles by their cargo */ |
547 /** Sort vehicles by their cargo */ |
548 static int CDECL VehicleCargoSorter(const Vehicle* const *a, const Vehicle* const *b) |
548 static int CDECL VehicleCargoSorter(const Vehicle* const *a, const Vehicle* const *b) |
549 { |
549 { |
550 const Vehicle *v; |
550 const Vehicle *v; |
551 AcceptedCargo diff; |
551 AcceptedCargo diff; |
552 MemSetT(diff, 0); |
552 memset(diff, 0, sizeof(diff)); |
553 |
553 |
554 /* Append the cargo of the connected weagons */ |
554 /* Append the cargo of the connected weagons */ |
555 for (v = *a; v != NULL; v = v->Next()) diff[v->cargo_type] += v->cargo_cap; |
555 for (v = *a; v != NULL; v = v->Next()) diff[v->cargo_type] += v->cargo_cap; |
556 for (v = *b; v != NULL; v = v->Next()) diff[v->cargo_type] -= v->cargo_cap; |
556 for (v = *b; v != NULL; v = v->Next()) diff[v->cargo_type] -= v->cargo_cap; |
557 |
557 |