summaryrefslogtreecommitdiff
path: root/src/vehiclelist.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-09-27 14:58:46 +0000
committerfrosch <frosch@openttd.org>2008-09-27 14:58:46 +0000
commit32289ebd637c84127281c0aea6068577f8966f93 (patch)
tree37781d55de944180d09d9cd6425c749c4707c28e /src/vehiclelist.cpp
parent423160f9467a00efa6580cad55df61b655c55d4d (diff)
downloadopenttd-32289ebd637c84127281c0aea6068577f8966f93.tar.xz
(svn r14406) -Fix [FS#Eddi]: Autoreplace did not work for vehicles in free wagon chains.
Diffstat (limited to 'src/vehiclelist.cpp')
-rw-r--r--src/vehiclelist.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vehiclelist.cpp b/src/vehiclelist.cpp
index 46762b247..62125d0db 100644
--- a/src/vehiclelist.cpp
+++ b/src/vehiclelist.cpp
@@ -18,8 +18,9 @@
* @param tile The tile the depot is located on
* @param engines Pointer to list to add vehicles to
* @param wagons Pointer to list to add wagons to (can be NULL)
+ * @param individual_wagons If true add every wagon to #wagons which is not attached to an engine. If false only add the first wagon of every row.
*/
-void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engines, VehicleList *wagons)
+void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engines, VehicleList *wagons, bool individual_wagons)
{
engines->Clear();
if (wagons != NULL && wagons != engines) wagons->Clear();
@@ -32,9 +33,10 @@ void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine
switch (type) {
case VEH_TRAIN:
+ if (IsArticulatedPart(v) || IsRearDualheaded(v)) continue;
if (v->u.rail.track != TRACK_BIT_DEPOT) continue;
- if (wagons != NULL && IsFreeWagon(v)) {
- *wagons->Append() = v;
+ if (wagons != NULL && IsFreeWagon(v->First())) {
+ if (individual_wagons || IsFreeWagon(v)) *wagons->Append() = v;
continue;
}
break;