Update to 12.0-beta1

This commit is contained in:
dP
2021-08-15 14:57:29 +03:00
parent ac7d3eba75
commit 9df4f2c4fc
666 changed files with 61302 additions and 20466 deletions

View File

@@ -291,7 +291,7 @@ void CcBuildRailTunnel(const CommandCost &result, TileIndex tile, uint32 p1, uin
*/
static void ToggleRailButton_Remove(Window *w)
{
DeleteWindowById(WC_SELECT_STATION, 0);
CloseWindowById(WC_SELECT_STATION, 0);
w->ToggleWidgetLoweredState(WID_RAT_REMOVE);
w->SetWidgetDirty(WID_RAT_REMOVE);
_remove_button_clicked = w->IsWidgetLowered(WID_RAT_REMOVE);
@@ -410,7 +410,7 @@ static void HandleAutoSignalPlacement()
}
/* _settings_client.gui.drag_signals_density is given as a parameter such that each user
* in a network game can specify his/her own signal density */
* in a network game can specify their own signal density */
DoCommandP(TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), p2,
_remove_button_clicked ?
CMD_REMOVE_SIGNAL_TRACK | CMD_MSG(STR_ERROR_CAN_T_REMOVE_SIGNALS_FROM) :
@@ -434,10 +434,11 @@ struct BuildRailToolbarWindow : Window {
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
}
~BuildRailToolbarWindow()
void Close() override
{
if (this->IsWidgetLowered(WID_RAT_BUILD_STATION)) SetViewportCatchmentStation(nullptr, true);
if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false);
this->Window::Close();
}
/**
@@ -742,12 +743,12 @@ struct BuildRailToolbarWindow : Window {
this->DisableWidget(WID_RAT_REMOVE);
this->SetWidgetDirty(WID_RAT_REMOVE);
DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL);
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL);
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL);
DeleteWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL);
DeleteWindowById(WC_SELECT_STATION, 0);
DeleteWindowByClass(WC_BUILD_BRIDGE);
CloseWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL);
CloseWindowById(WC_BUILD_STATION, TRANSPORT_RAIL);
CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL);
CloseWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL);
CloseWindowById(WC_SELECT_STATION, 0);
CloseWindowByClass(WC_BUILD_BRIDGE);
}
void OnPlacePresize(Point pt, TileIndex tile) override
@@ -864,7 +865,7 @@ Window *ShowBuildRailToolbar(RailType railtype)
if (!Company::IsValidID(_local_company)) return nullptr;
if (!ValParamRailtype(railtype)) return nullptr;
DeleteWindowByClass(WC_BUILD_TOOLBAR);
CloseWindowByClass(WC_BUILD_TOOLBAR);
_cur_railtype = railtype;
_remove_button_clicked = false;
return new BuildRailToolbarWindow(&_build_rail_desc, railtype);
@@ -1028,9 +1029,10 @@ public:
this->InvalidateData();
}
virtual ~BuildRailStationWindow()
void Close() override
{
DeleteWindowById(WC_SELECT_STATION, 0);
CloseWindowById(WC_SELECT_STATION, 0);
this->PickerWindowBase::Close();
}
/** Sort station classes by StationClassID. */
@@ -1219,7 +1221,7 @@ public:
StringID str = this->GetWidget<NWidgetCore>(widget)->widget_data;
for (auto station_class : this->station_classes) {
StationClass *stclass = StationClass::Get(station_class);
for (uint16 j = 0; j < stclass->GetSpecCount(); j++) {
for (uint j = 0; j < stclass->GetSpecCount(); j++) {
const StationSpec *statspec = stclass->GetSpec(j);
SetDParam(0, (statspec != nullptr && statspec->name != 0) ? statspec->name : STR_STATION_CLASS_DFLT);
d = maxdim(d, GetStringBoundingBox(str));
@@ -1345,7 +1347,7 @@ public:
this->LowerWidget(_railstation.orientation + WID_BRAS_PLATFORM_DIR_X);
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
this->SetDirty();
DeleteWindowById(WC_SELECT_STATION, 0);
CloseWindowById(WC_SELECT_STATION, 0);
break;
case WID_BRAS_PLATFORM_NUM_1:
@@ -1379,7 +1381,7 @@ public:
this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN);
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
this->SetDirty();
DeleteWindowById(WC_SELECT_STATION, 0);
CloseWindowById(WC_SELECT_STATION, 0);
break;
}
@@ -1414,7 +1416,7 @@ public:
this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN);
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
this->SetDirty();
DeleteWindowById(WC_SELECT_STATION, 0);
CloseWindowById(WC_SELECT_STATION, 0);
break;
}
@@ -1448,7 +1450,7 @@ public:
this->SetWidgetLoweredState(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN, !_settings_client.gui.station_dragdrop);
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
this->SetDirty();
DeleteWindowById(WC_SELECT_STATION, 0);
CloseWindowById(WC_SELECT_STATION, 0);
break;
}
@@ -1464,7 +1466,7 @@ public:
break;
case WID_BRAS_NEWST_LIST: {
int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_BRAS_NEWST_LIST, 0, this->line_height);
int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_BRAS_NEWST_LIST);
if (y >= (int)this->station_classes.size()) return;
StationClassID station_class_id = this->station_classes[y];
if (_railstation.station_class != station_class_id) {
@@ -1481,7 +1483,7 @@ public:
}
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
this->SetDirty();
DeleteWindowById(WC_SELECT_STATION, 0);
CloseWindowById(WC_SELECT_STATION, 0);
break;
}
@@ -1500,7 +1502,7 @@ public:
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
this->SetDirty();
DeleteWindowById(WC_SELECT_STATION, 0);
CloseWindowById(WC_SELECT_STATION, 0);
break;
}
}
@@ -1695,9 +1697,10 @@ public:
this->OnInvalidateData();
}
~BuildSignalWindow()
void Close() override
{
_convert_signal_button = false;
this->PickerWindowBase::Close();
}
void OnInit() override
@@ -2130,10 +2133,9 @@ static void SetDefaultRailGui()
/**
* Updates the current signal variant used in the signal GUI
* to the one adequate to current year.
* @param p needed to be called when a setting changes
* @return success, needed for settings
* @param new_value needed to be called when a setting changes
*/
bool ResetSignalVariant(int32 p)
void ResetSignalVariant(int32 new_value)
{
SignalVariant new_variant = (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
@@ -2145,8 +2147,6 @@ bool ResetSignalVariant(int32 p)
}
_cur_signal_variant = new_variant;
}
return true;
}
/**
@@ -2191,17 +2191,16 @@ DropDownList GetRailTypeDropDownList(bool for_replacement, bool all_option)
}
Dimension d = { 0, 0 };
RailType rt;
/* Get largest icon size, to ensure text is aligned on each menu item. */
if (!for_replacement) {
FOR_ALL_SORTED_RAILTYPES(rt) {
for (const auto &rt : _sorted_railtypes) {
if (!HasBit(used_railtypes, rt)) continue;
const RailtypeInfo *rti = GetRailTypeInfo(rt);
d = maxdim(d, GetSpriteSize(rti->gui_sprites.build_x_rail));
}
}
FOR_ALL_SORTED_RAILTYPES(rt) {
for (const auto &rt : _sorted_railtypes) {
/* If it's not used ever, don't show it to the user. */
if (!HasBit(used_railtypes, rt)) continue;