summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-01-04 18:50:50 +0000
committeryexo <yexo@openttd.org>2010-01-04 18:50:50 +0000
commit27fc22a76bf470c2088a38d57d9cd2a8e481cafb (patch)
tree89d2ac14e6b55e0f4f01be3a8d4441261c004a8c /src
parentb42e76d85897af64c7b2ca5c58e15c1286ea639c (diff)
downloadopenttd-27fc22a76bf470c2088a38d57d9cd2a8e481cafb.tar.xz
(svn r18724) -Fix [FS#3475] (r17899): refitting a non-refittable vehicle to it's default cargotype failed, causing problems for AIs
Diffstat (limited to 'src')
-rw-r--r--src/vehicle_cmd.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index f696d1153..a28436654 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -307,13 +307,11 @@ CommandCost RefitVehicle(Vehicle *v, bool only_this, CargoID new_cid, byte new_s
{
CommandCost cost(v->GetExpenseType(false));
uint total_capacity = 0;
- bool success = false;
v->InvalidateNewGRFCacheOfChain();
for (; v != NULL; v = (only_this ? NULL : v->Next())) {
const Engine *e = Engine::Get(v->engine_type);
if (!e->CanCarryCargo() || !HasBit(e->info.refit_mask, new_cid)) continue;
- success = true;
/* Back up the vehicle's cargo type */
CargoID temp_cid = v->cargo_type;
@@ -347,7 +345,7 @@ CommandCost RefitVehicle(Vehicle *v, bool only_this, CargoID new_cid, byte new_s
}
_returned_refit_capacity = total_capacity;
- return success ? cost : CMD_ERROR;
+ return cost;
}
/** Test if a name is unique among vehicle names.