Changeset - r6670:a5c8d94cb5d7
[Not reviewed]
master
0 8 0
maedhros - 17 years ago 2007-05-23 13:52:10
maedhros@openttd.org
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
8 files changed with 93 insertions and 69 deletions:
0 comments (0 inline, 0 general)
src/airport_gui.cpp
Show inline comments
 
@@ -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 
 
		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;
src/dock_gui.cpp
Show inline comments
 
@@ -53,12 +53,12 @@ static void PlaceDocks_Buoy(TileIndex ti
 

	
 
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(Windo
 

	
 
	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;
src/gui.h
Show inline comments
 
@@ -68,15 +68,29 @@ void PlaceProc_DemolishArea(TileIndex ti
 
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 */
src/main_gui.cpp
Show inline comments
 
@@ -1131,7 +1131,7 @@ static void PlaceProc_LowerBigLand(TileI
 

	
 
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(TileIn
 

	
 
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(Windo
 

	
 
	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;
 

	
src/misc_gui.cpp
Show inline comments
 
@@ -382,7 +382,7 @@ static void BuildTreesWndProc(Window *w,
 
	} 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,
 
		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));
 
		}
src/rail_gui.cpp
Show inline comments
 
@@ -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 t
 
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(TileInde
 

	
 
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
 
			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
 
					break;
 
				}
 

	
 
				case VPM_SIGNALDIRS:
 
				case DDSP_BUILD_SIGNALS:
 
					HandleAutoSignalPlacement();
 
					break;
 

	
 
				case VPM_X_AND_Y:
 
					if (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 GUI_PlaceProc_ConvertRailArea:
 
							DoCommandP(end_tile, start_tile, _cur_railtype, CcPlaySound10, CMD_CONVERT_RAIL | CMD_MSG(STR_CANT_CONVERT_RAIL));
 
							break;
 
					}
 
				case DDSP_DEMOLISH_AREA:
 
					GUIPlaceProcDragXY(e);
 
					break;
 

	
 
				case VPM_X_AND_Y_LIMITED:
 
				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 DDSP_CONVERT_RAIL:
 
					DoCommandP(end_tile, start_tile, _cur_railtype, CcPlaySound10, CMD_CONVERT_RAIL | CMD_MSG(STR_CANT_CONVERT_RAIL));
 
					break;
 

	
 
				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;
 
			}
 
		}
src/road_gui.cpp
Show inline comments
 
@@ -45,18 +45,18 @@ void CcPlaySound1D(bool success, TileInd
 
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(TileI
 

	
 
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
 
		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
 
			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) :
src/terraform_gui.cpp
Show inline comments
 
@@ -105,19 +105,19 @@ bool GUIPlaceProcDragXY(const WindowEven
 
	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(TileInde
 

	
 
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
 
		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;
 

	
0 comments (0 inline, 0 general)