Merge branch 'master' into enhanced_viewport_overlay
Notes on conflict resolution: * MarkTileDirtyByTile gained an extra param on both sides of the merge Move bridge level offset to be after zoom level param, as it's used less. * Add zoom level params to MarkBridgeDirty functions * Fix undefined behaviour in colour_index cycling in ViewportMapDraw Conflicts: src/clear_cmd.cpp src/pbs.cpp src/rail_cmd.cpp src/toolbar_gui.cpp src/train_cmd.cpp src/vehicle.cpp src/viewport.cpp src/viewport_func.h
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
#include "goal_base.h"
|
||||
#include "story_base.h"
|
||||
#include "plans_func.h"
|
||||
#include "toolbar_gui.h"
|
||||
|
||||
#include "widgets/toolbar_widget.h"
|
||||
|
||||
@@ -57,6 +58,9 @@
|
||||
#include "safeguards.h"
|
||||
|
||||
|
||||
/** Width of the toolbar, shared by statusbar. */
|
||||
uint _toolbar_width = 0;
|
||||
|
||||
RailType _last_built_railtype;
|
||||
RoadType _last_built_roadtype;
|
||||
|
||||
@@ -1125,7 +1129,7 @@ void SetStartingYear(Year year)
|
||||
_settings_game.game_creation.starting_year = Clamp(year, MIN_YEAR, MAX_YEAR);
|
||||
Date new_date = ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1);
|
||||
/* If you open a savegame as scenario there may already be link graphs.*/
|
||||
LinkGraphSchedule::Instance()->ShiftDates(new_date - _date);
|
||||
LinkGraphSchedule::instance.ShiftDates(new_date - _date);
|
||||
SetDate(new_date, 0);
|
||||
}
|
||||
|
||||
@@ -1354,7 +1358,7 @@ public:
|
||||
child_wid->current_x = child_wid->smallest_x;
|
||||
}
|
||||
}
|
||||
w->window_desc->default_width = nbuttons * this->smallest_x;
|
||||
_toolbar_width = nbuttons * this->smallest_x;
|
||||
}
|
||||
|
||||
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
|
||||
@@ -1530,7 +1534,7 @@ class NWidgetScenarioToolbarContainer : public NWidgetToolbarContainer {
|
||||
|
||||
assert(i < lengthof(this->panel_widths));
|
||||
this->panel_widths[i++] = child_wid->current_x;
|
||||
w->window_desc->default_width += child_wid->current_x;
|
||||
_toolbar_width += child_wid->current_x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1671,6 +1675,11 @@ struct MainToolbarWindow : Window {
|
||||
DoZoomInOutWindow(ZOOM_NONE, this);
|
||||
}
|
||||
|
||||
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
|
||||
{
|
||||
Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
|
||||
}
|
||||
|
||||
virtual void OnPaint()
|
||||
{
|
||||
/* If spectator, disable all construction buttons
|
||||
@@ -1907,7 +1916,7 @@ static const NWidgetPart _nested_toolbar_normal_widgets[] = {
|
||||
};
|
||||
|
||||
static WindowDesc _toolb_normal_desc(
|
||||
WDP_MANUAL, NULL, 640, 22,
|
||||
WDP_MANUAL, NULL, 0, 0,
|
||||
WC_MAIN_TOOLBAR, WC_NONE,
|
||||
WDF_NO_FOCUS,
|
||||
_nested_toolbar_normal_widgets, lengthof(_nested_toolbar_normal_widgets),
|
||||
@@ -1988,6 +1997,11 @@ struct ScenarioEditorToolbarWindow : Window {
|
||||
DoZoomInOutWindow(ZOOM_NONE, this);
|
||||
}
|
||||
|
||||
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
|
||||
{
|
||||
Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
|
||||
}
|
||||
|
||||
virtual void OnPaint()
|
||||
{
|
||||
this->SetWidgetDisabledState(WID_TE_DATE_BACKWARD, _settings_game.game_creation.starting_year <= MIN_YEAR);
|
||||
@@ -2218,7 +2232,7 @@ static const NWidgetPart _nested_toolb_scen_widgets[] = {
|
||||
};
|
||||
|
||||
static WindowDesc _toolb_scen_desc(
|
||||
WDP_MANUAL, NULL, 640, 22,
|
||||
WDP_MANUAL, NULL, 0, 0,
|
||||
WC_MAIN_TOOLBAR, WC_NONE,
|
||||
WDF_NO_FOCUS,
|
||||
_nested_toolb_scen_widgets, lengthof(_nested_toolb_scen_widgets),
|
||||
|
Reference in New Issue
Block a user