Loading

Revision differences

Old revision #ptp0qnve4New revision #pt53yaqwv
5    bool is_lock_middle = IsLock(tile) && GetLockPart(tile) == LOCK_PART_MIDDLE;  5    bool is_lock_middle = IsLock(tile) && GetLockPart(tile) == LOCK_PART_MIDDLE;  
6  6  
7    /* No need to dirty company windows here, we'll redraw the whole screen anyway. */  7    /* No need to dirty company windows here, we'll redraw the whole screen anyway. */  
8    if (is_lock_middle) Company::Get(old_owner)->infrastructure.water -= 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts.  8    if (is_lock_middle) {
9    if (GetWaterClass(tile) == WATER_CLASS_CANAL && is_lock_middle) {  9        Company::Get(old_owner)->infrastructure.water -= 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts.
10        Company::Get(old_owner)->infrastructure.water--;  10        if (GetWaterClass(tile) == WATER_CLASS_CANAL) Company::Get(old_owner)->infrastructure.water--;
11    }  11    }  
12    if (new_owner != INVALID_OWNER) {  12    if (new_owner != INVALID_OWNER) {  
13        if (is_lock_middle) Company::Get(new_owner)->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts.  13        if (is_lock_middle) {
14        if (GetWaterClass(tile) == WATER_CLASS_CANAL && is_lock_middle) {  14            Company::Get(new_owner)->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts.
15            Company::Get(new_owner)->infrastructure.water++;  15        if (GetWaterClass(tile) == WATER_CLASS_CANAL) Company::Get(new_owner)->infrastructure.water++;
16        }  16        }  
17        /* Only subtract from the old owner here if the new owner is valid,  17        /* Only subtract from the old owner here if the new owner is valid,  
18         * otherwise we clear ship depots and canal water below. */  18         * otherwise we clear ship depots and canal water below. */