summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/road_cmd.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index c94beb0b1..b47641689 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -2291,7 +2291,7 @@ static bool CanConvertUnownedRoadType(Owner owner, RoadTramType rtt)
}
/**
- * Convert the ownership of the RoadType of the tile if applyable
+ * Convert the ownership of the RoadType of the tile if applicable
* @param tile the tile of which convert ownership
* @param num_pieces the count of the roadbits to assign to the new owner
* @param owner the current owner of the RoadType
@@ -2428,11 +2428,9 @@ CommandCost CmdConvertRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
cost.AddCost(num_pieces * RoadConvertCost(from_type, to_type));
if (flags & DC_EXEC) { // we can safely convert, too
- /* Update the company infrastructure counters. */
+ /* Call ConvertRoadTypeOwner() to update the company infrastructure counters. */
if (owner == _current_company) {
- Company * c = Company::Get(_current_company);
- c->infrastructure.road[from_type] -= num_pieces;
- c->infrastructure.road[to_type] += num_pieces;
+ ConvertRoadTypeOwner(tile, num_pieces, owner, from_type, to_type);
}
/* Perform the conversion */