diff options
author | michi_cc <michi_cc@openttd.org> | 2011-12-03 23:40:13 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2011-12-03 23:40:13 +0000 |
commit | d30fcd4e354325af0d2b1968cd11c9db36a3e617 (patch) | |
tree | b69954355d81dd316ec4fcbeddcd117fecb1edee /src/road_cmd.cpp | |
parent | 6083d6ffb4b10ffd6e23e27183000cdb190d1ac7 (diff) | |
download | openttd-d30fcd4e354325af0d2b1968cd11c9db36a3e617.tar.xz |
(svn r23411) -Add: Company infrastructure counts for rail.
Diffstat (limited to 'src/road_cmd.cpp')
-rw-r--r-- | src/road_cmd.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 5fc871bfb..0f560165e 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1671,6 +1671,10 @@ static void ChangeTileOwner_Road(TileIndex tile, Owner old_owner, Owner new_owne if (new_owner == INVALID_OWNER) { DoCommand(tile, 0, GetCrossingRailTrack(tile), DC_EXEC | DC_BANKRUPT, CMD_REMOVE_SINGLE_RAIL); } else { + /* Update infrastructure counts. No need to dirty windows here, we'll redraw the whole screen anyway. */ + Company::Get(old_owner)->infrastructure.rail[GetRailType(tile)] -= LEVELCROSSING_TRACKBIT_FACTOR; + Company::Get(new_owner)->infrastructure.rail[GetRailType(tile)] += LEVELCROSSING_TRACKBIT_FACTOR; + SetTileOwner(tile, new_owner); } } |