From b0a1ecf160433e000ff2341bedf786dc7fba1f2a Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 10 Feb 2010 21:28:26 +0000 Subject: [PATCH] (svn r19091) -Cleanup: remove some unneeded zeroing --- src/aircraft_cmd.cpp | 13 ------------- src/roadveh_cmd.cpp | 13 ------------- src/ship_cmd.cpp | 8 ++------ src/train_cmd.cpp | 10 ---------- 4 files changed, 2 insertions(+), 42 deletions(-) diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index bea8f1f720..b6e0238239 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -273,7 +273,6 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin 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 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin 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 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin 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; diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index b7dd6bb4c2..4a9ed1a886 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -244,23 +244,13 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint 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 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint 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 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint 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); diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 723992e50d..ec907d2d77 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -650,14 +650,11 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 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 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 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 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 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 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 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]++; } diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 3e410d5524..0f2ae36b22 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -710,17 +710,14 @@ static CommandCost CmdBuildRailWagon(EngineID engine, TileIndex tile, DoCommandF 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 @@ static void AddRearEngineToMultiheadedTrain(Train *v) 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 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, 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 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, 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 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, 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();