summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-04 09:28:33 +0000
committertron <tron@openttd.org>2006-06-04 09:28:33 +0000
commita0caafeb5075ca58232068b48050717f9cf02313 (patch)
tree6608f31fde29931d1c8c939c55782cc8de75c8fb
parent9cf3badfcf4e99f20b8a751457ee76d22fc9f110 (diff)
downloadopenttd-a0caafeb5075ca58232068b48050717f9cf02313.tar.xz
(svn r5094) Remove _new_{aircraft,roadveh,ship,train,wagon}_id. _new_vehicle_id is enough.
-rw-r--r--ai/default/default.c14
-rw-r--r--aircraft_cmd.c1
-rw-r--r--aircraft_gui.c4
-rw-r--r--roadveh_cmd.c1
-rw-r--r--roadveh_gui.c4
-rw-r--r--ship_cmd.c1
-rw-r--r--ship_gui.c4
-rw-r--r--train_cmd.c2
-rw-r--r--train_gui.c6
-rw-r--r--vehicle.c4
-rw-r--r--vehicle.h5
11 files changed, 18 insertions, 28 deletions
diff --git a/ai/default/default.c b/ai/default/default.c
index 7563e391a..8ccb375a2 100644
--- a/ai/default/default.c
+++ b/ai/default/default.c
@@ -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];
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index d8794b0b2..83cc43287 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -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;
diff --git a/aircraft_gui.c b/aircraft_gui.c
index 8b13e6d35..59c7b7c13 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -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)
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index ae70fc41d..52347e337 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -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;
diff --git a/roadveh_gui.c b/roadveh_gui.c
index 573fda32d..758463a77 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -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);
diff --git a/ship_cmd.c b/ship_cmd.c
index 4c4171866..e86aae54a 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -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;
diff --git a/ship_gui.c b/ship_gui.c
index 00a364934..bed2beb5d 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -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)
diff --git a/train_cmd.c b/train_cmd.c
index d8468da91..c801668d8 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -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;
diff --git a/train_gui.c b/train_gui.c
index 597c0ce17..cc6f240b8 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -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,
diff --git a/vehicle.c b/vehicle.c
index 7240562f1..ecb305006 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -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;
}
diff --git a/vehicle.h b/vehicle.h
index aecb3c0af..d74a17eb0 100644
--- a/vehicle.h
+++ b/vehicle.h
@@ -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;