summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-10-29 21:54:28 +0000
committerbjarni <bjarni@openttd.org>2005-10-29 21:54:28 +0000
commit6d41c23cf2f485728a64470fe49a10c155e250cd (patch)
treeb3245017ad292e3af887c100aad93208b3a2f430 /train_cmd.c
parent76f4c5b6f9fac784e0330384bddae94a25777eac (diff)
downloadopenttd-6d41c23cf2f485728a64470fe49a10c155e250cd.tar.xz
(svn r3101) -Codechange: added _new_vehicle_id
this var works like _new_train_id and the rest of that kind of vars, except it is set each time a vehicle is build, nomatter what type this is a nice tool to code vehicle independent code, which in turn can reduce code duplication Right now it's used in ReplaceVehicle() and CmdCloneVehicle()
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/train_cmd.c b/train_cmd.c
index 8d3490196..6ee0e031f 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -471,6 +471,7 @@ static int32 CmdBuildRailWagon(EngineID engine, TileIndex tile, uint32 flags)
v->cur_image = 0xAC2;
_new_wagon_id = v->index;
+ _new_vehicle_id = v->index;
VehiclePositionChanged(v);
TrainConsistChanged(GetFirstVehicleInChain(v));
@@ -632,6 +633,7 @@ int32 CmdBuildRailVehicle(int x, int y, 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;
v->date_of_last_service = _date;