1
0
Fork 0

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

pull/9794/head
Michael Lutz 2022-03-20 12:05:31 +01:00
parent 0d9fdeda8e
commit 8d54f76539
2 changed files with 4 additions and 3 deletions

View File

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

View File

@ -638,14 +638,14 @@ struct BuildRoadToolbarWindow : Window {
case DDSP_PLACE_ROAD_X_DIR: case DDSP_PLACE_ROAD_X_DIR:
case DDSP_PLACE_ROAD_Y_DIR: case DDSP_PLACE_ROAD_Y_DIR:
case DDSP_PLACE_AUTOROAD: { 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) { if (_remove_button_clicked) {
Command<CMD_REMOVE_LONG_ROAD>::Post(this->rti->strings.err_remove_road, CcPlaySound_CONSTRUCTION_OTHER, 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); start_tile, end_tile, _cur_roadtype, _place_road_dir, start_half, _place_road_end_half);
} else { } else {
Command<CMD_BUILD_LONG_ROAD>::Post(this->rti->strings.err_build_road, CcPlaySound_CONSTRUCTION_OTHER, 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; break;
} }