mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r5094) Remove _new_{aircraft,roadveh,ship,train,wagon}_id. _new_vehicle_id is enough.
This commit is contained in:
parent
9cf3badfcf
commit
a0caafeb50
|
@ -316,7 +316,7 @@ static void AiHandleReplaceTrain(Player *p)
|
|||
|
||||
if (!CmdFailed(DoCommand(0, v->index, 2, DC_EXEC, CMD_SELL_RAIL_WAGON)) &&
|
||||
!CmdFailed(DoCommand(tile, veh, 0, DC_EXEC, CMD_BUILD_RAIL_VEHICLE)) ) {
|
||||
VehicleID veh = _new_train_id;
|
||||
VehicleID veh = _new_vehicle_id;
|
||||
AiRestoreVehicleOrders(GetVehicle(veh), orderbak);
|
||||
DoCommand(0, veh, 0, DC_EXEC, CMD_START_STOP_TRAIN);
|
||||
|
||||
|
@ -345,7 +345,7 @@ static void AiHandleReplaceRoadVeh(Player *p)
|
|||
|
||||
if (!CmdFailed(DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH)) &&
|
||||
!CmdFailed(DoCommand(tile, veh, 0, DC_EXEC, CMD_BUILD_ROAD_VEH)) ) {
|
||||
VehicleID veh = _new_roadveh_id;
|
||||
VehicleID veh = _new_vehicle_id;
|
||||
AiRestoreVehicleOrders(GetVehicle(veh), orderbak);
|
||||
DoCommand(0, veh, 0, DC_EXEC, CMD_START_STOP_ROADVEH);
|
||||
|
||||
|
@ -374,7 +374,7 @@ static void AiHandleReplaceAircraft(Player *p)
|
|||
|
||||
if (!CmdFailed(DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_AIRCRAFT)) &&
|
||||
!CmdFailed(DoCommand(tile, veh, 0, DC_EXEC, CMD_BUILD_AIRCRAFT)) ) {
|
||||
VehicleID veh = _new_aircraft_id;
|
||||
VehicleID veh = _new_vehicle_id;
|
||||
AiRestoreVehicleOrders(GetVehicle(veh), orderbak);
|
||||
DoCommand(0, veh, 0, DC_EXEC, CMD_START_STOP_AIRCRAFT);
|
||||
|
||||
|
@ -2382,7 +2382,7 @@ static void AiStateBuildRailVeh(Player *p)
|
|||
if (veh == INVALID_ENGINE) goto handle_nocash;
|
||||
cost = DoCommand(tile, veh, 0, DC_EXEC, CMD_BUILD_RAIL_VEHICLE);
|
||||
if (CmdFailed(cost)) goto handle_nocash;
|
||||
p->ai.wagon_list[i] = _new_wagon_id;
|
||||
p->ai.wagon_list[i] = _new_vehicle_id;
|
||||
p->ai.wagon_list[i + 1] = INVALID_VEHICLE;
|
||||
return;
|
||||
}
|
||||
|
@ -2410,7 +2410,7 @@ handle_nocash:
|
|||
// Try to build the locomotive
|
||||
cost = DoCommand(tile, veh, 0, DC_EXEC, CMD_BUILD_RAIL_VEHICLE);
|
||||
assert(!CmdFailed(cost));
|
||||
loco_id = _new_train_id;
|
||||
loco_id = _new_vehicle_id;
|
||||
|
||||
// Sell a vehicle if the train is double headed.
|
||||
v = GetVehicle(loco_id);
|
||||
|
@ -3163,7 +3163,7 @@ static void AiStateBuildRoadVehicles(Player *p)
|
|||
|
||||
if (CmdFailed(DoCommand(tile, veh, 0, DC_EXEC, CMD_BUILD_ROAD_VEH))) return;
|
||||
|
||||
loco_id = _new_roadveh_id;
|
||||
loco_id = _new_vehicle_id;
|
||||
|
||||
for (i = 0; p->ai.order_list_blocks[i] != 0xFF; i++) {
|
||||
const AiBuildRec* aib = &p->ai.src + p->ai.order_list_blocks[i];
|
||||
|
@ -3454,7 +3454,7 @@ static void AiStateBuildAircraftVehicles(Player *p)
|
|||
* and offset to the FIRST depot because the AI picks the st->xy tile */
|
||||
tile += ToTileIndexDiff(GetAirport(GetStationByTile(tile)->airport_type)->airport_depots[0]);
|
||||
if (CmdFailed(DoCommand(tile, veh, 0, DC_EXEC, CMD_BUILD_AIRCRAFT))) return;
|
||||
loco_id = _new_aircraft_id;
|
||||
loco_id = _new_vehicle_id;
|
||||
|
||||
for (i=0; p->ai.order_list_blocks[i] != 0xFF; i++) {
|
||||
AiBuildRec *aib = (&p->ai.src) + p->ai.order_list_blocks[i];
|
||||
|
|
|
@ -260,7 +260,6 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
v->reliability_spd_dec = e->reliability_spd_dec;
|
||||
v->max_age = e->lifelength * 366;
|
||||
|
||||
_new_aircraft_id = v->index;
|
||||
_new_vehicle_id = v->index;
|
||||
|
||||
v->u.air.pos = MAX_ELEMENTS;
|
||||
|
|
|
@ -76,7 +76,7 @@ static void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selectio
|
|||
void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (success) {
|
||||
const Vehicle* v = GetVehicle(_new_aircraft_id);
|
||||
const Vehicle* v = GetVehicle(_new_vehicle_id);
|
||||
|
||||
if (v->tile == _backup_orders_tile) {
|
||||
_backup_orders_tile = 0;
|
||||
|
@ -88,7 +88,7 @@ void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
|||
|
||||
void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (success) ShowAircraftViewWindow(GetVehicle(_new_aircraft_id));
|
||||
if (success) ShowAircraftViewWindow(GetVehicle(_new_vehicle_id));
|
||||
}
|
||||
|
||||
static void NewAircraftWndProc(Window *w, WindowEvent *e)
|
||||
|
|
|
@ -175,7 +175,6 @@ int32 CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
v->reliability = e->reliability;
|
||||
v->reliability_spd_dec = e->reliability_spd_dec;
|
||||
v->max_age = e->lifelength * 366;
|
||||
_new_roadveh_id = v->index;
|
||||
_new_vehicle_id = v->index;
|
||||
|
||||
v->string_id = STR_SV_ROADVEH_NAME;
|
||||
|
|
|
@ -224,7 +224,7 @@ static void ShowRoadVehDetailsWindow(const Vehicle* v)
|
|||
|
||||
void CcCloneRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (success) ShowRoadVehViewWindow(GetVehicle(_new_roadveh_id));
|
||||
if (success) ShowRoadVehViewWindow(GetVehicle(_new_vehicle_id));
|
||||
}
|
||||
|
||||
static void RoadVehViewWndProc(Window *w, WindowEvent *e)
|
||||
|
@ -430,7 +430,7 @@ void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
|||
|
||||
if (!success) return;
|
||||
|
||||
v = GetVehicle(_new_roadveh_id);
|
||||
v = GetVehicle(_new_vehicle_id);
|
||||
if (v->tile == _backup_orders_tile) {
|
||||
_backup_orders_tile = 0;
|
||||
RestoreVehicleOrders(v, _backup_orders_data);
|
||||
|
|
|
@ -890,7 +890,6 @@ int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
v->reliability = e->reliability;
|
||||
v->reliability_spd_dec = e->reliability_spd_dec;
|
||||
v->max_age = e->lifelength * 366;
|
||||
_new_ship_id = v->index;
|
||||
_new_vehicle_id = v->index;
|
||||
|
||||
v->string_id = STR_SV_SHIP_NAME;
|
||||
|
|
|
@ -304,7 +304,7 @@ void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
|||
const Vehicle* v;
|
||||
if (!success) return;
|
||||
|
||||
v = GetVehicle(_new_ship_id);
|
||||
v = GetVehicle(_new_vehicle_id);
|
||||
if (v->tile == _backup_orders_tile) {
|
||||
_backup_orders_tile = 0;
|
||||
RestoreVehicleOrders(v, _backup_orders_data);
|
||||
|
@ -314,7 +314,7 @@ void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
|||
|
||||
void CcCloneShip(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (success) ShowShipViewWindow(GetVehicle(_new_ship_id));
|
||||
if (success) ShowShipViewWindow(GetVehicle(_new_vehicle_id));
|
||||
}
|
||||
|
||||
static void NewShipWndProc(Window *w, WindowEvent *e)
|
||||
|
|
|
@ -626,7 +626,6 @@ static int32 CmdBuildRailWagon(EngineID engine, TileIndex tile, uint32 flags)
|
|||
|
||||
AddArticulatedParts(rvi, vl);
|
||||
|
||||
_new_wagon_id = v->index;
|
||||
_new_vehicle_id = v->index;
|
||||
|
||||
VehiclePositionChanged(v);
|
||||
|
@ -776,7 +775,6 @@ int32 CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
|
||||
v->string_id = STR_SV_TRAIN_NAME;
|
||||
v->u.rail.railtype = e->railtype;
|
||||
_new_train_id = v->index;
|
||||
_new_vehicle_id = v->index;
|
||||
|
||||
v->service_interval = _patches.servint_trains;
|
||||
|
|
|
@ -152,7 +152,7 @@ void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
|||
if (found != NULL) {
|
||||
found = GetLastVehicleInChain(found);
|
||||
// put the new wagon at the end of the loco.
|
||||
DoCommandP(0, _new_wagon_id | (found->index<<16), 0, NULL, CMD_MOVE_RAIL_VEHICLE);
|
||||
DoCommandP(0, _new_vehicle_id | (found->index << 16), 0, NULL, CMD_MOVE_RAIL_VEHICLE);
|
||||
RebuildVehicleLists();
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ void CcBuildLoco(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
|||
|
||||
if (!success) return;
|
||||
|
||||
v = GetVehicle(_new_train_id);
|
||||
v = GetVehicle(_new_vehicle_id);
|
||||
if (tile == _backup_orders_tile) {
|
||||
_backup_orders_tile = 0;
|
||||
RestoreVehicleOrders(v, _backup_orders_data);
|
||||
|
@ -173,7 +173,7 @@ void CcBuildLoco(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
|||
|
||||
void CcCloneTrain(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (success) ShowTrainViewWindow(GetVehicle(_new_train_id));
|
||||
if (success) ShowTrainViewWindow(GetVehicle(_new_vehicle_id));
|
||||
}
|
||||
|
||||
static void engine_drawing_loop(int *x, int *y, int *pos, int *sel,
|
||||
|
|
|
@ -1569,8 +1569,8 @@ int32 CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
} while (v->type == VEH_Train && (v = GetNextVehicle(v)) != NULL);
|
||||
|
||||
if (flags & DC_EXEC && v_front->type == VEH_Train) {
|
||||
// _new_train_id needs to be the front engine due to the callback function
|
||||
_new_train_id = w_front->index;
|
||||
// for trains this needs to be the front engine due to the callback function
|
||||
_new_vehicle_id = w_front->index;
|
||||
}
|
||||
return total_cost;
|
||||
}
|
||||
|
|
|
@ -416,11 +416,6 @@ static inline Vehicle *GetFirstVehicleFromSharedList(Vehicle *v)
|
|||
}
|
||||
|
||||
// NOSAVE: Return values from various commands.
|
||||
VARDEF VehicleID _new_train_id;
|
||||
VARDEF VehicleID _new_wagon_id;
|
||||
VARDEF VehicleID _new_aircraft_id;
|
||||
VARDEF VehicleID _new_ship_id;
|
||||
VARDEF VehicleID _new_roadveh_id;
|
||||
VARDEF VehicleID _new_vehicle_id;
|
||||
VARDEF uint16 _returned_refit_capacity;
|
||||
|
||||
|
|
Loading…
Reference in New Issue