summaryrefslogtreecommitdiff
path: root/src/roadveh_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-11-08 18:21:56 +0000
committerfrosch <frosch@openttd.org>2011-11-08 18:21:56 +0000
commit186694369d0e4e64e098ea2e0d9196594e4232b0 (patch)
tree71c603635390e45acad9bce78b07087f64df0a69 /src/roadveh_cmd.cpp
parented04410f8920a5481aa6d249a89cd78309b3785b (diff)
downloadopenttd-186694369d0e4e64e098ea2e0d9196594e4232b0.tar.xz
(svn r23164) -Fix (r23149): Default roadvehicles became somewhat short.
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r--src/roadveh_cmd.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index e48cbb349..3fe5ce84e 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -163,7 +163,7 @@ void DrawRoadVehEngine(int left, int right, int preferred_x, int y, EngineID eng
static uint GetRoadVehLength(const RoadVehicle *v)
{
const Engine *e = v->GetEngine();
- uint length = e->u.road.shorten_factor;
+ uint length = VEHICLE_LENGTH;
uint16 veh_len = CALLBACK_FAILED;
if (e->GetGRF() != NULL && e->GetGRF()->grf_version >= 8) {
@@ -173,7 +173,8 @@ static uint GetRoadVehLength(const RoadVehicle *v)
/* Use callback 11 */
veh_len = GetVehicleCallback(CBID_VEHICLE_LENGTH, 0, 0, v->engine_type, v);
}
- if (veh_len != CALLBACK_FAILED) {
+ if (veh_len == CALLBACK_FAILED) veh_len = e->u.road.shorten_factor;
+ if (veh_len != 0) {
if (veh_len >= VEHICLE_LENGTH) ErrorUnknownCallbackResult(e->GetGRFID(), CBID_VEHICLE_LENGTH, veh_len);
length -= Clamp(veh_len, 0, VEHICLE_LENGTH - 1);
}