summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--airport_gui.c15
-rw-r--r--dock_gui.c22
-rw-r--r--rail_gui.c67
-rw-r--r--road_gui.c42
-rw-r--r--terraform_gui.c23
5 files changed, 89 insertions, 80 deletions
diff --git a/airport_gui.c b/airport_gui.c
index 7aaf5a665..3d06e8c4f 100644
--- a/airport_gui.c
+++ b/airport_gui.c
@@ -38,12 +38,12 @@ static void PlaceAir_DemolishArea(uint tile)
static void BuildAirClick_Airport(Window *w)
{
- if (HandlePlacePushButton(w, 2, 0xAA4, 1, PlaceAirport)) ShowBuildAirportPicker();
+ if (HandlePlacePushButton(w, 3, 0xAA4, 1, PlaceAirport)) ShowBuildAirportPicker();
}
static void BuildAirClick_Demolish(Window *w)
{
- HandlePlacePushButton(w, 3, ANIMCURSOR_DEMOLISH, 1, PlaceAir_DemolishArea);
+ HandlePlacePushButton(w, 4, ANIMCURSOR_DEMOLISH, 1, PlaceAir_DemolishArea);
}
static void BuildAirClick_Landscaping(Window *w)
@@ -66,8 +66,8 @@ static void BuildAirToolbWndProc(Window *w, WindowEvent *e)
break;
case WE_CLICK:
- if (e->click.widget-2 >= 0)
- _build_air_button_proc[e->click.widget - 2](w);
+ if (e->click.widget - 3 >= 0)
+ _build_air_button_proc[e->click.widget - 3](w);
break;
case WE_PLACE_OBJ:
@@ -86,7 +86,7 @@ static void BuildAirToolbWndProc(Window *w, WindowEvent *e)
break;
case WE_ABORT_PLACE_OBJ:
- w->click_state = 0;
+ UnclickWindowButtons(w);
SetWindowDirty(w);
w = FindWindowById(WC_BUILD_STATION, 0);
if (w != 0)
@@ -97,7 +97,8 @@ static void BuildAirToolbWndProc(Window *w, WindowEvent *e)
static const Widget _air_toolbar_widgets[] = {
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 7, 11, 85, 0, 13, STR_A000_AIRPORTS, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 7, 11, 73, 0, 13, STR_A000_AIRPORTS, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 7, 74, 85, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_PANEL, 7, 0, 41, 14, 35, 0x2E8, STR_A01E_BUILD_AIRPORT},
{ WWT_PANEL, 7, 42, 63, 14, 35, 0x2BF, STR_018D_DEMOLISH_BUILDINGS_ETC},
{ WWT_PANEL, 7, 64, 85, 14, 35, SPR_IMG_LANDSCAPING_S, STR_LANDSCAPING_TOOLBAR_TIP},
@@ -108,7 +109,7 @@ static const Widget _air_toolbar_widgets[] = {
static const WindowDesc _air_toolbar_desc = {
640-86, 22, 86, 36,
WC_BUILD_TOOLBAR,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_air_toolbar_widgets,
BuildAirToolbWndProc
};
diff --git a/dock_gui.c b/dock_gui.c
index e7d034c91..66e11426e 100644
--- a/dock_gui.c
+++ b/dock_gui.c
@@ -62,33 +62,33 @@ static void PlaceDocks_BuildLock(uint tile)
static void BuildDocksClick_Canal(Window *w)
{
- HandlePlacePushButton(w, 2, SPR_OPENTTD_BASE + 11, 1, PlaceDocks_BuildCanal);
+ HandlePlacePushButton(w, 3, SPR_OPENTTD_BASE + 11, 1, PlaceDocks_BuildCanal);
}
static void BuildDocksClick_Lock(Window *w)
{
- HandlePlacePushButton(w, 3, SPR_OPENTTD_BASE + 64, 1, PlaceDocks_BuildLock);
+ HandlePlacePushButton(w, 4, SPR_OPENTTD_BASE + 64, 1, PlaceDocks_BuildLock);
}
static void BuildDocksClick_Demolish(Window *w)
{
- HandlePlacePushButton(w, 5, ANIMCURSOR_DEMOLISH, 1, PlaceDocks_DemolishArea);
+ HandlePlacePushButton(w, 6, ANIMCURSOR_DEMOLISH, 1, PlaceDocks_DemolishArea);
}
static void BuildDocksClick_Depot(Window *w)
{
- if (HandlePlacePushButton(w, 6, 0x2D1, 1, PlaceDocks_Depot)) ShowBuildDocksDepotPicker();
+ if (HandlePlacePushButton(w, 7, 0x2D1, 1, PlaceDocks_Depot)) ShowBuildDocksDepotPicker();
}
static void BuildDocksClick_Dock(Window *w)
{
- if (HandlePlacePushButton(w, 7, 0xE54, 3, PlaceDocks_Dock)) ShowBuildDockStationPicker();
+ if (HandlePlacePushButton(w, 8, 0xE54, 3, PlaceDocks_Dock)) ShowBuildDockStationPicker();
}
static void BuildDocksClick_Buoy(Window *w)
{
- HandlePlacePushButton(w, 8, 0x2BE, 1, PlaceDocks_Buoy);
+ HandlePlacePushButton(w, 9, 0x2BE, 1, PlaceDocks_Buoy);
}
static void BuildDocksClick_Landscaping(Window *w)
@@ -116,7 +116,7 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
break;
case WE_CLICK: {
- if (e->click.widget - 2 >= 0 && e->click.widget!=4) _build_docks_button_proc[e->click.widget - 2](w);
+ if (e->click.widget - 3 >= 0 && e->click.widget != 5) _build_docks_button_proc[e->click.widget - 3](w);
} break;
case WE_PLACE_OBJ:
@@ -138,7 +138,7 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
break;
case WE_ABORT_PLACE_OBJ:
- w->click_state = 0;
+ UnclickWindowButtons(w);
SetWindowDirty(w);
w = FindWindowById(WC_BUILD_STATION, 0);
@@ -165,8 +165,8 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
static const Widget _build_docks_toolb_widgets[] = {
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 7, 11, 157, 0, 13, STR_9801_DOCK_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
-
+{ WWT_CAPTION, 7, 11, 145, 0, 13, STR_9801_DOCK_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 7, 146, 157, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_PANEL, 7, 0, 21, 14, 35, SPR_OPENTTD_BASE+65, STR_BUILD_CANALS_TIP},
{ WWT_PANEL, 7, 22, 43, 14, 35, SPR_CANALS_BASE+69, STR_BUILD_LOCKS_TIP},
@@ -183,7 +183,7 @@ static const Widget _build_docks_toolb_widgets[] = {
static const WindowDesc _build_docks_toolbar_desc = {
640-158, 22, 158, 36,
WC_BUILD_TOOLBAR,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_build_docks_toolb_widgets,
BuildDocksToolbWndProc
};
diff --git a/rail_gui.c b/rail_gui.c
index 49f9856c8..65c535391 100644
--- a/rail_gui.c
+++ b/rail_gui.c
@@ -214,32 +214,32 @@ static void PlaceRail_AutoSignals(uint tile)
static void BuildRailClick_N(Window *w)
{
- HandlePlacePushButton(w, 3, _cur_railtype*4 + 0x4EF, 1, PlaceRail_N);
+ HandlePlacePushButton(w, 4, _cur_railtype*4 + 0x4EF, 1, PlaceRail_N);
}
static void BuildRailClick_NE(Window *w)
{
- HandlePlacePushButton(w, 4, _cur_railtype*4 + 0x4F0, 1, PlaceRail_NE);
+ HandlePlacePushButton(w, 5, _cur_railtype*4 + 0x4F0, 1, PlaceRail_NE);
}
static void BuildRailClick_E(Window *w)
{
- HandlePlacePushButton(w, 5, _cur_railtype*4 + 0x4F1, 1, PlaceRail_E);
+ HandlePlacePushButton(w, 6, _cur_railtype*4 + 0x4F1, 1, PlaceRail_E);
}
static void BuildRailClick_NW(Window *w)
{
- HandlePlacePushButton(w, 6, _cur_railtype*4 + 0x4F2, 1, PlaceRail_NW);
+ HandlePlacePushButton(w, 7, _cur_railtype*4 + 0x4F2, 1, PlaceRail_NW);
}
static void BuildRailClick_AutoRail(Window *w)
{
- HandlePlacePushButton(w, 7, _cur_railtype + SPR_OPENTTD_BASE + 4, 1, PlaceRail_AutoRail);
+ HandlePlacePushButton(w, 8, _cur_railtype + SPR_OPENTTD_BASE + 4, 1, PlaceRail_AutoRail);
}
static void BuildRailClick_Demolish(Window *w)
{
- HandlePlacePushButton(w, 8, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea);
+ HandlePlacePushButton(w, 9, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea);
}
static const SpriteID _depot_cursors[] = {
@@ -250,50 +250,50 @@ static const SpriteID _depot_cursors[] = {
static void BuildRailClick_Depot(Window *w)
{
- if (HandlePlacePushButton(w, 9, _depot_cursors[_cur_railtype], 1, PlaceRail_Depot)) ShowBuildTrainDepotPicker();
+ if (HandlePlacePushButton(w, 10, _depot_cursors[_cur_railtype], 1, PlaceRail_Depot)) ShowBuildTrainDepotPicker();
}
static void BuildRailClick_Waypoint(Window *w)
{
_waypoint_count = GetCustomStationsCount(STAT_CLASS_WAYP);
- if (HandlePlacePushButton(w, 10, SPR_OPENTTD_BASE + 7, 1, PlaceRail_Waypoint)
+ if (HandlePlacePushButton(w, 11, SPR_OPENTTD_BASE + 7, 1, PlaceRail_Waypoint)
&& _waypoint_count > 1)
ShowBuildWaypointPicker();
}
static void BuildRailClick_Station(Window *w)
{
- if (HandlePlacePushButton(w, 11, 0x514, 1, PlaceRail_Station)) ShowStationBuilder();
+ if (HandlePlacePushButton(w, 12, 0x514, 1, PlaceRail_Station)) ShowStationBuilder();
}
static void BuildRailClick_AutoSignals(Window *w)
{
- HandlePlacePushButton(w, 12, ANIMCURSOR_BUILDSIGNALS , 1, PlaceRail_AutoSignals);
+ HandlePlacePushButton(w, 13, ANIMCURSOR_BUILDSIGNALS , 1, PlaceRail_AutoSignals);
}
static void BuildRailClick_Bridge(Window *w)
{
- HandlePlacePushButton(w, 13, 0xA21, 1, PlaceRail_Bridge);
+ HandlePlacePushButton(w, 14, 0xA21, 1, PlaceRail_Bridge);
}
static void BuildRailClick_Tunnel(Window *w)
{
- HandlePlacePushButton(w, 14, 0x982 + _cur_railtype, 3, PlaceRail_Tunnel);
+ HandlePlacePushButton(w, 15, 0x982 + _cur_railtype, 3, PlaceRail_Tunnel);
}
static void BuildRailClick_Remove(Window *w)
{
- if (w->disabled_state & (1<<15))
+ if (w->disabled_state & (1<<16))
return;
SetWindowDirty(w);
SndPlayFx(SND_15_BEEP);
- _thd.make_square_red = !!((w->click_state ^= (1 << 15)) & (1<<15));
+ _thd.make_square_red = !!((w->click_state ^= (1 << 16)) & (1<<16));
MarkTileDirty(_thd.pos.x, _thd.pos.y);
- _remove_button_clicked = (w->click_state & (1 << 15)) != 0;
+ _remove_button_clicked = (w->click_state & (1 << 16)) != 0;
// handle station builder
- if( w->click_state & (1 << 15) )
+ if( w->click_state & (1 << 16) )
{
if(_remove_button_clicked)
SetTileSelectSize(1, 1);
@@ -304,7 +304,7 @@ static void BuildRailClick_Remove(Window *w)
static void BuildRailClick_Convert(Window *w)
{
- HandlePlacePushButton(w, 16, (SPR_OPENTTD_BASE + 26) + _cur_railtype * 2, 1, PlaceRail_ConvertRail);
+ HandlePlacePushButton(w, 17, (SPR_OPENTTD_BASE + 26) + _cur_railtype * 2, 1, PlaceRail_ConvertRail);
}
static void BuildRailClick_Landscaping(Window *w)
@@ -596,31 +596,33 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e)
{
switch(e->event) {
case WE_PAINT:
- w->disabled_state &= ~(1 << 15);
- if (!(w->click_state & ((1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<10)|(1<<11)|(1<<12)))) {
- w->disabled_state |= (1 << 15);
- w->click_state &= ~(1<<15);
+ w->disabled_state &= ~(1 << 16);
+ if (!(w->click_state & ((1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<11)|(1<<12)|(1<<13)))) {
+ w->disabled_state |= (1 << 16);
+ w->click_state &= ~(1<<16);
}
DrawWindowWidgets(w);
break;
case WE_CLICK:
- if (e->click.widget >= 3) {
+ if (e->click.widget >= 4) {
_remove_button_clicked = false;
- _build_railroad_button_proc[e->click.widget - 3](w);
+ _build_railroad_button_proc[e->click.widget - 4](w);
}
break;
case WE_KEYPRESS: {
int i;
- for(i=0; i!=lengthof(_rail_keycodes); i++)
+ for(i=0; i!=lengthof(_rail_keycodes); i++) {
if (e->keypress.keycode == _rail_keycodes[i]) {
e->keypress.cont = false;
_remove_button_clicked = false;
_build_railroad_button_proc[i](w);
break;
}
+ }
+ MarkTileDirty(_thd.pos.x, _thd.pos.y); // redraw tile selection
break;
}
@@ -663,7 +665,7 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e)
break;
case WE_ABORT_PLACE_OBJ:
- w->click_state = 0;
+ UnclickWindowButtons(w);
SetWindowDirty(w);
w = FindWindowById(WC_BUILD_STATION, 0);
@@ -683,7 +685,8 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e)
static const Widget _build_railroad_widgets[] = {
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5,STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 7, 11, 371, 0, 13, STR_100A_RAILROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 7, 11, 359, 0, 13, STR_100A_RAILROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 7, 360, 371, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_PANEL, 7, 110, 113, 14, 35, 0x0, STR_NULL},
@@ -712,14 +715,15 @@ static const Widget _build_railroad_widgets[] = {
static const WindowDesc _build_railroad_desc = {
640-372, 22, 372, 36,
WC_BUILD_TOOLBAR,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_build_railroad_widgets,
BuildRailToolbWndProc
};
static const Widget _build_monorail_widgets[] = {
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5,STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 7, 11, 371, 0, 13, STR_100B_MONORAIL_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 7, 11, 359, 0, 13, STR_100B_MONORAIL_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 7, 360, 371, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_PANEL, 7, 110, 113, 14, 35, 0x0, STR_NULL},
@@ -748,14 +752,15 @@ static const Widget _build_monorail_widgets[] = {
static const WindowDesc _build_monorail_desc = {
640-372, 22, 372, 36,
WC_BUILD_TOOLBAR,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_build_monorail_widgets,
BuildRailToolbWndProc
};
static const Widget _build_maglev_widgets[] = {
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5,STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 7, 11, 371, 0, 13, STR_100C_MAGLEV_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 7, 11, 359, 0, 13, STR_100C_MAGLEV_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 7, 360, 371, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_PANEL, 7, 110, 113, 14, 35, 0x0, STR_NULL},
@@ -784,7 +789,7 @@ static const Widget _build_maglev_widgets[] = {
static const WindowDesc _build_maglev_desc = {
640-372, 22, 372, 36,
WC_BUILD_TOOLBAR,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_build_maglev_widgets,
BuildRailToolbWndProc
};
diff --git a/road_gui.c b/road_gui.c
index e64e47ff8..ccf6c3310 100644
--- a/road_gui.c
+++ b/road_gui.c
@@ -106,58 +106,58 @@ typedef void OnButtonClick(Window *w);
static void BuildRoadClick_NE(Window *w)
{
_build_road_flag = 0;
- HandlePlacePushButton(w, 2, 0x51F, 1, PlaceRoad_NE);
+ HandlePlacePushButton(w, 3, 0x51F, 1, PlaceRoad_NE);
}
static void BuildRoadClick_NW(Window *w)
{
_build_road_flag = 0;
- HandlePlacePushButton(w, 3, 0x520, 1, PlaceRoad_NW);
+ HandlePlacePushButton(w, 4, 0x520, 1, PlaceRoad_NW);
}
static void BuildRoadClick_Demolish(Window *w)
{
- HandlePlacePushButton(w, 4, ANIMCURSOR_DEMOLISH, 1, PlaceRoad_DemolishArea);
+ HandlePlacePushButton(w, 5, ANIMCURSOR_DEMOLISH, 1, PlaceRoad_DemolishArea);
}
static void BuildRoadClick_Depot(Window *w)
{
if (_game_mode == GM_EDITOR) return;
- if (HandlePlacePushButton(w, 5, 0x511, 1, PlaceRoad_Depot)) ShowRoadDepotPicker();
+ if (HandlePlacePushButton(w, 6, 0x511, 1, PlaceRoad_Depot)) ShowRoadDepotPicker();
}
static void BuildRoadClick_BusStation(Window *w)
{
if (_game_mode == GM_EDITOR) return;
- if (HandlePlacePushButton(w, 6, 0xAA5, 1, PlaceRoad_BusStation)) ShowBusStationPicker();
+ if (HandlePlacePushButton(w, 7, 0xAA5, 1, PlaceRoad_BusStation)) ShowBusStationPicker();
}
static void BuildRoadClick_TruckStation(Window *w)
{
if (_game_mode == GM_EDITOR) return;
- if (HandlePlacePushButton(w, 7, 0xAA6, 1, PlaceRoad_TruckStation)) ShowTruckStationPicker();
+ if (HandlePlacePushButton(w, 8, 0xAA6, 1, PlaceRoad_TruckStation)) ShowTruckStationPicker();
}
static void BuildRoadClick_Bridge(Window *w)
{
_build_road_flag = 0;
- HandlePlacePushButton(w, 8, 0xA21, 1, PlaceRoad_Bridge);
+ HandlePlacePushButton(w, 9, 0xA21, 1, PlaceRoad_Bridge);
}
static void BuildRoadClick_Tunnel(Window *w)
{
_build_road_flag = 0;
- HandlePlacePushButton(w, 9, 0x981, 3, PlaceRoad_Tunnel);
+ HandlePlacePushButton(w, 10, 0x981, 3, PlaceRoad_Tunnel);
}
static void BuildRoadClick_Remove(Window *w)
{
- if (w->disabled_state & (1<<10))
+ if (w->disabled_state & (1<<11))
return;
SetWindowDirty(w);
SndPlayFx(SND_15_BEEP);
- _thd.make_square_red = !!((w->click_state ^= (1 << 10)) & (1<<10));
+ _thd.make_square_red = !!((w->click_state ^= (1 << 11)) & (1<<11));
MarkTileDirty(_thd.pos.x, _thd.pos.y);
}
@@ -182,17 +182,17 @@ static OnButtonClick * const _build_road_button_proc[] = {
static void BuildRoadToolbWndProc(Window *w, WindowEvent *e) {
switch(e->event) {
case WE_PAINT:
- w->disabled_state &= ~(1 << 10);
- if (!(w->click_state & ((1<<2)|(1<<3)))) {
- w->disabled_state |= (1 << 10);
- w->click_state &= ~(1<<10);
+ w->disabled_state &= ~(1 << 11);
+ if (!(w->click_state & ((1<<3)|(1<<4)))) {
+ w->disabled_state |= (1 << 11);
+ w->click_state &= ~(1<<11);
}
DrawWindowWidgets(w);
break;
case WE_CLICK: {
- if (e->click.widget >= 2)
- _build_road_button_proc[e->click.widget - 2](w);
+ if (e->click.widget >= 3)
+ _build_road_button_proc[e->click.widget - 3](w);
} break;
case WE_KEYPRESS:
@@ -210,16 +210,17 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e) {
default:
return;
}
+ MarkTileDirty(_thd.pos.x, _thd.pos.y); // redraw tile selection
e->keypress.cont = false;
break;
case WE_PLACE_OBJ:
- _remove_button_clicked = (w->click_state & (1 << 10)) != 0;
+ _remove_button_clicked = (w->click_state & (1 << 11)) != 0;
_place_proc(e->place.tile);
break;
case WE_ABORT_PLACE_OBJ:
- w->click_state = 0;
+ UnclickWindowButtons(w);
SetWindowDirty(w);
w = FindWindowById(WC_BUS_STATION, 0);
@@ -277,7 +278,8 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e) {
static const Widget _build_road_widgets[] = {
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 7, 11, 239, 0, 13, STR_1802_ROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 7, 11, 227, 0, 13, STR_1802_ROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, 7, 228, 239, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_PANEL, 7, 0, 21, 14, 35, SPR_IMG_ROAD_NW, STR_180B_BUILD_ROAD_SECTION},
{ WWT_PANEL, 7, 22, 43, 14, 35, SPR_IMG_ROAD_NE, STR_180B_BUILD_ROAD_SECTION},
@@ -295,7 +297,7 @@ static const Widget _build_road_widgets[] = {
static const WindowDesc _build_road_desc = {
640-240, 22, 240, 36,
WC_BUILD_TOOLBAR,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_build_road_widgets,
BuildRoadToolbWndProc
};
diff --git a/terraform_gui.c b/terraform_gui.c
index 6c8f915e9..77c3ed115 100644
--- a/terraform_gui.c
+++ b/terraform_gui.c
@@ -66,32 +66,32 @@ void PlaceProc_PlantTree(uint tile)
static void TerraformClick_Lower(Window *w)
{
- HandlePlacePushButton(w, 3, ANIMCURSOR_LOWERLAND, 2, PlaceProc_LowerLand);
+ HandlePlacePushButton(w, 4, ANIMCURSOR_LOWERLAND, 2, PlaceProc_LowerLand);
}
static void TerraformClick_Raise(Window *w)
{
- HandlePlacePushButton(w, 4, ANIMCURSOR_RAISELAND, 2, PlaceProc_RaiseLand);
+ HandlePlacePushButton(w, 5, ANIMCURSOR_RAISELAND, 2, PlaceProc_RaiseLand);
}
static void TerraformClick_Level(Window *w)
{
- HandlePlacePushButton(w, 5, SPR_OPENTTD_BASE+69, 2, PlaceProc_LevelLand);
+ HandlePlacePushButton(w, 6, SPR_OPENTTD_BASE+69, 2, PlaceProc_LevelLand);
}
static void TerraformClick_BuyLand(Window *w)
{
- HandlePlacePushButton(w, 6, 4792, 1, PlaceProc_BuyLand);
+ HandlePlacePushButton(w, 7, 4792, 1, PlaceProc_BuyLand);
}
static void TerraformClick_Trees(Window *w)
{
- if (HandlePlacePushButton(w, 7, 0, 1, PlaceProc_PlantTree)) ShowBuildTreesToolbar();
+ if (HandlePlacePushButton(w, 8, 0, 1, PlaceProc_PlantTree)) ShowBuildTreesToolbar();
}
static void TerraformClick_PlaceSign(Window *w)
{
- HandlePlacePushButton(w, 8, 722, 1, PlaceProc_Sign);
+ HandlePlacePushButton(w, 9, 722, 1, PlaceProc_Sign);
}
@@ -113,8 +113,8 @@ static void TerraformToolbWndProc(Window *w, WindowEvent *e)
DrawWindowWidgets(w);
break;
case WE_CLICK:
- if (e->click.widget >= 3) {
- _terraform_button_proc[e->click.widget - 3](w);
+ if (e->click.widget >= 4) {
+ _terraform_button_proc[e->click.widget - 4](w);
}
break;
@@ -159,7 +159,7 @@ static void TerraformToolbWndProc(Window *w, WindowEvent *e)
break;
case WE_ABORT_PLACE_OBJ:
- w->click_state = 0;
+ UnclickWindowButtons(w);
SetWindowDirty(w);
w = FindWindowById(WC_BUILD_STATION, 0);
@@ -175,7 +175,8 @@ static void TerraformToolbWndProc(Window *w, WindowEvent *e)
static const Widget _terraform_widgets[] = {
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, 7, 11, 135, 0, 13, STR_LANDSCAPING_TOOLBAR, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, 7, 11, 123, 0, 13, STR_LANDSCAPING_TOOLBAR, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{WWT_STICKYBOX, 7, 124, 135, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_PANEL, 7, 66, 69, 14, 35, 0x0, STR_NULL},
@@ -192,7 +193,7 @@ static const Widget _terraform_widgets[] = {
static const WindowDesc _terraform_desc = {
640-136, 22+36, 136, 36,
WC_SCEN_LAND_GEN,0,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_terraform_widgets,
TerraformToolbWndProc
};