summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-18 12:40:38 +0000
committerrubidium <rubidium@openttd.org>2008-05-18 12:40:38 +0000
commit4d5b9e38d60a4199dc36a6d275ca8e31f1b7f97c (patch)
tree714f6bb8fc38d8b835bffc7a3eaa83e7e6e08e5a /src
parentcbd09e4f5769ff22213fc96af609580bf0a9b71b (diff)
downloadopenttd-4d5b9e38d60a4199dc36a6d275ca8e31f1b7f97c.tar.xz
(svn r13160) -Codechange: prepare GUIPlaceProcDragXY for the removal of WindowEvent.
Diffstat (limited to 'src')
-rw-r--r--src/airport_gui.cpp2
-rw-r--r--src/dock_gui.cpp2
-rw-r--r--src/rail_gui.cpp3
-rw-r--r--src/road_gui.cpp2
-rw-r--r--src/terraform_gui.cpp13
-rw-r--r--src/tilehighlight_func.h2
-rw-r--r--src/window.cpp4
-rw-r--r--src/window_gui.h10
-rw-r--r--src/window_type.h1
9 files changed, 19 insertions, 20 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index 7333f8051..f887fb25a 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -95,7 +95,7 @@ static void BuildAirToolbWndProc(Window *w, WindowEvent *e)
case WE_PLACE_MOUSEUP:
if (e->we.place.pt.x != -1 && e->we.place.select_proc == DDSP_DEMOLISH_AREA) {
- GUIPlaceProcDragXY(e);
+ GUIPlaceProcDragXY(e->we.place.select_proc, e->we.place.starttile, e->we.place.tile);
}
break;
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 88ac47e3c..acfa4967a 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -162,7 +162,7 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
if (e->we.place.pt.x != -1) {
switch (e->we.place.select_proc) {
case DDSP_DEMOLISH_AREA:
- GUIPlaceProcDragXY(e);
+ GUIPlaceProcDragXY(e->we.place.select_proc, e->we.place.starttile, e->we.place.tile);
break;
case DDSP_CREATE_WATER:
DoCommandP(e->we.place.tile, e->we.place.starttile, 0, CcBuildCanal, CMD_BUILD_CANAL | CMD_MSG(STR_CANT_BUILD_CANALS));
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 4db21bdd3..860261387 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -610,6 +610,7 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e)
TileIndex end_tile = e->we.place.tile;
switch (e->we.place.select_proc) {
+ default: NOT_REACHED();
case DDSP_BUILD_BRIDGE:
ResetObjectToPlace();
ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_RAIL, _cur_railtype);
@@ -624,7 +625,7 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e)
break;
case DDSP_DEMOLISH_AREA:
- GUIPlaceProcDragXY(e);
+ GUIPlaceProcDragXY(e->we.place.select_proc, e->we.place.starttile, e->we.place.tile);
break;
case DDSP_CONVERT_RAIL:
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index d61651442..00f96f7ad 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -571,7 +571,7 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e)
break;
case DDSP_DEMOLISH_AREA:
- GUIPlaceProcDragXY(e);
+ GUIPlaceProcDragXY(e->we.place.select_proc, e->we.place.starttile, e->we.place.tile);
break;
case DDSP_PLACE_ROAD_X_DIR:
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index c24d85c6a..d0e2d3ef0 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -110,12 +110,9 @@ static void GenerateRockyArea(TileIndex end, TileIndex start)
* allows for additional implements that are more local. For example X_Y drag
* of convertrail which belongs in rail_gui.cpp and not terraform_gui.cpp
**/
-bool GUIPlaceProcDragXY(const WindowEvent *e)
+bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile)
{
- TileIndex start_tile = e->we.place.starttile;
- TileIndex end_tile = e->we.place.tile;
-
- switch (e->we.place.select_proc) {
+ switch (proc) {
case DDSP_DEMOLISH_AREA:
DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
break;
@@ -267,11 +264,12 @@ static void TerraformToolbWndProc(Window *w, WindowEvent *e)
case WE_PLACE_MOUSEUP:
if (e->we.place.pt.x != -1) {
switch (e->we.place.select_proc) {
+ default: NOT_REACHED();
case DDSP_DEMOLISH_AREA:
case DDSP_RAISE_AND_LEVEL_AREA:
case DDSP_LOWER_AND_LEVEL_AREA:
case DDSP_LEVEL_AREA:
- GUIPlaceProcDragXY(e);
+ GUIPlaceProcDragXY(e->we.place.select_proc, e->we.place.starttile, e->we.place.tile);
break;
}
}
@@ -655,6 +653,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
case WE_PLACE_MOUSEUP:
if (e->we.place.pt.x != -1) {
switch (e->we.place.select_proc) {
+ default: NOT_REACHED();
case DDSP_CREATE_ROCKS:
case DDSP_CREATE_DESERT:
case DDSP_CREATE_WATER:
@@ -663,7 +662,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
case DDSP_LOWER_AND_LEVEL_AREA:
case DDSP_LEVEL_AREA:
case DDSP_DEMOLISH_AREA:
- GUIPlaceProcDragXY(e);
+ GUIPlaceProcDragXY(e->we.place.select_proc, e->we.place.starttile, e->we.place.tile);
break;
}
}
diff --git a/src/tilehighlight_func.h b/src/tilehighlight_func.h
index 78eff6f5f..4a0f5bb0e 100644
--- a/src/tilehighlight_func.h
+++ b/src/tilehighlight_func.h
@@ -12,7 +12,7 @@
typedef void PlaceProc(TileIndex tile);
void PlaceProc_DemolishArea(TileIndex tile);
-bool GUIPlaceProcDragXY(const WindowEvent *e);
+bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile);
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc);
void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w);
diff --git a/src/window.cpp b/src/window.cpp
index 5d791d807..5e6a2f1b9 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -178,7 +178,7 @@ void Window::OnPlaceObjectAbort()
}
-void Window::OnPlaceDrag(ViewportPlaceMethod select_method, byte select_proc, Point pt)
+void Window::OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
{
WindowEvent e;
e.event = WE_PLACE_DRAG;
@@ -188,7 +188,7 @@ void Window::OnPlaceDrag(ViewportPlaceMethod select_method, byte select_proc, Po
this->HandleWindowEvent(&e);
}
-void Window::OnPlaceMouseUp(ViewportPlaceMethod select_method, byte select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
+void Window::OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
{
WindowEvent e;
e.event = WE_PLACE_MOUSEUP;
diff --git a/src/window_gui.h b/src/window_gui.h
index 3b8e792b6..f1e8ed21f 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -20,8 +20,6 @@
*/
static const int MAX_NUMBER_OF_WINDOWS = 25;
-typedef void WindowProc(Window *w, WindowEvent *e);
-
/* How the resize system works:
First, you need to add a WWT_RESIZEBOX to the widgets, and you need
to add the flag WDF_RESIZABLE to the window. Now the window is ready
@@ -147,7 +145,7 @@ struct WindowEvent {
TileIndex tile;
TileIndex starttile;
ViewportPlaceMethod select_method;
- byte select_proc;
+ ViewportDragDropSelectionProcess select_proc;
} place;
struct {
@@ -185,6 +183,8 @@ struct WindowEvent {
} we;
};
+typedef void WindowProc(Window *w, WindowEvent *e);
+
/**
* High level window description
*/
@@ -482,7 +482,7 @@ public:
* @param select_proc what will be created when the drag is over.
* @param pt the exact point on the map where the mouse is.
*/
- virtual void OnPlaceDrag(ViewportPlaceMethod select_method, byte select_proc, Point pt);
+ virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt);
/**
* The user has dragged over the map when the tile highlight mode
@@ -493,7 +493,7 @@ public:
* @param start_tile the begin tile of the drag.
* @param end_tile the end tile of the drag.
*/
- virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, byte select_proc, Point pt, TileIndex start_tile, TileIndex end_tile);
+ virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile);
/**
* The user moves over the map when a tile highlight mode has been set
diff --git a/src/window_type.h b/src/window_type.h
index 32c5eeb13..62f226527 100644
--- a/src/window_type.h
+++ b/src/window_type.h
@@ -99,7 +99,6 @@ enum WindowClass {
};
struct Window;
-struct WindowEvent;
typedef int32 WindowNumber;
#endif /* WINDOW_TYPE_H */