summaryrefslogtreecommitdiff
path: root/src/saveload/company_sl.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-02-09 22:38:39 +0000
committerfrosch <frosch@openttd.org>2012-02-09 22:38:39 +0000
commit07f69d8b88f8252e38bb728702b4548d1656b188 (patch)
tree7e2d5bee2d516ce3a799ee300493f64418a3baba /src/saveload/company_sl.cpp
parent5012ea91ef3201384d4e11ecb4b19e657464faf2 (diff)
downloadopenttd-07f69d8b88f8252e38bb728702b4548d1656b188.tar.xz
(svn r23920) -Fix: Consider only the middle tile of a lock for lock-infrastructure costs. The other two tiles may be owned by other companies. Also do not count the middle tile of a lock as canal, independent of whether it is build on ground or river slope.
Diffstat (limited to 'src/saveload/company_sl.cpp')
-rw-r--r--src/saveload/company_sl.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/saveload/company_sl.cpp b/src/saveload/company_sl.cpp
index 588d0fb18..e9cd02d95 100644
--- a/src/saveload/company_sl.cpp
+++ b/src/saveload/company_sl.cpp
@@ -173,7 +173,14 @@ void AfterLoadCompanyStats()
case MP_WATER:
if (IsShipDepot(tile) || IsLock(tile)) {
c = Company::GetIfValid(GetTileOwner(tile));
- if (c != NULL) c->infrastructure.water += LOCK_DEPOT_TILE_FACTOR;
+ if (c != NULL) {
+ if (IsShipDepot(tile)) c->infrastructure.water += LOCK_DEPOT_TILE_FACTOR;
+ if (IsLock(tile) && GetLockPart(tile) == LOCK_PART_MIDDLE) {
+ /* The middle tile specifies the owner of the lock. */
+ c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // the middle tile specifies the owner of the
+ break; // do not count the middle tile as canal
+ }
+ }
}
/* FALL THROUGH */