1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-23 14:39:08 +00:00

Feature: Press Ctrl to build a diagonal area of trees (#10342)

This commit is contained in:
Tyler Trahan
2023-01-13 18:04:30 -05:00
committed by GitHub
parent b951332def
commit 5c64cdcb79
5 changed files with 13 additions and 11 deletions

View File

@@ -103,7 +103,7 @@ class BuildTreesWindow : public Window
if (this->tree_to_plant >= 0) {
/* Activate placement */
if (_settings_client.sound.confirm) SndPlayFx(SND_15_BEEP);
SetObjectToPlace(SPR_CURSOR_TREE, PAL_NONE, HT_RECT, this->window_class, this->window_number);
SetObjectToPlace(SPR_CURSOR_TREE, PAL_NONE, HT_RECT | HT_DIAGONAL, this->window_class, this->window_number);
this->tree_to_plant = current_tree; // SetObjectToPlace may call ResetObjectToPlace which may reset tree_to_plant to -1
} else {
/* Deactivate placement */
@@ -231,7 +231,7 @@ public:
TileIndex tile = TileVirtXY(pt.x, pt.y);
if (this->mode == PM_NORMAL) {
Command<CMD_PLANT_TREE>::Post(tile, tile, this->tree_to_plant);
Command<CMD_PLANT_TREE>::Post(tile, tile, this->tree_to_plant, false);
} else {
this->DoPlantForest(tile);
}
@@ -241,7 +241,7 @@ public:
void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
{
if (_game_mode != GM_EDITOR && this->mode == PM_NORMAL && pt.x != -1 && select_proc == DDSP_PLANT_TREES) {
Command<CMD_PLANT_TREE>::Post(STR_ERROR_CAN_T_PLANT_TREE_HERE, end_tile, start_tile, this->tree_to_plant);
Command<CMD_PLANT_TREE>::Post(STR_ERROR_CAN_T_PLANT_TREE_HERE, end_tile, start_tile, this->tree_to_plant, _ctrl_pressed);
}
}