Merge branch 'master' into jgrpp
Replace build and refit, and group collapse implementations Fix template creation build and refit # Conflicts: # Makefile.bundle.in # config.lib # src/animated_tile.cpp # src/blitter/32bpp_anim.hpp # src/blitter/32bpp_base.hpp # src/blitter/8bpp_base.hpp # src/blitter/null.hpp # src/build_vehicle_gui.cpp # src/command.cpp # src/command_func.h # src/console_gui.cpp # src/core/smallstack_type.hpp # src/date.cpp # src/debug.cpp # src/genworld_gui.cpp # src/ground_vehicle.hpp # src/group_gui.cpp # src/lang/korean.txt # src/linkgraph/linkgraph_gui.h # src/main_gui.cpp # src/misc_gui.cpp # src/network/core/game.h # src/network/core/packet.cpp # src/network/core/udp.cpp # src/network/core/udp.h # src/network/network_content.cpp # src/network/network_type.h # src/network/network_udp.cpp # src/newgrf_house.h # src/openttd.cpp # src/order_cmd.cpp # src/order_gui.cpp # src/os/unix/crashlog_unix.cpp # src/os/windows/crashlog_win.cpp # src/osk_gui.cpp # src/pathfinder/opf/opf_ship.cpp # src/rail_cmd.cpp # src/rail_gui.cpp # src/saveload/saveload.cpp # src/settings.cpp # src/settings_gui.cpp # src/smallmap_gui.h # src/station_base.h # src/station_cmd.cpp # src/table/gameopt_settings.ini # src/table/newgrf_debug_data.h # src/table/settings.ini # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/train_gui.cpp # src/vehicle.cpp # src/vehicle_gui.cpp # src/vehiclelist.cpp # src/viewport.cpp # src/widgets/dropdown.cpp # src/window_gui.h
This commit is contained in:
@@ -129,7 +129,7 @@ static DropDownList *BuildSetDropDownList(int *selected_index, bool allow_select
|
||||
|
||||
DropDownList *list = new DropDownList();
|
||||
for (int i = 0; i < n; i++) {
|
||||
*list->Append() = new DropDownListCharStringItem(T::GetSet(i)->name, i, !allow_selection && (*selected_index != i));
|
||||
list->push_back(new DropDownListCharStringItem(T::GetSet(i)->name, i, !allow_selection && (*selected_index != i)));
|
||||
}
|
||||
|
||||
return list;
|
||||
@@ -152,7 +152,7 @@ struct BaseSetTextfileWindow : public TextfileWindow {
|
||||
this->LoadTextfile(textfile, BASESET_DIR);
|
||||
}
|
||||
|
||||
/* virtual */ void SetStringParameters(int widget) const
|
||||
void SetStringParameters(int widget) const override
|
||||
{
|
||||
if (widget == WID_TF_CAPTION) {
|
||||
SetDParam(0, content_type);
|
||||
@@ -213,13 +213,13 @@ struct GameOptionsWindow : Window {
|
||||
/* Add non-custom currencies; sorted naturally */
|
||||
for (uint i = 0; i < CURRENCY_END; items++, i++) {
|
||||
if (i == CURRENCY_CUSTOM) continue;
|
||||
*list->Append() = new DropDownListStringItem(*items, i, HasBit(disabled, i));
|
||||
list->push_back(new DropDownListStringItem(*items, i, HasBit(disabled, i)));
|
||||
}
|
||||
QSortT(list->Begin(), list->Length(), DropDownListStringItem::NatSortFunc);
|
||||
QSortT(list->data(), list->size(), DropDownListStringItem::NatSortFunc);
|
||||
|
||||
/* Append custom currency at the end */
|
||||
*list->Append() = new DropDownListItem(-1, false); // separator line
|
||||
*list->Append() = new DropDownListStringItem(STR_GAME_OPTIONS_CURRENCY_CUSTOM, CURRENCY_CUSTOM, HasBit(disabled, CURRENCY_CUSTOM));
|
||||
list->push_back(new DropDownListItem(-1, false)); // separator line
|
||||
list->push_back(new DropDownListStringItem(STR_GAME_OPTIONS_CURRENCY_CUSTOM, CURRENCY_CUSTOM, HasBit(disabled, CURRENCY_CUSTOM)));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ struct GameOptionsWindow : Window {
|
||||
}
|
||||
|
||||
for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) {
|
||||
*list->Append() = new DropDownListStringItem(*items, i, HasBit(disabled, i));
|
||||
list->push_back(new DropDownListStringItem(*items, i, HasBit(disabled, i)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -251,22 +251,22 @@ struct GameOptionsWindow : Window {
|
||||
/* Add and sort newgrf townnames generators */
|
||||
for (int i = 0; i < _nb_grf_names; i++) {
|
||||
int result = _nb_orig_names + i;
|
||||
*list->Append() = new DropDownListStringItem(_grf_names[i], result, enabled_item != result && enabled_item >= 0);
|
||||
list->push_back(new DropDownListStringItem(_grf_names[i], result, enabled_item != result && enabled_item >= 0));
|
||||
}
|
||||
QSortT(list->Begin(), list->Length(), DropDownListStringItem::NatSortFunc);
|
||||
QSortT(list->data(), list->size(), DropDownListStringItem::NatSortFunc);
|
||||
|
||||
int newgrf_size = list->Length();
|
||||
int newgrf_size = list->size();
|
||||
/* Insert newgrf_names at the top of the list */
|
||||
if (newgrf_size > 0) {
|
||||
*list->Append() = new DropDownListItem(-1, false); // separator line
|
||||
list->push_back(new DropDownListItem(-1, false)); // separator line
|
||||
newgrf_size++;
|
||||
}
|
||||
|
||||
/* Add and sort original townnames generators */
|
||||
for (int i = 0; i < _nb_orig_names; i++) {
|
||||
*list->Append() = new DropDownListStringItem(STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + i, i, enabled_item != i && enabled_item >= 0);
|
||||
list->push_back(new DropDownListStringItem(STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + i, i, enabled_item != i && enabled_item >= 0));
|
||||
}
|
||||
QSortT(list->Begin() + newgrf_size, list->Length() - newgrf_size, DropDownListStringItem::NatSortFunc);
|
||||
QSortT(list->data() + newgrf_size, list->size() - newgrf_size, DropDownListStringItem::NatSortFunc);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -275,18 +275,18 @@ struct GameOptionsWindow : Window {
|
||||
*selected_index = _settings_client.gui.autosave;
|
||||
const StringID *items = _autosave_dropdown;
|
||||
for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) {
|
||||
*list->Append() = new DropDownListStringItem(*items, i, false);
|
||||
list->push_back(new DropDownListStringItem(*items, i, false));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_GO_LANG_DROPDOWN: { // Setup interface language dropdown
|
||||
list = new DropDownList();
|
||||
for (uint i = 0; i < _languages.Length(); i++) {
|
||||
for (uint i = 0; i < _languages.size(); i++) {
|
||||
if (&_languages[i] == _current_language) *selected_index = i;
|
||||
*list->Append() = new DropDownListStringItem(SPECSTR_LANGUAGE_START + i, i, false);
|
||||
list->push_back(new DropDownListStringItem(SPECSTR_LANGUAGE_START + i, i, false));
|
||||
}
|
||||
QSortT(list->Begin(), list->Length(), DropDownListStringItem::NatSortFunc);
|
||||
QSortT(list->data(), list->size(), DropDownListStringItem::NatSortFunc);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ struct GameOptionsWindow : Window {
|
||||
list = new DropDownList();
|
||||
*selected_index = GetCurRes();
|
||||
for (int i = 0; i < _num_resolutions; i++) {
|
||||
*list->Append() = new DropDownListStringItem(SPECSTR_RESOLUTION_START + i, i, false);
|
||||
list->push_back(new DropDownListStringItem(SPECSTR_RESOLUTION_START + i, i, false));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -305,7 +305,7 @@ struct GameOptionsWindow : Window {
|
||||
*selected_index = ZOOM_LVL_OUT_4X - _gui_zoom;
|
||||
const StringID *items = _gui_zoom_dropdown;
|
||||
for (int i = 0; *items != INVALID_STRING_ID; items++, i++) {
|
||||
*list->Append() = new DropDownListStringItem(*items, i, _settings_client.gui.zoom_min > ZOOM_LVL_OUT_4X - i);
|
||||
list->push_back(new DropDownListStringItem(*items, i, _settings_client.gui.zoom_min > ZOOM_LVL_OUT_4X - i));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -315,7 +315,7 @@ struct GameOptionsWindow : Window {
|
||||
*selected_index = ZOOM_LVL_OUT_4X - _font_zoom;
|
||||
const StringID *items = _font_zoom_dropdown;
|
||||
for (int i = 0; *items != INVALID_STRING_ID; items++, i++) {
|
||||
*list->Append() = new DropDownListStringItem(*items, i, false);
|
||||
list->push_back(new DropDownListStringItem(*items, i, false));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -339,7 +339,7 @@ struct GameOptionsWindow : Window {
|
||||
return list;
|
||||
}
|
||||
|
||||
virtual void SetStringParameters(int widget) const
|
||||
void SetStringParameters(int widget) const override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GO_CURRENCY_DROPDOWN: SetDParam(0, _currency_specs[this->opt->locale.currency].name); break;
|
||||
@@ -358,7 +358,7 @@ struct GameOptionsWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void DrawWidget(const Rect &r, int widget) const
|
||||
void DrawWidget(const Rect &r, int widget) const override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GO_BASE_GRF_DESCRIPTION:
|
||||
@@ -378,7 +378,7 @@ struct GameOptionsWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GO_BASE_GRF_DESCRIPTION:
|
||||
@@ -432,11 +432,11 @@ struct GameOptionsWindow : Window {
|
||||
DropDownList *list = this->BuildDropDownList(widget, &selected);
|
||||
if (list != NULL) {
|
||||
/* Find the biggest item for the default size. */
|
||||
for (const DropDownListItem * const *it = list->Begin(); it != list->End(); it++) {
|
||||
for (const DropDownListItem * const ddli : *list) {
|
||||
Dimension string_dim;
|
||||
int width = (*it)->Width();
|
||||
int width = ddli->Width();
|
||||
string_dim.width = width + padding.width;
|
||||
string_dim.height = (*it)->Height(width) + padding.height;
|
||||
string_dim.height = ddli->Height(width) + padding.height;
|
||||
*size = maxdim(*size, string_dim);
|
||||
}
|
||||
delete list;
|
||||
@@ -445,7 +445,7 @@ struct GameOptionsWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget, int click_count)
|
||||
void OnClick(Point pt, int widget, int click_count) override
|
||||
{
|
||||
if (widget >= WID_GO_BASE_GRF_TEXTFILE && widget < WID_GO_BASE_GRF_TEXTFILE + TFT_END) {
|
||||
if (BaseGraphics::GetUsedSet() == NULL) return;
|
||||
@@ -508,7 +508,7 @@ struct GameOptionsWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnDropdownSelect(int widget, int index)
|
||||
void OnDropdownSelect(int widget, int index) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GO_CURRENCY_DROPDOWN: // Currency
|
||||
@@ -589,7 +589,7 @@ struct GameOptionsWindow : Window {
|
||||
* @param data Information about the changed data. @see GameOptionsInvalidationData
|
||||
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
|
||||
*/
|
||||
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
|
||||
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
this->SetWidgetLoweredState(WID_GO_FULLSCREEN_BUTTON, _fullscreen);
|
||||
@@ -1984,7 +1984,7 @@ struct GameSettingsWindow : Window {
|
||||
this->InvalidateData();
|
||||
}
|
||||
|
||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GS_OPTIONSPANEL:
|
||||
@@ -2019,7 +2019,7 @@ struct GameSettingsWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnPaint()
|
||||
void OnPaint() override
|
||||
{
|
||||
if (this->closing_dropdown) {
|
||||
this->closing_dropdown = false;
|
||||
@@ -2060,7 +2060,7 @@ struct GameSettingsWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void SetStringParameters(int widget) const
|
||||
void SetStringParameters(int widget) const override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GS_RESTRICT_DROPDOWN:
|
||||
@@ -2090,22 +2090,22 @@ struct GameSettingsWindow : Window {
|
||||
* we don't want to allow comparing with new game's settings. */
|
||||
bool disabled = mode == RM_CHANGED_AGAINST_NEW && settings_ptr == &_settings_newgame;
|
||||
|
||||
*list->Append() = new DropDownListStringItem(_game_settings_restrict_dropdown[mode], mode, disabled);
|
||||
list->push_back(new DropDownListStringItem(_game_settings_restrict_dropdown[mode], mode, disabled));
|
||||
}
|
||||
break;
|
||||
|
||||
case WID_GS_TYPE_DROPDOWN:
|
||||
list = new DropDownList();
|
||||
*list->Append() = new DropDownListStringItem(STR_CONFIG_SETTING_TYPE_DROPDOWN_ALL, ST_ALL, false);
|
||||
*list->Append() = new DropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_INGAME, ST_GAME, false);
|
||||
*list->Append() = new DropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_INGAME, ST_COMPANY, false);
|
||||
*list->Append() = new DropDownListStringItem(STR_CONFIG_SETTING_TYPE_DROPDOWN_CLIENT, ST_CLIENT, false);
|
||||
list->push_back(new DropDownListStringItem(STR_CONFIG_SETTING_TYPE_DROPDOWN_ALL, ST_ALL, false));
|
||||
list->push_back(new DropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_INGAME, ST_GAME, false));
|
||||
list->push_back(new DropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_INGAME, ST_COMPANY, false));
|
||||
list->push_back(new DropDownListStringItem(STR_CONFIG_SETTING_TYPE_DROPDOWN_CLIENT, ST_CLIENT, false));
|
||||
break;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
virtual void DrawWidget(const Rect &r, int widget) const
|
||||
void DrawWidget(const Rect &r, int widget) const override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GS_OPTIONSPANEL: {
|
||||
@@ -2155,7 +2155,7 @@ struct GameSettingsWindow : Window {
|
||||
this->last_clicked = pe;
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget, int click_count)
|
||||
void OnClick(Point pt, int widget, int click_count) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GS_EXPAND_ALL:
|
||||
@@ -2258,7 +2258,7 @@ struct GameSettingsWindow : Window {
|
||||
for (int i = sdb->min; i <= (int)sdb->max; i++) {
|
||||
int val = sd->orderproc ? sd->orderproc(i - sdb->min) : i;
|
||||
assert_msg(val >= sdb->min && val <= (int)sdb->max, "min: %d, max: %d, val: %d", sdb->min, sdb->max, val);
|
||||
*list->Append() = new DropDownListStringItem(sdb->str_val + val - sdb->min, val, false);
|
||||
list->push_back(new DropDownListStringItem(sdb->str_val + val - sdb->min, val, false));
|
||||
}
|
||||
|
||||
ShowDropDownListAt(this, list, value, -1, wi_rect, COLOUR_ORANGE, true);
|
||||
@@ -2345,7 +2345,7 @@ struct GameSettingsWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnTimeout()
|
||||
void OnTimeout() override
|
||||
{
|
||||
if (this->clicked_entry != NULL) { // On timeout, release any depressed buttons
|
||||
this->clicked_entry->SetButtons(0);
|
||||
@@ -2354,7 +2354,7 @@ struct GameSettingsWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnQueryTextFinished(char *str)
|
||||
void OnQueryTextFinished(char *str) override
|
||||
{
|
||||
/* The user pressed cancel */
|
||||
if (str == NULL) return;
|
||||
@@ -2384,7 +2384,7 @@ struct GameSettingsWindow : Window {
|
||||
this->SetDirty();
|
||||
}
|
||||
|
||||
virtual void OnDropdownSelect(int widget, int index)
|
||||
void OnDropdownSelect(int widget, int index) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GS_RESTRICT_DROPDOWN:
|
||||
@@ -2428,7 +2428,7 @@ struct GameSettingsWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnDropdownClose(Point pt, int widget, int index, bool instant_close)
|
||||
void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override
|
||||
{
|
||||
if (widget >= 0) {
|
||||
/* Normally the default implementation of OnDropdownClose() takes care of
|
||||
@@ -2447,7 +2447,7 @@ struct GameSettingsWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
|
||||
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
|
||||
@@ -2477,7 +2477,7 @@ struct GameSettingsWindow : Window {
|
||||
this->SetWidgetDisabledState(WID_GS_COLLAPSE_ALL, all_folded);
|
||||
}
|
||||
|
||||
virtual void OnEditboxChanged(int wid)
|
||||
void OnEditboxChanged(int wid) override
|
||||
{
|
||||
if (wid == WID_GS_FILTER) {
|
||||
this->filter.string.SetFilterTerm(this->filter_editbox.text.buf);
|
||||
@@ -2490,7 +2490,7 @@ struct GameSettingsWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnResize()
|
||||
void OnResize() override
|
||||
{
|
||||
this->vscroll->SetCapacityFromWidget(this, WID_GS_OPTIONSPANEL, SETTINGTREE_TOP_OFFSET + SETTINGTREE_BOTTOM_OFFSET);
|
||||
}
|
||||
@@ -2634,7 +2634,7 @@ struct CustomCurrencyWindow : Window {
|
||||
this->SetWidgetDisabledState(WID_CC_YEAR_UP, _custom_currency.to_euro == MAX_YEAR);
|
||||
}
|
||||
|
||||
virtual void SetStringParameters(int widget) const
|
||||
void SetStringParameters(int widget) const override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_CC_RATE: SetDParam(0, 1); SetDParam(1, 1); break;
|
||||
@@ -2652,7 +2652,7 @@ struct CustomCurrencyWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
||||
{
|
||||
switch (widget) {
|
||||
/* Set the appropriate width for the edit 'buttons' */
|
||||
@@ -2671,7 +2671,7 @@ struct CustomCurrencyWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget, int click_count)
|
||||
void OnClick(Point pt, int widget, int click_count) override
|
||||
{
|
||||
int line = 0;
|
||||
int len = 0;
|
||||
@@ -2753,7 +2753,7 @@ struct CustomCurrencyWindow : Window {
|
||||
this->SetDirty();
|
||||
}
|
||||
|
||||
virtual void OnQueryTextFinished(char *str)
|
||||
void OnQueryTextFinished(char *str) override
|
||||
{
|
||||
if (str == NULL) return;
|
||||
|
||||
@@ -2785,7 +2785,7 @@ struct CustomCurrencyWindow : Window {
|
||||
SetButtonState();
|
||||
}
|
||||
|
||||
virtual void OnTimeout()
|
||||
void OnTimeout() override
|
||||
{
|
||||
this->SetDirty();
|
||||
}
|
||||
|
Reference in New Issue
Block a user