Loading

Revision differences

Old revision #pjorloxaxNew revision #pmwystspn
1static CommandCost RemoveLock(TileIndex tile, DoCommandFlag flags)  1static CommandCost RemoveLock(TileIndex tile, DoCommandFlag flags)  
2{  2{  
3    CommandCost cost(EXPENSES_CONSTRUCTION);  3    CommandCost cost(EXPENSES_CONSTRUCTION);  
4        if (GetTileOwner(tile) != OWNER_NONE) {  4   
   5    if (GetTileOwner(tile) != OWNER_NONE) {
5        CommandCost ret = CheckTileOwnership(tile);  6        CommandCost ret = CheckTileOwnership(tile);  
6        if (ret.Failed()) return ret;  7        if (ret.Failed()) return ret;  
7        if (GetWaterClass(tile) != WATER_CLASS_RIVER) cost.AddCost(_price[PR_CLEAR_CANAL]);    
8    }  8    }  
9  9  
10    TileIndexDiff delta = TileOffsByDiagDir(GetLockDirection(tile));  10    TileIndexDiff delta = TileOffsByDiagDir(GetLockDirection(tile));  
  
38        MarkCanalsAndRiversAroundDirty(tile + delta);  38        MarkCanalsAndRiversAroundDirty(tile + delta);  
39    }  39    }  
40  40  
41    return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_LOCK]);  41    if (GetWaterClass(tile) != WATER_CLASS_RIVER) cost.AddCost(_price[PR_CLEAR_CANAL]);
   42    CommandCost cost(EXPENSES_CONSTRUCTION);
   43    cost.AddCost(_price[PR_CLEAR_LOCK]);
   44    return cost;
   45
42} 46}