Fix #10: Do not auto-terraform in polyrail remove mode

This commit is contained in:
dP
2021-10-23 19:36:03 +03:00
parent e921aae3bc
commit 4082c7c787
5 changed files with 10 additions and 8 deletions

View File

@@ -75,8 +75,9 @@ This is usable for any OpenTTD servers
== CHANGELOG ==
*** 12.1 (? Oct 2021) ***
- Hide new auto-terraforming mode for polyrail behind a setting for now as it is still quite bugged.
- Fix modifer keys selection in settings ui.
- Hid new auto-terraforming mode for polyrail behind a setting for now as it is still quite bugged.
- Fixed auto-terraforming messing remove mode in polyrail tool.
- Fixed modifer keys selection in settings ui.
*** 12.0 (17 Oct 2021) ***
- Automatically search servers when opening multiplayer window.

View File

@@ -74,6 +74,10 @@ std::pair<uint32, uint32> GetEPM() {
_last_actions.size());
}
bool HasSeparateRemoveMod() {
return (_settings_client.gui.cm_fn_mod != _settings_client.gui.cm_remove_mod);
}
void UpdateModKeys(bool shift_pressed, bool ctrl_pressed, bool alt_pressed) {
bool mod_pressed[(size_t)ModKey::END] = {false};
if (shift_pressed) mod_pressed[(size_t)ModKey::SHIFT] = true;
@@ -97,10 +101,6 @@ void UpdateModKeys(bool shift_pressed, bool ctrl_pressed, bool alt_pressed) {
}
}
bool HasSeparateRemoveMod() {
return (_settings_client.gui.cm_fn_mod != _settings_client.gui.cm_remove_mod);
}
ToolRemoveMode RailToolbar_GetRemoveMode(int widget) {
switch(widget) {
case WID_RAT_BUILD_NS:

View File

@@ -9,6 +9,7 @@ extern bool _fn_mod;
extern bool _estimate_mod;
extern bool _remove_mod;
enum class ToolRemoveMode : uint8 {
NONE = 0,
BUTTON = 1,

View File

@@ -515,7 +515,7 @@ static void HandleAutodirPlacement()
if (citymania::_estimate_mod || !(_thd.place_mode & HT_POLY) ||
DoCommand(&cmd, DC_AUTO | DC_NO_WATER).GetErrorMessage() != STR_ERROR_ALREADY_BUILT ||
_rail_track_endtile == INVALID_TILE) {
if (_thd.cm_poly_terra) {
if (_thd.cm_poly_terra && !_remove_button_clicked) {
if (!citymania::HandleAutodirTerraform(start_tile, end_tile, track, cmd)) return;
} else {
if (!DoCommandP(&cmd)) return;

View File

@@ -1181,7 +1181,7 @@ static void DrawTileSelection(const TileInfo *ti)
case HT_LINE: {
HighLightStyle type = GetPartOfAutoLine(ti->x, ti->y, _thd.selstart, _thd.selend, _thd.drawstyle & HT_DIR_MASK);
if (type < HT_DIR_END) {
DrawAutorailSelection(ti, type, _thd.cm_poly_terra ? CM_SPR_PALETTE_ZONING_YELLOW : PAL_NONE);
DrawAutorailSelection(ti, type, _thd.cm_poly_terra && !_thd.make_square_red ? CM_SPR_PALETTE_ZONING_YELLOW : PAL_NONE);
} else if (_thd.dir2 < HT_DIR_END) {
type = GetPartOfAutoLine(ti->x, ti->y, _thd.selstart2, _thd.selend2, _thd.dir2);
if (type < HT_DIR_END) DrawAutorailSelection(ti, type, PALETTE_SEL_TILE_BLUE);