summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2005-01-23 15:25:17 +0000
committerdarkvater <darkvater@openttd.org>2005-01-23 15:25:17 +0000
commitc9d6ea2570c3b9460e0a239dc7bbd1620ab46e72 (patch)
tree19ce437575178a0434a9682b56bafceb06b0c6b9
parent1cd455b8be2782590f708804f861a47a8d2fef29 (diff)
downloadopenttd-c9d6ea2570c3b9460e0a239dc7bbd1620ab46e72.tar.xz
(svn r1617) -Fix: Ugly hack to only call ResetObjectToPlaceon childwindows of build-toolbar if the window is closed manually (with 'X'); if not checked ResetObjectToPlace is called twice resulting in undesired actions (eg. clicked button is unclicked immediately).
-rw-r--r--airport_gui.c6
-rw-r--r--dock_gui.c12
-rw-r--r--rail_gui.c17
-rw-r--r--road_gui.c29
4 files changed, 20 insertions, 44 deletions
diff --git a/airport_gui.c b/airport_gui.c
index 9c8fcb2f6..fec9af299 100644
--- a/airport_gui.c
+++ b/airport_gui.c
@@ -179,9 +179,6 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
case WE_CLICK: {
switch(e->click.widget) {
- case 0:
- ResetObjectToPlace();
- break;
case 3: case 4: case 5: case 6: case 7:
_selected_airport_type = e->click.widget - 3;
SndPlayFx(SND_15_BEEP);
@@ -205,7 +202,8 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
} break;
case WE_DESTROY:
- ResetObjectToPlace();
+ if (!WP(w,def_d).close)
+ ResetObjectToPlace();
break;
}
}
diff --git a/dock_gui.c b/dock_gui.c
index 5aed706f6..cc59fd1f9 100644
--- a/dock_gui.c
+++ b/dock_gui.c
@@ -234,9 +234,6 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
case WE_CLICK: {
switch(e->click.widget) {
- case 0:
- ResetObjectToPlace();
- break;
case 3: case 4:
_station_show_coverage = e->click.widget - 3;
SndPlayFx(SND_15_BEEP);
@@ -256,7 +253,8 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
}
case WE_DESTROY:
- ResetObjectToPlace();
+ if (!WP(w,def_d).close)
+ ResetObjectToPlace();
break;
}
}
@@ -307,9 +305,6 @@ static void BuildDocksDepotWndProc(Window *w, WindowEvent *e)
case WE_CLICK: {
switch(e->click.widget) {
- case 0:
- ResetObjectToPlace();
- break;
case 3:
case 4:
_ship_depot_direction = e->click.widget - 3;
@@ -326,7 +321,8 @@ static void BuildDocksDepotWndProc(Window *w, WindowEvent *e)
break;
case WE_DESTROY:
- ResetObjectToPlace();
+ if (!WP(w,def_d).close)
+ ResetObjectToPlace();
break;
}
}
diff --git a/rail_gui.c b/rail_gui.c
index bd6f37990..18f249b78 100644
--- a/rail_gui.c
+++ b/rail_gui.c
@@ -761,9 +761,6 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) {
case WE_CLICK: {
switch(e->click.widget) {
- case 0:
- ResetObjectToPlace();
- break;
case 3:
case 4:
_railstation.orientation = e->click.widget - 3;
@@ -821,7 +818,8 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) {
} break;
case WE_DESTROY:
- ResetObjectToPlace();
+ if (!WP(w,def_d).close)
+ ResetObjectToPlace();
break;
}
}
@@ -888,13 +886,7 @@ static void BuildTrainDepotWndProc(Window *w, WindowEvent *e)
}
case WE_CLICK: {
switch(e->click.widget) {
- case 0:
- ResetObjectToPlace();
- break;
- case 3:
- case 4:
- case 5:
- case 6:
+ case 3: case 4: case 5: case 6:
_build_depot_direction = e->click.widget - 3;
SndPlayFx(SND_15_BEEP);
SetWindowDirty(w);
@@ -908,7 +900,8 @@ static void BuildTrainDepotWndProc(Window *w, WindowEvent *e)
return;
case WE_DESTROY:
- ResetObjectToPlace();
+ if (!WP(w,def_d).close)
+ ResetObjectToPlace();
break;
}
}
diff --git a/road_gui.c b/road_gui.c
index ba17873f9..b3fa397ea 100644
--- a/road_gui.c
+++ b/road_gui.c
@@ -353,14 +353,8 @@ static void BuildRoadDepotWndProc(Window *w, WindowEvent *e) {
break;
case WE_CLICK: {
- switch(e->click.widget) {
- case 0:
- ResetObjectToPlace();
- break;
- case 3:
- case 4:
- case 5:
- case 6:
+ switch (e->click.widget) {
+ case 3: case 4: case 5: case 6:
_road_depot_orientation = e->click.widget - 3;
SndPlayFx(SND_15_BEEP);
SetWindowDirty(w);
@@ -374,7 +368,8 @@ static void BuildRoadDepotWndProc(Window *w, WindowEvent *e) {
break;
case WE_DESTROY:
- ResetObjectToPlace();
+ if (!WP(w,def_d).close)
+ ResetObjectToPlace();
break;
}
}
@@ -436,20 +431,13 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
} break;
case WE_CLICK: {
- switch(e->click.widget) {
- case 0:
- ResetObjectToPlace();
- break;
- case 3:
- case 4:
- case 5:
- case 6:
+ switch (e->click.widget) {
+ case 3: case 4: case 5: case 6:
_road_station_picker_orientation = e->click.widget - 3;
SndPlayFx(SND_15_BEEP);
SetWindowDirty(w);
break;
- case 7:
- case 8:
+ case 7: case 8:
_station_show_coverage = e->click.widget - 7;
SndPlayFx(SND_15_BEEP);
SetWindowDirty(w);
@@ -467,7 +455,8 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
} break;
case WE_DESTROY:
- ResetObjectToPlace();
+ if (!WP(w,def_d).close)
+ ResetObjectToPlace();
break;
}
}