Fix 0125892: Don't crash when towns upgrade road tiles during expansion (#8651)

pull/221/head
Matt Kimber 3 years ago committed by GitHub
parent 9322b40df1
commit 2a6da319b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 */

Loading…
Cancel
Save