(svn r20199) -Fix [FS#3964]: NewGRFs that defined a vehicle without either loaded or loading groups could crash OpenTTD

This commit is contained in:
yexo 2010-07-21 11:29:59 +00:00
parent 7484eba2db
commit c5f12c337d

View File

@ -841,6 +841,8 @@ static const SpriteGroup *VehicleResolveReal(const ResolverObject *object, const
uint totalsets = in_motion ? group->num_loaded : group->num_loading;
if (totalsets == 0) return NULL;
uint set = (v->cargo.Count() * totalsets) / max((uint16)1, v->cargo_cap);
set = min(set, totalsets - 1);