changeset 18995:82481ec8bf0e draft

(svn r23851) -Fix: infrastructure cache could get out of sync when overbuilding a drive through road stop
author rubidium <rubidium@openttd.org>
date Wed, 25 Jan 2012 20:46:51 +0000
parents b26c49ea3930
children dd2fe8122b9d
files src/station_cmd.cpp
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1801,9 +1801,9 @@
 				 * road tile, count only the new road bits needed to get a full diagonal road. */
 				RoadType rt;
 				FOR_EACH_SET_ROADTYPE(rt, cur_rts | rts) {
-					Company *c = Company::GetIfValid(IsNormalRoadTile(cur_tile) && HasBit(cur_rts, rt) ? GetRoadOwner(cur_tile, rt) : _current_company);
+					Company *c = Company::GetIfValid(rt == ROADTYPE_ROAD ? road_owner : tram_owner);
 					if (c != NULL) {
-						c->infrastructure.road[rt] += 2 - (IsNormalRoadTile(cur_tile) ? CountBits(GetRoadBits(cur_tile, rt)) : 0);
+						c->infrastructure.road[rt] += 2 - (IsNormalRoadTile(cur_tile) && HasBit(cur_rts, rt) ? CountBits(GetRoadBits(cur_tile, rt)) : 0);
 						DirtyCompanyInfrastructureWindows(c->index);
 					}
 				}