(svn r19091) -Cleanup: remove some unneeded zeroing

This commit is contained in:
rubidium 2010-02-10 21:28:26 +00:00
parent a7a2568985
commit b0a1ecf160
4 changed files with 2 additions and 42 deletions

View File

@ -273,7 +273,6 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
v->owner = u->owner = _current_company; v->owner = u->owner = _current_company;
v->tile = tile; v->tile = tile;
// u->tile = 0;
uint x = TileX(tile) * TILE_SIZE + 5; uint x = TileX(tile) * TILE_SIZE + 5;
uint y = TileY(tile) * TILE_SIZE + 3; 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); u->z_pos = GetSlopeZ(x, y);
v->z_pos = u->z_pos + 1; 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; v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
u->vehstatus = VS_HIDDEN | VS_UNCLICKABLE | VS_SHADOW; u->vehstatus = VS_HIDDEN | VS_UNCLICKABLE | VS_SHADOW;
v->spritenum = avi->image_index; v->spritenum = avi->image_index;
// v->cargo_count = u->number_of_pieces = 0;
v->cargo_cap = avi->passenger_capacity; v->cargo_cap = avi->passenger_capacity;
u->cargo_cap = avi->mail_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(); v->cargo_type = e->GetDefaultCargoType();
u->cargo_type = CT_MAIL; u->cargo_type = CT_MAIL;
v->cargo_subtype = 0;
v->name = NULL; 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->last_station_visited = INVALID_STATION;
// v->destination_coords = 0;
v->max_speed = avi->max_speed; v->max_speed = avi->max_speed;
v->acceleration = avi->acceleration; v->acceleration = avi->acceleration;

View File

@ -244,23 +244,13 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
v->y_pos = y; v->y_pos = y;
v->z_pos = GetSlopeZ(x, y); v->z_pos = GetSlopeZ(x, y);
// v->running_ticks = 0;
v->state = RVSB_IN_DEPOT; v->state = RVSB_IN_DEPOT;
v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL; v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
v->spritenum = rvi->image_index; v->spritenum = rvi->image_index;
v->cargo_type = e->GetDefaultCargoType(); v->cargo_type = e->GetDefaultCargoType();
// v->cargo_subtype = 0;
v->cargo_cap = rvi->capacity; v->cargo_cap = rvi->capacity;
// v->cargo_count = 0;
v->value = cost.GetCost(); 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->last_station_visited = INVALID_STATION;
v->max_speed = rvi->max_speed; v->max_speed = rvi->max_speed;
@ -272,8 +262,6 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
v->max_age = e->GetLifeLengthInDays(); v->max_age = e->GetLifeLengthInDays();
_new_vehicle_id = v->index; _new_vehicle_id = v->index;
v->name = NULL;
v->service_interval = Company::Get(v->owner)->settings.vehicle.servint_roadveh; v->service_interval = Company::Get(v->owner)->settings.vehicle.servint_roadveh;
v->date_of_last_service = _date; 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->compatible_roadtypes = RoadTypeToRoadTypes(v->roadtype);
v->rcache.cached_veh_length = 8; v->rcache.cached_veh_length = 8;
v->vehicle_flags = 0;
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE); if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
AddArticulatedParts(v); AddArticulatedParts(v);

View File

@ -650,14 +650,11 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
v->y_pos = y; v->y_pos = y;
v->z_pos = GetSlopeZ(x, y); v->z_pos = GetSlopeZ(x, y);
v->running_ticks = 0;
v->UpdateDeltaXY(v->direction); v->UpdateDeltaXY(v->direction);
v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL; v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
v->spritenum = svi->image_index; v->spritenum = svi->image_index;
v->cargo_type = e->GetDefaultCargoType(); v->cargo_type = e->GetDefaultCargoType();
v->cargo_subtype = 0;
v->cargo_cap = svi->capacity; v->cargo_cap = svi->capacity;
v->value = value.GetCost(); v->value = value.GetCost();
@ -670,7 +667,6 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
v->max_age = e->GetLifeLengthInDays(); v->max_age = e->GetLifeLengthInDays();
_new_vehicle_id = v->index; _new_vehicle_id = v->index;
v->name = NULL;
v->state = TRACK_BIT_DEPOT; v->state = TRACK_BIT_DEPOT;
v->service_interval = Company::Get(_current_company)->settings.vehicle.servint_ships; 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->cur_image = SPR_IMG_QUERY;
v->random_bits = VehicleRandomBits(); v->random_bits = VehicleRandomBits();
v->vehicle_flags = 0;
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE); if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
v->InvalidateNewGRFCacheOfChain(); v->InvalidateNewGRFCacheOfChain();
@ -693,8 +688,9 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClassesData(WC_SHIPS_LIST, 0); InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
SetWindowDirty(WC_COMPANY, v->owner); SetWindowDirty(WC_COMPANY, v->owner);
if (IsLocalCompany()) if (IsLocalCompany()) {
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Ship window InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Ship window
}
Company::Get(_current_company)->num_engines[p1]++; Company::Get(_current_company)->num_engines[p1]++;
} }

View File

@ -710,17 +710,14 @@ static CommandCost CmdBuildRailWagon(EngineID engine, TileIndex tile, DoCommandF
v->track = TRACK_BIT_DEPOT; v->track = TRACK_BIT_DEPOT;
v->vehstatus = VS_HIDDEN | VS_DEFPAL; v->vehstatus = VS_HIDDEN | VS_DEFPAL;
// v->subtype = 0;
v->SetWagon(); v->SetWagon();
v->SetFreeWagon(); v->SetFreeWagon();
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
v->cargo_type = e->GetDefaultCargoType(); v->cargo_type = e->GetDefaultCargoType();
// v->cargo_subtype = 0;
v->cargo_cap = rvi->capacity; v->cargo_cap = rvi->capacity;
v->value = value.GetCost(); v->value = value.GetCost();
// v->day_counter = 0;
v->railtype = rvi->railtype; v->railtype = rvi->railtype;
@ -790,7 +787,6 @@ static void AddRearEngineToMultiheadedTrain(Train *v)
u->z_pos = v->z_pos; u->z_pos = v->z_pos;
u->track = TRACK_BIT_DEPOT; u->track = TRACK_BIT_DEPOT;
u->vehstatus = v->vehstatus & ~VS_STOPPED; u->vehstatus = v->vehstatus & ~VS_STOPPED;
// u->subtype = 0;
u->spritenum = v->spritenum + 1; u->spritenum = v->spritenum + 1;
u->cargo_type = v->cargo_type; u->cargo_type = v->cargo_type;
u->cargo_subtype = v->cargo_subtype; u->cargo_subtype = v->cargo_subtype;
@ -870,17 +866,14 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1,
v->x_pos = x; v->x_pos = x;
v->y_pos = y; v->y_pos = y;
v->z_pos = GetSlopeZ(x, y); v->z_pos = GetSlopeZ(x, y);
// v->running_ticks = 0;
v->track = TRACK_BIT_DEPOT; v->track = TRACK_BIT_DEPOT;
v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL; v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
v->spritenum = rvi->image_index; v->spritenum = rvi->image_index;
v->cargo_type = e->GetDefaultCargoType(); v->cargo_type = e->GetDefaultCargoType();
// v->cargo_subtype = 0;
v->cargo_cap = rvi->capacity; v->cargo_cap = rvi->capacity;
v->max_speed = rvi->max_speed; v->max_speed = rvi->max_speed;
v->value = value.GetCost(); v->value = value.GetCost();
v->last_station_visited = INVALID_STATION; v->last_station_visited = INVALID_STATION;
// v->dest_tile = 0;
v->engine_type = p1; v->engine_type = p1;
v->tcache.first_engine = INVALID_ENGINE; // needs to be set before first callback 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->reliability_spd_dec = e->reliability_spd_dec;
v->max_age = e->GetLifeLengthInDays(); v->max_age = e->GetLifeLengthInDays();
v->name = NULL;
v->railtype = rvi->railtype; v->railtype = rvi->railtype;
_new_vehicle_id = v->index; _new_vehicle_id = v->index;
@ -899,12 +891,10 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1,
v->cur_image = SPR_IMG_QUERY; v->cur_image = SPR_IMG_QUERY;
v->random_bits = VehicleRandomBits(); v->random_bits = VehicleRandomBits();
// v->vehicle_flags = 0;
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE); if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
v->group_id = DEFAULT_GROUP; v->group_id = DEFAULT_GROUP;
// v->subtype = 0;
v->SetFrontEngine(); v->SetFrontEngine();
v->SetEngine(); v->SetEngine();