mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r11756) -Fix: Out of bounds access caused if a vehicle's cargo amount was higher than its capacity when resolving sprite groups.
This commit is contained in:
parent
3182cbb332
commit
1cd2c3d517
|
@ -803,7 +803,7 @@ static const SpriteGroup *VehicleResolveReal(const ResolverObject *object, const
|
||||||
|
|
||||||
totalsets = in_motion ? group->g.real.num_loaded : group->g.real.num_loading;
|
totalsets = in_motion ? group->g.real.num_loaded : group->g.real.num_loading;
|
||||||
|
|
||||||
if (v->cargo.Count() == v->cargo_cap || totalsets == 1) {
|
if (v->cargo.Count() >= v->cargo_cap || totalsets == 1) {
|
||||||
set = totalsets - 1;
|
set = totalsets - 1;
|
||||||
} else if (v->cargo.Empty() || totalsets == 2) {
|
} else if (v->cargo.Empty() || totalsets == 2) {
|
||||||
set = 0;
|
set = 0;
|
||||||
|
|
Loading…
Reference in New Issue