(svn r2440) - Fix: [newgrf] Fix the spritesorter to handle overlapping sprites properly, this fixes display problems with really short wagons. (algorithm by patchman, ported by therax)

- Fix: [newgrf] Too short wagons could break the 'follow next vehicle' code used in the traincontroller. Clamp better to prevent this.
This commit is contained in:
hackykid
2005-06-15 14:04:48 +00:00
parent bae01fd636
commit 15b0c3b469
2 changed files with 29 additions and 8 deletions

View File

@@ -119,7 +119,7 @@ void TrainConsistChanged(Vehicle *v) {
veh_len = GetCallBackResult(CBID_VEH_LENGTH, u->engine_type, u);
if (veh_len == CALLBACK_FAILED)
veh_len = rvi_u->shorten_factor;
veh_len = clamp(veh_len, 0, 7);
veh_len = clamp(veh_len, 0, u->next == NULL ? 7 : 5); // the clamp on vehicles not the last in chain is stricter, as too short wagons can break the 'follow next vehicle' code
u->u.rail.cached_veh_length = 8 - veh_len;
};