diff options
author | bjarni <bjarni@openttd.org> | 2005-10-24 19:40:48 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2005-10-24 19:40:48 +0000 |
commit | 0f5c8787f8c0914f88dce4f1c106a82453c71165 (patch) | |
tree | cf9fee9ef1a7b1f4ef668ebcedec8d771cdfc860 /train_cmd.c | |
parent | 5536de23191ee3896783b45ea4b3f8531ca99d7c (diff) | |
download | openttd-0f5c8787f8c0914f88dce4f1c106a82453c71165.tar.xz |
(svn r3081) -Codechange: [autoreplace] complete rewrite of autoreplace
this is a complete rewrite, that makes use of existing commands like build and sell
this means that multiheaded train engines are replaced correctly
Diffstat (limited to 'train_cmd.c')
-rw-r--r-- | train_cmd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/train_cmd.c b/train_cmd.c index 2a65b91b8..7d87a7a4b 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -551,7 +551,8 @@ void AddRearEngineToMultiheadedTrain(Vehicle *v, Vehicle *u, bool building) /** Build a railroad vehicle. * @param x,y tile coordinates (depot) where rail-vehicle is built * @param p1 engine type id - * @param p2 build only one engine, even if it is a dualheaded engine. It also prevents any free cars from being added to the train + * @param p2 bit 0 build only one engine, even if it is a dualheaded engine. + p2 bit 1 prevents any free cars from being added to the train */ int32 CmdBuildRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) { @@ -647,7 +648,7 @@ int32 CmdBuildRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) TrainConsistChanged(v); UpdateTrainAcceleration(v); - if (!HASBIT(p2,0)) { // do not move the cars if HASBIT(p2,0) is set + if (!HASBIT(p2, 1)) { // check if the cars should be added to the new vehicle NormalizeTrainVehInDepot(v); } @@ -3319,7 +3320,7 @@ void TrainEnterDepot(Vehicle *v, TileIndex tile) v->load_unload_time_rem = 0; v->cur_speed = 0; - MaybeReplaceVehicle(v); + v = MaybeReplaceVehicle(v); TriggerVehicle(v, VEHICLE_TRIGGER_DEPOT); |