diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/airport_gui.cpp | 4 | ||||
-rw-r--r-- | src/dock_gui.cpp | 10 | ||||
-rw-r--r-- | src/gui.h | 30 | ||||
-rw-r--r-- | src/main_gui.cpp | 15 | ||||
-rw-r--r-- | src/misc_gui.cpp | 4 | ||||
-rw-r--r-- | src/rail_gui.cpp | 49 | ||||
-rw-r--r-- | src/road_gui.cpp | 23 | ||||
-rw-r--r-- | src/terraform_gui.cpp | 23 |
8 files changed, 91 insertions, 67 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 888d26112..681f9b297 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -39,7 +39,7 @@ static void PlaceAirport(TileIndex tile) static void PlaceAir_DemolishArea(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_X_AND_Y, GUI_PlaceProc_None); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_DEMOLISH_AREA); } @@ -95,7 +95,7 @@ static void BuildAirToolbWndProc(Window *w, WindowEvent *e) break; case WE_PLACE_MOUSEUP: - if (e->we.place.pt.x != -1) { + if (e->we.place.pt.x != -1 && e->we.place.select_proc == DDSP_DEMOLISH_AREA) { DoCommandP(e->we.place.tile, e->we.place.starttile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA)); } break; diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 8cd977928..02abcd129 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -53,12 +53,12 @@ static void PlaceDocks_Buoy(TileIndex tile) static void PlaceDocks_DemolishArea(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_X_AND_Y, GUI_PlaceProc_DemolishArea); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_DEMOLISH_AREA); } static void PlaceDocks_BuildCanal(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_X_OR_Y, GUI_PlaceProc_None); + VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_CREATE_WATER); } static void PlaceDocks_BuildLock(TileIndex tile) @@ -153,11 +153,11 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e) case WE_PLACE_MOUSEUP: if (e->we.place.pt.x != -1) { - switch (e->we.place.select_method) { - case VPM_X_AND_Y: + switch (e->we.place.select_proc) { + case DDSP_DEMOLISH_AREA: GUIPlaceProcDragXY(e); break; - case VPM_X_OR_Y: + case DDSP_CREATE_WATER: DoCommandP(e->we.place.tile, e->we.place.starttile, 0, CcBuildCanal, CMD_BUILD_CANAL | CMD_AUTO | CMD_MSG(STR_CANT_BUILD_CANALS)); break; default: break; @@ -68,15 +68,29 @@ void PlaceProc_DemolishArea(TileIndex tile); void PlaceProc_LevelLand(TileIndex tile); bool GUIPlaceProcDragXY(const WindowEvent *e); +/** Drag and drop selection process, or, what to do with an area of land when + * you've selected it. */ enum { - GUI_PlaceProc_None, - GUI_PlaceProc_DemolishArea, - GUI_PlaceProc_LevelArea, - GUI_PlaceProc_DesertArea, - GUI_PlaceProc_WaterArea, - GUI_PlaceProc_ConvertRailArea, - GUI_PlaceProc_RockyArea, - GUI_PlaceProc_RemoveFromStation, + DDSP_DEMOLISH_AREA, + DDSP_LEVEL_AREA, + DDSP_CREATE_DESERT, + DDSP_CREATE_ROCKS, + DDSP_CREATE_WATER, + DDSP_PLANT_TREES, + DDSP_BUILD_BRIDGE, + + /* Rail specific actions */ + DDSP_PLACE_RAIL_NE, + DDSP_PLACE_RAIL_NW, + DDSP_PLACE_AUTORAIL, + DDSP_BUILD_SIGNALS, + DDSP_BUILD_STATION, + DDSP_REMOVE_STATION, + DDSP_CONVERT_RAIL, + + /* Road specific actions */ + DDSP_PLACE_ROAD_NE, + DDSP_PLACE_ROAD_NW, }; /* misc_gui.cpp */ diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 806069775..73de8e195 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -1131,7 +1131,7 @@ static void PlaceProc_LowerBigLand(TileIndex tile) static void PlaceProc_RockyArea(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_X_AND_Y, GUI_PlaceProc_RockyArea); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_ROCKS); } static void PlaceProc_LightHouse(TileIndex tile) @@ -1158,12 +1158,12 @@ static void PlaceProc_Transmitter(TileIndex tile) static void PlaceProc_DesertArea(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_X_AND_Y, GUI_PlaceProc_DesertArea); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_DESERT); } static void PlaceProc_WaterArea(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_X_AND_Y, GUI_PlaceProc_WaterArea); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_WATER); } static const Widget _scen_edit_land_gen_widgets[] = { @@ -1382,8 +1382,13 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e) case WE_PLACE_MOUSEUP: if (e->we.place.pt.x != -1) { - if (e->we.place.select_method == VPM_X_AND_Y) // dragged actions - GUIPlaceProcDragXY(e); + switch (e->we.place.select_proc) { + case DDSP_CREATE_ROCKS: + case DDSP_CREATE_DESERT: + case DDSP_CREATE_WATER: + GUIPlaceProcDragXY(e); + break; + } } break; diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 380b8fc38..34c1564d5 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -382,7 +382,7 @@ static void BuildTreesWndProc(Window *w, WindowEvent *e) } break; case WE_PLACE_OBJ: - VpStartPlaceSizing(e->we.place.tile, VPM_X_AND_Y_LIMITED, GUI_PlaceProc_None); + VpStartPlaceSizing(e->we.place.tile, VPM_X_AND_Y_LIMITED, DDSP_PLANT_TREES); VpSetPlaceSizingLimit(20); break; @@ -391,7 +391,7 @@ static void BuildTreesWndProc(Window *w, WindowEvent *e) return; case WE_PLACE_MOUSEUP: - if (e->we.place.pt.x != -1) { + if (e->we.place.pt.x != -1 && e->we.place.select_proc == DDSP_PLANT_TREES) { DoCommandP(e->we.place.tile, _tree_to_plant, e->we.place.starttile, NULL, CMD_PLANT_TREE | CMD_AUTO | CMD_MSG(STR_2805_CAN_T_PLANT_TREE_HERE)); } diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index fe829deed..838eeda8c 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -72,7 +72,7 @@ static void PlaceRail_N(TileIndex tile) static void PlaceRail_NE(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_FIX_Y, GUI_PlaceProc_None); + VpStartPlaceSizing(tile, VPM_FIX_Y, DDSP_PLACE_RAIL_NE); } static void PlaceRail_E(TileIndex tile) @@ -83,12 +83,12 @@ static void PlaceRail_E(TileIndex tile) static void PlaceRail_NW(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_FIX_X, GUI_PlaceProc_None); + VpStartPlaceSizing(tile, VPM_FIX_X, DDSP_PLACE_RAIL_NW); } static void PlaceRail_AutoRail(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_RAILDIRS, GUI_PlaceProc_None); + VpStartPlaceSizing(tile, VPM_RAILDIRS, DDSP_PLACE_AUTORAIL); } static void PlaceExtraDepotRail(TileIndex tile, uint16 extra) @@ -151,9 +151,9 @@ void CcStation(bool success, TileIndex tile, uint32 p1, uint32 p2) static void PlaceRail_Station(TileIndex tile) { if (_remove_button_clicked) { - VpStartPlaceSizing(tile, VPM_X_AND_Y, GUI_PlaceProc_RemoveFromStation); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_REMOVE_STATION); } else if (_railstation.dragdrop) { - VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, GUI_PlaceProc_None); + VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION); VpSetPlaceSizingLimit(_patches.station_spread); } else { DoCommandP(tile, @@ -197,7 +197,7 @@ static void GenericPlaceSignals(TileIndex tile) static void PlaceRail_Bridge(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_X_OR_Y, GUI_PlaceProc_None); + VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE); } void CcBuildRailTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2) @@ -223,12 +223,12 @@ void PlaceProc_BuyLand(TileIndex tile) static void PlaceRail_ConvertRail(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_X_AND_Y, GUI_PlaceProc_ConvertRailArea); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CONVERT_RAIL); } static void PlaceRail_AutoSignals(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_SIGNALDIRS, GUI_PlaceProc_None); + VpStartPlaceSizing(tile, VPM_SIGNALDIRS, DDSP_BUILD_SIGNALS); } @@ -501,13 +501,13 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e) TileIndex start_tile = e->we.place.starttile; TileIndex end_tile = e->we.place.tile; - switch (e->we.place.select_method) { - case VPM_X_OR_Y: + switch (e->we.place.select_proc) { + case DDSP_BUILD_BRIDGE: ResetObjectToPlace(); ShowBuildBridgeWindow(start_tile, end_tile, _cur_railtype); break; - case VPM_RAILDIRS: { + case DDSP_PLACE_AUTORAIL: { bool old = _remove_button_clicked; if (_ctrl_pressed) _remove_button_clicked = true; HandleAutodirPlacement(); @@ -515,30 +515,29 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e) break; } - case VPM_SIGNALDIRS: + case DDSP_BUILD_SIGNALS: HandleAutoSignalPlacement(); break; - case VPM_X_AND_Y: - if (GUIPlaceProcDragXY(e)) break; + case DDSP_DEMOLISH_AREA: + GUIPlaceProcDragXY(e); + break; - switch (e->we.place.select_proc) { - case GUI_PlaceProc_RemoveFromStation: - DoCommandP(end_tile, start_tile, 0, CcPlaySound1E, CMD_REMOVE_FROM_RAILROAD_STATION | CMD_MSG(STR_CANT_REMOVE_PART_OF_STATION)); - break; + case DDSP_REMOVE_STATION: + DoCommandP(end_tile, start_tile, 0, CcPlaySound1E, CMD_REMOVE_FROM_RAILROAD_STATION | CMD_MSG(STR_CANT_REMOVE_PART_OF_STATION)); + break; - case GUI_PlaceProc_ConvertRailArea: - DoCommandP(end_tile, start_tile, _cur_railtype, CcPlaySound10, CMD_CONVERT_RAIL | CMD_MSG(STR_CANT_CONVERT_RAIL)); - break; - } + case DDSP_CONVERT_RAIL: + DoCommandP(end_tile, start_tile, _cur_railtype, CcPlaySound10, CMD_CONVERT_RAIL | CMD_MSG(STR_CANT_CONVERT_RAIL)); break; - case VPM_X_AND_Y_LIMITED: + case DDSP_BUILD_STATION: HandleStationPlacement(start_tile, end_tile); break; - default: - DoRailroadTrack(e->we.place.select_method == VPM_FIX_Y ? TRACK_X : TRACK_Y); + case DDSP_PLACE_RAIL_NE: + case DDSP_PLACE_RAIL_NW: + DoRailroadTrack(e->we.place.select_proc == DDSP_PLACE_RAIL_NE ? TRACK_X : TRACK_Y); break; } } diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 189a93c6a..217c0618d 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -45,18 +45,18 @@ void CcPlaySound1D(bool success, TileIndex tile, uint32 p1, uint32 p2) static void PlaceRoad_NE(TileIndex tile) { _place_road_flag = (_tile_fract_coords.y >= 8) + 4; - VpStartPlaceSizing(tile, VPM_FIX_X, GUI_PlaceProc_None); + VpStartPlaceSizing(tile, VPM_FIX_X, DDSP_PLACE_ROAD_NE); } static void PlaceRoad_NW(TileIndex tile) { _place_road_flag = (_tile_fract_coords.x >= 8) + 0; - VpStartPlaceSizing(tile, VPM_FIX_Y, GUI_PlaceProc_None); + VpStartPlaceSizing(tile, VPM_FIX_Y, DDSP_PLACE_ROAD_NW); } static void PlaceRoad_Bridge(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_X_OR_Y, GUI_PlaceProc_None); + VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE); } @@ -134,7 +134,7 @@ static void PlaceRoad_TruckStation(TileIndex tile) static void PlaceRoad_DemolishArea(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_X_AND_Y, GUI_PlaceProc_None); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_DEMOLISH_AREA); } @@ -271,12 +271,12 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e) break; case WE_PLACE_DRAG: - switch (e->we.place.select_method) { - case VPM_FIX_X: + switch (e->we.place.select_proc) { + case DDSP_PLACE_ROAD_NE: _place_road_flag = (_place_road_flag & ~2) | ((e->we.place.pt.y & 8) >> 2); break; - case VPM_FIX_Y: + case DDSP_PLACE_ROAD_NW: _place_road_flag = (_place_road_flag & ~2) | ((e->we.place.pt.x & 8) >> 2); break; } @@ -289,17 +289,18 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e) TileIndex start_tile = e->we.place.starttile; TileIndex end_tile = e->we.place.tile; - switch (e->we.place.select_method) { - case VPM_X_OR_Y: + switch (e->we.place.select_proc) { + case DDSP_BUILD_BRIDGE: ResetObjectToPlace(); ShowBuildBridgeWindow(start_tile, end_tile, 0x80 | RoadTypeToRoadTypes(_cur_roadtype)); break; - case VPM_X_AND_Y: + case DDSP_DEMOLISH_AREA: DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA)); break; - default: + case DDSP_PLACE_ROAD_NE: + case DDSP_PLACE_ROAD_NW: DoCommandP(end_tile, start_tile, _place_road_flag | (_cur_roadtype << 3), CcPlaySound1D, _remove_button_clicked ? CMD_REMOVE_LONG_ROAD | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1805_CAN_T_REMOVE_ROAD_FROM) : diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 99def0e85..4bd990674 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -105,19 +105,19 @@ bool GUIPlaceProcDragXY(const WindowEvent *e) TileIndex end_tile = e->we.place.tile; switch (e->we.place.select_proc) { - case GUI_PlaceProc_DemolishArea: + case DDSP_DEMOLISH_AREA: DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA)); break; - case GUI_PlaceProc_LevelArea: + case DDSP_LEVEL_AREA: DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_LEVEL_LAND | CMD_AUTO); break; - case GUI_PlaceProc_RockyArea: + case DDSP_CREATE_ROCKS: GenerateRockyArea(end_tile, start_tile); break; - case GUI_PlaceProc_DesertArea: + case DDSP_CREATE_DESERT: GenerateDesertArea(end_tile, start_tile); break; - case GUI_PlaceProc_WaterArea: + case DDSP_CREATE_WATER: DoCommandP(end_tile, start_tile, _ctrl_pressed, CcBuildCanal, CMD_BUILD_CANAL | CMD_AUTO | CMD_MSG(STR_CANT_BUILD_CANALS)); break; default: @@ -141,7 +141,7 @@ static const uint16 _terraform_keycodes[] = { void PlaceProc_DemolishArea(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_X_AND_Y, GUI_PlaceProc_DemolishArea); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_DEMOLISH_AREA); } static void PlaceProc_RaiseLand(TileIndex tile) @@ -162,7 +162,7 @@ static void PlaceProc_LowerLand(TileIndex tile) void PlaceProc_LevelLand(TileIndex tile) { - VpStartPlaceSizing(tile, VPM_X_AND_Y, GUI_PlaceProc_LevelArea); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_LEVEL_AREA); } static void TerraformClick_Lower(Window *w) @@ -244,8 +244,13 @@ static void TerraformToolbWndProc(Window *w, WindowEvent *e) break; case WE_PLACE_MOUSEUP: - if (e->we.place.pt.x != -1 && e->we.place.select_method == VPM_X_AND_Y) { - GUIPlaceProcDragXY(e); + if (e->we.place.pt.x != -1) { + switch (e->we.place.select_proc) { + case DDSP_DEMOLISH_AREA: + case DDSP_LEVEL_AREA: + GUIPlaceProcDragXY(e); + break; + } } break; |