| Old revision #pft3rt0m2 | New revision #pagzyrmdn | ||
|---|---|---|---|
| 6 | if (IsLock(tile) && GetLockPart(tile) == LOCK_PART_MIDDLE) { | 6 | if (IsLock(tile) && GetLockPart(tile) == LOCK_PART_MIDDLE) { |
| 7 | /* The middle tile specifies the owner of the lock. */ | 7 | /* The middle tile specifies the owner of the lock. */ |
| 8 | c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // the middle tile specifies the owner of the | 8 | c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // the middle tile specifies the owner of the |
| 9 | + if (GetWaterClass(tile) != WATER_CLASS_ | 9 | + if (GetWaterClass(tile) != WATER_CLASS_RIVER) { |
| 10 | + c->infrastructure.water++; | 10 | + c->infrastructure.water++; |
| 11 | + } | 11 | + } |
| 12 | break; // do not count the middle tile as canal | 12 | break; // do not count the middle tile as canal | … | … |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | /** | 83 | /** |
| 84 | @@ -1276,8 +1288,14 @@ | 84 | @@ -1275,9 +1287,15 @@ |
| 85 | bool is_lock_middle = IsLock(tile) && GetLockPart(tile) == LOCK_PART_MIDDLE; | ||
| 85 | 86 | ||
| 86 | /* No need to dirty company windows here, we'll redraw the whole screen anyway. */ | 87 | /* No need to dirty company windows here, we'll redraw the whole screen anyway. */ |
| 87 | if (is_lock_middle) Company::Get(old_owner)->infrastructure.water -= 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts. | 88 | - if (is_lock_middle) Company::Get(old_owner)->infrastructure.water -= 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts. |
| 88 | + if (GetWaterClass(tile) == WATER_CLASS_CANAL && is_lock_middle) { | 89 | + if (is_lock_middle) { |
| 89 | + Company::Get(old_owner)->infrastructure.water--; | 90 | + Company::Get(old_owner)->infrastructure.water -= 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts. |
| 91 | + if (GetWaterClass(tile) == WATER_CLASS_CANAL) Company::Get(old_owner)->infrastructure.water--; | ||
| 90 | + } | 92 | + } |
| 91 | if (new_owner != INVALID_OWNER) { | 93 | if (new_owner != INVALID_OWNER) { |
| 92 | if (is_lock_middle) Company::Get(new_owner)->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts. | 94 | - if (is_lock_middle) Company::Get(new_owner)->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts. |
| 93 | + if (GetWaterClass(tile) == WATER_CLASS_CANAL && is_lock_middle) { | 95 | + if (is_lock_middle) { |
| 94 | + Company::Get(new_owner)->infrastructure.water++; | 96 | + Company::Get(new_owner)->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts. |
| 97 | + if (GetWaterClass(tile) == WATER_CLASS_CANAL) Company::Get(new_owner)->infrastructure.water++; | ||
| 95 | + } | 98 | + } |
| 96 | /* Only subtract from the old owner here if the new owner is valid, | 99 | /* Only subtract from the old owner here if the new owner is valid, |
| 97 | * otherwise we clear ship depots and canal water below. */ | 100 | * otherwise we clear ship depots and canal water below. */ |