summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-08-22 19:15:47 +0000
committerfrosch <frosch@openttd.org>2010-08-22 19:15:47 +0000
commit4b0fa883f14e98c24d33dfb9cc9d651478fdb7f7 (patch)
tree96fffe5e6280d4ca7151669c8c4373f937d3469f
parentcdadc58b664e59ab6cbb8f243e1ed1b482d2ebc2 (diff)
downloadopenttd-4b0fa883f14e98c24d33dfb9cc9d651478fdb7f7.tar.xz
(svn r20595) -Fix (r20536)[FS#4068]: Autoreplace needs refitting of wagons in free wagon chains.
-rw-r--r--src/vehicle_cmd.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index a22c825c6..0754e581c 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -314,13 +314,15 @@ CommandCost CmdRefitVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
Vehicle *v = Vehicle::GetIfValid(p1);
if (v == NULL) return CMD_ERROR;
+ /* Don't allow disasters and sparks and such to be refitted.
+ * We cannot check for IsPrimaryVehicle as autoreplace also refits in free wagon chains. */
+ if (!IsCompanyBuildableVehicleType(v->type)) return CMD_ERROR;
+
Vehicle *front = v->First();
CommandCost ret = CheckOwnership(front->owner);
if (ret.Failed()) return ret;
- /* Don't allow disasters and sparks and such to be refitted. */
- if (!front->IsPrimaryVehicle()) return CMD_ERROR;
/* Don't allow shadows and such to be refitted. */
if (v != front && (v->type == VEH_SHIP || v->type == VEH_AIRCRAFT)) return CMD_ERROR;
if (!front->IsStoppedInDepot()) return_cmd_error(STR_ERROR_TRAIN_MUST_BE_STOPPED_INSIDE_DEPOT + front->type);