Merge remote-tracking branch 'upstream/1.11' into 1.11
This commit is contained in:
@@ -101,12 +101,12 @@ void CcPlaySound_SPLAT_RAIL(const CommandCost &result, TileIndex tile, uint32 p1
|
||||
if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_20_SPLAT_RAIL, tile);
|
||||
}
|
||||
|
||||
static CommandContainer GenericPlaceRailCmd(TileIndex tile, Track track)
|
||||
static CommandContainer GenericPlaceRailCmd(TileIndex tile, int cmd)
|
||||
{
|
||||
CommandContainer ret = {
|
||||
tile, // tile
|
||||
_cur_railtype, // p1
|
||||
track, // p2
|
||||
tile, // tile
|
||||
_cur_railtype, // p1
|
||||
cmd | (_settings_client.gui.auto_remove_signals << 3), // p2
|
||||
_remove_button_clicked ?
|
||||
CMD_REMOVE_SINGLE_RAIL | CMD_MSG(STR_ERROR_CAN_T_REMOVE_RAILROAD_TRACK) :
|
||||
CMD_BUILD_SINGLE_RAIL | CMD_MSG(STR_ERROR_CAN_T_BUILD_RAILROAD_TRACK), // cmd
|
||||
@@ -126,10 +126,11 @@ static CommandContainer GenericPlaceRailCmd(TileIndex tile, Track track)
|
||||
*/
|
||||
static void PlaceExtraDepotRail(TileIndex tile, DiagDirection dir, Track track)
|
||||
{
|
||||
if (GetRailTileType(tile) != RAIL_TILE_NORMAL) return;
|
||||
if (GetRailTileType(tile) == RAIL_TILE_DEPOT) return;
|
||||
if (GetRailTileType(tile) == RAIL_TILE_SIGNALS && !_settings_client.gui.auto_remove_signals) return;
|
||||
if ((GetTrackBits(tile) & DiagdirReachesTracks(dir)) == 0) return;
|
||||
|
||||
DoCommandP(tile, _cur_railtype, track, CMD_BUILD_SINGLE_RAIL);
|
||||
DoCommandP(tile, _cur_railtype, track | (_settings_client.gui.auto_remove_signals << 3), CMD_BUILD_SINGLE_RAIL);
|
||||
}
|
||||
|
||||
/** Additional pieces of track to add at the entrance of a depot. */
|
||||
@@ -377,7 +378,7 @@ static CommandContainer DoRailroadTrackCmd(TileIndex start_tile, TileIndex end_t
|
||||
CommandContainer ret = {
|
||||
start_tile, // tile
|
||||
end_tile, // p1
|
||||
(uint32)(_cur_railtype | (track << 6)), // p2
|
||||
((uint32)_cur_railtype | ((uint32)track << 6) | ((uint32)_settings_client.gui.auto_remove_signals << 11)), // p2
|
||||
_remove_button_clicked ?
|
||||
CMD_REMOVE_RAILROAD_TRACK | CMD_MSG(STR_ERROR_CAN_T_REMOVE_RAILROAD_TRACK) :
|
||||
CMD_BUILD_RAILROAD_TRACK | CMD_MSG(STR_ERROR_CAN_T_BUILD_RAILROAD_TRACK), // cmd
|
||||
@@ -769,8 +770,7 @@ struct BuildRailToolbarWindow : Window {
|
||||
break;
|
||||
|
||||
case WID_RAT_REMOVE:
|
||||
_remove_button_clicked = citymania::RailToolbar_RemoveModChanged(this, _cm_invert_remove, _remove_button_clicked, true);
|
||||
// BuildRailClick_Remove(this);
|
||||
BuildRailClick_Remove(this);
|
||||
break;
|
||||
|
||||
case WID_RAT_CONVERT_RAIL:
|
||||
@@ -988,7 +988,7 @@ struct BuildRailToolbarWindow : Window {
|
||||
*/
|
||||
static EventState RailToolbarGlobalHotkeys(int hotkey)
|
||||
{
|
||||
if (_game_mode != GM_NORMAL || !CanBuildVehicleInfrastructure(VEH_TRAIN)) return ES_NOT_HANDLED;
|
||||
if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
|
||||
extern RailType _last_built_railtype;
|
||||
Window *w = ShowBuildRailToolbar(_last_built_railtype);
|
||||
if (w == nullptr) return ES_NOT_HANDLED;
|
||||
@@ -1197,7 +1197,7 @@ public:
|
||||
}
|
||||
if (newstation) {
|
||||
_railstation.station_count = StationClass::Get(_railstation.station_class)->GetSpecCount();
|
||||
_railstation.station_type = min(_railstation.station_type, _railstation.station_count - 1);
|
||||
_railstation.station_type = std::min<int>(_railstation.station_type, _railstation.station_count - 1);
|
||||
|
||||
int count = 0;
|
||||
for (uint i = 0; i < StationClass::GetClassCount(); i++) {
|
||||
@@ -1205,7 +1205,7 @@ public:
|
||||
count++;
|
||||
}
|
||||
this->vscroll->SetCount(count);
|
||||
this->vscroll->SetPosition(Clamp(_railstation.station_class - 2, 0, max(this->vscroll->GetCount() - this->vscroll->GetCapacity(), 0)));
|
||||
this->vscroll->SetPosition(Clamp(_railstation.station_class - 2, 0, std::max(this->vscroll->GetCount() - this->vscroll->GetCapacity(), 0)));
|
||||
|
||||
NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BRAS_MATRIX);
|
||||
matrix->SetScrollbar(this->vscroll2);
|
||||
@@ -1281,7 +1281,7 @@ public:
|
||||
if (i == STAT_CLASS_WAYP) continue;
|
||||
d = maxdim(d, GetStringBoundingBox(StationClass::Get((StationClassID)i)->name));
|
||||
}
|
||||
size->width = max(size->width, d.width + padding.width);
|
||||
size->width = std::max(size->width, d.width + padding.width);
|
||||
this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
|
||||
size->height = 5 * this->line_height;
|
||||
resize->height = this->line_height;
|
||||
@@ -1307,7 +1307,7 @@ public:
|
||||
d = maxdim(d, GetStringBoundingBox(str));
|
||||
}
|
||||
}
|
||||
size->width = max(size->width, d.width + padding.width);
|
||||
size->width = std::max(size->width, d.width + padding.width);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1557,7 +1557,7 @@ public:
|
||||
_railstation.station_class = (StationClassID)i;
|
||||
StationClass *stclass = StationClass::Get(_railstation.station_class);
|
||||
_railstation.station_count = stclass->GetSpecCount();
|
||||
_railstation.station_type = min((int)_railstation.station_type, max(0, (int)_railstation.station_count - 1));
|
||||
_railstation.station_type = std::min((int)_railstation.station_type, std::max(0, (int)_railstation.station_count - 1));
|
||||
|
||||
this->CheckSelectedSize(stclass->GetSpec(_railstation.station_type));
|
||||
|
||||
@@ -1762,9 +1762,9 @@ public:
|
||||
for (uint lowered = 0; lowered < 2; lowered++) {
|
||||
Point offset;
|
||||
Dimension sprite_size = GetSpriteSize(rti->gui_sprites.signals[type][variant][lowered], &offset);
|
||||
this->sig_sprite_bottom_offset = max<int>(this->sig_sprite_bottom_offset, sprite_size.height);
|
||||
this->sig_sprite_size.width = max<int>(this->sig_sprite_size.width, sprite_size.width - offset.x);
|
||||
this->sig_sprite_size.height = max<int>(this->sig_sprite_size.height, sprite_size.height - offset.y);
|
||||
this->sig_sprite_bottom_offset = std::max<int>(this->sig_sprite_bottom_offset, sprite_size.height);
|
||||
this->sig_sprite_size.width = std::max<int>(this->sig_sprite_size.width, sprite_size.width - offset.x);
|
||||
this->sig_sprite_size.height = std::max<int>(this->sig_sprite_size.height, sprite_size.height - offset.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1774,10 +1774,10 @@ public:
|
||||
{
|
||||
if (widget == WID_BS_DRAG_SIGNALS_DENSITY_LABEL) {
|
||||
/* Two digits for signals density. */
|
||||
size->width = max(size->width, 2 * GetDigitWidth() + padding.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT);
|
||||
size->width = std::max(size->width, 2 * GetDigitWidth() + padding.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT);
|
||||
} else if (IsInsideMM(widget, WID_BS_SEMAPHORE_NORM, WID_BS_ELECTRIC_PBS_OWAY + 1)) {
|
||||
size->width = max(size->width, this->sig_sprite_size.width + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT);
|
||||
size->height = max(size->height, this->sig_sprite_size.height + WD_IMGBTN_TOP + WD_IMGBTN_BOTTOM);
|
||||
size->width = std::max(size->width, this->sig_sprite_size.width + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT);
|
||||
size->height = std::max(size->height, this->sig_sprite_size.height + WD_IMGBTN_TOP + WD_IMGBTN_BOTTOM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user