Fix #9837, 46bd2f1c: Road build with wrong half-tile ends.

pull/379/head
Michael Lutz 2 years ago
parent 0d9fdeda8e
commit 8d54f76539

@ -989,7 +989,8 @@ CommandCost CmdBuildLongRoad(DoCommandFlag flags, TileIndex start_tile, TileInde
/* Swap direction, also the half-tile drag vars. */
if (start_tile > end_tile || (start_tile == end_tile && start_half)) {
dir = ReverseDiagDir(dir);
std::swap(start_half, end_half);
start_half = !start_half;
end_half = !end_half;
if (drd == DRD_NORTHBOUND || drd == DRD_SOUTHBOUND) drd ^= DRD_BOTH;
}

@ -638,14 +638,14 @@ struct BuildRoadToolbarWindow : Window {
case DDSP_PLACE_ROAD_X_DIR:
case DDSP_PLACE_ROAD_Y_DIR:
case DDSP_PLACE_AUTOROAD: {
bool start_half = _place_road_dir == AXIS_Y ? _place_road_start_half_y : _place_road_start_half_y;
bool start_half = _place_road_dir == AXIS_Y ? _place_road_start_half_y : _place_road_start_half_x;
if (_remove_button_clicked) {
Command<CMD_REMOVE_LONG_ROAD>::Post(this->rti->strings.err_remove_road, CcPlaySound_CONSTRUCTION_OTHER,
start_tile, end_tile, _cur_roadtype, _place_road_dir, start_half, _place_road_end_half);
} else {
Command<CMD_BUILD_LONG_ROAD>::Post(this->rti->strings.err_build_road, CcPlaySound_CONSTRUCTION_OTHER,
start_tile, end_tile, _cur_roadtype, _place_road_dir, _one_way_button_clicked ? DRD_NORTHBOUND : DRD_NONE, start_tile, _place_road_end_half, false);
start_tile, end_tile, _cur_roadtype, _place_road_dir, _one_way_button_clicked ? DRD_NORTHBOUND : DRD_NONE, start_half, _place_road_end_half, false);
}
break;
}

Loading…
Cancel
Save