Mercurial > hg > openttd
changeset 16891:b7771f19cf07 draft
(svn r21626) -Codechange: Remove more small static functions.
author | alberth <alberth@openttd.org> |
---|---|
date | Fri, 24 Dec 2010 15:06:58 +0000 |
parents | 3176f2910463 |
children | 1e94199f85d6 |
files | src/terraform_gui.cpp |
diffstat | 1 files changed, 13 insertions(+), 51 deletions(-) [+] |
line wrap: on
line diff
--- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -131,33 +131,15 @@ return true; } -typedef void OnButtonClick(Window *w); - -static void PlaceProc_BuyLand(TileIndex tile) -{ - DoCommandP(tile, OBJECT_OWNED_LAND, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_PURCHASE_THIS_LAND), CcPlaySound1E); -} - +/** + * Start a drag for demolishing an area. + * @param tile Position of one corner. + */ void PlaceProc_DemolishArea(TileIndex tile) { VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_DEMOLISH_AREA); } -static void PlaceProc_RaiseLand(TileIndex tile) -{ - VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_RAISE_AND_LEVEL_AREA); -} - -static void PlaceProc_LowerLand(TileIndex tile) -{ - VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_LOWER_AND_LEVEL_AREA); -} - -static void PlaceProc_LevelLand(TileIndex tile) -{ - VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_LEVEL_AREA); -} - /** Enum referring to the widgets of the terraform toolbar */ enum TerraformToolbarWidgets { TTW_SHOW_PLACE_OBJECT, ///< Should the place object button be shown? @@ -267,15 +249,15 @@ { switch (this->last_user_action) { case TTW_LOWER_LAND: // Lower land button - PlaceProc_LowerLand(tile); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_LOWER_AND_LEVEL_AREA); break; case TTW_RAISE_LAND: // Raise land button - PlaceProc_RaiseLand(tile); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_RAISE_AND_LEVEL_AREA); break; case TTW_LEVEL_LAND: // Level land button - PlaceProc_LevelLand(tile); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_LEVEL_AREA); break; case TTW_DEMOLISH: // Demolish aka dynamite button @@ -283,7 +265,7 @@ break; case TTW_BUY_LAND: // Buy land button - PlaceProc_BuyLand(tile); + DoCommandP(tile, OBJECT_OWNED_LAND, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_PURCHASE_THIS_LAND), CcPlaySound1E); break; case TTW_PLACE_SIGN: // Place sign button @@ -468,26 +450,6 @@ } } -static void PlaceProc_RaiseBigLand(TileIndex tile) -{ - CommonRaiseLowerBigLand(tile, 1); -} - -static void PlaceProc_LowerBigLand(TileIndex tile) -{ - CommonRaiseLowerBigLand(tile, 0); -} - -static void PlaceProc_RockyArea(TileIndex tile) -{ - VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_ROCKS); -} - -static void PlaceProc_DesertArea(TileIndex tile) -{ - VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_DESERT); -} - static const int8 _multi_terraform_coords[][2] = { { 0, -2}, { 4, 0}, { -4, 0}, { 0, 2}, @@ -736,23 +698,23 @@ break; case ETTW_LOWER_LAND: // Lower land button - PlaceProc_LowerBigLand(tile); + CommonRaiseLowerBigLand(tile, 0); break; case ETTW_RAISE_LAND: // Raise land button - PlaceProc_RaiseBigLand(tile); + CommonRaiseLowerBigLand(tile, 1); break; case ETTW_LEVEL_LAND: // Level land button - PlaceProc_LevelLand(tile); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_LEVEL_AREA); break; case ETTW_PLACE_ROCKS: // Place rocks button - PlaceProc_RockyArea(tile); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_ROCKS); break; case ETTW_PLACE_DESERT: // Place desert button (in tropical climate) - PlaceProc_DesertArea(tile); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_DESERT); break; case ETTW_PLACE_OBJECT: // Place transmitter button