Merge commit 'a8b575671894ffe1329ef37dca4989c0e60d70f5'
These merges are becoming more awful every time Conflicts: src/ai/ai_gui.cpp src/build_vehicle_gui.cpp src/cheat_gui.cpp src/company_gui.cpp src/depot_gui.cpp src/dock_gui.cpp src/error_gui.cpp src/genworld_gui.cpp src/misc_gui.cpp src/network/network_content_gui.cpp src/network/network_gui.cpp src/newgrf_gui.cpp src/news_gui.cpp src/rail_gui.cpp src/rev.cpp.in src/road_gui.cpp src/settings_gui.cpp src/settings_gui.h src/signs_gui.cpp src/station_gui.cpp src/table/settings.ini src/terraform_gui.cpp src/toolbar_gui.cpp src/toolbar_gui.h src/vehicle_gui.cpp src/video/sdl_v.cpp src/viewport.cpp src/widget.cpp src/widgets/settings_widget.h
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "hotkeys.h"
|
||||
#include "engine_base.h"
|
||||
#include "terraform_gui.h"
|
||||
#include "zoom_func.h"
|
||||
|
||||
#include "widgets/terraform_widget.h"
|
||||
|
||||
@@ -210,12 +211,7 @@ struct TerraformToolbarWindow : Window {
|
||||
break;
|
||||
|
||||
case WID_TT_PLACE_OBJECT: // Place object button
|
||||
/* Don't show the place object button when there are no objects to place. */
|
||||
if (ObjectClass::GetUIClassCount() == 0) return;
|
||||
if (HandlePlacePushButton(this, WID_TT_PLACE_OBJECT, SPR_CURSOR_TRANSMITTER, HT_RECT)) {
|
||||
ShowBuildObjectPicker(this);
|
||||
this->last_user_action = widget;
|
||||
}
|
||||
ShowBuildObjectPicker();
|
||||
break;
|
||||
|
||||
default: NOT_REACHED();
|
||||
@@ -243,8 +239,7 @@ struct TerraformToolbarWindow : Window {
|
||||
|
||||
case WID_TT_BUY_LAND: // Buy land button
|
||||
case WID_TT_PLACE_SIGN: // Place sign button
|
||||
case WID_TT_PLACE_OBJECT: // Place object button
|
||||
VpStartPlaceSizing(tile, VPM_SINGLE_TILE, DDSP_SINGLE_TILE);
|
||||
PlaceProc_Sign(tile);
|
||||
break;
|
||||
|
||||
default: NOT_REACHED();
|
||||
@@ -288,7 +283,6 @@ struct TerraformToolbarWindow : Window {
|
||||
|
||||
virtual void OnPlaceObjectAbort()
|
||||
{
|
||||
DeleteWindowById(WC_BUILD_OBJECT, 0);
|
||||
this->RaiseButtons();
|
||||
ResetObjectToPlace();
|
||||
}
|
||||
@@ -357,7 +351,7 @@ static const NWidgetPart _nested_terraform_widgets[] = {
|
||||
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_PLACE_SIGN), SetMinimalSize(22, 22),
|
||||
SetFill(0, 1), SetDataTip(SPR_IMG_SIGN, STR_SCENEDIT_TOOLBAR_PLACE_SIGN),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_TT_SHOW_PLACE_OBJECT),
|
||||
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_PLACE_OBJECT), SetMinimalSize(22, 22),
|
||||
NWidget(WWT_PUSHIMGBTN, COLOUR_DARK_GREEN, WID_TT_PLACE_OBJECT), SetMinimalSize(22, 22),
|
||||
SetFill(0, 1), SetDataTip(SPR_IMG_TRANSMITTER, STR_SCENEDIT_TOOLBAR_PLACE_OBJECT),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@@ -374,7 +368,7 @@ static WindowDesc _terraform_desc(
|
||||
/**
|
||||
* Show the toolbar for terraforming in the game.
|
||||
* @param link The toolbar we might want to link to.
|
||||
* @return The allocated toolbar.
|
||||
* @return The allocated toolbar if the window was newly opened, else \c NULL.
|
||||
*/
|
||||
Window *ShowTerraformToolbar(Window *link)
|
||||
{
|
||||
@@ -485,7 +479,7 @@ static const NWidgetPart _nested_scen_edit_land_gen_widgets[] = {
|
||||
NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_PLACE_DESERT), SetMinimalSize(22, 22),
|
||||
SetFill(0, 1), SetDataTip(SPR_IMG_DESERT, STR_TERRAFORM_TOOLTIP_DEFINE_DESERT_AREA),
|
||||
EndContainer(),
|
||||
NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_PLACE_OBJECT), SetMinimalSize(23, 22),
|
||||
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_ETT_PLACE_OBJECT), SetMinimalSize(23, 22),
|
||||
SetFill(0, 1), SetDataTip(SPR_IMG_TRANSMITTER, STR_SCENEDIT_TOOLBAR_PLACE_OBJECT),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
@@ -568,6 +562,14 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||
{
|
||||
if (widget != WID_ETT_DOTS) return;
|
||||
|
||||
size->width = max<uint>(size->width, ScaleGUITrad(59));
|
||||
size->height = max<uint>(size->height, ScaleGUITrad(31));
|
||||
}
|
||||
|
||||
virtual void DrawWidget(const Rect &r, int widget) const
|
||||
{
|
||||
if (widget != WID_ETT_DOTS) return;
|
||||
@@ -580,7 +582,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
|
||||
|
||||
assert(n != 0);
|
||||
do {
|
||||
DrawSprite(SPR_WHITE_POINT, PAL_NONE, center_x + coords[0], center_y + coords[1]);
|
||||
DrawSprite(SPR_WHITE_POINT, PAL_NONE, center_x + ScaleGUITrad(coords[0]), center_y + ScaleGUITrad(coords[1]));
|
||||
coords += 2;
|
||||
} while (--n);
|
||||
}
|
||||
@@ -621,10 +623,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
|
||||
break;
|
||||
|
||||
case WID_ETT_PLACE_OBJECT: // Place transmitter button
|
||||
if (HandlePlacePushButton(this, WID_ETT_PLACE_OBJECT, SPR_CURSOR_TRANSMITTER, HT_RECT)) {
|
||||
ShowBuildObjectPicker(this);
|
||||
this->last_user_action = widget;
|
||||
}
|
||||
ShowBuildObjectPicker();
|
||||
break;
|
||||
|
||||
case WID_ETT_INCREASE_SIZE:
|
||||
@@ -692,10 +691,6 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
|
||||
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_DESERT);
|
||||
break;
|
||||
|
||||
case WID_ETT_PLACE_OBJECT: // Place transmitter button
|
||||
PlaceProc_Object(tile);
|
||||
break;
|
||||
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
@@ -726,7 +721,6 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
|
||||
{
|
||||
this->RaiseButtons();
|
||||
this->SetDirty();
|
||||
DeleteWindowById(WC_BUILD_OBJECT, 0);
|
||||
}
|
||||
|
||||
static HotkeyList hotkeys;
|
||||
@@ -768,7 +762,7 @@ static WindowDesc _scen_edit_land_gen_desc(
|
||||
|
||||
/**
|
||||
* Show the toolbar for terraforming in the scenario editor.
|
||||
* @return The allocated toolbar.
|
||||
* @return The allocated toolbar if the window was newly opened, else \c NULL.
|
||||
*/
|
||||
Window *ShowEditorTerraformToolbar()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user