changeset 14520:45f055caa455 draft

(svn r19091) -Cleanup: remove some unneeded zeroing
author rubidium <rubidium@openttd.org>
date Wed, 10 Feb 2010 21:28:26 +0000
parents 3c95cfb7a679
children 7e2812a8ef44
files src/aircraft_cmd.cpp src/roadveh_cmd.cpp src/ship_cmd.cpp src/train_cmd.cpp
diffstat 4 files changed, 2 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -273,7 +273,6 @@
 		v->owner = u->owner = _current_company;
 
 		v->tile = tile;
-//		u->tile = 0;
 
 		uint x = TileX(tile) * TILE_SIZE + 5;
 		uint y = TileY(tile) * TILE_SIZE + 3;
@@ -284,15 +283,10 @@
 		u->z_pos = GetSlopeZ(x, y);
 		v->z_pos = u->z_pos + 1;
 
-		v->running_ticks = 0;
-
-//		u->delta_x = u->delta_y = 0;
-
 		v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
 		u->vehstatus = VS_HIDDEN | VS_UNCLICKABLE | VS_SHADOW;
 
 		v->spritenum = avi->image_index;
-//		v->cargo_count = u->number_of_pieces = 0;
 
 		v->cargo_cap = avi->passenger_capacity;
 		u->cargo_cap = avi->mail_capacity;
@@ -300,15 +294,8 @@
 		v->cargo_type = e->GetDefaultCargoType();
 		u->cargo_type = CT_MAIL;
 
-		v->cargo_subtype = 0;
-
 		v->name = NULL;
-//		v->next_order_param = v->next_order = 0;
-
-//		v->time_counter = 0;
-//		v->progress = 0;
 		v->last_station_visited = INVALID_STATION;
-//		v->destination_coords = 0;
 
 		v->max_speed = avi->max_speed;
 		v->acceleration = avi->acceleration;
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -244,23 +244,13 @@
 		v->y_pos = y;
 		v->z_pos = GetSlopeZ(x, y);
 
-//		v->running_ticks = 0;
-
 		v->state = RVSB_IN_DEPOT;
 		v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
 
 		v->spritenum = rvi->image_index;
 		v->cargo_type = e->GetDefaultCargoType();
-//		v->cargo_subtype = 0;
 		v->cargo_cap = rvi->capacity;
-//		v->cargo_count = 0;
 		v->value = cost.GetCost();
-//		v->day_counter = 0;
-//		v->next_order_param = v->next_order = 0;
-//		v->time_counter = 0;
-//		v->progress = 0;
-
-//		v->overtaking = 0;
 
 		v->last_station_visited = INVALID_STATION;
 		v->max_speed = rvi->max_speed;
@@ -272,8 +262,6 @@
 		v->max_age = e->GetLifeLengthInDays();
 		_new_vehicle_id = v->index;
 
-		v->name = NULL;
-
 		v->service_interval = Company::Get(v->owner)->settings.vehicle.servint_roadveh;
 
 		v->date_of_last_service = _date;
@@ -287,7 +275,6 @@
 		v->compatible_roadtypes = RoadTypeToRoadTypes(v->roadtype);
 		v->rcache.cached_veh_length = 8;
 
-		v->vehicle_flags = 0;
 		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
 
 		AddArticulatedParts(v);
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -650,14 +650,11 @@
 		v->y_pos = y;
 		v->z_pos = GetSlopeZ(x, y);
 
-		v->running_ticks = 0;
-
 		v->UpdateDeltaXY(v->direction);
 		v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
 
 		v->spritenum = svi->image_index;
 		v->cargo_type = e->GetDefaultCargoType();
-		v->cargo_subtype = 0;
 		v->cargo_cap = svi->capacity;
 		v->value = value.GetCost();
 
@@ -670,7 +667,6 @@
 		v->max_age = e->GetLifeLengthInDays();
 		_new_vehicle_id = v->index;
 
-		v->name = NULL;
 		v->state = TRACK_BIT_DEPOT;
 
 		v->service_interval = Company::Get(_current_company)->settings.vehicle.servint_ships;
@@ -679,7 +675,6 @@
 		v->cur_image = SPR_IMG_QUERY;
 		v->random_bits = VehicleRandomBits();
 
-		v->vehicle_flags = 0;
 		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
 
 		v->InvalidateNewGRFCacheOfChain();
@@ -693,8 +688,9 @@
 		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
 		InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
 		SetWindowDirty(WC_COMPANY, v->owner);
-		if (IsLocalCompany())
+		if (IsLocalCompany()) {
 			InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Ship window
+		}
 
 		Company::Get(_current_company)->num_engines[p1]++;
 	}
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -710,17 +710,14 @@
 		v->track = TRACK_BIT_DEPOT;
 		v->vehstatus = VS_HIDDEN | VS_DEFPAL;
 
-//		v->subtype = 0;
 		v->SetWagon();
 
 		v->SetFreeWagon();
 		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
 
 		v->cargo_type = e->GetDefaultCargoType();
-//		v->cargo_subtype = 0;
 		v->cargo_cap = rvi->capacity;
 		v->value = value.GetCost();
-//		v->day_counter = 0;
 
 		v->railtype = rvi->railtype;
 
@@ -790,7 +787,6 @@
 	u->z_pos = v->z_pos;
 	u->track = TRACK_BIT_DEPOT;
 	u->vehstatus = v->vehstatus & ~VS_STOPPED;
-//	u->subtype = 0;
 	u->spritenum = v->spritenum + 1;
 	u->cargo_type = v->cargo_type;
 	u->cargo_subtype = v->cargo_subtype;
@@ -870,17 +866,14 @@
 		v->x_pos = x;
 		v->y_pos = y;
 		v->z_pos = GetSlopeZ(x, y);
-//		v->running_ticks = 0;
 		v->track = TRACK_BIT_DEPOT;
 		v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
 		v->spritenum = rvi->image_index;
 		v->cargo_type = e->GetDefaultCargoType();
-//		v->cargo_subtype = 0;
 		v->cargo_cap = rvi->capacity;
 		v->max_speed = rvi->max_speed;
 		v->value = value.GetCost();
 		v->last_station_visited = INVALID_STATION;
-//		v->dest_tile = 0;
 
 		v->engine_type = p1;
 		v->tcache.first_engine = INVALID_ENGINE; // needs to be set before first callback
@@ -889,7 +882,6 @@
 		v->reliability_spd_dec = e->reliability_spd_dec;
 		v->max_age = e->GetLifeLengthInDays();
 
-		v->name = NULL;
 		v->railtype = rvi->railtype;
 		_new_vehicle_id = v->index;
 
@@ -899,12 +891,10 @@
 		v->cur_image = SPR_IMG_QUERY;
 		v->random_bits = VehicleRandomBits();
 
-//		v->vehicle_flags = 0;
 		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
 
 		v->group_id = DEFAULT_GROUP;
 
-//		v->subtype = 0;
 		v->SetFrontEngine();
 		v->SetEngine();