summaryrefslogtreecommitdiff
path: root/src/rail_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r--src/rail_cmd.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index ed0362935..9cd40c83e 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -1402,7 +1402,9 @@ static Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data)
* @param tile end tile of rail conversion drag
* @param flags operation to perform
* @param p1 start tile of drag
- * @param p2 new railtype to convert to
+ * @param p2 various bitstuffed elements:
+ * - p2 = (bit 0- 3) new railtype to convert to.
+ * - p2 = (bit 4) build diagonally or not.
* @param text unused
* @return the cost of this operation or an error
*/
@@ -1418,7 +1420,8 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
CommandCost cost(EXPENSES_CONSTRUCTION);
CommandCost error = CommandCost(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK); // by default, there is no track to convert.
TileArea ta(tile, p1);
- TILE_AREA_LOOP(tile, ta) {
+ TileIterator *iter = HasBit(p2, 4) ? (TileIterator *)new DiagonalTileIterator(tile, p1) : new OrthogonalTileIterator(ta);
+ for (; (tile = *iter) != INVALID_TILE; ++(*iter)) {
TileType tt = GetTileType(tile);
/* Check if there is any track on tile */