(svn r5094) Remove _new_{aircraft,roadveh,ship,train,wagon}_id. _new_vehicle_id is enough.
--- a/ai/default/default.c Sun Jun 04 09:13:59 2006 +0000
+++ b/ai/default/default.c Sun Jun 04 09:28:33 2006 +0000
@@ -316,7 +316,7 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
* 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];
--- a/aircraft_cmd.c Sun Jun 04 09:13:59 2006 +0000
+++ b/aircraft_cmd.c Sun Jun 04 09:28:33 2006 +0000
@@ -260,7 +260,6 @@
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;
--- a/aircraft_gui.c Sun Jun 04 09:13:59 2006 +0000
+++ b/aircraft_gui.c Sun Jun 04 09:28:33 2006 +0000
@@ -76,7 +76,7 @@
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 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)
--- a/roadveh_cmd.c Sun Jun 04 09:13:59 2006 +0000
+++ b/roadveh_cmd.c Sun Jun 04 09:28:33 2006 +0000
@@ -175,7 +175,6 @@
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;
--- a/roadveh_gui.c Sun Jun 04 09:13:59 2006 +0000
+++ b/roadveh_gui.c Sun Jun 04 09:28:33 2006 +0000
@@ -224,7 +224,7 @@
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 @@
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);
--- a/ship_cmd.c Sun Jun 04 09:13:59 2006 +0000
+++ b/ship_cmd.c Sun Jun 04 09:28:33 2006 +0000
@@ -890,7 +890,6 @@
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;
--- a/ship_gui.c Sun Jun 04 09:13:59 2006 +0000
+++ b/ship_gui.c Sun Jun 04 09:28:33 2006 +0000
@@ -304,7 +304,7 @@
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 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)
--- a/train_cmd.c Sun Jun 04 09:13:59 2006 +0000
+++ b/train_cmd.c Sun Jun 04 09:28:33 2006 +0000
@@ -626,7 +626,6 @@
AddArticulatedParts(rvi, vl);
- _new_wagon_id = v->index;
_new_vehicle_id = v->index;
VehiclePositionChanged(v);
@@ -776,7 +775,6 @@
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;
--- a/train_gui.c Sun Jun 04 09:13:59 2006 +0000
+++ b/train_gui.c Sun Jun 04 09:28:33 2006 +0000
@@ -152,7 +152,7 @@
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 @@
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 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,
--- a/vehicle.c Sun Jun 04 09:13:59 2006 +0000
+++ b/vehicle.c Sun Jun 04 09:28:33 2006 +0000
@@ -1569,8 +1569,8 @@
} 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;
}
--- a/vehicle.h Sun Jun 04 09:13:59 2006 +0000
+++ b/vehicle.h Sun Jun 04 09:28:33 2006 +0000
@@ -416,11 +416,6 @@
}
// 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;