Feature: Purchase land multiple tiles at a time

This commit is contained in:
Tyler Trahan 2022-09-12 10:45:02 -06:00 committed by Michael Lutz
parent 8e6ed8d5e9
commit f7eb0ffc37
4 changed files with 16 additions and 6 deletions

View File

@ -87,7 +87,7 @@ struct CompanyProperties {
uint32 terraform_limit; ///< Amount of tileheights we can (still) terraform (times 65536).
uint32 clear_limit; ///< Amount of tiles we can (still) clear (times 65536).
uint32 tree_limit; ///< Amount of trees we can (still) plant (times 65536).
uint32 build_object_limit; ///< Amount of tiles we can (still) build objects on (times 65536).
uint32 build_object_limit; ///< Amount of tiles we can (still) build objects on (times 65536). Also applies to buying land.
/**
* If \c true, the company is (also) controlled by the computer (a NoAI program).

View File

@ -2812,7 +2812,7 @@ STR_LANDSCAPING_TOOLBAR :{WHITE}Landscap
STR_LANDSCAPING_TOOLTIP_LOWER_A_CORNER_OF_LAND :{BLACK}Lower a corner of land. Dragging lowers the first selected corner and levels the selected area to the new corner height. Ctrl selects the area diagonally. Shift toggles building/showing cost estimate
STR_LANDSCAPING_TOOLTIP_RAISE_A_CORNER_OF_LAND :{BLACK}Raise a corner of land. Dragging raises the first selected corner and levels the selected area to the new corner height. Ctrl selects the area diagonally. Shift toggles building/showing cost estimate
STR_LANDSCAPING_LEVEL_LAND_TOOLTIP :{BLACK}Level an area of land to the height of the first selected corner. Ctrl selects the area diagonally. Shift toggles building/showing cost estimate
STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND :{BLACK}Purchase land for future use. Shift toggles building/showing cost estimate
STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND :{BLACK}Purchase land for future use. Ctrl selects the area diagonally. Shift toggles building/showing cost estimate
# Object construction window
STR_OBJECT_BUILD_CAPTION :{WHITE}Object Selection

View File

@ -355,8 +355,8 @@ struct ConstructionSettings {
uint16 clear_frame_burst; ///< how many tiles may, over a short period, be cleared?
uint32 tree_per_64k_frames; ///< how many trees may, over a long period, be planted per 65536 frames?
uint16 tree_frame_burst; ///< how many trees may, over a short period, be planted?
uint32 build_object_per_64k_frames; ///< how many tiles may, over a long period, have objects built on them per 65536 frames?
uint16 build_object_frame_burst; ///< how many tiles may, over a short period, have objects built on them?
uint32 build_object_per_64k_frames; ///< how many tiles may, over a long period, be purchased or have objects built on them per 65536 frames?
uint16 build_object_frame_burst; ///< how many tiles may, over a short period, be purchased or have objects built on them?
};
/** Settings related to the AI. */

View File

@ -201,7 +201,7 @@ struct TerraformToolbarWindow : Window {
break;
case WID_TT_BUY_LAND: // Buy land button
HandlePlacePushButton(this, WID_TT_BUY_LAND, SPR_CURSOR_BUY_LAND, HT_RECT);
HandlePlacePushButton(this, WID_TT_BUY_LAND, SPR_CURSOR_BUY_LAND, HT_RECT | HT_DIAGONAL);
this->last_user_action = widget;
break;
@ -242,7 +242,7 @@ struct TerraformToolbarWindow : Window {
break;
case WID_TT_BUY_LAND: // Buy land button
Command<CMD_BUILD_OBJECT>::Post(STR_ERROR_CAN_T_PURCHASE_THIS_LAND, CcPlaySound_CONSTRUCTION_RAIL, tile, OBJECT_OWNED_LAND, 0);
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_BUILD_OBJECT);
break;
case WID_TT_PLACE_SIGN: // Place sign button
@ -276,6 +276,16 @@ struct TerraformToolbarWindow : Window {
case DDSP_LEVEL_AREA:
GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
break;
case DDSP_BUILD_OBJECT:
if (!_settings_game.construction.freeform_edges) {
/* When end_tile is MP_VOID, the error tile will not be visible to the
* user. This happens when terraforming at the southern border. */
if (TileX(end_tile) == MapMaxX()) end_tile += TileDiffXY(-1, 0);
if (TileY(end_tile) == MapMaxY()) end_tile += TileDiffXY(0, -1);
}
Command<CMD_BUILD_OBJECT_AREA>::Post(STR_ERROR_CAN_T_PURCHASE_THIS_LAND, CcPlaySound_CONSTRUCTION_RAIL,
end_tile, start_tile, OBJECT_OWNED_LAND, 0, (_ctrl_pressed ? true : false));
break;
}
}
}