summaryrefslogtreecommitdiff
path: root/src/roadveh_cmd.cpp
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-12-14 21:33:53 +0000
committerterkhen <terkhen@openttd.org>2010-12-14 21:33:53 +0000
commit48b7916458de4b2cdbc226a4a6ab078db4c77e73 (patch)
treec3a49ca7a91890042ca56765574bc40a54c15f96 /src/roadveh_cmd.cpp
parenta93944e765776c6e9a2bd556457cd93748068da6 (diff)
downloadopenttd-48b7916458de4b2cdbc226a4a6ab078db4c77e73.tar.xz
(svn r21521) -Codechange: Unify some cached values that were present in both road vehicles and trains.
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r--src/roadveh_cmd.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index aea5a9e99..422086e83 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -102,7 +102,7 @@ int RoadVehicle::GetDisplayImageWidth(Point *offset) const
offset->x = reference_width / 2;
offset->y = 0;
}
- return this->rcache.cached_veh_length * reference_width / 8;
+ return this->gcache.cached_veh_length * reference_width / 8;
}
static SpriteID GetRoadVehIcon(EngineID engine)
@@ -175,18 +175,18 @@ void RoadVehUpdateCache(RoadVehicle *v)
v->InvalidateNewGRFCacheOfChain();
- v->rcache.cached_total_length = 0;
+ v->gcache.cached_total_length = 0;
for (RoadVehicle *u = v; u != NULL; u = u->Next()) {
/* Check the v->first cache. */
assert(u->First() == v);
/* Update the 'first engine' */
- u->rcache.first_engine = (v == u) ? INVALID_ENGINE : v->engine_type;
+ u->gcache.first_engine = (v == u) ? INVALID_ENGINE : v->engine_type;
/* Update the length of the vehicle. */
- u->rcache.cached_veh_length = GetRoadVehLength(u);
- v->rcache.cached_total_length += u->rcache.cached_veh_length;
+ u->gcache.cached_veh_length = GetRoadVehLength(u);
+ v->gcache.cached_total_length += u->gcache.cached_veh_length;
/* Update visual effect */
v->UpdateVisualEffect();
@@ -236,7 +236,7 @@ CommandCost CmdBuildRoadVehicle(TileIndex tile, DoCommandFlag flags, const Engin
v->last_station_visited = INVALID_STATION;
v->engine_type = e->index;
- v->rcache.first_engine = INVALID_ENGINE; // needs to be set before first callback
+ v->gcache.first_engine = INVALID_ENGINE; // needs to be set before first callback
v->reliability = e->reliability;
v->reliability_spd_dec = e->reliability_spd_dec;
@@ -254,7 +254,7 @@ CommandCost CmdBuildRoadVehicle(TileIndex tile, DoCommandFlag flags, const Engin
v->roadtype = HasBit(e->info.misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD;
v->compatible_roadtypes = RoadTypeToRoadTypes(v->roadtype);
- v->rcache.cached_veh_length = 8;
+ v->gcache.cached_veh_length = 8;
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
@@ -1317,7 +1317,7 @@ again:
* it's on a depot tile, check if it's time to activate the next vehicle in
* the chain yet. */
if (v->Next() != NULL && IsRoadDepotTile(v->tile)) {
- if (v->frame == v->rcache.cached_veh_length + RVC_DEPOT_START_FRAME) {
+ if (v->frame == v->gcache.cached_veh_length + RVC_DEPOT_START_FRAME) {
RoadVehLeaveDepot(v->Next(), false);
}
}