summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-10-24 19:40:48 +0000
committerbjarni <bjarni@openttd.org>2005-10-24 19:40:48 +0000
commitbf467bd99c36842c259dd11b6ac2be69db72e745 (patch)
treecf9fee9ef1a7b1f4ef668ebcedec8d771cdfc860 /train_cmd.c
parente0dd7efc82fbe232c59e4c5a84d714159b3e7d5f (diff)
downloadopenttd-bf467bd99c36842c259dd11b6ac2be69db72e745.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.c7
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);