forked from mirror/OpenTTD
(svn r8436) -Fix
-Feature: When linking the terraform toolbar to the build toolbars place them side by side instead of on top of each other
This commit is contained in:
@@ -135,8 +135,8 @@ void ShowBuildAirToolbar(void)
|
|||||||
if (!IsValidPlayer(_current_player)) return;
|
if (!IsValidPlayer(_current_player)) return;
|
||||||
|
|
||||||
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
|
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
|
||||||
AllocateWindowDescFront(&_air_toolbar_desc, 0);
|
Window *w = AllocateWindowDescFront(&_air_toolbar_desc, 0);
|
||||||
if (_patches.link_terraform_toolbar) ShowTerraformToolbar();
|
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
|
static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
|
||||||
|
@@ -219,8 +219,8 @@ void ShowBuildDocksToolbar(void)
|
|||||||
if (!IsValidPlayer(_current_player)) return;
|
if (!IsValidPlayer(_current_player)) return;
|
||||||
|
|
||||||
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
|
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
|
||||||
AllocateWindowDesc(&_build_docks_toolbar_desc);
|
Window *w = AllocateWindowDesc(&_build_docks_toolbar_desc);
|
||||||
if (_patches.link_terraform_toolbar) ShowTerraformToolbar();
|
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BuildDockStationWndProc(Window *w, WindowEvent *e)
|
static void BuildDockStationWndProc(Window *w, WindowEvent *e)
|
||||||
|
@@ -57,7 +57,7 @@ void ShowShipViewWindow(const Vehicle *v);
|
|||||||
void ShowBuildAirToolbar(void);
|
void ShowBuildAirToolbar(void);
|
||||||
|
|
||||||
/* terraform_gui.c */
|
/* terraform_gui.c */
|
||||||
void ShowTerraformToolbar(void);
|
void ShowTerraformToolbar(Window *link = NULL);
|
||||||
|
|
||||||
/* tgp_gui.c */
|
/* tgp_gui.c */
|
||||||
void ShowGenerateLandscape(void);
|
void ShowGenerateLandscape(void);
|
||||||
|
@@ -624,7 +624,7 @@ void ShowBuildRailToolbar(RailType railtype, int button)
|
|||||||
_build_railroad_button_proc[button](w);
|
_build_railroad_button_proc[button](w);
|
||||||
UpdateRemoveWidgetStatus(w, button + 4);
|
UpdateRemoveWidgetStatus(w, button + 4);
|
||||||
}
|
}
|
||||||
if (_patches.link_terraform_toolbar) ShowTerraformToolbar();
|
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: For custom stations, respect their allowed platforms/lengths bitmasks!
|
/* TODO: For custom stations, respect their allowed platforms/lengths bitmasks!
|
||||||
|
@@ -329,8 +329,8 @@ void ShowBuildRoadToolbar(void)
|
|||||||
if (!IsValidPlayer(_current_player)) return;
|
if (!IsValidPlayer(_current_player)) return;
|
||||||
|
|
||||||
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
|
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
|
||||||
AllocateWindowDesc(&_build_road_desc);
|
Window *w = AllocateWindowDesc(&_build_road_desc);
|
||||||
if (_patches.link_terraform_toolbar) ShowTerraformToolbar();
|
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Widget _build_road_scen_widgets[] = {
|
static const Widget _build_road_scen_widgets[] = {
|
||||||
|
@@ -278,8 +278,15 @@ static const WindowDesc _terraform_desc = {
|
|||||||
TerraformToolbWndProc
|
TerraformToolbWndProc
|
||||||
};
|
};
|
||||||
|
|
||||||
void ShowTerraformToolbar(void)
|
void ShowTerraformToolbar(Window *link)
|
||||||
{
|
{
|
||||||
if (!IsValidPlayer(_current_player)) return;
|
if (!IsValidPlayer(_current_player)) return;
|
||||||
AllocateWindowDescFront(&_terraform_desc, 0);
|
Window *w = AllocateWindowDescFront(&_terraform_desc, 0);
|
||||||
|
if (w != NULL && link != NULL) {
|
||||||
|
/* Align the terraform toolbar under the main toolbar and put the linked
|
||||||
|
* toolbar to left of it
|
||||||
|
*/
|
||||||
|
w->top = 22;
|
||||||
|
link->left = w->left - link->width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user