(svn r16480) -Fix (r15617): Invalidate newgrf variable caches of more vehicles in more places. Esp. they were only invalidated for trains.
This commit is contained in:
@@ -137,6 +137,8 @@ void RoadVehUpdateCache(RoadVehicle *v)
|
||||
assert(v->type == VEH_ROAD);
|
||||
assert(IsRoadVehFront(v));
|
||||
|
||||
v->InvalidateNewGRFCacheOfChain();
|
||||
|
||||
for (RoadVehicle *u = v; u != NULL; u = u->Next()) {
|
||||
/* Check the v->first cache. */
|
||||
assert(u->First() == v);
|
||||
@@ -252,12 +254,15 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
v->cargo_cap = rvi->capacity;
|
||||
|
||||
AddArticulatedParts(v, VEH_ROAD);
|
||||
v->InvalidateNewGRFCacheOfChain();
|
||||
|
||||
/* Call various callbacks after the whole consist has been constructed */
|
||||
for (RoadVehicle *u = v; u != NULL; u = u->Next()) {
|
||||
u->rcache.cached_veh_length = GetRoadVehLength(u);
|
||||
/* Cargo capacity is zero if and only if the vehicle cannot carry anything */
|
||||
if (u->cargo_cap != 0) u->cargo_cap = GetVehicleProperty(u, 0x0F, u->cargo_cap);
|
||||
v->InvalidateNewGRFCache();
|
||||
u->InvalidateNewGRFCache();
|
||||
}
|
||||
|
||||
VehicleMove(v, false);
|
||||
|
Reference in New Issue
Block a user