From 087fe86ed28fb6ac5885cac7f64d34ccd5a9c140 Mon Sep 17 00:00:00 2001 From: tron Date: Mon, 6 Feb 2006 09:18:04 +0000 Subject: (svn r3564) Several smaller changes: - Don't treat non-booleans as booleans - Reduce variable scope - Bracing - Use DeMorgan's law to make conditionals easier to read - if cascade -> switch - Replace some magic numbers by symbolic names - Avoid assignments within other statements --- train_cmd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'train_cmd.c') diff --git a/train_cmd.c b/train_cmd.c index 3b0347a7a..045b7d478 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -44,9 +44,7 @@ static void TrainCargoChanged(Vehicle* v) for (u = v; u != NULL; u = u->next) { const RailVehicleInfo *rvi = RailVehInfo(u->engine_type); - uint16 vweight = 0; - - vweight += (_cargoc.weights[u->cargo_type] * u->cargo_count) / 16; + uint16 vweight = (_cargoc.weights[u->cargo_type] * u->cargo_count) / 16; // Vehicle weight is not added for articulated parts. if (!IsArticulatedPart(u)) { -- cgit v1.2.3-54-g00ecf