diff options
author | alberth <alberth@openttd.org> | 2010-12-24 15:06:58 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-12-24 15:06:58 +0000 |
commit | 9a5cce382fb56ea91f95a56bc7b83b0ccbb69e1b (patch) | |
tree | d711ea64b360783917e7c6afd1499d9e9821de2b /src | |
parent | 62f2771eddb25eca8d9f1877d51013e11108bbe2 (diff) | |
download | openttd-9a5cce382fb56ea91f95a56bc7b83b0ccbb69e1b.tar.xz |
(svn r21626) -Codechange: Remove more small static functions.
Diffstat (limited to 'src')
-rw-r--r-- | src/terraform_gui.cpp | 64 |
1 files changed, 13 insertions, 51 deletions
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 00dcce1b9..5979f8831 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -131,33 +131,15 @@ bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_t 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 @@ struct TerraformToolbarWindow : Window { { 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 @@ struct TerraformToolbarWindow : Window { 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 CommonRaiseLowerBigLand(TileIndex tile, int mode) } } -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 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { 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 |